Skip to content

fix(cuda): cut a DFlash2 hold into frames an NVFP4 head accepts - #4682

Draft
devopsfortunato wants to merge 1 commit into
ashhart:mainfrom
devopsfortunato:fix-4190-dflash2-nvfp4-frames
Draft

devopsfortunato wants to merge 1 commit into
ashhart:mainfrom
devopsfortunato:fix-4190-dflash2-nvfp4-frames

Conversation

@devopsfortunato

Copy link
Copy Markdown
Contributor

What this changes

An NVFP4 target's head refuses 256 rows or more (cuda_modelopt.zig project, because the fused tile sums in another order). holdFn ran every eligible hold as one DFlash2 frame, which asks that head for streams * (block - 1) rows: 15 a stream at block 16. From 18 streams (270 rows) every drafted round failed with WindowTooWide.

holdFn now runs the hold as consecutive frames of at most (fused_rows - 1) / (block - 1) streams, 17 at block 16, the same cut the HIP drafter's frames() makes. A hold of 17 streams or fewer is still one frame, exactly as before, so 16 streams is unchanged. --parallel is not refused and no row arithmetic changes: each stream's rows are computed by the same kernels, only the frame boundaries move. Chunking at the head's row bound was chosen over running the proposal head in pieces because it needs no change to the head or its sums and mirrors HIP.

Checks on this head

  • Head commit: 5767d2c
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 165 problems on the base, 165 on this head, 0 new (tools/zig/lean_new.py).
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test-qwen35-draft-frames-host: 7 passed, 0 failed (includes the new test).
    • The new test fails when headStreams is planted back to an unbounded value (expected 17, found 64) and passes with the fix.
    • zig build test-cuda-host --summary all: 470/470 steps succeeded, 8483/8525 tests passed, 42 skipped (this was started on the commit before a two-line simplification of headStreams/frameLen; the frames step was rerun on this head).
    • zig fmt --check zig/src/families/qwen3_5 zig/qwen35_draft_frames_host.zig and git diff --check: clean.
  • CI: pending on this head.
  • Not run, and why: any device or checkpoint run. This machine is aarch64 with no NVIDIA device, no nvcc and no NVFP4 Qwen3.8-27B or DFlash2 checkpoint, so nothing below was measured. Full zig build test and test-golden (macOS Metal steps) were not run; CI runs the host aggregate.

Receipt

  • Main against branch: not run, see the device ask below.
  • Boxes it reaches: CUDA DFlash2 (Qwen3.5/3.8 family) with a drafter, every NVFP4-target --parallel width above 17. Streams, KV and the other projections are untouched. The same split also applies, with identical bits expected, to blocks of 8 above 36 streams and to DSpine holds above 17 streams.
  • New switch? No.
  • Environment: host-only, aarch64 Linux, Zig 0.17.0, no GPU.
  • Paths and platforms the change reaches, which I ran and which I could not: CUDA only; host tests ran; no CUDA SM, HIP, Metal or Windows run.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: not measured. The bar from the issue is drafted output equal to --no-drafts at 17, 18 and 32 streams, greedy and seeded, with 16 unchanged. @Maxrio9 (reporter) or the maintainers: could you run the issue's repro with this branch at those widths and post the token hashes? I'll keep this a draft until then.
  • Main against this branch, same machine and checkpoint: not run, no device.
  • Decode speed before and after: n/a, no device. At 17 streams and below nothing changes; above 17 the hold launches ceil(streams / 17) frames instead of failing.
  • Prompt speed before and after: n/a, drafted decode rounds only (no prompt path is touched).
  • Licence of any new weights or drafter: n/a

Known and left alone: a DSpine drafter with an NVFP4 head asks the head for 2 * streams * (block - 1) rows, so it still hits the same limit at 9 or more streams; it failed the same way before this change and wants its own bound.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

…hart#4190)

A hold ran as one frame asking the target head for streams * (block - 1)
rows. An NVFP4 head refuses 256 rows or more (the fused tile sums in
another order), so from 18 streams at block 16 every drafted round failed
with WindowTooWide. holdFn now runs the hold as consecutive frames of at
most floor((fused_rows - 1) / (block - 1)) streams, 17 at block 16, as the
HIP drafter's frames() does. A hold of 17 streams or fewer stays one frame.
@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks @devopsfortunato for tracing the failure to the 256-row ModelOpt boundary. The block-16 arithmetic is right: 17 streams produce 255 rows, while 18 produce 270.

Three changes are needed before this is ready for device A/B:

  1. Make the whole hold atomic on failure. If a later frame fails, clear held_n and grown for every context, including contexts in earlier published frames and later unattempted frames. Please add a multi-frame test that fails only the second frame and checks all contexts.
  2. Scope the split to the row-limited DFlash2 ModelOpt path. The current unconditional split also changes A4 scheduling: the existing 128-stream fixture becomes several frames, with different maximum rows, uploads, downloads, waits and launch counts. That is separate from issue CUDA DFlash2 with an NVFP4 target: every drafted round fails with WindowTooWide above 17 streams although --parallel admits more #4190.
  3. Add a regression through the production hold path. The new frameLen test stays green if the production split is removed. An 18-stream ModelOpt hold should observably use consecutive 17- and 1-stream frames, while 16 and 17 streams remain single-frame; the old single 270-row call must fail the new test.

Please also retain the current-main graph support when rebasing. I reviewed source only; I did not build or run the PR.

  • Synthena

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CUDA DFlash2 with an NVFP4 target: every drafted round fails with WindowTooWide above 17 streams although --parallel admits more

2 participants