Skip to content

[FlyDSL] perf: Reuse GEMM outputs and tuned A8W8 configurations above the largest tuned M - #6205

Closed
yuychang wants to merge 1 commit into
ROCm:mainfrom
yuychang:pr/aiter-03-gemm-output-and-large-m
Closed

yuychang wants to merge 1 commit into
ROCm:mainfrom
yuychang:pr/aiter-03-gemm-output-and-large-m

Conversation

@yuychang

@yuychang yuychang commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

A8W8 bpreshuffle GEMM allocates an output even when the caller already owns a suitable destination, and a row count above the tuned table misses the available configuration.

Technical Details

A8W8 bpreshuffle GEMM allocates an output even when the caller already owns a suitable destination, and a row count above the tuned table misses the available configuration. Add a validated optional out buffer, opt-in A4W4 scratch reuse, and reuse of the largest matching tuned M only when the requested M exceeds it. Chunk FlyDSL launches at their row limit and slice per-row activation scales with each chunk. Keep the Kimi-K3 FP8 tuning rows and large-M dispatch tests with this change.

Branch pr/aiter-03-gemm-output-and-large-m, head 10ae462f18b9e352b210de539146f4657c26062a; intended feature base e4ceb9dd95e12595dc9d87a06eaef79dfd6cdb8c. 6 files changed, 395 insertions(+), 23 deletions(-).

Changed files in this slice
  • aiter/configs/model_configs/a8w8_bpreshuffle_tuned_gemm_kimik3.csv
  • aiter/configs/model_configs/a8w8_bpreshuffle_untuned_gemm_kimik3.csv
  • aiter/configs/model_configs/dsv3_a8w8_bpreshuffle_tuned_gemm.csv
  • aiter/ops/gemm_op_a4w4.py
  • aiter/ops/gemm_op_a8w8.py
  • op_tests/test_gemm_a8w8_bpreshuffle_large_m.py

Test Plan

Validation performed and its limits are listed below. Remaining before marking ready: Exact-head large-M numerical equivalence across chunk boundaries and graph replay with caller-owned buffers.

Test Result

op_tests/test_gemm_a8w8_bpreshuffle_large_m.py passed on combined AITER: dispatch above the largest tuned M and fallback below the table are exercised. This was part of a 4-test run, completed in 4.45 s. Standalone direct probes below use adjusted SGLang target a1e96661f4937e7ee4fa811c2f28d26297db82e3 with AITER d78f1d4751fa.

Direct operator probe: {"same_stream_reuses":true,"different_stream_isolated":true}.

Direct operator probe: {"caller_output_reused":true,"exact_equality":true,"invalid_shape_dtype_device":["expected ValueError","expected ValueError","expected ValueError"]}.

No isolated GEMM throughput or Kimi-K3 E2E delta is measured for this head. A [16384,7168] BF16 output is 224 MiB; scratch reuse avoids repeated allocation of that buffer, which is an allocation-size calculation rather than a measured peak-memory saving.

git diff --check and changed-Python AST checks passed. All 15 AITER slices replay to the original source tree exactly.

Tests ran on 8× AMD Instinct MI355X (gfx950, 256 CUs/device), PyTorch 2.11.0+rocm7.2, ROCm 7.2.4, on 2026-10-07. GPU operator checks use AITER d78f1d4751fae6733400623b4a3ebcfe8cea6b89 and SGLang 50886800373fbf09fb33bd79212510541868063d unless a different checkout is explicitly named. These are combined-tree checks, not isolated PR-head A/B runs.

Evidence artifacts in the benchmark bundle (upstream/k3-quark-opts/evidence/): logs/aiter-contracts.log, direct-gpu.json, logs/direct-gpu.log, logs/direct-gpu-followup.log. These paths identify retained local raw data; they are not public artifact URLs.

Submission Checklist

- Accept caller-owned A8W8 outputs and optionally reuse A4W4 scratch.
- Reuse the largest tuned bpreshuffle row only above the table and chunk FlyDSL launches at their row limit.
- Keep KDA prefill tuning and dispatch tests with the GEMM implementation.
@github-actions

github-actions Bot commented Oct 7, 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
multigpu 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: 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 6205 --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.

@yuychang

Copy link
Copy Markdown
Contributor Author

Closing: the large-M reuse heuristic (reuse the largest tuned bpreshuffle row up to 3x its M) slowed down 9 of 43 gfx950 tuned groups in a sweep, the worst at 0.17x (DSv3 N=2112 K=7168). Kimi-K3's missing M values are being added as tuned rows instead (see #6410). The caller-owned out= part has no consumer, so it is dropped as well.

@yuychang yuychang closed this Oct 12, 2026
@yuychang
yuychang deleted the pr/aiter-03-gemm-output-and-large-m branch October 12, 2026 11:47
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