Repository navigation
Conversation
…ile, opt-in tuning knobs On top of the stage-1 fusion (ROCm#6564): - Fix: swap the stage-1 hook into dispatch_context as well as scatter. The grouped GEMM reads it off dispatch_context, so replacing scatter alone left the probe / fused stage-1 path unreachable on the compact path. - Precompile every stage-1 compact-plan variant at setup (compile only, AITER_S1F_PRECOMPILE=0 skips). Eager widths otherwise JIT-compiled inside the serving loop: 250-470 ms prefill steps for the first ~100 s of a run. - AITER_S1F_MAX_RECV=N: steps whose receive bound exceeds N run the whole S1F=0 path (plan, GEMM1, no probe), e.g. fuse decode only. - AITER_S1F_ANY_TILE=1: fuse when the tuned GEMM1's tile_m matches; the stage-1 kernel runs its own 256x256 n/k tiles. - AITER_S1F_PRODUCERS / AITER_S1F_BLOCK_RUNS: per tokens-per-rank bucket overrides of the stage-1 tables. - AITER_TDM_COMPACT_ROUTE_UPTO / _ROUTE_SPEC / _ROUTE_PARALLEL: keep the route-parallel compact walk up to N tokens per rank. All knobs default to the current behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #6564 (base branch
ghu_mega_1250), so the diff here is only this change. It fixes the stage-1 hook wiring and the in-loop JIT, and adds opt-in tuning knobs for the gfx1250 MegaMoE stage-1 fusion (S1F). Every knob defaults to the current behaviour.Motivation
We ran #6564 on DSV4.1-Flash DEP4 (MI455X, MLPerf Endpoints agentic c512) and hit three problems:
dispatch_context, but onlytarget.scatterwas replaced.Changes
mega_moe.py: swap the hook intodispatch_contextas well when it is the same object asscatter.stages/dispatch_compact.py:_precompile_s1f_plans(): compile every plan variant a fused step can need at setup, compile only (48 variants, ~30 s on DEP4).AITER_S1F_PRECOMPILE=0skips it.AITER_TDM_COMPACT_ROUTE_UPTO/_ROUTE_SPEC/_ROUTE_PARALLEL: keep the route-parallel compact walk up to N tokens per rank.s1f_ctl.py:AITER_S1F_MAX_RECV=N: a step whose receive bound exceeds N runs the whole S1F=0 path (plan key and width, GEMM1, no probe).AITER_S1F_ANY_TILE=1: only tile_m has to match; the stage-1 kernel runs its own 256×256 n/k tiles.s1f_stage1.py:AITER_S1F_PRODUCERS/AITER_S1F_BLOCK_RUNSoverride the per-bucket tables. Format is "N" for all four buckets, or "a,b,c,d".Performance (if applicable)
S1F config:
AITER_MEGA_S1F=1 AITER_S1F_BLOCK_RUNS=4,2,8,8 AITER_S1F_MAX_RECV=4096 AITER_S1F_ANY_TILE=1 AITER_TDM_COMPACT_ROUTE_UPTO=1024 AITER_TDM_COMPACT_ROUTE_SPEC=384,16. The baseline already used the route-parallel walk. With precompile, no compile happened after load started (checked with a JIT log), and the first prefill steps took 103–117 ms.Testing
Documentation
Dependencies
Breaking Changes
None. All new knobs default to the current behaviour. Precompile runs only when S1F is enabled.
PR Self-Review
Reviewed revision
8e4c846
Behavior and intent
See Motivation. With the variables unset, only the hook fix and the setup-time precompile change behaviour, and only when
AITER_MEGA_S1F=1.Validation and unverified scope
gfx1250-atom-20261102-dsv41), on an earlier [HIP] [FlyDSL] perf(mega_moe): fuse the gfx1250 compact dispatch and GEMM1 into one stage-1 kernel #6564 head with this change applied.PR-specific question
Should the tuned values (
BLOCK_RUNS=4,2,8,8,MAX_RECV=4096,ANY_TILE) become defaults? We have only measured them on DSV4.1-Flash DEP4, so they stay opt-in for now.Changed op tests
None
🤖 Generated with Claude Code