Repository navigation
CUDA: fuse bit-exact Qwen3.8 BF16 prefill launches - #1439
Conversation
|
Thanks @yguanrong. As far as we can read, the bit-exactness argument holds.
Then, on a GB10, we'll run |
2751b1d to
7c5135c
Compare
|
Addressed the review requests in
The PR body now separates final-head proof, pre-final full-contract evidence, existing repository limit debt, and the prior frozen A-B-A performance/model-parity evidence. Please re-review when convenient. |
7c5135c to
ebd934c
Compare
|
Fixed the failing The only new finding was:
I collapsed the two-line explanatory comment into one line; no code, contract shape, control, or numerical behavior changed. I also rebased the single commit onto current Validation after the rebase:
The first parallel local contract attempt hit host OOM while two full-repository lean scans were running; its 116 executed tests passed. A standalone rerun after those scans exited passed completely. |
68051d0 to
b47b537
Compare
|
Maintainers: the PR branch has been rewritten to remove the merge commit and is now exactly one optimization commit on the latest
The new fork workflows are waiting for approval:
Please click Approve and run workflows for this new head. Thank you. |
b47b537 to
8b303f3
Compare
|
Thanks @yguanrong, this is merged. On a GB10 with Qwen3.8-27B MLX 4-bit, alternating main, PR, PR, main:
Thanks for keeping the shipped kernel body literal, and for splitting the contract into its own files. |
|
Thanks @yguanrong: the fused BF16 prefill launches (Qwen3.8-27B prefill +8.8% to +11.1% on a GB10 against 1.1.8, same tokens) shipped in TensorFold 1.1.9. |
Fixes #1398
Scope
This is a bit-exact BF16 prefill launch optimization for the Qwen3.8 CUDA affine-4 path. It does not use E4M3 activation quantization or prompt-only E4M3 gate/up weights, and it does not change decode, KV-cache, GDN recurrent-state arithmetic, projection operands, accumulation order, or rounding.
The branch is one commit (
b47b537d) on current upstreammain(1b9a987e).Implementation
tf_qmm_prefill_manyruns up to four prompt projections in one grid. Each projection still executes the shipped BF16 qmm body with its own original block order; only host setup, grid launch, address selection, and BF16 input loading are shared.tf_qmm_prefillkernel body remains literal. Refactoring it through the shared helper was rejected because it changed Blackwell SASS under nvcc 13.0/13.3.contract_qmm_prefill_many.zig(385 lines) andcontract_qmm_prefill_tile22.zig(125 lines). The aggregatecontract_tests.zigis exactly 598 lines andcontract_limits.zigis 170 lines.min_sm; the many launch retains its GB10 admission.Final-head host validation (
b47b537d)zig fmt --check build.zig zig: pass.zig build test-kernel-contract: pass.git diff --check: pass.qmm_prefill_many:1 pass, 0 fail; 1 controls red, 0 missed; four served shapes, five runs byte-identical, 487,424 output bytes.qmm_prefill_tile22:1 pass, 0 fail; 1 controls red, 0 missed; six served shapes, five runs byte-identical, 1,835,008 output bytes.cuda_engines.zig; the later CI fix is comment-only.test-cuda-host test-kernel-contract: 272/274 steps, 1,670/1,699 tests passed, 28 skipped. The only actual failure is the existing Windowsvideo.zigtest exhausting host memory; the focused kernel-contract step passed.Full GPU contract and live limits
A complete nvcc 13.3 GB10 run immediately before the final upstream-only rebases produced:
SUMMARY 422 kernels: 422 pass gates 1-4, 0 fail, 6 known findings; 314 controls: 314 red as planted, 0 missed; 214 limit problemsThe final rebases and lean-check fix did not change the qmm runtime or focused-contract executable logic; the focused contracts were rebuilt and rerun before the final comment-only fix. In the full run, both new candidates passed nonfinite, repeat, shapes, and live-limit gates:
The full command exits nonzero because the repository currently has 214 unrelated live-limit records with missing/outdated receipts (principally existing qwen4 entries); neither new qmm registration is among them.
Compiler receipts and SASS
Independent source/cache/output directories built 138 five-architecture fatbins (
sm_80,86,89,120,121) with nvcc 13.0, 13.2, and 13.3. The new records are current in all three compiler audits.nvcc 13.2 and 13.3 produced identical new receipts, so one
qmm_prefill_132.zigoverride covers both. The existing shipped prefill instantiations are SASS-identical to current main across all five SMs for both nvcc 13.0 and 13.3. The compared SASS dump SHA-256 values are90b91b0c5e0651f21ff7434344b953501dc4956c9743415d29ce72247cd26aba(13.0) anddcae3cd480b5486d55aa74559ebb0224122648bf788f877cadfd92fa0e511fda(13.3).Prior same-path correctness evidence
Before the review rework, the same runtime optimization path had token-hash parity for C1/C8, concurrent/solo, drafted/serial, and fresh/resume; 29/29 planned-grid fresh/cache-on replies matched full token SHA-256, and KV-cache/GDN state receipts were byte-identical. The final review changes preserve the runtime arithmetic path and add stricter contracts, but those end-to-end model parity scenarios were not rerun at
b47b537d.Frozen same-stack A1-B-A2 performance evidence
This is prior evidence for the same runtime path, not a new benchmark on final head. Frozen contract: NVIDIA GB10 sm_121; Qwen3.8-27B MLX affine-4 plus DFlash2 drafter; BF16 prompt; FP8 KV; 2,048 input tokens; 512 output tokens; greedy seed 11230; prefix cache off; three repetitions; C1 and C8. A1/A2 used upstream
8c36359d; B usedcd3df397.Maximum A1/A2 drift was 0.816%. The frozen gate required <=5% drift, >=3% C1 prefill gain, and no metric below 97% of the A1/A2 median; it returned
qualified: true.Overlap audit
atc overlap --base upstream/main --jsonreports 20 changed files and no open-PR overlap. It reached its time limit (complete: false,timeLimit); the only reported conflicts are with local historical experiment worktrees, not remote PRs.