Skip to content

Zan/dsv41 decoding exp - #7495

Merged
Zzz9990 merged 3 commits into
zan/dsv41-decodingfrom
zan/dsv41-decoding-exp
Nov 5, 2026
Merged

Zzz9990 merged 3 commits into
zan/dsv41-decodingfrom
zan/dsv41-decoding-exp

Conversation

@Zzz9990

@Zzz9990 Zzz9990 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Motivation

Changes

Performance (if applicable)

Hardware Workload/configuration Before After Change

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

PR Self-Review

Reviewed revision

Behavior and intent

Validation and unverified scope

PR-specific question

Changed op tests

The global m-major item order spreads the 18 n-tiles that share an m-tile's
A over most XCCs, so each XCC fetches that A again instead of hitting its
own L2. With xcc_queues, queue x holds the m-tiles m % 8 == x, n fastest;
consumer l of XCC x starts on item l of queue x, later claims stay on that
queue, and an exhausted queue moves on to the next ones (claiming only
after the previous one came back empty, so no item is lost).

Decode m-tiles are one per expert, so B has no reuse for the order to keep:
AITER_MEGA_S1F_XCC_QUEUE (auto) enables it up to tile_m 96; 0 / 1 force it.
A queue model (random claim interleavings) runs every item exactly once and
cuts the XCCs reading each A tile from 6.2 to 1.2 at 96 m-tiles, 512 CTAs.
…E_LOC)

On MI455X (SPX + NPS1) a 16 KiB granule is homed on IOD domain
a14 ^ a17 ^ a20 ^ phase(2 MiB page), and workgroup b runs on domain
((b + 3) % 8) >= 4. Remote reads cost ~445 ns vs ~340 ns local and cap
streaming bandwidth.

- iod_locality.placed_w1: probe the page phases once (iod_loc_probe.cpp,
  built with hipcc on first use) and re-lay W1 + its n32k4 scales so unit
  (expert, n-tile) sits on domain n-tile % 2; one granule per wave per
  k-tile of B, one per 8 k-tiles of B scales; cached per weight.
- mxfp4_preshuffle_gfx1250_tdm: b_placed addresses B/SB by granule via
  the TDM imm_offset (2 phase loads per tile); loc_sched runs a persistent
  grid where each worker only visits n-tiles of its own domain parity.
- grouped_gemm_mxfp4: AITER_MOE_LOC=1 local, 2 remote-only control,
  3 placed B on the stock schedule; AITER_MOE_LOC_PW sets the workers.

DSv4.1 EP4 GEMM1 (192 tokens, E96, K5120, N4608, a4w4, tile 32x256x256),
AITER_MOE_LOC=1 AITER_MOE_LOC_PW=1024: 73.5 -> 68.5 us, output bitwise
identical; LOC=2 gives 114 us.
…workers

- s1f_stage1 iod_loc: GEMM1 reads the placed W1 (b_placed), and per-XCC
  queue x only holds n-tiles of its IOD domain parity ((x + 3) % 8 >= 4),
  its m-tiles split over the 4 queues of that domain; steals try the
  same-domain queues first.
- s1f_ctl: AITER_MOE_LOC=1 forces xcc_queues and swaps in placed_w1.
- The b_placed builder accepts the As-prologue wave split (two B owners).
- grouped_gemm_mxfp4 keeps the stock path for tilings placed_w1 does not
  cover (e.g. the S1F probe step at tile_k 128) instead of asserting, and
  the persistent workers default to 4 per CU (AITER_MOE_LOC_PW overrides),
  so AITER_MOE_LOC=1 is the only knob.

bench_mega_moe EP4, a4w4, 8 layers, --iters 20, only AITER_MOE_LOC=1 set:
  tpr 192 (dispatch + GEMM1): GEMM1 73.2 -> 66.5 us, layer 201.4 -> 196.2 us
  tpr 384 (S1F t64): stage-1 103.5 -> 99.0 us, layer 226.1 -> 221.4 us
  tpr 768 (S1F t96): stage-1 108.6 -> 104.2 us, layer 249.5 -> 244.6 us
  tpr 768, AITER_MEGA_S1F=0: GEMM1 83.0 -> 78.6 us, layer 249.6 -> 244.7 us
--acc_verify 1 passes at tpr 192/384/768.
@Zzz9990
Zzz9990 merged commit dacca34 into zan/dsv41-decoding Nov 5, 2026
@Zzz9990
Zzz9990 deleted the zan/dsv41-decoding-exp branch November 5, 2026 06:19
yhl-amd pushed a commit that referenced this pull request Dec 2, 2026
…2 schedules


Squash of the IOD series rebased onto main:

- Zan/dsv41 decoding exp (#7495)
- [Fix] Keep placed_w1 sources alive so a freed weight address cannot hit a stale placement
- IOD locality: place W1 at load time via moe_shuffle_weight_iod
- IOD locality: probe the phase with all eight probers running, and refuse placement when the mapping does not hold
- IOD locality: keep only probe launches that start at the rotation the GEMM assumes
- IOD locality: place W2 too, with one layout serving both 512x128 and 256x256 GEMM2 tiles, and read the launch rotation from HW_ID2
- IOD locality: warn when a weight shape has no placed layout
- IOD locality: name the target gfx1250 in docstrings
- IOD locality: moe_shuffle_weight_iod takes gate_up like moe_shuffle_weight, instead of a gemm index
- IOD locality: read AITER_MOE_LOC in one place, as 0 on every arch but gfx1250
- IOD locality: place MoE weights in their own storage, no copy
- IOD locality: one S1F GEMM1 queue per IOD domain, not per XCC
- IOD locality probe: use tensor_shim typed buffer stores instead of buffer_ops
- IOD locality probe: stream reads before probing so dirty lines do not blur the parities
- bench_mega_moe: let roctracer drain before stopping the profiler
- IOD locality: cluster-granular domain schedule, domain groups, and a host mask table
- S1F decode: global GEMM1 order on placed W1 below tile_m 128, no per-XCC queues, no CSV TDM knobs
- DSR1 EP4 MegaMoE: ep_fused=1 grouped FMoE rows, 256-tile S1F uncapped for top-9
- moe_shuffle_weight_scale: shuffle a stage's weight and scale and IOD-place them in one call (allow_relayout=False keeps the shuffled layout), replacing moe_shuffle_weight_iod

Rebased onto main: the S1F hook keeps the per-step CSV GEMM1 knobs (B TDM
hint and A-scale prologue) instead of turning both off, and adds the placed
W1's domain group (iod_loc) to the launcher and precompile keys. The grouped
GEMM keeps main's post_gemm2_rmsnorm / out_preshuffled next to b_placed /
loc_sched / loc_group, and the deferred C wait follows either worker loop.
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