Repository navigation
[Triton/Gluon] [Config] Add gfx1250 A16W16 GEMM configs for FLUX.2 shapes - #4851
Merged
Merged
Conversation
The gfx1250 GEMM-A16W16 fallback (BLOCK_M=32, BLOCK_N=64) leaves the FLUX.2 projection shapes at ~270 TFLOP/s; tuned per-shape tiles reach ~840 TFLOP/s on a DPX partition (96 CU). Shapes are resolution-independent, so the M buckets cover 512x512 through 2048x2048. NUM_BUFFERS is held at 2 throughout. Three or more buffers is measurably faster (~934 TFLOP/s) but not run-to-run deterministic on this arch: repeated launches on identical inputs disagree on thousands of elements.
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
The tile configs from the previous commit only take effect once a caller actually reaches the Triton kernel. tuned_gemm has no gfx1250 rows for these shapes, so lookups fall through to the default libtype "torch" and FLUX.2 stays on hipBLASLt regardless of how well the Triton side is tuned. Adds the dispatch table for every (M,N,K) FLUX.2-dev feeds to tgemm at 512x512, 1024x1024 and 2048x2048, collected with AITER_TUNE_GEMM=1. Each shape was timed both ways and the winner recorded; triton takes 23 of the 27, by 1.5x to 9.4x. The four that stay on torch are the interesting ones, because a plain "large M means triton" rule gets them wrong: the two M=1 modulation projections, and M=1024 with an N or K of 128, where triton is 2.2x to 2.6x slower. Triton is only selected where it is also bit-exact against torch and deterministic across repeated launches on identical inputs.
valarLip
approved these changes
Aug 21, 2026
1 task
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.
Summary
Two commits. The first adds tuned
GEMM-A16W16tile configs for the FLUX.2projection shapes on gfx1250; without a matching config they fall back to
BLOCK_M=32, BLOCK_N=64. The second adds thetuned_gemmdispatch table thatactually routes those shapes to Triton — without it, lookups fall through to
the default libtype
torchand FLUX.2 stays on hipBLASLt no matter how wellthe Triton side is tuned.
Config-only; no kernel or Python changes, and nothing outside gfx1250 with
these exact shapes is affected.
Backend choice is measured, not assumed
Every (M,N,K) FLUX.2-dev feeds to
tgemmat 512x512, 1024x1024 and 2048x2048was collected with
AITER_TUNE_GEMM=1and timed both ways. Triton takes 23 ofthe 27 shapes, by 1.5x to 9.4x, peaking at ~613 TFLOP/s on a 96 CU gfx1250
The four that stay on
torchare the useful ones, because a plain "large Mmeans Triton" rule gets them wrong: the two M=1 modulation projections, and
M=1024 with an N or K of 128, where Triton is 2.2x to 2.6x slower.
NUM_BUFFERS is deliberately capped at 2
NUM_BUFFERS >= 3benchmarks faster but is not run-to-run deterministic onthis architecture: repeated launches on identical inputs disagree on thousands
of elements. Every tile config here uses
NUM_BUFFERS=2, which measured zeromismatches. Please keep this in mind if these files are ever re-tuned.
Validation
torchon all 27 shapes, and deterministic across repeatedlaunches; Triton is only selected where both hold.
12 steps, median of repeated runs on an otherwise idle GPU, measured with the
companion SGLang change that routes linear layers through
tgemm:Submission Checklist