Repository navigation
Conversation
…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.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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
gemm_a8w8_mxfp8_bpreshuffle_tune.py --mxscale_table. Every winner isflydsl_mxfp8_8w_256x256x128_F8_F8_B16_*.Performance (if applicable)
gemm_a8w8_blockscale_bpreshufflewith 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.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
Documentation
Tuned-table rows only.
Dependencies
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):
checkAllcloseatol/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.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.