Skip to content

Dev/dsv4 a4w4 tuned - #3835

Closed
Bernard-Liu wants to merge 4 commits into
mainfrom
dev/dsv4_a4w4_tuned
Closed

Bernard-Liu wants to merge 4 commits into
mainfrom
dev/dsv4_a4w4_tuned

Conversation

@Bernard-Liu

Copy link
Copy Markdown
Contributor

Motivation

add tuned config for dsv4 a4w4

@Bernard-Liu
Bernard-Liu requested review from a team and Copilot June 22, 2026 03:21
@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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 3835 --add-label <label>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds DeepSeek-V4 (DSv4) FP4 (A4W4) MoE CSV configurations under aiter/configs/model_configs/ so the runtime’s tuned_fmoe config merge can pick up DSv4-tuned kernel selections (and the associated untuned shape list) automatically.

Changes:

  • Added a DSv4 FP4 untuned MoE shape list (dsv4_fp4_untuned_fmoe.csv) for shape collection / tuning baselines.
  • Added a DSv4 FP4 tuned MoE config (dsv4_fp4_tuned_fmoe.csv) with per-shape kernel selections (including FlyDSL and CK 2-stage entries) and metadata columns (gfx, xbf16, flat, etc.).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
aiter/configs/model_configs/dsv4_fp4_untuned_fmoe.csv Adds the DSv4 FP4 MoE “untuned” shape manifest (schema matches existing untuned fmoe manifests).
aiter/configs/model_configs/dsv4_fp4_tuned_fmoe.csv Adds the DSv4 FP4 MoE tuned winners (schema compatible with runtime merge/lookup; includes gfx and FlyDSL fallback tagging).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zufayu
zufayu self-requested a review June 22, 2026 06:06
@zufayu

zufayu commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Validated on gfx950 (MI355X), DSv4-Pro, token=512, expert=385, topk=7:

Stage1 µs Stage2 µs Total
A8W4 mfma_moe1_silu_mul_afp8_wfp4_fp8_t64x256x256_pm1_fp8q_sort_async_gui_v32 333 mfma_moe2_afp8_wfp4_bf16_cshuffle_t64x256x256_vscale_fix3_fp4opt_v1_pm1_acc0 195 528 (+ moe_reduction_kernel 74µs = 602 total)
A4W4 tuned (this PR) flydsl_moe1_afp4_wfp4_bf16_t128x128x256_w3 320 flydsl_moe2_afp4_wfp4_bf16_t64x256x256_reduce_bnt2_sbm128 345 665

A4W4 stage1 is on par with A8W4 (320 vs 333µs). Stage2 is the bottleneck (345 vs 195µs, 77% slower). Note: A8W4 has a separate moe_reduction_kernel (74µs) not included in stage2; if A4W4 stage2 fuses this reduce, the effective gap narrows to ~10% (665 vs 602µs). Any plans to optimize the flydsl stage2 reduce path?


CI note: The MI35X failures (shards 2/3/5) appear to be pre-existing issues unrelated to this PR's changes (CSV files only) — test_fused_qk_norm_rope_cache_quant.py crashes with core dump and test_flydsl_qk_norm_rope_quant.py has accuracy failures on gfx950. Worth a look separately.

@zufayu

zufayu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Note: benchmarks show A4W4 is ~16–22% slower than A8W4 at token=1/2/4 (fp4 activation quantization overhead dominates at small batch sizes). This is expected behavior — users on latency-sensitive small-batch scenarios should remain on A8W4.

For large-batch / bandwidth-bound scenarios (token ≥ 256), A4W4 shows clear wins (r ≈ 0.76–0.87). Overall ~4% average improvement across all shapes.

LGTM otherwise — pure CSV additions with graceful fallback, manually validated on gfx950.

zufayu
zufayu previously approved these changes Jun 23, 2026
@zufayu

zufayu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@Bernard-Liu There's a merge conflict in dsv4_fp8fp4_tuned_fmoe.csv — could you rebase onto the latest main and resolve it? CI checks are also pending. Thanks!

@zufayu

zufayu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

merge conflict

@zufayu

zufayu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

There are merge conflicts with main — could you please rebase or merge main into your branch to resolve them? Thanks!

@zufayu
zufayu requested review from junhaha666 and zufayu and removed request for zufayu June 26, 2026 06:14
@zufayu

zufayu commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

There are merge conflicts with main — could you please rebase or merge main into your branch to resolve them? Thanks!

@zufayu

zufayu commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@Bernard-Liu There's a merge conflict in dsv4_fp8fp4_tuned_fmoe.csv — could you rebase onto the latest main and resolve it? CI checks are also pending. Thanks!

@zufayu

zufayu commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Hi @Bernard-Liu — trying to help move this one forward. Here is why it's stuck and one thing I need you to decide.

Why it's blocked: the branch is ~104 commits behind main with two merge main commits in history (so rebaseable=false), plus the review was dismissed on 6/29 — that combination keeps it blocked.

What I found when I tried to rebase (locally only — I aborted and did NOT push): the net diff only shows the new dsv4_fp4_*.csv files (no conflict), BUT commit 81ec3e0e (update) also modifies dsv4_fp8fp4_tuned_fmoe.csv / dsv4_fp8fp4_untuned_fmoe.csv. Those two files already exist on main and have been re-tuned by ~106 later commits. The earlier merge main flattened this conflict, so it is invisible in the net diff; a linear rebase replays it and conflicts (3 hunks in tuned, 1 in untuned).

The conflict is the same shape, different tuned values, e.g. gfx950, token=1, 7168/512/384:

kernelName us tflops
main ...t32x64x256_w4_gui_kw4_fp8 20.93 6.31
this PR ...t32x128x256_w3_gui_fp8 27.21 4.86

Which side to keep is a perf call — I can't make it for you. Also, since this PR is about dsv4 fp4 a4w4, the changes to the fp8fp4 files look like they might be accidentally included / stale?

Please confirm:

  1. Are 81ec3e0e's changes to the two fp8fp4 files meant to be part of this PR (then which values should win on rebase), or were they brought in by accident and should be dropped?
  2. Once decided: rebase onto origin/main (dropping the two merge commits) + --force-with-lease, or tell me how to resolve and I can push it for you. If you have unpushed local work, sync/tell me first so a force-push doesn't overwrite it.

The code itself looks fine to me — the only blocker is the ownership of these fp8fp4 tuning tables. Also: after the 6/29 dismiss, are you still planning changes, or is this version ready? If ready, I'll re-approve once it's rebased and CI is green (the MI35X shard-6 failure looked flaky — will rerun).

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it.

@github-actions github-actions Bot added the stale The PR hasn't been updated in 2 weeks label Oct 7, 2026
@zufayu

zufayu commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Closing due to inactivity: no pushes, reviews, or comments for 88 days. This is housekeeping, not a judgement on the change — if you want to continue this work, comment here and we'll reopen, or open a fresh PR rebased on the latest main.

@zufayu zufayu closed this Oct 9, 2026
@zufayu
zufayu deleted the dev/dsv4_a4w4_tuned branch October 10, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The PR hasn't been updated in 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants