Skip to content

[Config] [Perf] Tune DeepSeek V4.1 EP16 A4W4 for routed and shared experts - #7389

Merged
yzhou103 merged 4 commits into
mainfrom
perf/dsv41-ep16-a4w4-tune
Nov 9, 2026
Merged

yzhou103 merged 4 commits into
mainfrom
perf/dsv41-ep16-a4w4-tune

Conversation

@james-huang09

@james-huang09 james-huang09 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Add DSV4.1 Flash EP16 A4W4 tuning rows to dsv41_fp4_tuned_fmoe.csv.

1. Configurations

Hidden size 5120, intermediate size 2304, BF16 output, MXFP4 activations/weights, per-32 scaling, SiLU and G1U1.

Local experts Compute top-k Configuration
24 6 384 routed experts across 16 EP ranks
25 7 24 routed experts plus one shared replica per rank

The router selects six routed experts. In 25/7, shared is appended as the seventh slot with weight 1.

Both configurations cover 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 and 131072 tokens, for 18 rows total.

2. Tuning

  • Environment: MI355X, gfx950, 256 CUs; ROCm 7.2.0, Python 3.12, PyTorch 2.9.1 and FlyDSL 0.4.2.
  • Kernels: generic flydsl_moe1_* and flydsl_moe2_layout_*, using a bounded search with balanced local routing, five warmups and 30 profiler iterations.
  • Results: all 18 selected pairs pass stage reference checks; recorded errors are 0.9% / 1.2%, within the 5% threshold. CSV timings are GPU stage durations, excluding initial sorting/input quantization and communication.

The E24/K6 source input and log are archived under /home/hzm/d41tune/, with explicit expert=24, topk=6 entries. New inputs, results and measurement logs are under /home/hzm/dsv41_ep16_review_20261105/ (input.csv, tuned42.csv, tune42.log, tune42_chunked.log). The untimed sorted-reference gather uses equivalent batching, verified bitwise against the original on CPU and gfx950.

3. EP Validation

36 cases passed: 18 EP configuration lookups and 18 numerical fused_moe calls across all token buckets with real expert_mask. All calls select the configured kernel pair. The 25/7 cases include an always-active shared expert.

Full outputs are finite. The independent Torch reference checks 32 sampled rows and both quantization boundaries; maximum mean row cosine error is 0.00080180, below 0.01.

Validation log

屏幕截图 2026-11-05 181159

Validation covers one rank's compute in an EP16 layout. Full 16-GPU ATOM deployment and inter-node performance were not measured; tuning uses uniform local routing rather than the shared expert's deployment load.

4. Checks

CSV schema, block-M consistency, unique lookup keys and merged-table collisions checked. The original 137 rows are preserved.

Local checks passed over the full repository and complete PR scope: Black 26.10.1, Ruff 0.16.0, repository pre-commit, dependency pre-check and diff whitespace checks.

PR Self-Review

Reviewed revision

2c9557c508d9a1de5af7f8274c1a471541365570

Behavior and intent

18 DSV4.1 EP16 A4W4 tuning rows for the configurations in Section 1.

Validation and unverified scope

See Sections 3 and 4 for validation results and deployment scope.

PR-specific question

expert_mask selects the tuned pairs for all 18 configurations.

Changed op tests

None. The validation harness and logs are retained separately; this PR contains only the tuning table.

@james-huang09
james-huang09 requested a review from a team November 3, 2026 09:48
@github-actions github-actions Bot added the Config label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 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 7389 --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 3, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 2c9557c508d9 · 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 exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  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 — Behavior and intent is too short to show concrete reasoning (12 units; need 18)
  • FAIL — Validation and unverified scope is too short to show concrete reasoning (11 units; need 18)
  • FAIL — PR-specific question is too short to show concrete reasoning (9 units; need 14)
  • FAIL — validation answer must name a command, result, or evidence link
  • FAIL — validation answer must explicitly state what remains unverified (or say none with a reason)

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

@yzhou103

yzhou103 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@valar-cop review

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some changes needed..

need the fused_moe log showing one of these rows selected for EP16, and the source tuning report for these numbers (24 local experts?)

ci green.

@james-huang09
james-huang09 marked this pull request as draft November 5, 2026 08:11
@james-huang09 james-huang09 changed the title [Config] [Perf] Add DeepSeek V4.1 EP16 A4W4 MoE tuning configs [Config] [Perf] Tune DeepSeek V4.1 EP16 A4W4 for routed and shared experts Nov 5, 2026
@james-huang09
james-huang09 marked this pull request as ready for review November 5, 2026 10:52

@yzhou103 yzhou103 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.

LGTM

@yzhou103
yzhou103 merged commit 2ec8c26 into main Nov 9, 2026
@yzhou103
yzhou103 deleted the perf/dsv41-ep16-a4w4-tune branch November 9, 2026 08:00
ruanjm pushed a commit that referenced this pull request Nov 10, 2026
…perts (#7389)

* [Perf] Add DeepSeek V4.1 EP16 A4W4 MoE tuning configs

Signed-off-by: james-huang09 <[email protected]>

* [Config] Retune DSV4.1 EP16 A4W4 and add shared expert configs

* [Config] Keep DSV4.1 EP16 PR limited to tuning table

---------

Signed-off-by: james-huang09 <[email protected]>
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.

4 participants