Skip to content

moe t_rows on gfx1151: guard the tail-tile reads past N, then un-gate (Flash-Next C4 +26%, C8 +23%) - #292

Merged
AzeezIsh merged 2 commits into
mainfrom
fix/hip-moe-t-rows-tail
Oct 31, 2026
Merged

AzeezIsh merged 2 commits into
mainfrom
fix/hip-moe-t-rows-tail

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Two commits:

  1. c26286e: resolves the forward_rows_t dedup kernels (moe_expert_union_t, moe_expert_{gate_up,silu_down}_shared_t_rows_v3_r{2..8}_b256) on gfx1151 too. They were gated to !atlas_hip, so with ATLAS_QWEN4EXP_BATCH_FAST on, every batched Flash-Next decode step ran one MoE launch chain per row. Framework f135 (C8 rocprof) counted 97,920 moe_expert_gate_up_shared_t launches, 40% of the window.
  2. Tail guard: un-gated alone, the lane faulted (f127: hipErrorIllegalAddress right after moe_expert_gate_up_shared_t_rows, grid [3,41,2]). The rows kernels stage a whole 256-column tile. At Flash-Next's gate/up N = 640, the third CTA reads 128 bytes past every weight row, and past the tensor end on its last row. Those columns are never stored. Under __SCALE__ / __HIP_PLATFORM_AMD__, the staging loops now skip chunks at or past N. The gb10 build is unchanged, because the macro expands to nothing there.

A/B (framework f139, main-291 b73b73e vs 36ac079, Flash-Next NVFP4 through serve-amd at MAX_BATCH 8 with the lane on, AR, Gufo protocol):

C1 C4 C8 solo-vs-C8 identity
main 12.8 24.2 27.8 5/8
this 12.6 30.4 34.1 5/8
  • 0 faults on every arm.
  • Round 2 and the same-solo-text-across-builds check are still running. Results will be posted here before merge.
  • The rows kernels keep the single-row accumulation order per (row, slot).

🤖 Generated with Claude Code

AzeezIsh and others added 2 commits October 31, 2026 12:32
…ode stops falling back to per-row MoE)

The forward_rows_t kernels (moe_expert_union_t and
moe_expert_{gate_up,silu_down}_shared_t_rows_v3_r{2..8}_b256) come from
moe_shared_expert_fused_t.cu. strix-hip/common links that gb10 source,
which is portable, and the gfx1151 code object already contains all
fifteen entries. The lookups were gated to !atlas_hip, so on gfx1151
every batched decode step (MTP verify rows, C>1) ran one MoE launch chain
per row.

Framework f113 (Flash-Next, 8 concurrent decodes) counted 97,920
moe_expert_gate_up_shared_t launches for 2,040 tokens x 48 layers, i.e.
per row. MoE was ~40% of GPU time, and aggregate decode stayed flat from
C4 to C8 (f110: 12.8 / 16.2 / 15.6 tok/s).

The rows kernels keep the single-row accumulation order per (row, slot):
byte-identical by construction. ATLAS_QWEN4EXP_BATCH_FAST_BISECT bit 128
remains the kill switch, and t_rows_eligible still checks every handle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…f127 fault)

The rows kernels stage a CTA's whole 256-column tile. Flash-Next's
gate/up N is 640, so the third CTA reads 128 bytes past every weight row,
and past the end of the tensor on the last row. Those columns are never
stored, so the reads are dead. They land in mapped memory on gb10, but on
gfx1151 the un-gated lane faulted (framework f127: hipErrorIllegalAddress
right after moe_expert_gate_up_shared_t_rows, grid [3, 41, 2] =
ceil(640/256) x (4 rows x top-10 + 1) x {gate, up}). Under
__SCALE__ / __HIP_PLATFORM_AMD__ the staging loops now skip chunks at
or past N. The gb10 build is unchanged.

Stacked on the un-gating commit, so ATLAS_QWEN4EXP_BATCH_FAST's dedup
path runs on gfx1151 instead of one MoE launch chain per row (f135:
97,920 gate_up launches at C8, 40% of the window).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

f139 round 2: C1/C4/C8 12.8/30.4/34.2 vs main 12.8/24.2/27.8; solo replies identical across builds 8/8; 0 faults on all four arms. Two-round means: C4 +26%, C8 +23%, C1 flat. DevLab build 41223299463 passed and CI is green. Merging.

@AzeezIsh
AzeezIsh merged commit 170c3ed into main Oct 31, 2026
25 of 26 checks passed
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