Skip to content

[OPUS] [FlyDSL] [AOT] Cover the full gfx1250 kernel family for gfx1250-strict wheels - #7434

Merged
zufayu merged 9 commits into
mainfrom
fix-strict-aot-opgate-family
Nov 5, 2026
Merged

zufayu merged 9 commits into
mainfrom
fix-strict-aot-opgate-family

Conversation

@zufayu

@zufayu zufayu commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Problem

GPU_ARCHS=gfx1250-strict still produced a largely-empty FlyDSL AOT wheel after #7379. #7379 fixed job selection (strict was matching 0 tuned jobs), but each enqueued job was then rejected a second time inside the op layer, where 8 sites compared the exact arch to the literal "gfx1250".

On A0 (ASIC rev 0, flydsl 0.4.2.dev1008) the strict AOT build produced only 140 artifacts vs 1002 for plain gfx1250 (~7%), with 5 hard [FAIL]s (gemm rc=1); the rest fell through to gluon/Triton (KeyError NUM_BUFFERS ×946, GROUP_K ×560, missing configs/gfx1250-strict/gluon ×434, "no grouped CSV config matched" ×2276).

Root cause was pinned empirically by an A0 build/coverage diff (strict artifacts ⊖ plain artifacts), not by guessing — exactly 8 sites are traversed by the AOT build.

Fix

Map strict to the gfx1250 kernel family at those 8 AOT-traversed sites, in two patterns:

  • 3 dispatch gates (capability / codegen choice) → is_gfx1250_family(): gemm_op_a8w8 mxfp8_128 gate and blockscale_abpreshuffle guard (the rc=1 raise), and flydsl moe_kernels LDS selection.
  • 5 tuned-config lookups → exact identity first, gfx1250-family fallback only when strict has no tuned row of its own: tuned_gemm (a16w16), gemm_op_a4w4 (a4w4 mxscale), grouped_moe CSV, plus the a8w8 mxscale and shared CK config helpers reached once the gates open.

A0 bring-up reuses the gfx1250 tuned data (A0 and B0 share the gfx1250 ISA; performance parity is a later follow-up). An exact strict tuned row still wins when one exists, and the fallback guard (base_gfx_arch(gfx) != gfx) keeps the table scan off the normal non-strict runtime path. Build targets, cache keys, and prebuilt .co paths stay keyed by the exact identity, per #6767's two-layer model — so this does not weaken per-identity tuning.

Not in scope (deliberate)

  • assert_targets_covered per-op count hardening: the partial wheel was a symptom of the op-layer rejection above (a build-time drop), not a weakness of the enumeration-time guard, which already fail-louds the 0-job case. Left as optional hardening.
  • Runtime cache-hit on real strict hardware: needs the strict nightly (ROCr reporting gfx1250-strict) + enumerator #14668; not an aiter code change.

Validation

Draft until A0 acceptance passes: rc=0, 0 [FAIL], coverage ≈ plain gfx1250, all products still chip=gfx1250-strict / mach 0xeb, and the plain gfx1250 build unchanged.

🤖 Generated with Claude Code

…dispatch/tuned-lookup sites

Follow-up to #7379. With GPU_ARCHS=gfx1250-strict, #7379 fixed job *selection*
(strict was selecting 0 jobs), but the enqueued jobs were then rejected a
second time inside the op layer, where 8 sites compared the exact arch to the
literal "gfx1250". That capped the strict AOT wheel at ~7% coverage (140 vs
1002 artifacts) with 5 hard [FAIL]s. This maps strict to the gfx1250 family at
exactly those AOT-traversed sites:

- 3 dispatch gates (capability / codegen choice) -> is_gfx1250_family():
  gemm_op_a8w8 mxfp8_128 gate and blockscale_abpreshuffle guard (the rc=1
  raise), and flydsl moe_kernels LDS selection.
- 5 tuned-config lookups -> exact identity first, gfx1250-family fallback when
  strict has no tuned row of its own: tuned_gemm (a16w16), gemm_op_a4w4
  (a4w4 mxscale), grouped_moe CSV, plus the a8w8 mxscale and shared CK config
  helpers reached once the gates above open.

A0 bring-up reuses the gfx1250 tuned data (A0 and B0 share the gfx1250 ISA;
performance parity is a later follow-up). An exact strict tuned row still wins
when one exists, and the fallback guard (base_gfx_arch(gfx) != gfx) keeps the
table scan off the normal non-strict runtime path. Build targets, cache keys,
and prebuilt .co paths stay keyed by the exact identity, per #6767's two-layer
model.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 7434 --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.

@aiter-bot

aiter-bot commented Nov 4, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision c596ffffdc4b · mode shadow

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

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

A0 acceptance of the first commit surfaced a deeper layer: opening the
first-layer gates let 816 previously-silently-dropped jobs reach a *second*
set of exact-"gfx1250" checks -- all GATE, zero genuine kernel failures. Deduped
to 2 hard points + the silent coverage gaps:

- [A] gemm_op_a8w8 gemm_a8w8_mxfp8_128_bpreshuffle_flydsl guard (812 of 816
  FAILs) + the bpreshuffle WMMA dispatch gate (189) and untuned fallback (917).
- [B] opus get_kernel_instance now folds arch to the gfx1250 family (get_registry
  already did; this was the missed sibling -> "unknown OPUS kid" on strict).
- [D] flydsl batched_gemm_a8w8 _RUNNERS lookup.
- [C]/[E] a8w8 int8 and mxfp8_32 tuned-config lookups -> exact-then-family
  fallback; plus the mxfp8_bpreshuffle_tuned predicate and the
  a_scale_preshuffled gate, mapped proactively to avoid a third round.

Same two patterns as the first commit (dispatch gate -> is_gfx1250_family;
tuned lookup -> exact identity first, gfx1250 fallback). Pending A0 re-acceptance.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@zufayu
zufayu marked this pull request as ready for review November 4, 2026 13:27
@zufayu
zufayu requested a review from a team November 4, 2026 13:27
@zufayu

zufayu commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@coderfeli ready for review — follow-up to #7379.

What: GPU_ARCHS=gfx1250-strict now builds the full gfx1250 kernel family, not just a few artifacts. #7379 fixed job selection (strict was matching 0 jobs); this fixes the layers below it. The op layer had ~18 sites comparing the exact arch to the literal "gfx1250", which re-rejected strict a second time inside each enqueued job — capping the strict wheel at 7% → 53% coverage with silent/hard failures.

How (two patterns, per #6767's two-layer model):

  • Capability/codegen dispatch gates → is_gfx1250_family(...).
  • Tuned-config lookups → exact identity first, gfx1250-family fallback only when strict has no tuned row of its own (A0 and B0 share the gfx1250 ISA; perf parity is a later follow-up). Build targets, cache keys and prebuilt .co paths stay keyed by the exact identity.
  • Also fixes the opus get_kernel_instance arch fold that get_registry already had.

A0 validation (real MI450 A0, ASIC rev 0, flydsl 0.4.2.dev1008):

  • gemm rc 1→0, [FAIL] 816→0
  • coverage 140 → 977/1002 (97.5%), gemm 622/647 (96.1%)
  • all 977 strict artifacts are chip=gfx1250-strict / mach 0xeb, 0 0x49 leak
  • plain gfx1250 build unchanged (1002 / 0x49) — non-strict untouched
  • old-ROCm sanity bit-identical to flydsl 0.4.1

Known follow-up (not in this PR): assert_targets_covered is family-level and won't catch a single-op silent drop; a per-op post-build coverage net is tracked as a separate hardening PR. Not a functional blocker — A0 runs via runtime JIT regardless.

@zufayu
zufayu requested a review from coderfeli November 4, 2026 13:28
@github-actions github-actions Bot changed the title [FlyDSL][AOT] Cover the full gfx1250 kernel family for gfx1250-strict wheels [OPUS] [FlyDSL] [AOT] Cover the full gfx1250 kernel family for gfx1250-strict wheels Nov 4, 2026
An A0 per-row kernel-identity diff against the gfx1250 baseline found one
remaining silent single-op drop: lookup_mxscale_bmm_config (opus/policy.py)
keyed the mxscale BMM tuned table by the exact gfx, so a strict build missed
all 50 BMM rows and 43 of them silently compiled a different heuristic kernel
than gfx1250 (tile_k 512/nb2 instead of the tuned 256/nb4), with no log.

Same exact-identity-first, gfx1250-family fallback as the other tuned lookups.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@zufayu

zufayu commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Re-validated on real A0 after the final commit (3b1a283bd, which adds the BMM tuned-key fix in opus/policy.py):

  • coverage 984/1002 (98.2%), gemm 629/647 (97.2%) — the BMM rows that previously fell back to a heuristic now compile the same tuned kernel as gfx1250
  • gemm rc 0, [FAIL] 0
  • all strict artifacts gfx1250-strict / mach 0xeb, 0 0x49 leak; plain gfx1250 build unchanged (1002 / 0x49)
  • old-ROCm sanity unchanged

A per-row kernel-identity diff against the gfx1250 baseline confirms no remaining silent drop. The one thing deliberately not in this PR is a coverage regression net (the family-level assert_targets_covered won't catch a future single-op silent drop) — that's a standalone follow-up tool, not a blocker here. Ready for review.

zufayu and others added 6 commits November 5, 2026 01:55
The get_kernel_instance fold this PR added was unconditional, which let a non-CO
kid resolve under a strict *runtime* identity instead of being rejected --
breaking op_tests/test_gfx1250_strict_alias::test_non_co_kid_keeps_real_id
(the expected ValueError was no longer raised).

Only an AOT replay (AITER_AOT_REPLAY=1) compiles the whole gfx1250 kernel family
for the strict target and needs the fold; the product is still emitted for the
exact strict arch (0xeb). At runtime the exact identity is kept, so a non-CO kid
under strict is rejected as before, and CO kids keep resolving via
get_registry's existing fold. Verified locally: the test passes again.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…w kernels

gfx1250-strict deliberately disables wmma-f4-insts and wmma-16x16x128fp8-insts
for A0 silicon errata, so a strict build of the ops that need them (a8w8 ptpc,
a4w4 / a4w4_mx32_compute, MoE mxfp4) silently compiled HOLLOW, compute-less
kernels (rc 0). Earlier family-mapping routed these to the gfx1250 fast-WMMA
kernels, which is wrong for strict.

- Gate the errata ops off the strict AOT build: skip the a8w8_bpreshuffle and
  a4w4_mxscale_bpreshuffle tables (STRICT_ERRATA_TABLES) and MoE mxfp4 rows
  (_is_mxfp4_kname) when the target is a gfx1250-strict identity. A0 falls back
  to runtime JIT for these. The good ops (mx128/mx32/BMM/a16w16/fp8-TDM, which
  use retained instructions) are unaffected.
- Defense in depth: fail_build_on_missing_target_feature wraps run_aot and fails
  the build (fd-level capture of the LLVM 'requires target feature' diagnostic)
  if any hollow kernel is still produced, so a missed errata op can never
  silently ship a hollow wheel.

The feature-disable is correct; the compiler-side ask (hard-fail / safe
lowering) is tracked separately. Pending A0 validation.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… worker too

A0 STEP-0 validation found the MoE errata gate was a no-op: _is_mxfp4_kname
matches "flydsl_mxmoe_g", but the gfx1250 grouped rows name their kernel
grouped_gemm1_fp4_gugu (also shared by the fine fp8-activation a8w4 rows), so no
row was gated. Key on q_dtype_a == float4 instead, which cleanly separates the
hollow fp4 rows from the fp8-activation ones. Also add the gate to the `--arch`
worker, which re-reads the CSV and filters independently of run().

GEMM gate confirmed correct by STEP 0 (a8w8_bpreshuffle ptpc + a4w4_mxscale
tables, all hollow; every other table clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…reentrant

The hollow-kernel build guard only wrapped run_aot (the setup.py wheel path), so
a direct `python -m aiter.aot.flydsl.<driver>` build was unguarded. Wrap the
driver orchestrator entry points (replay.main, moe.main) as well.

To avoid double-capturing fd 2 when guards nest -- run_aot's guard around a
driver whose main also guards, or an orchestrator around its per-arch worker
subprocesses -- the guard now sets AITER_AOT_FEATURE_GUARD=1 (inherited by
children); a nested or child guard sees it and no-ops, so only the outermost
capture is active.

(The remaining cache-hit gap -- a stale pre-gate hollow object that is not
recompiled, so prints no diagnostic -- is addressed by building strict wheels
from a clean cache; the complete errata gate means a fresh build never produces
one.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A0 showed the compile-time guard misses a hollow kernel already in the FlyDSL
cache: a cache hit recompiles nothing and prints no 'requires target feature'
diagnostic, and setup.py's cache persists across builds, so a stale hollow object
would ship silently. Add a cheap post-build name audit: after a strict run_aot,
fail if the cache still holds any gemm_a4w4* / gemm_a8w8_ptpc* / mxfp4_tdm_fp4*
object -- the errata families strict gates off. It inspects the cache, not the
compiler output, so it is immune to cache hits.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A0 found the glob-by-filename audit could not work: cache paths are
<launcher>_<manager_key>/<hash>.pkl, so the kernel name is not in the path --
ptpc shares launch_gemm_a8w8 with mx128 and fp4 MoE shares launch_gemm_a8w4_tdm
with fp8, so the ptpc/mxfp4 globs never matched, gemm_a4w4 matched only a
directory name, and a mixed gfx1250+strict build false-positived on legitimate
gfx1250 a4w4 objects.

Read each cached object's IR instead: flag an errata-family kernel (gemm_a4w4 /
gemm_a8w8_ptpc / mxfp4_tdm_fp4) only in objects whose ROCDL target chip is a
strict identity. A0-validated on the same cache set: dirty caches report
134 / 282 / 101 offenders; clean, plain, and mixed-target all pass. ~1000 pkl,
a few seconds.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@zufayu
zufayu merged commit 0d5b4af into main Nov 5, 2026
@zufayu
zufayu deleted the fix-strict-aot-opgate-family branch November 5, 2026 08:51
zhiding512 added a commit that referenced this pull request Nov 9, 2026
Main's gfx1250-strict wheel builds (#7379, #7434) and MegaMoEV2 (#6881)
edited the code this branch rewrites; both sides are kept:

- moe.py: an arch's replay keeps the jobs of that arch's family, retargets
  them to it and leaves out the MXFP4 ones on gfx1250-strict; deployment
  jobs now pass through that filter as rows do. run_aot and moe.py's main
  run inside fail_build_on_missing_target_feature(), and run_aot still ends
  with the strict errata check.
- mega_moe.py: the MTPR 8192 instances build the opt-in small- and
  large-input paths, and --check compiles nothing. FUSED_PATHS_MTPR and
  FUSED_PATHS_ENV stay module constants: they say how the replay builds an
  instance, not what a deployment is.
- README: main's gdn_fused_prefill entries next to the deployment ones.

#6464 moved DeepSeek-V4-Pro's TP8 rows at M 32 and 2048 to MXMOE stage 1,
which compiles the clamp in, so the clamp the TP8 deployment passes now
picks kernels the deployment builds.

The merge changes no job list: the 1195 deployment jobs are 88ab025's, the
14374 tuned-row jobs main's (apart from the empty expert_mask_size this
branch adds) and the 192 MegaMoE jobs main's.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants