Skip to content

[Config] gfx950 DSv4.1-Flash MXFP8 GEMM rows for the rank-sharded Engram WKV (N=10240, K=6144) - #8052

Draft
fhuizing wants to merge 1 commit into
mainfrom
folkert/dsv41-engram-wkv-n10240
Draft

fhuizing wants to merge 1 commit into
mainfrom
folkert/dsv41-engram-wkv-n10240

Conversation

@fhuizing

Copy link
Copy Markdown

Summary

Add gfx950 rows for the DeepSeek-V4.1-Flash Engram WKV projection sharded across TP4 ranks: the e8m0 32x32 block-scale MXFP8 GEMM at N=10240, K=6144, M=2048 to 32768, in aiter/configs/model_configs/dsv41_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv.

Motivation

In a DSv4.1-Flash TP4 prefill trace on MI355X, the Engram WKV projection runs replicated on every rank as a 16384 x 25600 x 6144 MXFP8 GEMM, 1910 us twice per 16k chunk. Sharding it to a local key plus the complete value (as in the closed #6994) makes it N=10240 per rank. The table has rows for N=25600 only, so N=10240 falls back to the batched-GEMM heuristic, which is about 20% slower than the tuned 8-wave kernel at this shape. These rows let the serving-side sharding pick up the tuned kernel.

Changes

  • Nine rows, M in {2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 32768}, tuned with gemm_a8w8_mxfp8_bpreshuffle_tune.py --mxscale_table. Every winner is flydsl_mxfp8_8w_256x256x128_F8_F8_B16_*.
  • M below 2048 (decode) keeps the heuristic.

Performance (if applicable)

gemm_a8w8_blockscale_bpreshuffle with 32x32 w_scale and 1x32 x_scale, BF16 output. Before: no row (bmm heuristic). After: these rows. Median of 30 interleaved reps of 10 calls after warm-up, one process. Per-call footprint is above the 256 MB L3 at M >= 8192.

Hardware M x N x K Before (us) After (us) Change
MI355X (gfx950) 2048 x 10240 x 6144 184.9 (1394 TFLOP/s) 129.8 (1985 TFLOP/s) 1.42x
MI355X (gfx950) 4096 x 10240 x 6144 248.7 (2072 TFLOP/s) 201.6 (2557 TFLOP/s) 1.23x
MI355X (gfx950) 8192 x 10240 x 6144 439.5 (2345 TFLOP/s) 363.6 (2835 TFLOP/s) 1.21x
MI355X (gfx950) 12000 x 10240 x 6144 (ragged) 682.3 (2213 TFLOP/s) 554.0 (2725 TFLOP/s) 1.23x
MI355X (gfx950) 16384 x 10240 x 6144 885.6 (2328 TFLOP/s) 730.6 (2822 TFLOP/s) 1.21x
MI355X (gfx950) 32768 x 10240 x 6144 1783.5 (2312 TFLOP/s) 1492.9 (2762 TFLOP/s) 1.19x

M = 6144, 10240, 12288 and 14336 gain 1.22x to 1.25x. For scale: the replicated N=25600 GEMM at M=16384 is 1934 us in the existing table, against 731 us for the sharded one.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Tuned-table rows only.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

cc75f9f

Behavior and intent

Only (N=10240, K=6144, w_scale_block 32x32) on gfx950 changes kernel, for M >= 2048 (with the usual padded-M walk; M=12000 resolves to the 8192 row). No other shape is touched.

Validation and unverified scope

On MI355X (gfx950, FlyDSL 0.5.0):

  • Each M above: output matches an fp32 dequant reference (checkAllclose atol/rtol 0.01, err 0) both before and after.
  • AITER_LOG_TUNED_CONFIG=1: mxscale bpreshuffle M:16384, N:10240, K:6144, w_scale 32x32 is tuned at padded_M 16384 on gfx950: flydsl_mxfp8_8w_256x256x128_F8_F8_B16_3x4 (and M=12000 at padded_M 8192, M=4096 at 4096).
  • pytest op_tests/test_gemm_group32_interface.py -k mxscale: 84 passed, 4 skipped (documented skips).
  • pytest op_tests/tuning_tests/test_csv_validation.py op_tests/tuning_tests/test_config_shape_collision.py: 52 passed.
  • Anchor: the tuner re-measured the existing N=25600, M=16384 shape at 1946 us in the same session (table: 1934 us).

Not verified: serving end to end. The sharded WKV itself (key/value ownership and the gate exchange) is a serving-side change; this PR only provides the GEMM rows it needs.

PR-specific question

Will answer once the automated PR Self-Review comment is posted.

Changed op tests

None.

…ram WKV (N=10240, K=6144)

Sharding the Engram WKV projection across TP4 ranks (a local key plus the
complete value) turns the replicated 16384 x 25600 x 6144 MXFP8 GEMM into
N=10240. The DSv4.1 e8m0 32x32 table has rows for N=25600 only, so N=10240
runs the batched GEMM heuristic. Add rows for M=2048 to 32768, tuned with
gemm_a8w8_mxfp8_bpreshuffle_tune.py --mxscale_table: all pick the 8-wave
256x256x128 MXFP8 kernel.
@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 8052 --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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant