Skip to content

perf(hip): Flash-Next hc_pre_down prefetches 16 weights per pass (bit-exact, C1 decode +9-27%) - #373

Merged
AzeezIsh merged 1 commit into
mainfrom
perf/hip-hc-pre-down-unroll
Nov 15, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
perf/hip-hc-pre-down-unroll

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

What

hc_pre_down is Flash-Next's hyper-connection stage 2, run in serial and short-T decode from the strix-local hyper_connection.cu. Each lane now loads 16 of its lane-strided BF16 weights into registers, then runs the same FMAs in the same ascending-i order. The per-lane sum and the shfl reduction are unchanged, so the output is byte-identical.

Why

The old loop did one 2-byte load per FMA, so each warp was latency-bound at ~52 GB/s on the 6.5 MB down_w stream. Together with hc_pre_finish_x4 it was 27% of single-user Flash-Next decode GPU time (rocprof 43677480400). A wider grid did not help (kbench 43681868396), so the launch is unchanged.

Evidence (DevLab Strix runner)

kbench (scripts/devlab/kbench_hc2, 43686225170): 0 differing outputs.

T Before After Speed-up
1 125 µs 46 µs 2.7×
2 111 µs 53 µs 2.1×
4 127 µs 57 µs 2.2×

End to end, Flash-Next NVFP4, C1 greedy decode, same wave (main 43695284596, this branch 43695287105):

Prompt Reply sha (both builds) main this branch
bicycle essay 09714ec21a48 21.6 tok/s 23.5 tok/s
refrigerator 103770824dbe 22.4 tok/s 25.8 tok/s
LRU cache code 242c7689320c 21.3 tok/s 27.0 tok/s

All three replies are byte-identical between the builds; decode is +9–27%.

The h2h on the branch (43690712002) shows b8 C1 20.2 → 21.7 tok/s. C4 and C8 run the separate tiled kernel and are unchanged.

🤖 Generated with Claude Code

…it-exact, 2.1-2.7x)

hc_pre_down (Flash-Next hyper-connection stage 2, serial and short-T decode)
did one 2-byte BF16 load per FMA. Each warp was latency-bound at ~52 GB/s on
the 6.5 MB down_w stream; together with hc_pre_finish_x4 it is 27% of
single-user decode GPU time (devlab rocprof 43677480400).

Each lane now loads 16 of its lane-strided weights into registers, then runs
the same FMAs in the same ascending-i order, so the per-lane sum and the shfl
reduction are unchanged and the output is byte-identical. kbench_hc2 (devlab
43686225170) found 0 differing outputs. Ship grid, per call: 125 -> 46 us at
T=1, 111 -> 53 us at T=2, 127 -> 57 us at T=4. A wider grid did not help
(same kbench, 43681868396), so the launch is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh
AzeezIsh merged commit f132e5e into main Nov 15, 2026
22 of 25 checks passed
AzeezIsh added a commit that referenced this pull request Nov 16, 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.

1 participant