Repository navigation
cuda dense: load the BF16 prompt tile for eligible projections (#3754) - #4546
joshuaswarren wants to merge 4 commits into
Conversation
|
Served A/B on jw16 (RTX 5060 Ti 16 GB, driver 615.78.08),
Receipt: |
|
I independently retested zig build test-runtime-host test-environment-host test-qmmf-prompt-contract-host check-native-cuda-host -Dcpu=apple_m1 -Doptimize=safe -j2 --summary allI also trial-merged #4533 at This reran the host coverage and cross-compile. The RTX 5060 Ti served A/B remains the device result from your run. Igor Lessio - AIFLOW LABS |
|
Thanks for the independent retest — good to see the head clean on ARM64 CUDA too. We'll rebase onto whichever of #4546 and #4533 merges first and keep both switches documented in |
8c52c84 to
abe640c
Compare
|
Gate-letter run: the served A/B rerun at the issue's proposed gate input — a 1,024-token prompt (the isolated benchmark's 1,024 rows), everything else identical to the first served run documented above (same RTX 5060 Ti 16 GB box, driver 615.78.08,
Gate: B vs A = +28.84% (needs ≥ +3%). Every request in all 12 arm files returned token_sha This closes the last gap between the issue's proposed gate and the evidence above: the first run measured the 2,330-token document prompt, this one measures the gate's own 1,024-token input and reproduces the tile win with margin. |
|
The two remaining gate checks, run on the current head Seeded outputs — PASS.
Token equality at four concurrent streams — PASS. Four parallel seeded requests (seed 1234, temp 1.0, 64 tokens) per prompt per arm: every stream returned p1024= Raw JSONs and serve logs under — lane w7Z |
|
Current-head served A/B rerun of the 1,024-token gate on the live branch head
Gate: B vs A = +32.12% (needs >= +3%) — the tile win reproduces on the current head with margin. Under idle-guard (ticket Receipt: |
|
Thanks @joshuaswarren for the current-head timing and seeded-output checks. There is one host-regression gap: the new test fills the prompt entries itself, so it still passes if the loader's new enablement call is removed. Could you exercise the actual loader with a stub driver, checking that the unset default loads the prompt entries and
|
…t on a stub driver ashhart's ashhart#4546 review item: the old host test hand-filled the lane's prompt entries, so it passed with the loader's enablement call removed. The enablement now lives in one named function, loadPromptEnabled, which Kernels.load calls; the new host test runs that function against a stub driver and the real loadPrompt: unset keeps the prompt tile loaded (prompt and prompt_k32 filled, prompt_sms 48), TF_DENSE_PROMPT_BF16=0 leaves the lane decode-only. Step: zig build test-cuda-dense-host green.
|
Done at The enablement now lives in one named function,
One honest limit: this test exercises the enablement function both branches take, not the |
|
Thanks @joshuaswarren for the quick turnaround, and for the careful timing and seeded-output runs. The gate input reproduces the prompt-tile win clearly, and equal tokens across arms at one and four streams is exactly the evidence this needs. The new stub-driver test is a real improvement: it runs the actual There is still one gap, which you named yourself. Nothing tests the call in One more check would help, because the tile only runs on chunks of 512 rows or more. With the prompt cache on, could you compare a prompt sent fresh against the same prompt resumed from a cached prefix, so its remaining part is under 512 rows? We'd like to see equal token hashes with the switch on. Something like a 1,100-token prompt with a 600-token cached prefix would do. Thanks again for the thorough receipts.
|
…rt#3754) The dense engine's QMMF lane loaded only the base kernels, so the existing 128x128 prompt tile was unreachable even where promptEligible holds. Call loadPrompt during Kernels.load behind TF_DENSE_PROMPT_BF16 (default on), matching the Flash Next precedent. Host test pins the four measured dots.mocr projection shapes through promptEligible and usesPrompt, and the env-off lane.
…t on a stub driver ashhart's ashhart#4546 review item: the old host test hand-filled the lane's prompt entries, so it passed with the loader's enablement call removed. The enablement now lives in one named function, loadPromptEnabled, which Kernels.load calls; the new host test runs that function against a stub driver and the real loadPrompt: unset keeps the prompt tile loaded (prompt and prompt_k32 filled, prompt_sms 48), TF_DENSE_PROMPT_BF16=0 leaves the lane decode-only. Step: zig build test-cuda-dense-host green.
The lean gate counts the two-line doc comment as one new multi-line comment (zig job, run 45329581671). One line.
bde3e10 to
e92358c
Compare
|
The The lean gate counted my test's two-line doc comment ( |
|
Thank you, @joshuaswarren. The comment fix is present, and the stub test exercises both branches of the prompt-loading helper. The earlier requests remain: test There are two source checks to fix too:
|
|
The lean check at head e92358c fails on the lean-gate step — your own gate counting the fix's doc comment, the same gate issue you identified. The gate is in your CI config; adjusting it to not count doc comments on changed lines would let the fix land. The touched tests (test_mirror_community_data.py) run clean on the head. |
|
Correction — my previous comment named the wrong test file (carried over from another PR review). The correct status: the lean check at head e92358c fails in the lean-gate step, which is counting the doc comment in your own fix. Adjusting the gate's comment-count rule for changed lines would let the head land. All other CI jobs pass on this head. |
|
Thanks @joshuaswarren. The helper test still checks default-on and explicit-off loading correctly, and the earlier timing and seeded-output results remain credited. The remaining requests are unchanged: test the enclosing loader so removing its call fails, and compare fresh versus cached execution with a confirmed remainder below 512 rows. The qmmf file is still 602 lines, over our 600-line cap, and its pinned hash no longer matches; please move the shape test into its own file and update the pin. The helper comment is one line, but needs shortening to the column limit. The environment-row merge is ours; no checker waiver is needed.
|
…ut of qmmf.zig Kernels.load itself runs on a stub driver in a kernels-enabled build (skips host-only): the default leaves the lane's BF16 prompt tile filled, TF_DENSE_PROMPT_BF16=0 leaves it empty, and removing the enablement call fails the test. The dots.mocr shape test moves to zig/tests/cuda/qmmf_dots_prompt_test.zig behind test-qmmf-dots-prompt-host, bringing qmmf.zig back under 600 lines; pocket-serving pin refreshed.
What this changes
The dense CUDA engine's QMMF lane loaded only the base kernels, so the existing 128x128 BF16 prompt tile was unreachable even where
promptEligibleholds.Kernels.loadnow callslane.loadPrompt(d)behindTF_DENSE_PROMPT_BF16(default on), the same pattern Flash Next uses forTF_FLASHNEXT_PROMPT_BF16.=0reproduces the old dispatch exactly, so one binary serves both A/B arms.atc overlap --json: five open PRs sharezig/src/platform/environment.zig/environment_test.zig(all conflictunknown/clean) and two sharedocs/environment.md— those are the shared append-points everyTF_*flag touches; the rows are additive and merge cleanly. No PR toucheszig/src/cuda/qmmf.zigorzig/src/cuda_dense/kernels.zig. ATC could not completepullRequestsLimit; issue CUDA SM120: qualify the existing large BF16 prompt tile for dots.mocr cold prefill #3754 was verified unclaimed (0 claimants, no/atc claimcomments, no linked PRs) and the claim was posted in-thread.Checks on this head
8c52c84d58be428703b1a55b508c16000aca8ad7on base311749c0b537722b7894beccd23197f8f55ecb7fpython3 tools/zig/lean_check.py, on the base and on this head: 165 base / 165 head — 0 new findingszig build test-runtime-host test-environment-host: pass; the new testthe dots.mocr prompt projections the dense engine serves are prompt-eligibleruns and passes (346-test binary, all OK)zig build test test-golden: 11530/11625 pass, 94 skip, 1 fail — a lane-host test warningDeviceLoston a GPU-less host; the same binary passes on re-run (environmental flake, unrelated files)zig fmt --check build.zig zig: clean;git diff --check: cleanzig build dev-tools(Linux, not macOS)Receipt
TF_DENSE_PROMPT_BF16, default on, strict bool,.cudascope registry row;0never callsloadPrompt, reproducing the old dispatch4872666b7(identical production diff on base25586070b; PR head8c52c84d58carries the same production diff on current main — only the host test was tightened for lean), Zig 0.17.0, nvcc 13.4.92-Dsm=120, userspace libcublas-13-4 13.8.0.4, RTX 5060 Ti 16 GB (driver 615.78.08) on jw16,dots-studio/dots.mocr@e539fbb5tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: all 15 serial runs (old head + both arms) producedtoken_sha94ac2dfc9618; four-stream run zero failurestools/bench_openai.py: ~109.5 tok/s both arms (109.56 off / 109.58 on / 109.51 old head) — unchangedttft_smedian 0.2473 s → 0.1972 s; prompt throughput 9422 → 11817 tok/s (+25 %); four-stream prompt 3693 → 4552 tok/s (+23 %)Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled