Repository navigation
Conversation
59e09f2 to
526bbc8
Compare
526bbc8 to
7d83147
Compare
|
Thanks @laudney. This sits on #1846/#1847, and we took #1764 for that tile and fusion instead (it's in the landing queue now), so this stack's base won't land as it stands. Once #1764 is on main, please restack this one operator commit onto main and re-run its receipts on that head. We'll review it standalone then. |
7d83147 to
92e0997
Compare
|
@ashhart #1764 is on main, so this PR is now one commit (
On #1847: I posted a kernel A/B against #1764's fuse there. Nothing in it is faster on a real pass, so I suggest that we close it. |
|
@ashhart The red
|
|
Thanks @laudney. This is exactly the standalone version we asked for. I read it on current main. The vector mix does dense_mix8's arithmetic in the same order (multiply, round, four-stream sum, divide by 4, round), and each 32-column group sum stays in ascending order. Only the loads are paired, and it's used from 512 rows of the 2,560 × 4 shape. Two small things:
|
Mix paired BF16 values in five blocks per row while keeping dense_mix8's FMA order, rounding points, output bytes and ascending FP32 group sums. Glue.hcDenseMix takes the vector kernel from 512 rows of Flash Next's 2560 x 4 streams, so ashhart#1764's native read-out uses it with no new branch at its call site, and fewer rows keep dense_mix8. Add replacement gates, resource records and timing; the records' test runs from test-flashnext-hc-mix-host, so registry.zig gains no test-block import and stays within the lean line limit.
27cdaf1 to
1bf5be4
Compare
|
@ashhart Squashed, as you asked. The PR is one commit again,
Thanks for running the mix tests and the served A/B on your GB10. |
|
GB10 A/B of this head (tree 994008062) against its base, Flash Next FP4 on one GB10, warm then base-new-new-base:
So on this checkpoint the paired-load mix doesn't buy prompt time, and it costs a little. Your numbers were on the BF16 checkpoint, if I read them right. Could you check whether the gain is BF16-only, and if so take the new mix only where it wins (by format, or by row count if it's the 512-row and up path)? Then we'll A/B again on both. Until then this stays open: a small steady prefill loss is still a loss for us. |
|
@ashhart Thanks for the A/B. The gain is not BF16-only, and no gate would keep it, so I suggest we close this PR. If you agree, I will close it.
A row-count gate would add a special case for a few microseconds in tail chunks, and it would not remove the loss at 1,536 rows. A likely cause is that the vector kernel's five blocks a row share the SMs with the side-stream shared expert in a real pass, which the isolated bench does not show. |
|
Closing, as offered above: the served A/B shows no prompt gain on this checkpoint, and the mix has no format or row range that would keep a gain. |
fn_hc_dense_mix8(main)fn_hc_dense_mix_vec(this PR)GB10 (sm_121), nvcc 13.4.92, driver 580.178.04, on this PR's head
92e099761(one commit on mainef9fa700a).tf-cuda-test flashnext-hc-mix-bench ROWS: alternating old/new order, CUDA events, median of nine samples after two warm-ups. The mixed rows and group sums are byte-equal at every row count.Flash Next's HC stream mix combines four BF16 streams into 2,560 values and their FP32 group sums.
fn_hc_dense_mix8uses ten 256-thread blocks a row, one warp for each 32-column group. This PR's kernel reads BF16 pairs, so five blocks cover a row, and it writes the same bytes. The gain is small: at 1,536 rows, 94 calls in a main-model chunk save about 0.5 ms of a chunk that takes about 0.9 s at about 1,700 prompt tokens a second. No served speedup is claimed.Refs #1754. Restacked onto main after #1764, as asked: it no longer depends on #1847.
What
fn_hc_dense_mix_vec(flashnext_hc_mix_vec.cuh): one BF16 pair a thread, 64 columns a warp, five blocks a row. Each value keeps dense_mix8's stream order,__fmul_rn/rbfrounding points and__fdiv_rn(total, 4). Each 32-column group sums in ascending order, as dense_mix8's lane 0 does.Glue.hcDenseMixtakes the vector kernel from 512 rows of the 2,560 × 4 shape (mixVec), and keepsdense_mix8below that. Its one caller is flashnext cuda: prompt passes with the same bits and less work, and a prompt scratch sized by use #1764'sreadoutNative, so the call site does not change.Glue.hcDenseMixVecis the one launcher, and the tests use it too.contract_hc_mix.zigregisters the vector mix and its group sums as replacements offn_hc_dense_mix8, with a swapped-input control (Registrations; the existing four mix entries are unchanged).flashnext_hc_mix_vec_records.zig(nvcc 13.0, sm_80/86/89/120/121), inall_cuda.tf-cuda-test flashnext-hc-mix,flashnext-hc-mix-contract,flashnext-hc-mix-bench [ROWS]; host steptest-flashnext-hc-mix-host(stress witnesses and records); a host test ofmixVec's threshold.Gate (on
92e099761)flashnext-hc-mixpasses at 1, 64, 65, 511, 512, 513, 1,536 and 4,218 rows, and at 65 rows with NaN, infinite and subnormal plants: dense_mix8's bytes, five repeats, solo rows, guards and unchanged inputs.SUMMARY hc_mix_vectors: 2 pass, 0 fail; 1 controls red, 0 missed. Ten shapes are bit-equal; the group sums are exact at k 4 where FP16 or BF16 sums would miss.flashnext-hcpasses (writebacks, the read-out chain, the n-gram gate and conv, stream adds).kernel-contract-limitswith nvcc 13.0 on sm_80/86/89/120/121:fn_hc_dense_mix_vecis 32/31/31/29/29 registers, 2,048 static shared bytes, bound 256 (record current). The run's other 226 problems are stale records that mainef9fa700ahas too: the same 226 lines on both trees, none of them new (flashnext cuda: prompt passes with the same bits and less work, and a prompt scratch sized by use #1764'sfn_hc_writeback_norm_moeon sm_120/121 is one).zig build test test-kernel-contract test-golden fuzz-cortheonandcompile-cuda-tests test-cuda-host test-flashnext-hc-mix-hostpass;zig fmtclean; lean 424 problems, 424 on main, 0 new.