Skip to content

[FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback - #7960

Merged
coderfeli merged 7 commits into
mainfrom
dev/yadai_dsv41_flash_fix_csv
Nov 14, 2026
Merged

coderfeli merged 7 commits into
mainfrom
dev/yadai_dsv41_flash_fix_csv

Conversation

@yadaish

@yadaish yadaish commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Improve DeepSeek V4.1 Flash grouped MoE configuration selection on gfx1250: tune EP4 rows and reuse the largest compatible CSV token when a larger workload has no exact match. For example, non-EP 32768 tokens now uses the existing 16384-token configuration while still computing all 32768 tokens.

Changes

  • Rename dsv41_tuned_grouped_fmoe.csv to dsv41_flash_tuned_grouped_fmoe.csv.
  • Update EP (topk=-1) rows for tokens 32–2048, 16384 and 32768; add a separate 65536 row. Keep tokens 4/8/16 and 4096/8192 unchanged. Replace existing rows rather than retaining duplicate scatter variants.
  • Simplify token bucketing to min(next_pow2(m), 131072). This allows EP raw tokens 32768 and 65536 to select distinct rows.
  • When no row matches and the requested token exceeds the largest compatible CSV token, reuse that largest token. Apply to EP and non-EP while preserving workload keys, CU-count preference and scatter-specific row preference. Missing intermediate buckets do not trigger this fallback.
  • Factor the exact-CU/relaxed-CU search into one helper.

Performance

Hardware: AMD gfx1250, 256 CUs. A4W4 MXFP4, BF16 output, SiLU, dimensions 5120/2304, topk=6, no shared experts, balanced routing, seed=0; GEMM1 activation and requantization enabled. Values below are isolated GEMM timings, not end-to-end MoE or communication timings.

EP4: original CSV versus selected tuning

Native op_tests/test_moe_ep.py, real EP mode, local compute (ep_fused=0), global E=384/local E=96, warmup=5, iters=128. EP raw tokens are global: compare raw 4*T with non-EP T (E96). The baseline and candidate were measured in the same workspace (02f8455c715cbfbc1884a1aaecae7860fd31ad9f), changing only the CSV. These selected tuning fields match the PR; tested rows had explicit ep_fused=0, whereas the PR uses shared wildcard rows.

Times are GEMM1+GEMM2 in microseconds. Positive reduction means faster. Raw 1024 and 32768 use the median of two runs; other listed points use one run.

EP global tokens Per-rank tokens Const baseline → tuned (µs) Reduction Random baseline → tuned (µs) Reduction
32 8 53.89 → 46.46 13.79% 56.66 → 49.39 12.83%
64 16 102.36 → 91.86 10.26% 105.97 → 95.89 9.51%
128 32 102.98 → 93.58 9.13% 105.75 → 97.09 8.19%
256 64 102.98 → 93.59 9.12% 106.92 → 97.13 9.16%
512 128 103.74 → 94.08 9.31% 106.88 → 97.57 8.71%
1024 256 105.59 → 103.37 2.11% 110.22 → 107.55 2.43%
2048 512 112.18 → 103.29 7.92% 117.30 → 110.16 6.09%
32768 8192 431.01 → 301.71 30.00% 471.40 → 340.57 27.75%

The latest commit changes EP 16384 and 65536 configurations after these measurements; their previous candidate timings are intentionally excluded. Those two final rows still need GPU revalidation. Unchanged rows are omitted from the tuning table.

Non-EP validation, including 32768 tokens

FlyDSL 0.5.0, E96, warmup=5, iters=32; constant data/constant scales and uniform data/auto scales. The full powers-of-two sweep from 1 through 32768 passed 32/32 correctness checks. The measured lookup implementation and non-EP CSV rows match the PR. These are absolute validation results; no paired before/after timing was collected for this sweep.

Tokens Const GEMM1 (µs) Const GEMM2 (µs) Random GEMM1 (µs) Random GEMM2 (µs)
4096 105.68 64.14 111.39 68.54
8192 165.35 111.75 192.64 126.67
16384 308.16 209.34 354.45 238.27
32768 603.57 408.52 682.85 450.82

Runtime logging confirms non-EP 32768 selects CSV token 16384. Const/random GEMM sums at 32768 are 1012.09/1133.68 µs.

Reproduce the non-EP sweep with FlyDSL 0.5.0 and the PR CSV:

AITER_CONFIG_GROUPED_FMOE=aiter/configs/model_configs/dsv41_flash_tuned_grouped_fmoe.csv AITER_FLYDSL_DISABLE_GEMM1_ACT=0 AITER_FLYDSL_DISABLE_GEMM1_REQUANT=0 gpu-lock python3 -u -m op_tests.flydsl_tests.test_flydsl_grouped_gemm --scenario kernel --data-format a4w4 --experts 96 --tokens 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 --topk 6 --model-dim 5120 --inter-dim 2304 --act silu --no-bias --balanced-routing --warmup 5 --iters 32 --seed 0 --no-check-aot-cache --data-init constant uniform --scale-init constant auto

Testing

  • Performance benchmarks run on gfx1250; scope and remaining validation listed above.
  • Unit tests added: nine lookup tests passed locally through a CPU-isolated AST harness. Ruff, Black and diff checks passed.
  • Tested on MI250X.
  • Tested on MI300X.

Documentation

  • No separate user-guide change needed for automatic selection. Users explicitly setting the old CSV filename must update it to dsv41_flash_tuned_grouped_fmoe.csv.

Dependencies

No new third-party dependencies or submodule changes. The unintended CK pin change was removed; CK matches main at f93c029e09f67c983696eecac8e0e0350f3dbb54.

Breaking Changes

The explicit CSV path is renamed; update external AITER_CONFIG_GROUPED_FMOE references. No Python API or tensor shape changes.

PR Self-Review

Reviewed revision

ad1f5faa842d91d16e611e2dcd8fa17394d3cd06

Behavior and intent

Large inputs retain the actual workload size and reuse compatible tuning only when their lookup token exceeds available tuning. EP and non-EP retain distinct topk keys. Exact matches take priority; gaps below the maximum remain gaps.

Validation and unverified scope

  • CPU audit of every integer token 1–262144 for Flash non-EP: old versus new padding with the same maximum-token fallback selects identical full CSV rows. Existing tokens 1–16384 retain their selection; larger inputs now reuse token 16384 instead of missing the CSV. Beyond that range both padding rules saturate at 131072.
  • Nine local AST-harness tests cover fallback, exact matches, missing intermediate buckets, workload/CU/scatter matching, padding boundaries and real CSV selection. This is not a full package-import unit-test run.
  • Historical EP validation passed 30/30 const/random cases over raw tokens 4–65536. It predates the final EP 16384/65536 changes and does not establish correctness or performance for those final rows or ep_fused=1.
  • Non-EP sweep passed 32/32 cases and exit code 0. The benchmark snapshot matches the PR lookup code and non-EP rows, but was not a full rerun of the latest commit.
  • Local artifacts: /workspace/trace/dsv41_ep4_tune_20261113/, /workspace/trace/dsv41_non_ep_32768_20261113/, /workspace/trace/flash_all_20261113_211740_3768/. These are local paths, not public downloads.

PR-specific question

No automated path-specific self-review question was posted when this description was updated.

Changed op tests

op_tests/tuning_tests/test_grouped_ep_fused_lookup.py: adds coverage for maximum-token fallback, exact-match priority, missing intermediate buckets, workload/CU/scatter isolation, real Flash CSV selection and padding boundaries. These extend the existing lookup suite to cover the new behavior. Validation used the CPU-isolated AST harness; this is not a full package-import test run.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 7960 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@amd-ruitang3 amd-ruitang3 changed the title Dev/yadai dsv41 flash fix csv [FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback Nov 14, 2026
@yadaish
yadaish marked this pull request as ready for review November 14, 2026 08:15
@yadaish
yadaish requested a review from a team November 14, 2026 08:15
@github-actions github-actions Bot changed the title [FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback [CK] [FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback Nov 14, 2026
@aiter-bot

aiter-bot commented Nov 14, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision f14fd935596e · 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 — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — PR-specific question is too short to show concrete reasoning (12 units; need 14)
  • 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.

@github-actions github-actions Bot changed the title [CK] [FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback [FlyDSL] Tune DSV4.1 Flash EP4 configs and support large-token CSV fallback Nov 14, 2026
@github-actions github-actions Bot removed the CK label Nov 14, 2026
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