Repository navigation
cuda: tf_qmm_prefill_many works out its copy addresses once, before the K loop - #2825
Conversation
|
Welcome to TensorFold, @GumbiiDigital, and thank you (and @terrapinelf) for this and for such a careful write-up; the host replay with a planted fault is exactly the kind of evidence we like to see. I read the new A few things before this can land:
No need to add a CHANGELOG bullet; we write those when it lands. Thanks again, and welcome aboard!
|
a99fc2c to
f51bd84
Compare
|
Thanks @GumbiiDigital and @terrapinelf. To get this moving, we rebased it onto current main ourselves, keeping your commit as it was, and added one commit that updates both serving pins with the reason and corrects the comment and description to match. What remains is ours: the GB10 contract and timing pair. We will post the result here; nothing is needed from you.
|
… copies and math
…he K loop Each thread's input, weight and scale/bias cp.async addresses are set up once; a stage only adds its group offset. The copies, their order and their shared-memory bytes are unchanged, so outputs stay bit-equal to prefill_kernel. Co-authored-by: terrapinelf <166810331+terrapinelf@users.noreply.github.com>
… copies and math
f51bd84 to
f1838f2
Compare
|
Thank you @GumbiiDigital. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
tf_qmm_prefill_many's shared tile body (prefill_body) now computes each thread's input, weight and scale/biascp.asyncaddresses once, before the K loop; each stage only adds its group offset. Before, every stage recomputed them. The copies, their order and their shared-memory bytes are the same, so the outputs stay bit-equal toprefill_kernel, which is unchanged.gradient-serving.tsvgets the newqmm_prefill.cusha256.The idea comes from @terrapinelf's work in the Qwen3.8-27B TensorFold CUDA speed contest on Yukon (GB10). There they hoisted the same
cp.asyncaddressing in the contest's own prompt kernels; this pull request applies that idea toprefill_body. Their authorship is kept as a co-author on the commit.fb8fdf3d8), one commit.atc overlap --json: not run (ATC is not installed here). By hand withgh: no open pull request touchesqmm_prefill.cu. tests: re-pin three serving sources main changed #2798 and GLM-5.3-Flash on CUDA: a decode window's DSA select on many CTAs #2722 edit other lines ofgradient-serving.tsv;git merge-treeagainst tests: re-pin three serving sources main changed #2798 is clean.Checks on this head
a99fc2c5bpython3 tools/zig/lean_check.py, on the base and on this head: 386 and 386, 0 new findings.python3 tools/pr_check.py --base origin/main --pr 2825: 0 errors, 1 advisory warning (no Unreleased bullet naming this pull request).zig build test-cuda-host(macOS host): 5978 pass, 5 fail, 39 skip, the same counts and the same 5 failures on mainfb8fdf3d8in another folder of the same machine. All 5 arebenchmark_*CLI and server tests; none touches this kernel.zig build test-gradient-serving: fails on main and on this head at the same line,prefill_attention.cu. Hashing every listed file directly gives the same 3 stale pins on main and on this head (prefill_attention.cu,cuda/kernels.zig,cuda/sample.zig); theqmm_prefill.culine matches the file. tests: re-pin three serving sources main changed #2798 re-pins those 3.git patch-idas this head's): prompt rows 1, 17, 128, 129, 496 and 2048; padded widths 192, 960 and 1024; K 256 and 1024; random data. It compares each copy's order, destination and 16 bytes, then each stage byte for byte: 9,000 stages, 11,664,000 copies, 0 fail. With a planted fault (the padded-column guard removed) it fails. The replay was a throwaway file and is not in this pull request.git diff --check: clean.nvccon the machine used, sozig build kernel-contract,kernel-contract-fatbinsandtf-cuda-test kernel-contract-limitsdid not run. The register count recorded fortf_qmm_prefill_manyinzig/src/core/contract/registry.zigmay need re-deriving.Receipt
tf_qmm_prefill_manylaunch.fb8fdf3d8, Zig 0.17.0, macOS 27.2 on Apple M3 Ultra (host tests); the host replay on an Apple M5 Max. No CUDA toolchain, GPU or checkpoint.tf_qmm_prefill_manylaunch on CUDA sm_121+. Ran: host tests and the host load replay. Not run: any CUDA device.contract_qmm_prefill_manychecks every output byte againstprefill_kernelon a GB10.Kernel contract, only when a GPU kernel is new or changed
tf_qmm_prefill_manyis already registered (registry.zig, opt-in, min SM 121) and must stay bit-equal toprefill_kernel.SUMMARYline and exit status: not run, no CUDA device.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Not run on a device.)