You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HSLM backward on the GPU: dX and dW int8 tensor-core kernels written by a .t27 spec, measured against cuBLAS on an RTX 4090 #10847
HSLM training (specs/ml/train_hslm.t27, 2.13M ternary params) runs its backward pass on the CPU in f64: ternary_matmul_t_add (dX = dY x W^T) and outer_add (dW = X^T x dY). This issue gives that backward a GPU path through the t27c PTX backend of #10425: two int8 tensor-core kernels whose PTX is written by a .t27 spec, each with a CPU reference in the same spec, measured on an RTX 4090 against cuBLAS (the library torch.mm dispatches to). Wiring into the trainer is a follow-up; train_hslm.t27 is not touched here.
Boundary
specs/igla/coder/hslm_bwd_ptx.t27
bootstrap/gen/rust/igla/coder/hslm_bwd_ptx.rs
.trinity/seals/coder_igla-coder-hslm-bwd-ptx.json
bootstrap/src/main.rs
bootstrap/src/host/driver.rs
bootstrap/src/runtime_minimal.rs
bootstrap/src/runtime_minimal_test.rs
bootstrap/src/neural/attention.rs
bootstrap/src/neural/hslm.rs
docs/reports/orphan_modules.json
User Scenarios
Given the spec, when t27c test-report runs it, then every test passes: the text pins of both kernels, the integer references on hand cases in the trainer's index layout, and the f64 error bounds of the quantized path.
Given an RTX 4090, when t27c ptx-run --kernel 1 (dX) or --kernel 2 (dW) runs an HSLM shape, then it prints mismatches=0 against the t27 integer reference and the time per call.
Given the same shapes, when cutlass_profiler runs cuBLAS SGEMM, bf16 and s8 GEMMs, then the PR reports both side by side.
Requirements
FR-001: The dX kernel MUST compute C[m][j] = sum_i dYq[m][i] * w(j*K + i), the index layout of ternary_matmul_t_add, with W as 2-bit codes packed four per byte.
FR-002: The dW kernel MUST compute C[i][j] = sum_r X[r][i] * dY[r][j], the index layout of outer_add summed over rows, with i32 accumulation and K <= 131071.
FR-003: The spec MUST state the scales (dX: s_dy[row]; dW: s_x[i] * s_dy[j], per-column) and test an f64 error bound against an f64 reference.
FR-004: The added foreign glue MUST be offset by deleted hand-written foreign lines (specs/policy/own_language.t27); the deleted files are orphans no mod reaches.
FR-005: The report MUST be read against specs/t27t/t27t.t27 without flipping RUNNER_USES_INT_MM or F_MEASURED.
Success Criteria
t27c test-report specs/igla/coder/hslm_bwd_ptx.t27 exits 0 on the lab.
t27c ptx-run prints mismatches=0 for both kernels on 243x243, 243x729, 729x243 (padded to 256/736) at 27 and 1782 rows.
The PR body has a table of ms per call and GFLOP/s for the kernels and for cuBLAS f32, bf16 and s8 on the same GPU.
Activity
spec(igla): hslm_bwd_ptx -- pin the PTX text lengths ptx-run wrote on…
spec(igla): hslm_bwd_ptx -- the HSLM backward GEMMs dX and dW as int8…
spec(igla): hslm_bwd_ptx -- pin the PTX text lengths ptx-run wrote on…
spec(igla): hslm_bwd_ptx -- HSLM backward dX and dW as int8 tensor-co…