Repository navigation
[AMD][Diffusion] Route unquantized linears through aiter tgemm on gfx1250 - #41988
Merged
Merged
Conversation
sogalin
marked this pull request as ready for review
October 1, 2026 10:15
sogalin
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
mickqian,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 1, 2026 10:15
Add SGLANG_USE_ROCM_AITER_TGEMM (default off). When set on ROCm, apply_unquantized_linear sends bf16/fp16 linears to aiter's tgemm.mm, which picks the backend (torch/hipBLASLt or Triton) per (M, N, K) from aiter's bf16_tuned_gemm CSVs. Mixed-dtype calls keep using F.linear. This covers every DiT linear in Wan (QKV/out projections, FFN, text and time embedders), which all reach ColumnParallelLinear/RowParallelLinear. Wan2.2-T2V-A14B, 720x1280, 33 frames, 8 steps, 1x gfx1250, median of 3 interleaved runs, with the companion aiter Wan2.2 gfx1250 configs: | Stage | hipBLASLt | aiter tgemm | Speedup | | Encoding | 1.01 s | 0.96 s | 1.05x | | Denoise | 228.74 s | 64.41 s | 3.55x | | Decoding | 7.37 s | 7.00 s | 1.05x | | Total | 237.39 s | 72.64 s | 3.27x | Output video is bit-identical (same mp4 md5) to the F.linear path.
sogalin
force-pushed
the
amd-opt-wan2.2
branch
from
October 1, 2026 14:18
ba2c7e9 to
6b74bcb
Compare
HaiShaw
approved these changes
Oct 6, 2026
|
|
||
| if ( | ||
| _USE_AITER_TGEMM | ||
| and x.dtype in (torch.bfloat16, torch.float16) |
Contributor
There was a problem hiding this comment.
we should add x.ndim >= 2 and x.is_contiguous() to avoid unsuported and copy call ?
Collaborator
|
In #44379, aiter has been upgrade. This PR is ready to merge. |
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
On ROCm, diffusion DiT linears call
F.linear, which goes to hipBLASLt. On gfx1250 that is about 3x slower than aiter's tuned Triton GEMM for the large Wan2.2 projections.Modifications
SGLANG_USE_ROCM_AITER_TGEMM(default off).apply_unquantized_linearsends bf16/fp16 linears toaiter.tuned_gemm.tgemm.mm, which picks the backend for each (M, N, K) from aiter's tuned CSVs. Calls with mixed dtypes still useF.linear.Tuned configs for Wan2.2 on gfx1250 are in the companion aiter PR#6032.
Accuracy Tests
The output video is bit-identical (same mp4 md5) with the flag on and off.
tgemmmatchesF.linearexactly on all Wan2.2 GEMM shapes.Speed Tests and Profiling
Wan2.2-T2V-A14B, 720x1280, 33 frames, 8 steps, 1x gfx1250, median of 3 interleaved runs:
Scaling with
--num-frames(single run each; 193-frame tuned run is estimated):* At 193 frames, the two FFN GEMMs exceed 2^31 elements and stay on
F.linear. Only the 5120x5120 projections use tgemm.Time saved per step grows with frame count (20.6 s at 33 frames to 75.3 s at 129 frames). The overall speedup still drops, because attention grows quadratically with token count and becomes the main bottleneck. Text encoding (~1 s) and decoding are unaffected. No new GEMM shapes appear between 33 and 193 frames (only M changes), so the aiter configs need no retuning.
To reproduce, add
SGLANG_USE_ROCM_AITER_TGEMM=1to thesglang generatecommand.These numbers were measured on the original local branch, which has the same diff as this PR. The rebased branch has only passed
py_compile.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #36875285583
Latest PR Test (Extra): ❌ Run #36875284125
Latest PR Test (AMD ROCm 10): ❌ Run #36875285745