Skip to content

flashnext cuda: opt-in lone verify tail in the window graph - #4544

Merged
ashhart merged 7 commits into
mainfrom
lead/fn-graph-tail
Nov 25, 2026
Merged

ashhart merged 7 commits into
mainfrom
lead/fn-graph-tail

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

On one GPU with one drafted window, the verify pass runs as a captured window graph, but the copies around it and the greedy fn_row_best that follows were queued eagerly. With TF_FLASHNEXT_GRAPH_TAIL=1 they go inside the same graph, before and after the pass, with the same arguments in the same order (the after-copy reads the pass's own scratch when it runs, as today). Sampled, masked and multi-window rounds keep today's path.

Not built: folding fn_late_roll and chaining the greedy MTP steps on the device. Both need host-picked values each round, so they could not be moved without changing what the host decides; the expected gain is therefore small (fewer launches, no saved host sync).

Checks

  • Host tests on the window graph cache's captures, updates and replays with the tail on and off; environment table and count; fmt, ast-check, 600-line cap.
  • A second commit re-pins the five Flash Next serving sources this changes.

Still to run

GB10 pair: Flash Next NVFP4 one stream, switch off vs on, tokens compared; land only if level or faster.

@ashhart
ashhart force-pushed the lead/fn-graph-tail branch 3 times, most recently from 2d78f39 to 60eabd4 Compare November 24, 2026 02:04
@ashhart
ashhart force-pushed the lead/fn-graph-tail branch 2 times, most recently from 9dcb9ef to cebe9dc Compare November 25, 2026 08:42
@AIFlowML

Copy link
Copy Markdown
Contributor

On M5 Max, the exact #5021 train at 35cb3f0d53 with this head (cebe9dcd32) passed 44/44 tests via:

zig build test-flashnext-rank-graphs-host -Dfixed-cpu -j2 --summary all

One test wiring gap remains. That command skips the ranked eager-fallback test in cuda_mtp_ops.zig. Adding a test-only import to cuda_graph_tail_test.zig brings the same train target to 46/46:

test {
    _ = @import("cuda_mtp_ops.zig");
}

On the source trial merge, I removed the single-GPU guard as a control. The newly registered ranked test then failed at the assertion that row-best was neither queued nor computed ahead. Restoring the guard made the suite pass again. This was host coverage for scheduling and fallback. CUDA device performance remains unverified in my run.

Igor Lessio - AIFLOW LABS

…nd row best

TF_FLASHNEXT_GRAPH_TAIL=1 (default off) hands a lone drafted window's rollback
copies (the n-gram tail before the pass, its rows after) and, for a greedy
unmasked draw, its fn_row_best to the pass, which queues them around its
kernels: inside the window's captured graph when it has one, at the same
points when it runs eagerly. The same copies and kernel with the same
arguments in the same order; draws then waits and reads as before. Without a
tail the window key hashes as before.
… switches)

Main reached 41 Flash Next settings (29 switches) with another setting, so the PR's own count commit
(40 to 41) became empty on rebase. With TF_FLASHNEXT_GRAPH_TAIL registered the table holds 42: 30
switches, 9 integers, 1 real, 2 structured. docs/environment.md and the count test say so.
@ashhart
ashhart merged commit 47e9932 into main Nov 25, 2026
2 of 12 checks passed
@ashhart
ashhart deleted the lead/fn-graph-tail branch November 25, 2026 10:53
ashhart added a commit to plotarmordev/TensorFold that referenced this pull request Nov 25, 2026
ashhart added a commit that referenced this pull request Nov 25, 2026
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.

2 participants