Skip to content

native hip: size RDNA3.5 MoE lane plans to window rows and pool rising row steps - #3774

Merged
ashhart merged 3 commits into
ashhart:mainfrom
gilby:strix/hip-moe-exact-window
Nov 19, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
gilby:strix/hip-moe-exact-window

Conversation

@gilby

@gilby gilby commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

On RDNA3.5 (gfx1151), moe.planRows sizes lane-round (o.window) routed MoE plan buffers (pick, wts, items, members, local) to the round's exact rows instead of bucket(rows) = 16, and costs.poolWindowRows applies Pool Adjacent Violators pooling to rising added-row forward deltas within each four-row tile regime so tile boundary steps (m = 2 -> 3, 6 -> 7) never price an earlier draft step under a later one. No GPU kernel or token changes.

Checks on this head

  • Head commit: 6315cdc37 (a4f62edf5 code plus 6315cdc37 changelog), on main 3f1290ffe.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 221 and 221, 0 new findings. python3 tools/pr_check.py --base 3f1290ffe --pr 3774: 0 error(s), 0 warning(s). Upstream publish check across 3f1290ffe..HEAD: clean.
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test test-kernel-contract test-golden fuzz-cortheon --summary all on RDNA3.5 host: 756/758 steps succeeded (3265/3308 tests passed, 42 skipped, 1 pre-existing failure in stage_hip_test.test.every staged call on HIP memory equals the reference, whole and in parts, matching main).
    • zig build test -Dhip=true --summary all on RDNA3.5 host: 769/771 steps succeeded (1119/1139 tests passed, 19 skipped, same 1 pre-existing stage_hip_test failure).
    • zig build hip-kernel-test -Dhip=true -Dhip-arch=gfx1151 --summary all: 22/22 steps succeeded (220/227 tests passed, 7 skipped, 0 failed).
    • Direct unit tests on macOS host (zig test on zig/src/hip/root.zig and zig/src/hip_serve/costs.zig): 119/119 passed on hip/root, 4/4 passed on hip_serve/costs; zig fmt --check clean.
    • Before-change red checks on both new unit tests: reverting moe.planRows to if (exact) rows else bucket(rows) fails moe.test.planRows keeps RDNA3.5 lane rounds exact while leaving non-RDNA3.5 and non-window launches bucketed with expected 3, found 16 (TestExpectedEqual); removing poolWindowRows from costs.windows fails costs.test.windows pools a rising added-row step across tile boundaries while leaving concave rows alone with actual 11, not within absolute tolerance 0.000000000001 of expected 12 (TestExpectedApproxEqAbs at costs.zig:178).
  • CI: no checks reported yet on strix/hip-moe-exact-window.
  • Not run, and why: gfx1030, gfx1100, and gfx1201 hardware (no such cards; the planRows unit test verifies non-RDNA3.5 chips remain bucketed, and poolWindowRows is chip-independent host math). Qwen3.8-27B was not served because it is dense (.dense when num_experts is absent) and does not call moe.run.

Receipt

  • Main against branch: 64 served cells across all 4 routed MoE checkpoints (16 cells each) under #2984 (LOSSES_TOTAL=0: 0 two-series losses). Qwen3.6-35B-A3B gains >=2% on both pairs in 10 cells (+2.48% to +14.47%). Full Group 1 tables (group1_pr3774_merged.md, group1_pr3774.md, group1_pr3774_rerun.md) and runners: https://gist.github.com/gilby/0afb93436834f38d94c67fb674ddb3dd.
  • Boxes it reaches: RDNA3.5 lane-round routed MoE plan allocation sizing (zig/src/hip/moe.zig) and HIP serve window cost table smoothing (zig/src/hip_serve/costs.zig).
  • New switch? None.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: TensorFold 6315cdc37 vs main 3f1290ffe (#3242 be9fe6237 merged onto both base and head arms for Lightning oQ4e), Zig 0.17.0, HIP 7.1, one Strix Halo (Radeon 8060S, gfx1151, 128 GB unified, stock 12.3 GiB reserve, performance power mode). Checkpoints: Qwen3.8-Flash-Next oQ4e; Nemotron 3.5 Lightning 30B-A3B MLX 4-bit; Qwen3.6-35B-A3B MLX 4-bit with MTP; Nemotron 3.5 Lightning oQ4e (user3892 r4).
  • Paths and platforms the change reaches, which I ran and which I could not: ran routed 4-bit MoE paths of flashnext, qwen3_5 MoE, and nemotron on gfx1151, plus host unit tests over gfx1030, gfx1100, gfx1151, and gfx1201; could not execute on gfx1030/gfx1100/gfx1201 GPUs (verified bucketed fallback in host tests).
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: 57/57 token_sha256 equality, alone [42, 0], serial [24, 0] in every arm (1-discard, 2-main, 3-exact, 4-exact, 5-main) and rerun across all 4 checkpoints.
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): 1-discard then main/this/this/main on fresh servers (--context 131072 --parallel 4 --prompt-cache-gib 0, page cache dropped each arm); bench_openai --tokens 256 --reps 3, bench_concurrent --levels 1,2,4 --reps 3 --alone --serial --temperatures 1.0,0, bench_cache --require-cold at 2K/8K/32K. Any single-series SLOWER cell got one rerun of the full series per #2984: on Lightning stock 4-bit, 3 noisy first-series flags (openai gpu-chat-no-think T1 -3.48%/-1.08%, T0 -0.92%/-4.11%, conc T0 x4 -0.86%/-2.42%) all passed on rerun (+0.36%/+0.11%, +0.09%/-0.07%, -0.69%/+0.87%).
  • Decode speed before and after, from tools/bench_openai.py (in tok/s; pair 1 = 3-exact / 2-main, pair 2 = 4-exact / 5-main, rerun shown where run):
checkpoint cell main1 exact1 exact2 main2 pair 1 pair 2 rerun pair 1 / pair 2 verdict
Qwen3.8-Flash-Next oQ4e fibonacci-raw T1 49.56 49.51 49.57 49.48 -0.10% +0.16% - within the rule
Qwen3.8-Flash-Next oQ4e gpu-chat-no-think T1 38.19 38.15 38.20 38.31 -0.11% -0.30% - within the rule
Qwen3.8-Flash-Next oQ4e fibonacci-raw T0 50.23 50.19 50.25 50.21 -0.07% +0.08% - within the rule
Qwen3.8-Flash-Next oQ4e gpu-chat-no-think T0 43.49 43.48 43.50 43.50 -0.04% -0.01% - within the rule
Nemotron 3.5 Lightning 4-bit fibonacci-raw T1 117.86 116.10 117.80 116.98 -1.50% +0.70% +0.04% / -0.01% within the rule
Nemotron 3.5 Lightning 4-bit gpu-chat-no-think T1 93.56 90.30 90.85 91.84 -3.48% -1.08% +0.36% / +0.11% passes on rerun
Nemotron 3.5 Lightning 4-bit fibonacci-raw T0 123.04 124.49 124.49 122.98 +1.18% +1.23% -0.33% / +0.98% within the rule
Nemotron 3.5 Lightning 4-bit gpu-chat-no-think T0 99.23 98.31 94.83 98.89 -0.92% -4.11% +0.09% / -0.07% passes on rerun
Qwen3.6-35B-A3B MLX 4-bit fibonacci-raw T1 105.52 108.13 108.13 105.46 +2.48% +2.53% - gain >=2% both pairs
Qwen3.6-35B-A3B MLX 4-bit gpu-chat-no-think T1 100.21 104.92 105.83 100.15 +4.70% +5.67% - gain >=2% both pairs
Qwen3.6-35B-A3B MLX 4-bit fibonacci-raw T0 124.70 128.29 128.39 124.63 +2.88% +3.02% - gain >=2% both pairs
Qwen3.6-35B-A3B MLX 4-bit gpu-chat-no-think T0 87.39 100.04 100.01 95.39 +14.47% +4.85% - gain >=2% both pairs
Nemotron 3.5 Lightning oQ4e (+#3242) fibonacci-raw T1 97.02 97.65 98.52 96.04 +0.65% +2.58% - within the rule
Nemotron 3.5 Lightning oQ4e (+#3242) gpu-chat-no-think T1 80.91 81.59 84.28 81.17 +0.84% +3.83% - within the rule
Nemotron 3.5 Lightning oQ4e (+#3242) fibonacci-raw T0 112.24 112.31 112.44 112.27 +0.06% +0.15% - within the rule
Nemotron 3.5 Lightning oQ4e (+#3242) gpu-chat-no-think T0 90.85 90.89 91.00 90.85 +0.04% +0.17% - within the rule

On Qwen3.6-35B-A3B MLX 4-bit, concurrent and cold decode also gain >=2% on both pairs in 6 additional cells: conc T1 x2 +6.47% / +6.89% (117.50->125.10), conc T0 x1 +3.56% / +3.71% (137.50->142.40), conc T0 x2 +3.53% / +3.04% (161.40->167.10), cold 2k decode +6.29% / +6.72% (105.57->112.21), cold 8k decode +5.18% / +4.94% (95.80->100.77), and cold 32k decode +3.07% / +3.29% (61.01->62.88).

  • Prompt speed before and after (bench_cache --require-cold ttft_s; positive pair % means lower ttft_s on head): all 12 cold ttft_s cells across the 4 checkpoints are within #2984's noise rule (-2.04% to +0.59%): Flash-Next (2K 2.993->2.999 -0.22%/-0.16%, 8K 9.591->9.790 -2.04%/+0.13%, 32K 40.009->39.868 +0.35%/+0.59%), Lightning 4-bit (0.733->0.733 -0.05%/+0.38%, 2.686->2.687 -0.04%/+0.22%, 13.491->13.472 +0.15%/-0.45%), Qwen3.6-35B-A3B (0.893->0.896 -0.36%/-0.34%, 3.450->3.452 -0.07%/-0.19%, 17.414->17.437 -0.13%/-0.07%), and Lightning oQ4e (0.734->0.736 -0.20%/+0.37%, 2.679->2.684 -0.19%/+0.50%, 13.280->13.312 -0.24%/+0.36%).
  • Licence of any new weights or drafter, or "n/a": n/a.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled.

@ashhart

ashhart commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Thanks @gilby. The exact window sizing and cost pooling look ready, with useful regression tests and scoped equality and paired performance receipts. The only current-main apply issue is the already noted changelog context; the source files apply cleanly. Ready to land with that routine integration.

  • Synthena

ashhart pushed a commit to gilby/TensorFold that referenced this pull request Nov 19, 2026
@ashhart
ashhart force-pushed the strix/hip-moe-exact-window branch from 6315cdc to dc2d5fd Compare November 19, 2026 07:31
ashhart pushed a commit to gilby/TensorFold that referenced this pull request Nov 19, 2026
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @gilby. To get this moving, we rebased it onto current main ourselves, keeping every one of your commits as it was (author and message) and fitting it to the code main has gained since; no behaviour changes. It is in the landing queue now, and if anything else is needed from you we will say so here.

  • Synthena

gilby and others added 3 commits November 19, 2026 16:40
… pool tile-step window costs

Size RDNA3.5 lane-round routed MoE plan buffers in hip.moe to the round's exact row count instead of rounding up to a 16-row minimum bucket, avoiding unnecessary zero-fill and empty item dispatch padding during decode and speculative verification.

Pool rising added-row deltas across each 4-row tile regime in hip_serve/costs when timing lone decode windows so load-time window costs remain concave across per-tile step boundaries.
@ashhart
ashhart force-pushed the strix/hip-moe-exact-window branch from dc2d5fd to 249a96f Compare November 19, 2026 16:40
@ashhart
ashhart merged commit d7c969c into ashhart:main Nov 19, 2026
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thank you @gilby. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

ashhart pushed a commit to gilby/TensorFold that referenced this pull request Nov 20, 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