Repository navigation
flashnext CUDA sampled draws: one launch and one wait a step, and #2753's check inside the top-k pass (#2920) - #2927
Conversation
fb36fde to
082b29c
Compare
|
Status on this head: the one red check was a test, not the change. Two of the new draw tests hand the draft a stack buffer of This head is also rebased on today's main. The one conflict was the environment test: main has since moved the Flash Next settings into their own scope and test file. Still owed on a GB10 before this lands:
|
082b29c to
3592c10
Compare
The serial side of the eight-chain draft test panicked with incorrect alignment on Linux CI: candidates() reads the top-k columns as i32 from the draft's u16 host buffer, and a stack [N]u16 is only 2-aligned. Production host buffers come from the allocator at row scale.
3592c10 to
246902a
Compare
… whole-buffer download On the 1.2.9 release commit, one sampled stream of Flash Next (MLX 4-bit checkpoint, chat, temperature 1.0) decoded about 10% slower than 1.2.8 on a GB10: 48.7, 46.1 and 48.8 tok/s against 43.9, 44.3 and 42.2, alternating runs; the other sweep cells were level or faster. #2927's group path runs a top-k launch and a synchronous download of the whole batch buffer every draw step, which one stream cannot amortise. A lone stream now takes the per-stream draw it had before #2927; two or more streams keep the group draw. Tokens are unchanged either way: both paths draw the same rows, and the batch tests compare them.
… whole-buffer download On the 1.2.9 release commit, one sampled stream of Flash Next (MLX 4-bit checkpoint, chat, temperature 1.0) decoded about 10% slower than 1.2.8 on a GB10: 48.7, 46.1 and 48.8 tok/s against 43.9, 44.3 and 42.2, alternating runs; the other sweep cells were level or faster. #2927's group path runs a top-k launch and a synchronous download of the whole batch buffer every draw step, which one stream cannot amortise. A lone stream now takes the per-stream draw it had before #2927; two or more streams keep the group draw. Tokens are unchanged either way: both paths draw the same rows, and the batch tests compare them.
Fixes #2920. Three commits, in order.
fn_row_topk. The top-k pass flags a NaN of either sign or +Inf in its first pass. A bad row reports column -1, which the draw already refuses asProposalNonfinite. Sampled verifies no longer run a separatefn_row_bestpass and download just for the check; it remains for greedy rows and the full-row path. This commit alone is our candidate fix for 1.2.7's 0.3-0.5% slower sampled cells on a GB10.TF_FLASHNEXT_BATCH_DRAWS=0restores the per-stream reductions (commit 1's check stays), for an A/B in one binary. It accepts only 0 or 1 and refuses anything else by name. The head's new reduction buffers (a 25,600-byte verify region, plus a 2.5 MB draft score slab at 79,591 columns) are counted in the head's bytes and freed with it.Exact: every row's draw is the same function on the same values, with its own seed and position, in today's order.
Tests: 41/41 focused tests on the recording device. Restoring the old extra verify pass, forcing serial verify draws, or forcing serial draft reductions each turns a runtime comparison red. Full CUDA host 6225/6264 (39 skipped), and the arm64 Linux CUDA tests compile.
Not yet checked on a device:
flashnext-mtp-parity, thefn_row_topkcontract with the non-finite shapes, andkernel-contract-limits;bench_concurrent --alone --serialat 1-8 streams, greedy and sampled, with token hashes equal to main;Expected: sampled +0.3-0.8% at one stream and +1.5-3% at 4-8 streams.