Skip to content

[FlyDSL] Add gfx1250 grouped MoE A-preshuffle and tuned CSV validation - #6709

Merged
coderfeli merged 26 commits into
mainfrom
dev/yadai_improve_test
Oct 27, 2026
Merged

coderfeli merged 26 commits into
mainfrom
dev/yadai_improve_test

Conversation

@yadaish

@yadaish yadaish commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Add a CSV-selectable A-preshuffled activation layout to gfx1250 A4W4 grouped MoE and make the existing TP/EP test entry points validate every applicable tuned configuration. CSV sweeps now use each selected file for runtime configuration lookup, including when switching between model-specific files.

Technical Details

  • Thread a_preshuffle from the matched tuning row through activation preparation and both grouped GEMMs. Add compact MXFP4 quantization followed by routed scatter into M16 payload tiles and M16K4 scales; prequantized inputs can enter scatter directly.
  • Update TDM/LDS addressing and fused GEMM1 quantized output for the packed layout. Validate layout constraints and include the layout in kernel specialization/cache identities.
  • Align AOT generation with runtime launch signatures, stage-specific tile settings, A-preshuffle variants, and compact/aligned scale strides. Keep EP's topk=-1 tuning sentinel out of compile-time route-count arithmetic.
  • Add format-specific scheduling defaults for 256x256x256 prefill tiles, enable MoE expert scheduling by default, refresh main/Qwen tuning, and add Kimi gfx1250 tuning.
  • Extend the existing CSV runners: TP defaults to main + Qwen, EP defaults to main + Kimi, and --csv-path selects one file. Clear configuration lookup caches between files, support SiLU/Swiglu/Situv2, fix shared-expert reference mapping, and aggregate failures across selected files. Default sweeps exclude untuned configurations; TP skips EP rows.

Test Plan

Validated on gfx1250 using the existing test entry points without --csv-path:

  • TP: op_tests/flydsl_tests/test_flydsl_grouped_gemm.py --scenario csv --no-bias --iters 16 --no-check-aot-cache, with grouped GEMM enabled, CK disabled, and balanced routing. Run constant/constant and uniform/auto data/scale initialization with CUDA graphs and JIT allowed.
  • EP: op_tests/test_moe_ep.py -t ep_csv --ep-mode real, with four simulated ranks, top-k 8, and balanced routing. Validate local outputs only; distributed EP scatter-combine is outside this validation.
  • Ruff 0.16.0: ruff check .; whitespace: git diff --check.

Test Result

Mode Tuned CSV Correctness checks passed
TP Main 190/190
TP Qwen3.5-397B 72/72
EP Main 42/42
EP Kimi K3 gfx1250 27/27

All 200 applicable CSV rows passed, totaling 331 correctness checks. Both CSV processes exited successfully. The two ep_fused=1 rows were tested as local EP shapes; their fused scatter behavior was not validated. Ruff and whitespace checks passed.

Performance comparison remains pending: existing priority-script measurements had concurrent GPU activity or substantial timing variation and do not support a stable speedup/regression claim.

Submission Checklist

@yadaish
yadaish requested a review from a team October 20, 2026 09:04
@github-actions github-actions Bot changed the title Dev/yadai improve test [FlyDSL] Dev/yadai improve test Oct 20, 2026
@github-actions

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 6709 --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.

Comment thread aiter/ops/flydsl/moe_kernels.py Resolved
@amd-ruitang3 amd-ruitang3 changed the title [FlyDSL] Dev/yadai improve test [FlyDSL] Add gfx1250 grouped MoE A-preshuffle and tuned CSV validation Oct 26, 2026
Resolve grouped MoE AOT and CSV conflicts while preserving the test removals in f073496. Retain main's quant-layout checks alongside branch A-preshuffle coverage and dual-CSV sweep behavior.

@coderfeli coderfeli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coderfeli
coderfeli merged commit ec1557e into main Oct 27, 2026
63 checks passed
@coderfeli
coderfeli deleted the dev/yadai_improve_test branch October 27, 2026 15:02
amd-bartgips added a commit that referenced this pull request Oct 28, 2026
#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.

Co-authored-by: Cursor <[email protected]>
amd-bartgips added a commit that referenced this pull request Oct 28, 2026
#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.

Co-authored-by: Cursor <[email protected]>
amd-bartgips added a commit that referenced this pull request Oct 28, 2026
#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.
amd-bartgips added a commit that referenced this pull request Nov 3, 2026
#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.
amd-bartgips added a commit that referenced this pull request Nov 4, 2026
#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.
jhinpan added a commit that referenced this pull request Nov 14, 2026
tuned_grouped_fmoe.csv: keep main's rows for the 11 7168x3072 E96 keys that
#6709 re-tuned, and apply this branch's values only to the 6 7168x768 E384
keys that main left unchanged (a_preshuffle stays 0).
yzhou103 added a commit that referenced this pull request Nov 19, 2026
…to-select in --compare (#5846)

* mp_tuner: report a typed status per candidate; a fault fails only that candidate

With return_status=True, mp_tuner returns (info, us, err_ratio, status,
detail), where status is ok, mismatch, unsupported, crash, timeout,
zero_time (still 0 us after the retries), oom_runtime, oom_preflight or
not_run.

When a worker dies, times out or its group raises, the candidate it was
running fails, what its group measured before it is kept, and the rest of the group is
resubmitted to the restarted pool, for typed and untyped callers alike. A
group that faults 5 times in a row without measuring anything returns its
remaining candidates as not_run. A fault is an AcceleratorError or an
error after which torch.cuda.synchronize() fails; the worker raises
GpuContextLost so the parent restarts the pool.

* run_config verifies the dispatch of the row it times; --compare can time auto-select

Tuned rows may carry gpu_model (chip_info.get_gpu_model, overridable with
AITER_GPU_MODEL): gfx and cu_num cannot tell MI300X from MI325X, or
MI350X from MI355X. The model comes from the HIP device name or, for the
gfx950 parts an older libdrm does not name, from the PCI device ID as
upstream libdrm's amdgpu.ids lists it. Rows without it match as before.
comm_fused_moe_host reuses chip_info's model lookup, so the PCI table
exists once.

dispatch_verification runs a row through the public op in a fresh
process, with the family's config variable pointing at the candidate CSV,
and checks the selection dispatch recorded against the one the row names.
A family opts in with SELECTION_PROBE_MODULE; run_config then verifies
each shape's row from the active config file and reports a stale or
failed row as an error. Verification and the auto-select run see the
model_configs/ merge serving sees. With COMPARE_AUTOSELECT, --compare
also times auto-select (a header-only table), and --update_improved drops
a row auto-select beats and writes no row for a candidate that does not
beat it. stale_reason lets a family mark a row its dispatch would skip,
so a plain run retunes it.

* GroupedFmoeTuner: a blank a_preshuffle cell reads as 0

#6709 added an a_preshuffle column to tuned_grouped_fmoe.csv without a
blank-cell value, so retuning a row of the production table raises, and
two test_tuner_infra tests fail on main. grouped_moe_gfx1250 reads a
blank a_preshuffle as 0.

* mp_tuner: a shape without candidates no longer fails a shape-grouped batch

A tuner adds an in_datas entry for every shape, with a count of 0 when no
candidate supports the shape (gemm_a16w16 under --libtype flydsl for a
preshuffled shape, opus_gemm for a non-bf16 one). Such a shape has no task
group, so the shape-grouped path's group-count assert failed and the whole
batch was lost, under --shape_grouped and in every --mp 1 run. Zero-count
entries are now dropped before groups are matched to in_datas, so the
shape is left untuned and reported as such, as the per-candidate path
already does.

* mp_tuner: a typed result carries watts, so a power tune ranks return_status callers

return_status=True result was a plain 5-tuple, so under --select power its
watts read as NaN and the tune wrote no rows for that caller.
TuneStatusResult still unpacks as (info, us, err_ratio, status, detail).

* mp_tuner: a stale PID map waits for the restart its root cause triggers, as on main

A group that hits a worker missing from the PID-to-GPU map stays queued and
is resubmitted in the restart the dead worker's own fault triggers. Restarting
on the KeyError itself could restart before that fault was polled, so the
candidate that killed the worker ran again instead of failing.

* run_config: verify a user's --run_config table as given

Only a table the tuner wrote and times itself (--compare) stands in for the
default table and is verified with the model_configs CSVs serving merges.
A --run_config file is timed as given, so its dispatch check now reads it
the same way.

* base_tuner: no gpu_model key in the shared tuner

No table the shared tuner handles carries gpu_model, and neither serving
lookup nor the duplicate-shape keys read it, so a row filtered or checked by
model here could not be told apart at runtime. A family that keys its table
on the model end to end adds the check itself, and brings the model
detection with it.

* mp_tuner: return_status returns statuses alongside plain results

A return_status result was a 5-tuple, so a family whose own overrides unpack
(info, us, err_ratio) would fail the moment it opted in. Results are the
3-value TuneResult again for every caller; with return_status=True,
mp_tuner returns (results, statuses), one (status, detail) per result in the
same order. Workers carry one private record with all fields, so the status
cannot be lost between the worker and the parent.

---------

Co-authored-by: yzhou103 <[email protected]>
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.

3 participants