[AMD][Diffusion] FlyDSL fused norm kernels on wave32 targets (gfx1250) - #37751
Merged
Merged
Conversation
Collaborator
Author
This was referenced Sep 5, 2026
yctseng0211
marked this pull request as ready for review
September 9, 2026 09:22
yctseng0211
requested review from
BBuf,
mickqian and
yingluosanqian
as code owners
September 9, 2026 09:22
Collaborator
Author
This was referenced Sep 11, 2026
HaiShaw
approved these changes
Sep 13, 2026
Collaborator
|
/tag-and-rerun-ci |
This was referenced Sep 15, 2026
Collaborator
Author
Collaborator
Author
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
Applies on top of #36349 (FlyDSL v0.3.0 stable-API migration).
Problem
SGLANG_USE_ROCM_FLYDSL=1aborts at kernel compile time on gfx1250 (MI450):This is not a regression from #36349 -- the pre-migration kernel fails
identically. Both versions carry the same wave64 assumption.
Root cause
fused_residual_norm_flydsl.pyhardcodesWARP_SIZE = 64and_SHUFFLE_OFFSETS = (32, 16, 8, 4, 2, 1). gfx1250 is a wave32 part(
torch.cuda.get_device_properties().warp_size == 32), so the leading stride-32XOR shuffle of width 64 crosses the wave boundary. The lowering can only express
that as
permlane32_swap, which exists only in the wave64 ISA, so instructionselection fails.
Fix
Derive the three wave-dependent constants from the device warp size:
WARP_SIZEfromtorch.cuda.get_device_properties().warp_size, falling backto 64 when no device is visible.
_NUM_WAVESfrom a fixed 640-thread block, soBLOCKand the publicFLYDSL_NORM_MIN_ALIGNED_DIM(5120) stay identical on both wave sizes andcallers are unaffected.
_SHUFFLE_OFFSETSstarting atWARP_SIZE // 2.No other change is needed: both reduction sites go through
wave_reduce_add,which already iterates
len(_SHUFFLE_OFFSETS).On wave64 every derived value is identical to before (
_NUM_WAVES = 10, offsets(32, 16, 8, 4, 2, 1)), so gfx950 codegen is unchanged.Validation
gfx1250 (MI450), ROCm 10, Wan2.2-T2V-A14B, 480x832, 33 frames, 4 steps,
HIP_FORCE_DEV_KERNARG=0:Structural metrics match the FLYDSL=0 reference to within 0.005 (pure noise
scores ~0.001 on the same metric) and the decoded video is visually
indistinguishable. The residual latent difference is the expected bf16 rounding
drift from a different reduction order, and it grows with step count as it
accumulates -- at 17 frames / 2 steps the same comparison gives 0.9991.
Note for reviewers
FlyDSL 0.3.1 separately misclassifies gfx1250 as CDNA:
is_rdna_arch()onlymatches the
gfx10/gfx11/gfx120prefixes, so gfx1250 falls through andgets
warp_size = 64plus awave64 = truecompile target. That does not blockthis fix -- verified by A/B running with and without a shim that corrects the
classification, both produce correct output -- but the same predicate also
drives buffer descriptor flag selection, so it is worth fixing upstream.
Modifications
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #34829420545
Latest PR Test (Extra): ❌ Run #34829420101
Latest PR Test (AMD ROCm 10): ❌ Run #34829420138