Repository navigation
Conversation
…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.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
…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.
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.
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.
…h context The hook went onto a copy of target.scatter, but the grouped GEMM reads it off target.dispatch_context, which still held the original scatter. The probe never ran, every step stayed "probing" (a reason the fallback warning filters out), and AITER_MEGA_S1F=1 silently kept dispatch + GEMM1.
* [Perf] Per-XCC GEMM1 queues in the S1F stage-1 kernel for decode tiles 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. * [Perf] IOD-local W1 placement for the gfx1250 grouped GEMM1 (AITER_MOE_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. * [Perf] IOD-local W1 in the S1F stage-1 kernel; default AITER_MOE_LOC 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.
…it a stale placement
- moe_shuffle_weight_iod(w13, w13_scale, experts_cnt) in aiter.ops.shuffle: with AITER_MOE_LOC=1 on gfx1250, probes the IOD home of fresh pages and builds the placed W1 copy once at weight-load time; no-op otherwise. - GEMM1 (grouped_gemm_mxfp4, S1F) only looks the copy up by the weight addresses; no allocation, probing or placement in forward. - Phase probe is a FlyDSL kernel (iod_loc_probe.py); the hipcc-built iod_loc_probe.cpp is removed. - test_flydsl_grouped_gemm and bench_mega_moe call the interface after shuffling W1.
…use placement when the mapping does not hold - probe_phase launches 8 probers (one per workgroup class) that all run and walk every page, timing one cold load in each of its first 16 granules; the faster in-page parity gives domain ^ phase with no absolute latency threshold. One launch per pass: 23 ms for 581 pages instead of 256 launches per pass. - The old probe let only one CTA of a 256-CTA grid run; with another process resident on the GPU two of the eight classes landed on the other domain (97% of their loads mislabelled, weak pages 456 of 581). - Every class must agree with ((b + 3) & 7) >= 4 on >= 90% of pages, else probe_phase returns no phase and place_w13 leaves W1 unplaced (LOC off for that weight). With a 380 GB co-resident allocation local and remote loads time the same and the probe now refuses instead of placing on a guess. - Idle GPUs: weak pages 0, repeat agreement 100%, same phase as the old probe; GEMM1 12288 rows x tile_m 64 stock 141-145 us vs LOC=1 125-129 us, bitwise equal.
… GEMM assumes - Where workgroup 0 of a launch starts is dispatcher state: an 8-prober launch sees domain(b) = ((b + c) & 7) >= 4 with c following the hardware pipe it lands on (HW_ID2 PIPE_ID 1/2/3 -> c = 3/2/1, pipe 0 -> 0 or 4). ATOM's DEP4 weight load landed on pipe 0, so every rank measured c = 0, classes 0 and 4 disagreed on every page (agreement [0, 1, 1, 1, 0, 1, 1, 1]) and all 43 W1 layers stayed unplaced. - probe_phase reads each launch's rotation from the eight classes relative to class 0 (the page phase cancels), keeps only c = 3 launches, and relaunches the others on a new stream, at most 16 launches so every one still reads a cold line. Fewer than npass kept passes refuses placement as before. c = 7, the complement of 3, was never observed (47 launches). - Returns the rotation of every launch; place_w13 logs it. - Co-resident spin kernels on 0-16 other streams, 28 probes of one buffer: 27 equal the idle phase, 1 refused (3 of 16 launches on c = 3), none wrong. - bench_mega_moe (4 ranks, 8 layers, AITER_MOE_LOC=1): all W1 placed, weak 0, agreement 1.000; one rank's first two launches came at c = 2 and 0 and were relaunched.
…256x256 GEMM2 tiles, and read the launch rotation from HW_ID2 The placed layout interleaves k-tile pairs so a kernel tile of (LN/2, 2*LK) loads one 3D TDM tensor per wave per k-tile (b_placed=2). W2 is placed at (512,128) and GEMM2 keeps its CSV tile; W13 stays at (256,256). The probe, the TDM GEMM and the S1F stage-1 queues take the IOD rotation c from HW_ID2 instead of assuming c=3.
Placed W1 forced the per-XCC queues, whose load imbalance at tile_m >= 128 cost as much as the local reads saved. Without xcc_queues, a placed launch now keeps the global m-major order in one queue per domain over its n-tile parity, stealing from the other domain's queue once its own runs out.
…ffer_ops Write results through ptr_buf_tensor/buf_copy_store with an fx.Pointer output, drop arith.unwrap/trunci for ir_value()/to(), and unroll the per-page granule loop. The inline-asm timed load and s_getreg stay raw (no stable FlyDSL API) with comments saying so. Probe phases and the GEMM ISA are unchanged.
… blur the parities Lines the previous kernels left dirty in the memory-side cache (the shuffle that wrote the weight, the scatter that placed the previous one) make the probe's timed loads noisy until they are written back. The 470-940 MB weights mostly survive it, but the 28-58 MB scales failed on most pages, so W13/W2 stayed unplaced on most ranks (0-10 of 16 placements per bench run) and AITER_MOE_LOC=1 ran unplaced. Writing more does not drain the lines, reading 256 MiB does; read 512 MiB first. Placement now succeeds on every rank.
Kineto's roctracer backend segfaults in RoctracerActivityApi::processActivities when the trace stops while its buffer thread still delivers records, which killed the --profile_table pass in 3 of 4 runs. Wait BENCH_MEGA_MOE_PROF_FLUSH_S (1 s) after the replays before leaving the profiler.
…host mask table A workgroup cluster runs on one IOD domain, ((cluster_id + c) & 7) >= 4, so the persistent placed schedule now hands each cluster runs of loc_group * b_placed local n-tiles, n fastest: B multicast and IOD-local reads apply together and GEMM2 keeps its 4x4 cluster. - iod_locality: n-tiles are placed in domain groups (W13 256x256 and W2 512x128, two layout n-tiles each); an odd last group splits across the domains. The kernels take a per-unit table of two 64-bit granule masks (B and scale) instead of reading the page phases. - b_placed 2 (256x256 tiles on the 512x128 W2 layout): the B and B-scale LDS stages hold one block per layout k-tile, so every placed granule and scale half is one contiguous TDM copy. - S1F stage 1 follows the domain groups, including the odd last group.
…XCC queues, no CSV TDM knobs At tile_m 32 the stage-1 kernel ran 5-9% slower than main's on three choices that only the decoding branch makes, each measured on EP4 DSV4.1 Flash / DeepSeek-R1: - Per-IOD-domain GEMM1 queues on the placed W1 (tuned at tile_m >= 128) cost ~7% at tile_m 32. loc_queues (AITER_MEGA_S1F_LOC_QUEUE, auto) now keeps the global order below tile_m 128, still reading the placed W1 (kernel tag _locg); forced per-XCC queues stay domain-aware. - Per-XCC queues (AITER_MEGA_S1F_XCC_QUEUE auto up to tile_m 96) cost 5-9 us at tile_m 32-96; auto now leaves them off, 1 still forces them. - The tile_m 32 CSV row's B TDM hint and A-scale prologue tune the unfused GEMM1 and cost the stage-1 kernel ~1.5 us; it keeps both off. Kernel sum per layer, LOC=1 vs main: DSV4.1 Flash 192/768/1536/4096 tpr -3.7/-6.0/-3.1/-5.9%, DeepSeek-R1 -2.7/-3.8/-4.7/-6.7%; LOC=0 matches main on the stage-1 kernel. Accuracy (MEGA-CHECK) passes at 192 and 4096 tpr.
… for top-9 The DSR1 rows that carry the 256-tile configs were marked ep_fused=0, so the MegaMoE (ep_fused=1) lookup missed them past token 4096 and fell back to the 64-tile default. Take the ep_fused=1 rows for experts=65 from #8002. With those tiles the S1F receive cap of 4096 sends DSR1 top-9 (shared expert fused) back to dispatch + GEMM1 at 1536 tokens/rank and up. Lift it like the DSV4.1 Flash shapes: 798 vs 899 us/layer at 4096, 384 vs 422 at 1536.
…D placement stays usable Merge main, which now carries the DSR1 EP4 rows from #8002. Reduce the s1f_ctl change to the (4, 9) entry that #7332 also adds, so overlaying either branch does not drop the placed-weight launch arguments. Keep only the token-512 to 4096 rows that are faster than main's. Co-authored-by: Cursor <[email protected]>
…tter overlap Integrate PR #7332 while carrying deferred scatter state through the IOD-domain persistent schedule. Let both load waves read placed B without using the scatter waves, preserve configured workers, and retain the three-buffer overlap pipeline. Keep IOD and output-preshuffle launch specialization together. Remove benchmark environment exports and add IOD/overlap worker regression coverage. Validation: 38 CPU regressions and three successful DSR1 EP4 8192-token merged runs with IOD, A1/A2 preshuffle, and EP scatter overlap active.
…D placement stays usable Merge main, which now carries the DSR1 EP4 rows from #8002. Reduce the s1f_ctl change to the (4, 9) entry that #7332 also adds, so overlaying either branch does not drop the placed-weight launch arguments. Keep only the token-512 to 4096 rows that are faster than main's. Co-authored-by: Cursor <[email protected]>
- Under AITER_MEGA_S1F_FALLBACK=mori, steps that cannot run the stage-1 kernel go through mori dispatch instead of compact dispatch + GEMM1, and skip the compact plan (prefetch is a no-op for them). - a_preshuffled=2 packs only GEMM1's quant output, so the compact path (and the S1F stage-1 kernel) feeds GEMM2 the A-preshuffled layout its tile-256 CSV rows ask for. - CSV rows with ep_fused=2 override ep_fused=1 for the compact dispatch only; DSR1 token bucket 8192 runs tile 128 there. - Under AITER_MEGA_S1F_FALLBACK=mori, (4, 9) caps S1F at recv 16384: past it the row-major wire A costs GEMM1 more than the fusion saves. - Add a unit test for the compact ep_fused=2 lookup. DSR1 EP4 us/layer, mori -> S1F (fallback=mori): 64 204.2->183.2, 128 207.0->186.5, 256 229.4->205.3, 512 290.2->252.0, 1024 378.7->338.1, 1536 433.5->415.9, 2048 513.8->487.2, 4096 846.9->831.8, 8192 1517.4->1511.1, 16384 2879.0->2876.3.
Under AITER_MEGA_S1F_FALLBACK=mori the (4, 9) recv cap is 32768 (tpr 8192) instead of 16384, so tpr 8192 runs the stage-1 kernel. Tpr 16384 (recv 65536) still runs mori: its forced S1F run hit an intermittent memory fault on the non-blocking launch path (1 of 2 runs; HIP_LAUNCH_BLOCKING=1 passed) and was no faster than mori (2930.3 vs 2944.1 us/layer). DSR1 EP4 us/layer, mori -> S1F (fallback=mori): 8192 1515.9->1505.9.
…1 tpr Port the pinned Flash/DSR1 EP4 prefill path from #7410 onto the DSR1 S1F branch and keep the mori and small-tile paths at their previous speed. From #7410: - s1f_prefill_config(): M256/N256/K256 2x2 GEMM1 (3 buffers) and GEMM2 (4 buffers) with A preshuffle for recv >= 16384 on (5120, 2304, 96, 6, 4) and (7168, 2048, 65, 9, 4). - Stage-1 kernel: row-major MMA reuse, paired CTAs (pair_cluster_n=2), 8-slot ring, silu16, quant_payload_preshuffled APRE output for GEMM2. - GEMM2: fixed_n_ep 4096-worker EP scatter. - Combine: dense BF16 slot pitch, 128-thread reduce, route masking from the source topk IDs. On top of #7410: - AITER_FLYDSL_EXPLICIT_VGPR_PARTITION now defaults to 1 and only gates the pinned prefill specializations. M256 4-wave tiles always take the fixed VGPR partition, as on main; small tiles no longer take it (tpr 256 S1F was 241 us/layer with it, 205.5 without). - Clustered 1x4/2x2 APRE GEMMs keep main's grouped DS schedule and ksl0_fence_mma tail instead of the native schedule, and compact M variants are limited to cluster_n <= 2 (mori GEMM2 at tpr 4096: 300.7 -> 291.5 us). - The direct BF16 combine reduce picks a block that divides one token's lanes (448 threads for hidden 7168), so route IDs load at a uniform address (mori combine at tpr 4096: 57.1 -> 44.9 us). - DSR1 tile-256 grouped rows use cluster_m=1. With the clusters now formed under graph capture, 4x4 GEMM1 at tpr 16384 took 980 us vs 780 us at 1x4. - Under AITER_MEGA_S1F_FALLBACK=mori, tpr 16384 (recv 65536) runs S1F when the pinned prefill is on: 2665.9 vs 2778.7 us/layer, 3 of 3 runs passed. DSR1 EP4 unit bench, us/layer (mori -> S1F): 64 204.2->184.5, 128 207.6->186.7, 256 231.1->205.5, 512 291.6->251.6, 1024 376.2->338.1, 1536 425.7->419.6, 2048 513.8->492.2, 4096 845.3->777.5, 8192 1493.5->1384.4, 16384 2778.7->2665.9. Accuracy passes at every point and logits_diff matches the previous commit bit for bit.
- Drop the ep_fused=2 token-8192 row (GEMM2 tile 128). The compact path now shares the tile-256 ep_fused=1 row with mori; the tile-128 row cost S1F 10-20 us/layer at tpr 1536/2048 (recv bucket 8192). - iod_locality.w2_tile: DSR1 (N 7168, K 2048) places W2 for 256x256 tiles. On the 512x128 layout its tuned 256x256 GEMM2 rows read b_placed 2, 5-7% slower than unplaced at tpr 512-2048; other shapes keep 512x128. - test_grouped_ep_fused_lookup: expectations follow the current rows; a mocked test covers the ep_fused=2 override, and the DSR1-based one checks that compact and mori now share rows. DSR1 EP4 S1F (fallback=mori, pinned), us/layer, LOC0 / LOC1, before -> after: 512 259.6 / 273.3 -> 257.9 / 258.4 1024 342.7 / 367.6 -> 344.2 / 346.2 1536 426.8 / 454.1 -> 410.5 / 406.4 2048 496.4 / 522.9 -> 496.0 / 476.5 Accuracy passes at every DSR1 tpr; test_grouped_ep_fused_lookup 14 passed. Co-authored-by: Cursor <[email protected]>
At tpr 8192/16384 (pinned prefill) AITER_MOE_LOC=1 ran 2.4% / 1.3% slower than LOC=0: - GEMM2: a placed W2 forced the 1024-worker domain schedule, which drops the fixed_n_ep 4096-worker live-route grid. A GEMM2 that qualifies for fixed_n_ep now keeps it and reads the placed B there (504.2 vs 505.1 us at tpr 8192, 1044.8 both at 16384). - S1F stage 1: the paired CTAs (pair_cluster_n=2) kept one global queue, reading half the placed W1 from the other domain. With loc_queues they now claim from their domain's queue (a pair's two n-tiles share a domain group), then from the other's; bit 30 of the pair ticket marks the other queue so tickets stay monotonic. Shapes whose domain groups split (DSv4.1 Flash, NT 18) keep the global order. tpr 8192: 529.8 -> 515.9 us (LOC0 513.6); flipping the domain mapping gives 533.8. DSR1 EP4 S1F (fallback=mori, pinned), us/layer, LOC0 vs LOC1: 8192 1378.1 vs 1412.8 -> 1384.1 16384 2650.4 vs 2682.1 -> 2670.3 Other DSR1 tpr unchanged; DSv4.1 Flash 4096/8192/16384 LOC0 vs LOC1: 517.1/517.0, 867.7/866.4, 1549.4/1552.0. Accuracy passes everywhere. Co-authored-by: Cursor <[email protected]>
…-mask selects
A select on a raw ArithValue condition takes the constant type from the
other operand, so two Python ints fail to build ('int' object has no
attribute '_CAPIPtr') on some FlyDSL 0.5.3 builds. Main wraps them; #8092
had unwrapped the cluster-mask pair.
# Conflicts: # aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py
… at decode tiles (#8997) * [FlyDSL] [gfx1250] MegaMoE S1F: per-XCC GEMM1 queues on placed W1 at 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 * [FlyDSL] [gfx1250] DSV4.1 Flash EP4 decode: 11-16 grouped MoE rows at 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). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: hyi <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…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.
E2E results: DSv4.1-Flash, gfx1250,
original imagevsPR & AITER_MOE_LOC=1Setup: DeepSeek-V4.1-Flash, DEP4 (EP4 + DP attention), a4w4 MXFP4 MoE, MegaMoE with S1F on, MLPerf agentic endpoints benchmark (600 s issue window). Same build for both runs; the only difference is
AITER_MOE_LOC(IOD-local placement of the W13 and W2 weights at load time).Summary
Motivation
Changes
Performance (if applicable)
Testing
Documentation
Dependencies
Breaking Changes
PR Self-Review
Reviewed revision
Behavior and intent
Validation and unverified scope
PR-specific question
Changed op tests