Skip to content

dflash2 cuda: opt-in spanned lm_head for NVFP4/FP8 targets and drafter graphs - #4516

Merged
ashhart merged 4 commits into
mainfrom
lead/dflash-span-graph
Nov 24, 2026
Merged

ashhart merged 4 commits into
mainfrom
lead/dflash-span-graph

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

Two opt-in drafter levers for Qwen3.8-27B with DFlash2 on CUDA:

  1. TF_DFLASH_QL_SPAN=1: the drafter's lm_head for NVFP4 and FP8 targets reads only the vocabulary span it uses, as the affine formats already do, cutting the drafter's weight reads per round.
  2. TF_DFLASH_GRAPH=1: the drafter's hold and absorb steps (over a hundred small launches per round) are captured in CUDA graphs, bucketed by accepted count, with the same kernels and arguments in order.

The target's verification is untouched, so accepted tokens equal the switch-off run.

Checks

  • Host tests; CUDA tests cross-compiled for Linux; fmt, ast-check, lean, 600-line cap.

Still to run

One GB10 and an sm_120 GPU: drafter outputs and served tokens compared with each switch off and on, then one-stream A-B-B-A.

TF_DFLASH_QL_SPAN=1 drafts a ModelOpt head over the two vocabulary spans,
as the .a4 and .x3 heads already do. It is off by default.

The views read the stored 64-row tiles and keep the whole head's K slices.
Unpinned, the 320-row tail would sum in eight slices instead of one.
BF16, MXFP8, FP8G and FP8 with an input scale stay on the whole head.

The target still verifies against the whole head.
TF_DFLASH_GRAPH=1 replays the drafter's launches from CUDA graphs, with
the same kernels and arguments in the same order. It is off by default.

A hold graph is keyed by stream count, spanned head and projection role.
An absorb graph is keyed by accepted rows and gather kind. Its gather,
rope and ring nodes take this round's position and ring addresses before
each launch. Prompt chunks and absorbs over 16 rows stay eager.

Startup timing stays eager, so window planning sees the same step cost.
Resizing the scratch drops every graph. A driver refusal falls back to
the eager launches.
@ashhart
ashhart force-pushed the lead/dflash-span-graph branch from fe75ad1 to c7f135d Compare November 24, 2026 01:24
@ashhart
ashhart merged commit 141d699 into main Nov 24, 2026
2 of 12 checks passed
@ashhart
ashhart deleted the lead/dflash-span-graph branch November 24, 2026 01:24
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.

1 participant