Skip to content

[FlyDSL] [GFX1250] [MoE] IOD-local MoE weight placement and DSv4.1 EP4 grouped MoE retune - #8728

Draft
Boss2002n wants to merge 21 commits into
mainfrom
zan/dsv41-iod-loc-main
Draft

Boss2002n wants to merge 21 commits into
mainfrom
zan/dsv41-iod-loc-main

Conversation

@Boss2002n

@Boss2002n Boss2002n commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Update (12-02): rebased onto current main (a0b6b7c7a; previous head e3362233a kept on yhl-amd/aiter as bak/8728-pre1202a), plus two commits:

  • IOD locality: on by default on gfx1250: drops the AITER_MOE_LOC gate, so gfx1250 always places the MegaMoE weights and runs the domain-parity schedule.
  • iod_locality: place a misaligned MoE weight/scale through a 64 KiB-aligned copy: a weight or scale that is not 64 KiB aligned (the DSpark draft MoE) was left unplaced; it is now placed through an aligned copy rebound in place. tests/test_iod_locality_realign.py (5 CPU tests).

Rebase notes (each Zan commit that needed more than a textual merge says so in its message):

IOD-local placement of the gfx1250 MegaMoE weights (on by default on gfx1250), plus the DSv4.1 EP4 a4w4 grouped-MoE retune and S1F stage-1 tuning, on top of current main.

This replaces #7332, whose branch carried a merge of #8092. This branch has no #8092 content and is kept free of textual conflicts with it, so the two can land in either order.

Motivation

On gfx1250 (SPX + NPS1) each 16 KiB granule is homed on one of two IOD domains, and each workgroup runs on a known domain. A remote read costs about 445 ns against 340 ns for a local one, and streaming local reads reach 21.9 TB/s against 20.0 TB/s for the stock order at the same power. The MoE GEMMs are bound by reading every local expert's weights once at decode sizes, so placing W13/W2 so that each workgroup reads its own domain's memory cuts their latency and power.

Changes

  • aiter/ops/flydsl/iod_locality.py, kernels/iod_loc_probe.py: probe the per-2 MiB-page IOD phase once per allocation, then re-lay a preshuffled weight and its scale in their own storage (no extra memory), with a small per-unit mask table the kernels read.
  • aiter.ops.shuffle.moe_shuffle_weight_scale: shuffle one MoE stage's weight and scale and, on gfx1250, place them in the same call (through a 64 KiB-aligned copy when the weight or scale is not aligned). allow_relayout=False keeps the shuffled layout for callers that also read the weights another way (Triton decode views, EPLB). It is a no-op placement on every other arch.
  • mxfp4_preshuffle_gfx1250_tdm.py: placed B / B-scale TDM loads (b_placed 1 or 2, so one layout serves 256x256 and 512x128 GEMM2 tiles), a cluster-granular domain-parity schedule for GEMM2.
  • S1F stage 1: one GEMM1 queue per IOD domain on placed W1; tile_m 96 variant; B TDM hint and A-scale prologue.
  • Retuned DSv4.1 EP4 a4w4 grouped-MoE rows (see [FlyDSL] [GFX1250] [MoE] Retune gfx1250 DSv4.1 EP4 a4w4 grouped MoE rows for d… #7332 for the per-bucket numbers).

Performance

E2E, DeepSeek-V4.1-Flash, gfx1250, DEP4 (EP4 + DP attention), a4w4 MXFP4 MoE, MegaMoE with S1F, MLPerf agentic endpoints benchmark (600 s issue window). Same build; only AITER_MOE_LOC differs (measured on #7332):

Metric c128 LOC0 → LOC1 Δ c512 LOC0 → LOC1 Δ
TPOT mean 3.97 → 3.81 ms −4.0% 7.06 → 6.57 ms −6.9%
Throughput (tok/s/GPU) 4062 → 4187 +3.1% 9500 → 10163 +7.0%
TTFT mean 631 → 619 ms −2.0% 1821 → 1675 ms −8.0%
Accuracy (threshold 52.36%) 54.01% → 53.87% both pass 55.16% → 55.54% both pass

Testing

  • op_tests/tuning_tests/test_grouped_gemm_launch_abi.py, test_grouped_ep_fused_lookup.py: pass.
  • bench_mega_moe.py --acc_verify 1, 4x gfx1250 EP4, S1F + fused stage 2: DSv4 shape tpr 192 / 1536 and DSR1 shape tpr 1536 pass with AITER_MOE_LOC=0 and 1, identical logits diff between the two.
  • black, ruff.

Breaking Changes

gfx1250 places the MegaMoE weights at load time by default (AITER_MOE_LOC is gone). Callers that read the weights another way pass allow_relayout=False; every other arch is unchanged.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8728 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

zejunchen-zejun added a commit to ROCm/ATOM that referenced this pull request Dec 2, 2026
…OE_LOC (#3144 @ 7214718, head 2026-11-11)

Port of #3144 onto k3-455-dev. After the
FlyDSL shuffle (Mxfp4MoEMethod._process_weight_layout_after_loading, branch
C), with AITER_MOE_LOC set on gfx1250, aiter re-lays W13 / W2 and their scales
IOD-locally in their own storage, and its gfx1250 grouped MoE reads them
placed from then on. As in #3144, placement is skipped under
ATOM_USE_TRITON_MOE_DECODE (zero-copy Triton views of the same bytes) and
EPLB (expert-major migration), and is a no-op without AITER_MOE_LOC.

#3144 calls aiter.ops.shuffle.moe_shuffle_weight_iod, which ROCm/aiter#8728
replaced with moe_shuffle_weight_scale (shuffle and place in one call). The
port calls what both wrap, aiter.ops.flydsl.iod_locality (mode, place_w13,
place_w2), on the tensors the layer keeps, so the scale aiter registers is
the one MegaMoE is handed later; an aiter without that module leaves the
weights as they are. One INFO line on the first layer says whether W13 and W2
were placed: aiter logs its successes at INFO, below the recipes'
AITER_LOG_LEVEL=WARNING.

This is the method Kimi-K3's D runs: under ATOM_MORI_V2=1,
MoriV2ModularKernel.forward hands layer.w13_weight / w2_weight and their
scales to MegaMoEGfx1250, whose S1F stage 1 and grouped GEMMs look the
placement up by address. MegaMxfp4MoEMethod (--moe-backend mega) builds its
own _mega_* copies and is not placed.

Co-Authored-By: zanzhang <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
zejunchen-zejun added a commit to ROCm/ATOM that referenced this pull request Dec 2, 2026
…-dev-1201-iod

- D_MOE_LOC sets AITER_MOE_LOC on D (LLM-Booster #875). It is off by default
  and needs aiter's IOD placement (ROCm/aiter#8728 + #8997), which lives on
  aiter `zejun/k3-455-dev-1201-iod`. On K3 only W13 is placed.
- The aiter decode megakernel (ROCm/aiter#7345, #865) lives on aiter
  `zejun/k3-455-dev-1201`. The two do not combine yet: they conflict in 21
  hunks of the S1F / GEMM builder, so they are A/B'd on separate builds. The
  IOD install script now defaults AITER_REF to the -iod branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Zzz9990 and others added 11 commits December 2, 2026 15:58
…ecode tokens

Retune the DeepSeek-V4.1 EP4 a4w4 rows (hidden 5120, inter 2304, 96 local
experts) for the 256..2048 token buckets:
  256/512/1024: gemm1 t32x256x256, gemm2 t32x512x128, 2/2 buffers
  2048:         gemm1 t64x256x128, gemm2 t64x512x128, 2/2 buffers
all with the B-only TDM temporal hint (tdm_b_th=1).

At these sizes both GEMMs are bound by reading every local expert's weights
once, so the tile that keeps each expert in a single M tile wins: tile_m=16
leaves gemm2 under-occupied, and tile_m=32 at 2048 tokens needs a second M
tile per expert, which reads B twice.

Measured single-GPU (op_tests/flydsl_tests/test_flydsl_grouped_gemm.py
--scenario kernel, random routing, 96 experts, topk 6, tokens = bucket/4 so
rows per expert match an EP4 rank), gemm1+gemm2 us, old -> new rows:
  bucket  256: 104.4 ->  95.9
  bucket  512: 118.8 ->  97.8
  bucket 1024: 109.6 ->  98.7
  bucket 2048: 115.4 -> 104.4
The us column holds the new single-GPU gemm1+gemm2 time.
…v4.1 EP4 a4w4 4096-token row

The 4096-token bucket keeps its tiles (gemm1 and gemm2 t128x256x256) but
moves gemm2 from 2 to 3 buffers and sets the B-only TDM temporal hint
(tdm_b_th=1).

Measured single-GPU (op_tests/flydsl_tests/test_flydsl_grouped_gemm.py
--scenario kernel, random routing, 96 experts, topk 6, 1024 tokens so rows
per expert match an EP4 rank at the 4096 bucket), us:
  old row: gemm1 85.8, gemm2 47.6, total 133.5
  new row: gemm1 81.0, gemm2 41.3, total 122.2
Of 36 tile_m 64/128 configurations swept, this was the fastest; tile_m=64
needs a second M tile for most experts and lands at 143-154 us. The us
column holds the new single-GPU gemm1+gemm2 time.
…ped MoE row

Random routing puts 44-83 rows on each of the 96 local experts, so a
96-row tile still covers every expert in one M tile while doing less
padded work per tile than 128. Kernel scenario at 1024 tokens per GPU:
121.9 -> 117.8 us (gemm1 80.3 -> 77.0, gemm2 41.6 -> 40.8), three rounds.
…is on

With tdm_as_in_prologue the whole K range of A scale is loaded once into
AS_FULL and the main loop never reads a per-stage A-scale slot, but each
stage still reserved one. Give it no per-stage slot so LDS shrinks; for
DSv4.1 EP4 tile_m 96 nb3 this brings gemm1 from 164352 B to 162816 B,
back under the 160 KB-per-WG limit for 2 WGs per CU.

Enable the prologue for the DSv4.1 EP4 a4w4 2048/4096 rows (512/1024
tokens per rank, random routing, 3 rounds under gpu-lock):
  512 tokens:  104.9 -> 104.4 us
  1024 tokens: 117.8 -> 117.4 us
The tile_m 32 rows (64/128/256 tokens) get 2.5-2.9 us slower with it, so
they stay off. Existing prologue rows in tuned_grouped_fmoe.csv and
gptoss_gfx1250 still pass the reference check.
moe_apre_quant gave each wave one whole token, so 1024 tokens on a
1024-workgroup grid kept only 64 workgroups busy and each wave walked all
K256 groups in series. Split each row into enough K256 runs to occupy every
wave. When there are at least as many tokens as waves, keep one wave per
row with a constant K256 trip count so group loads still overlap.

moe_apre_quant per call:
  DSv4.1 EP4 (K 5120), 1024 tokens: 13.3 -> 4.4 us
  K 7168 E64 topk 8, 2048 tokens:   17.5 -> 6.2 us
  K 7168 E64 topk 8, 16384 tokens:  25.3 -> 25.5 us (unchanged)
…ed MoE row

Turn on a_preshuffle for the key-4096 (1024 tokens, random routing) row.
A arrives packed for the TDM copy, so the A LDS rows lose their pad and each
A tile lands as one contiguous run.

1024 tokens, kernel bench, 3 rounds: gemm1 76.7 -> 75.8 us,
gemm2 40.5 -> 40.0 us. End-to-end fused_moe GPU time (sum of kernels):
161.5 -> 159.3 us, now that the A-preshuffle quant no longer idles most of
the grid. Accuracy is unchanged (rel_l2 2.65e-3).
…GEMM1


The S1F stage-1 kernel embedded GEMM1 with tdm_b_th and tdm_as_in_prologue
hardcoded to 0, so the grouped CSV rows that tune them had no effect on the
MegaMoE fused dispatch path. Pass both through from the GEMM1 launch.

The A-scale prologue loads the tile's full A-scale range up front, but under
S1F those rows arrive from the same launch's dispatch. Move the a_ready gate
ahead of that load (and drop it from the mainloop) instead of rejecting the
combination. With defer_c_wait the next tile's prologue now lands while the
deferred C store is in flight, so assert that the C staging stays below the
resident A-scale region rather than forbidding the prologue outright.

The resident A-scale region grows the arena. A variant whose CTAs would no
longer share the CU (or whose layout asserts reject the prologue) keeps the
rotating A-scale stages, decided at build time outside the jit body.

Rebased onto main after #8189, which already passes the CSV B TDM hint per
compact step (g1_tdm_b_th). The A-scale prologue now rides the same way:
_compact_gemm_tiles also returns the row's tdm_as_in_prologue (after
AITER_GROUPED_GEMM_AS_PROLOGUE, as fused_moe applies it), the step keeps it
as g1_tdm_as_in_prologue, and the launcher / precompile keys carry it. Main
moved the C staging to the arena tail (C_OFF), so the defer_c_wait check is
now that C_OFF clears the resident A-scale region; where it does not,
_g1_asprol keeps the rotating A-scale stages.
The DSv4.1 EP4 a4w4 4096-token row tunes GEMM1 to tile_m 96, which the
stage-1 kernel rejected: an m-tile has to be whole 64-row flag tiles, so
every step at that alignment fell back to dispatch + a separate GEMM1.

Pick the flag tile per variant instead. tile_m 96 runs on 32-row flag tiles
(three per m-tile, polled as one b128 per flag tile like the other
multi-flag variants, so it keeps the at-most-4-ranks limit); the others keep
64 rows. The compact plan already pads experts to a non-power-of-two
alignment over a smaller plan tile, and the flag, tile_src and control
buffers are sized for 16-row tiles, so only the plan tile and the kernel's
flag geometry change. The variant sits between 64 and 128 rows: three
buffers, two CTAs per CU.

Rebased onto main: #8189 already has FLAG_M_SMALL and the 96-row flag tile
in s1f_flag_m, so this adds only the 96 entry of _S1F_VARIANTS.
The stage-1 kernel embeds its own 256x256 GEMM1 tile and buffer count, so
only the CSV row's tile_m has to match. Requiring tile_n / tile_k 256 made
the DSv4.1 EP4 2048-token row (64x256x128) drop S1F and with it the B TDM
hint and A-scale prologue the row asks for.

Rebased onto main: main's prefill-tile widening now sets got["tile_m"].
…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.
Drop the AITER_MOE_LOC gate: gfx1250 always places the MegaMoE weights and runs the domain-parity schedule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yhl-amd
yhl-amd force-pushed the zan/dsv41-iod-loc-main branch from e336223 to f047223 Compare December 2, 2026 08:11
…igned copy

In-place placement needs each storage to start on a 64 KiB boundary. The
torch caching allocator only aligns segment starts; a tensor carved from
a reused block is 512 B aligned. The DSV4.1 Flash DSpark draft MoE (32
experts/rank under EP4) is shuffled after the main model has fragmented
the pool, so its new n32k4 scales landed 2560 / 6656 / 13312 B past a
boundary and 3-6 of its 6 GEMMs per rank stayed unplaced
("its scale starts N B past a 64 KiB boundary").

A storage that is whole granule pairs but misaligned (or whose pages have
no probe window) is now copied to a 64 KiB-aligned buffer, placed there,
and the caller tensor is rebound to it with .data once placement
succeeds; its old storage goes back to the allocator. Placement failure
leaves both tensors untouched. Cost: at most 64 KiB slack per copied
tensor plus one transient copy at load (the draft scales: 23.6 / 11.8 MB).

CPU tests: tests/test_iod_locality_realign.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 32c942d0267231eb88c14cd339809e6729c31541)
@yhl-amd
yhl-amd force-pushed the zan/dsv41-iod-loc-main branch from f047223 to a0b6b7c Compare December 2, 2026 08:13
Zzz9990 and others added 9 commits December 2, 2026 08:20
Replace the per-tiling placed layouts (W13 512x256 / W2 512x128 tiles,
pin_tile, cluster_n capped to the domain group) with one layout every
grouped-MoE / S1F tiling reads, so the CSV tuned tiles, waves and clusters
run unchanged on placed weights.

- iod_locality: the unit is the atom (expert e, column c of 256 n rows,
  k-block a of 128): 16 KiB of B, one granule, and its 1 KiB of n32k4
  scales. A column's atoms are on one domain; runs of GROUP=4 columns
  alternate domains and the last runs balance (column_domains). One place()
  for W1 and W2, an ENTRY-int32 phase table per (e, c), lookup() for any
  tile_k % 128 == 0 and tile_n a multiple or 32-aligned divisor of 256.
  Keeps hyi's 64 KiB-aligned copy for a misaligned storage and the
  default-on mode() on gfx1250.
- tdm grouped GEMM: placed B / scale addressed per atom from the table,
  domain_tile() schedule over cluster_n-wide n-tile clusters for any
  cluster_n, tile_n and tile_k the table serves.
- S1F stage 1: domain queues over the atom columns; up to 1024 tokens/rank
  and tile_m <= 128 the domain queues are walked with a fixed stride
  instead of claims (AITER_MEGA_S1F_LOC_STATIC, auto by default). EP4,
  per layer, claims -> fixed stride: DSv4.1 192 tpr 196.5 -> 183.1 us,
  DSR1 192 tpr 201.8 -> 190.2.
- DSR1 EP4 32768-token grouped row: cluster 1x2 for both GEMMs (28 columns
  split 7/7 between domains; 1x4 left a straddling cluster), tpr 8192
  1487 (previous layout) -> 1481 us/layer.
- tests: op_tests/flydsl_tests/test_iod_atom_layout.py (layout, table,
  schedule coverage, CPU); test_iod_locality_realign.py on place().

Checked on gfx1250 EP4 (DSR1 192/2048/8192/16384, DSv4.1 192/2048):
MEGA-CHECK passes; an in-kernel audit found every atom's B and scale homed
on its column's domain, every task on its workgroup's domain (but the
balancing tail cluster of N=7168 at cluster_n 4: 1/14 of GEMM2 tasks), and
each tile run exactly once.
moe_shuffle_weight_scale allocates the shuffled weight and scale with
iod_locality.aligned_empty (64 KiB aligned, a probe window on every page),
so place() takes them as they are: no aligned copy, no freed hole, peak one
tensor lower. _aligned_copy stays the fallback for other callers.
…decode tiles

_S1F_XCC_QUEUE_MAX_TILE_M = 0 turned the per-XCC queues off for every
tile, placed W1 included, so a decode step with AITER_MOE_LOC=1 ran the
global GEMM1 order (_locg) instead of the domain-aware per-XCC queues
(_xq_loc). The 5-9 us loss that motivated the default was measured on
unplaced weights.

Auto now takes the per-XCC queues on placed W1 below
_S1F_LOC_QUEUE_MIN_TILE_M (the per-domain queues already cover the wider
tiles); unplaced weights keep the global order.
AITER_MEGA_S1F_XCC_QUEUE=0/1 still overrides.

DSV4.1 Flash EP4 a4w4, 4x gfx1250, 8 layers, S1F + fused stage 2,
stage 1 / per layer (us), placed weights:
  tpr 192 (tile_m 32): _locg 90.3 / 184.9 -> _xq_loc 83.4 / 179.4
  tpr 384 (tile_m 64): _locg 95.0 / 207.1 -> _xq_loc 90.1 / 201.8
… recv 32..1024, CSV GEMM1 TDM knobs in the S1F stage-1 kernel

The other two parts of the DSV4.1 decode regression against the 1116 build,
next to the per-XCC queues of the previous commit.

Grouped MoE CSV, e96 a4w4 EP rows (topk -1) for the buckets c32-c256 decode
lands in, back to the rows the 11-16 build ran:
- 32: GEMM1 16x512x256, GEMM2 16x512x256, no A-scale prologue, no B TDM hint.
- 64, 128: no prologue, no hint.
- 256, 512, 1024: no prologue (B TDM hint 1 kept).

S1F: the stage-1 kernel embeds the resolved row's B TDM hint and A-scale
prologue again, as fused_moe passes them, instead of both off. 0fd0988 kept
them off because the tile_m 32 row had both on (~1.5 us on the stage-1
kernel); with the rows above, the tile_m 16 buckets have both off, the tile_m
32 buckets (192..1024) run bth1 and 1536 up asprol + bth1, which is what the
11-16 build ran (_bth1 / _asprol_bth1). Each step bound's precompile key
carries its own row's knobs (_compact_g1_tdm), so no bucket JIT-compiles in a
graph capture. _compact_row factors out the row lookup _compact_gemm_tiles
already did; the tiles it resolves are unchanged for every bucket.

DSV4.1 Flash DEP4 c64 decode on gfx1250, 11-16 build vs the plain 11-27 main
rebase: GEMM2 0.348 vs 0.429 ms/step, the stage-1 kernel 0.341 vs 0.454
ms/step (the latter with the per-XCC queues).

Cherry-picked from #8997 onto the main-based IOD branch: only the CSV rows
apply. main already embeds each row's B TDM hint and A-scale prologue in the
stage-1 kernel and keys every step bound's precompile by them
(_compact_gemm_tiles, g1_tdm_b_th / g1_tdm_as_in_prologue).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lock

- kernels/iod/probe.py: the phase probe (was kernels/iod_loc_probe.py).
- kernels/iod/device.py: the device helpers the GEMMs reading placed weights
  share: launch_rotation, loc_sel, and unit_offsets, the phase-table decode
  the TDM GEMM inlined as loc_atom.
- The 256 n x 128 k placement block is a "unit" (UNIT_N / UNIT_K, SC_UNIT,
  unit_offsets); FlyDSL's TDM / MMA atoms keep their name.
- op_tests/flydsl_tests/test_iod_atom_layout.py -> test_iod_layout.py.

No behavior change.
GEMM2 with the EP scatter dropped the IOD domain schedule whenever
combine_quant_bits was set (the TDM GEMM asserted a persistent grid needs an
unquantized wire), so on an MXFP4 / MXFP8 combine wire, which the DSV4
recipes use for prefill (ATOM_MEGA_COMBINE_WIRE=fp4), placed W2 ran the stock
grid. A quantized scatter waits for its gather-stores before the persistent
loop's barrier, so the next task's prologue cannot overwrite the staged rows;
only bf16's deferred wait needs the arena tail, and it stays bf16-only.

The tuned persistent GEMM2 grids of the CSV still apply to a bf16 scatter
only.

gfx1250 EP4, 8 layers, MEGA-CHECK passes on the IOD schedule: DSv4.1 Flash
tpr 2048 / 8192 with mxfp4 and mxfp8 combine, DeepSeek-R1 tpr 2048 / 8192
with mxfp4.
…venly between IOD domains

N=7168 is 28 tiles in 7 groups of 4; a cluster of 4 leaves one cluster
straddling both domains. Mega bench DSR1 tpr 16384 (2 rounds): GEMM2
1036 -> 1024 us, per layer 2858 -> 2830 us.
The kernel imports kernels/iod/device.py and builds its schedule with
iod_locality.py; undeclared, every entry failed to build and launched on
the JIT path.
…e is fine on placed weights

The IOD schedule sets its own grid there, so only an unplaced weight
keeps the stock grid on a quantized wire.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants