Skip to content

[Tune] Re-land qwen3.5-397B a16w16 GEMM configs without DSv4 conflict - #4017

Merged
yifehuan merged 1 commit into
ROCm:mainfrom
yichiche:add-qwen3_5-397b-bf16-gemm-tuning
Jul 1, 2026
Merged

yifehuan merged 1 commit into
ROCm:mainfrom
yichiche:add-qwen3_5-397b-bf16-gemm-tuning

Conversation

@yichiche

@yichiche yichiche commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Re-land the qwen3.5-397B a16w16 (bf16) GEMM tuning configs from #3974, which was
reverted in #4013 due to a config conflict with DSv4.

aiter/configs/model_configs/qwen3_5_397b_bf16_tuned_gemm.csv shared 60
identical shapes
with aiter/configs/model_configs/dsv4_bf16_tuned_gemm.csv.
The runtime config merge in aiter/jit/core.py concatenates the global
bf16_tuned_gemm.csv with every model_configs/*_bf16_tuned_gemm.csv and
deduplicates on the shape key:

(gfx, cu_num, M, N, K, bias, dtype, outdtype, scaleAB, bpreshuffle)

This key excludes libtype/us, so two independently-tuned winners for the
same shape collide. The merge then raised:

RuntimeError: Found 60 duplicate shape entries during merge of 'bf16_tuned_gemm'...

which failed op_tests/test_gemm_a16w16.py. These 60 shapes are model-agnostic
dense-GEMM shapes (N=64/256/512, K=4096) that both DSv4 and Qwen3.5 happened to
tune independently.

Modifications

  • Re-introduce qwen3_5_397b_bf16_tuned_gemm.csv and
    qwen3_5_397b_untuned_gemm.csv.
  • The tuned config has the 60 shapes already present in
    dsv4_bf16_tuned_gemm.csv removed (187 → 127 rows), deferring those
    shared shapes to the existing DSv4 config.
  • dsv4_bf16_tuned_gemm.csv is left untouched, so this PR is self-contained and
    does not modify another model's tuning. The untuned shape spec is restored
    unchanged.

Test

python op_tests/test_gemm_a16w16.py passes (exit 0); all checkAllclose
checks pass and the merge no longer raises RuntimeError. Verified there are
0 cross-file duplicate shapes across all *_bf16_tuned_gemm.csv configs, and
the test no longer rewrites any CSV as a side effect (the auto-dedup writeback no
longer triggers).

@yichiche
yichiche requested a review from a team June 30, 2026 09:08
@github-actions

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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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 4017 --add-label <label>

#3974 added qwen3.5-397B bf16 tuned GEMM configs but was reverted (#4013)
because qwen3_5_397b_bf16_tuned_gemm.csv shared 60 shapes with
dsv4_bf16_tuned_gemm.csv. The runtime config merge in aiter/jit/core.py
concatenates the global bf16_tuned_gemm.csv with every
model_configs/*_bf16_tuned_gemm.csv and dedups on the shape key
(gfx, cu_num, M, N, K, bias, dtype, outdtype, scaleAB, bpreshuffle) --
which excludes libtype/us -- so two tuned winners for the same shape
collide and raise RuntimeError, failing op_tests/test_gemm_a16w16.py.

Re-introduce the qwen3.5-397B configs with the 60 shapes that already
exist in dsv4_bf16_tuned_gemm.csv removed from the tuned file
(187 -> 127 rows). Those model-agnostic dense shapes are deferred to the
existing DSv4 config; dsv4_bf16_tuned_gemm.csv is left untouched. The
untuned shape spec is restored unchanged.

Verified: 0 cross-file duplicate shapes across all *_bf16_tuned_gemm.csv,
and op_tests/test_gemm_a16w16.py passes without rewriting any CSV.
@yichiche
yichiche force-pushed the add-qwen3_5-397b-bf16-gemm-tuning branch from 0c05b45 to cda5c0d Compare June 30, 2026 09:11
@yichiche yichiche changed the title [Fix] Drop qwen3.5-397B a16w16 GEMM configs duplicated with DSv4 [Tune] Re-land qwen3.5-397B a16w16 GEMM configs without DSv4 conflict Jun 30, 2026
@zufayu
zufayu requested a review from yifehuan July 1, 2026 01:43

@yifehuan yifehuan 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 — 127 rows, clean power-of-two M bucketing, no hipBLASLt kernel names, and 0 cross-file key conflicts (incl. DSv4), so the re-land is clean.

@yifehuan
yifehuan merged commit 5bb599a into ROCm:main Jul 1, 2026
42 checks passed
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.

2 participants