Repository navigation
spec(igla): hslm_bwd_ptx -- HSLM backward dX and dW as int8 tensor-core PTX written by t27 (Closes #10847) - #10855
Merged
Merged
Conversation
This was referenced Oct 19, 2026
gHashTag
marked this pull request as ready for review
October 19, 2026 05:07
Contributor
This was referenced Oct 19, 2026
… tensor-core PTX written by t27, with their CPU references (Closes #10847) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the RTX 4090 (Refs #10847) dX 19431 bytes, dW 20141 bytes; both kernels gave mismatches=0 on every HSLM shape at 27 and 1782 rows. Seal regenerated on the lab (19/19, 0 vacuous). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
force-pushed
the
claude/hslm-ptx-backward-0d1f39
branch
from
October 19, 2026 05:53
5720ad3 to
0284b3a
Compare
This was referenced Oct 19, 2026
Merged
Merged
Contributor
PR DashboardGenerated at: 2026-10-19 06:26:19 UTC
Summary
Seal Status
|
3 tasks done
This was referenced Oct 19, 2026
Merged
This was referenced Oct 19, 2026
gHashTag
added a commit
that referenced
this pull request
Oct 19, 2026
) (#10913) * ledger(t27b): rows for six specs master carries unlisted, max_not_pass 129 -> 130 (Closes #10912) As the steward applies UNLISTED (specs/tri/t27b/ledger_steward.t27): four pass rows (mos_psp103_50c_data, sar_adc, sar_comparator_psp, tri/worktrees/reap) and two blocked rows, ExprCall(undeclared fn), reason unimplemented (eval_hslm, ngram_hslm -- the same blocker hslm_corpus already carries). Verdicts are the UNLISTED lines of the t27b runs of #10908, #10855, #10907 and #10836 on current master. Not-pass rows become 129 blocked + 1 codegen = 130, so the cap rises by one, within the two new non-pass rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ledger(t27b): drop the eval_hslm row, max_not_pass back to 129 (Closes #10912) The PR's own t27b run reported eval_hslm.t27 STALE: on current master the reference no longer compiles it (undeclared identifier 'b3_q' after a train_hslm change), and the steward lists only what the reference passes. Five rows remain (four pass, ngram_hslm blocked); not-pass rows are 128 blocked + 1 codegen = 129, the cap master had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
gHashTag
added a commit
that referenced
this pull request
Oct 19, 2026
… specs use it (Closes #10947) duplicate-bodies has been red on master since #10855: put_s, put_u, ins, put_quad, emit_lds, emit_mma_step, emit_store, emit_epilogue, code_at, weight, at_text and count_text were byte copies between ternary_gemm_ptx.t27 and hslm_bwd_ptx.t27, in no ledger. They move to specs/igla/coder/ptx_emit.t27 (10 tests of its own); both kernel specs `use` it. Seals regenerated, gen-rust output regenerated by t27c (it inlines the imported functions, so no Rust edit). Existing tests: 21/21 and 19/19, 0 vacuous, unchanged. No ledger row added. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gHashTag
added a commit
that referenced
this pull request
Oct 19, 2026
… specs use it (Closes #10947) (#10948) duplicate-bodies has been red on master since #10855: put_s, put_u, ins, put_quad, emit_lds, emit_mma_step, emit_store, emit_epilogue, code_at, weight, at_text and count_text were byte copies between ternary_gemm_ptx.t27 and hslm_bwd_ptx.t27, in no ledger. They move to specs/igla/coder/ptx_emit.t27 (10 tests of its own); both kernel specs `use` it. Seals regenerated, gen-rust output regenerated by t27c (it inlines the imported functions, so no Rust edit). Existing tests: 21/21 and 19/19, 0 vacuous, unchanged. No ledger row added. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10847
Two int8 tensor-core kernels for the HSLM backward pass (specs/ml/train_hslm.t27), written as PTX by a .t27 spec on the skeleton of the forward kernel of #10425:
hslm_dx_s8(kernel 1): dX = dY x W^T with W ternary, in ternary_matmul_t_add's index layout (codej*K + i). One u32 of 16 codes per thread, decoded branch-free (nibble spread +prmton the table 0x00FF0100), one 16-byte shared store.hslm_dw_s8(kernel 2): dW = X^T x dY summed over rows, outer_add's layout, i32 accumulation, k <= 131071.The spec holds each kernel's integer CPU reference, the scales the host must use (dX per row, dW per column of X and dY), and f64 tests that bound the quantized path against an f64 reference.
t27c ptx-run --kernel 1|2runs them against that reference. The trainer is not touched; wiring is a follow-up.t27c test-report specs/igla/coder/hslm_bwd_ptx.t27on the lab: 19/19 pass, 0 vacuous, 7 invariants. The PTX text lengths are pinned to what ptx-run wrote on the pod (19431 and 20141 bytes).ptxas -arch=sm_89 -v: dX 98 registers, dW 99, 0 spills, 12288 B smem each.Measured: RTX 4090, 2026-10-19
The pod was a RunPod RTX 4090 (driver 580.126.20, CUDA 12.4). It ran t27c
--features cudabuilt from this branch and CUTLASS 3.5.1cutlass_profilerbuilt on the same pod. ptx-run used 200 iterations with every 31st row checked, plus a 3-iteration run checking every row. Both gave mismatches=0 on all 26 runs, kernel 0 (forward) included as a regression check.About "torch" / cuBLAS: this is not a cuBLAS number. CUTLASS 3.5.1's profiler links cuBLAS (found and linked,
lddshows libcublas.so.12) but uses it only as a verification provider, never as a timed one. Writing a cuBLAS or torch harness would be hand-written C or Python, which this repo forbids. The comparison columns are therefore the best CUTLASS kernel per dtype and shape, which is the same class of kernel cuBLAS dispatches on sm_89, though not cuBLAS's own heuristic pick. f32 is CUTLASS SIMT sgemm, 128x128_8x2 tiles only (the filter kept the build short). That is torch's default f32 matmul path class, no TF32.Shapes are padded to the kernels' multiple of 16: 243 -> 256 and 729 -> 736. CUTLASS bf16/s8 tn kernels also need M % 8 and K % 16, so they ran at rows 27 -> 32 and K 1782 -> 1792. f32 dX ran at the true 243/729 dims. GOP/s for t27 counts true HSLM work, 2 * rows * in * out.
dX = dY x W^T (rows x K -> rows x N), ms per call:
dW = X^T x dY (M x N, summed over K rows), ms per call:
What this says:
Raw output: ptx-run lines, the best-kernel table and the profiler CSVs are kept with the session notes.
Against specs/t27t/t27t.t27
RUNNER_USES_INT_MMstays false. The law is about gHashTag/igla-coder-gpu train.py calling torch._int_mm, and nothing here touches that runner.F_MEASUREDstays false. f is the share of a tern-tc-500m step spent in forward GEMMs. These are per-call times of backward HSLM GEMMs in isolation, not a step profile.Left (follow-ups)
Foreign lines: +18 / -20. Two orphan .rs files that no
modreaches (neural/attention.rs, neural/hslm.rs) are deleted to pay the budget, and the orphan ceiling drops from 3 to 1. (The runtime_minimal stubs went in #10805 on master.)🤖 Generated with Claude Code