[AMD] Disable PTX-inline-asm diffusion LayerNorm fast path on ROCm (fix FLUX warmup crash) - #34352
kangwangamd wants to merge 1 commit into
Conversation
…ix FLUX warmup crash)
|
Closing in favour of #34481, which supersedes this. That PR covers the same ROCm PTX-inline-asm problem but more completely: it gates the fast paths in For the record, the fix here was hardware-verified on MI300X (gfx942) with image |
|
Thanks @kangwangamd — carried your MI300X evidence into #34481 as corroboration of the same root cause. One note since #34481 shrank after you closed this: it no longer touches |
Motivation
On ROCm (MI300X gfx942), bringing up FLUX.1-dev on the native SGLang diffusion backend crashes during warmup:
The server never becomes ready (
ready to rollnever prints,/health_generate= 503). In CI this ismultimodal-gen-test-1-gpu-amd*(flux_image_t2i) timing out at the 90-min step limit (e.g. run 31327057626, 08/09; run 31415663809, 08/10). Deterministic and chronic. Root-cause detail in #34351.Root cause
The diffusion fast-path helpers embed NVIDIA PTX inline asm with float-register constraints (
"=f") viatl.inline_asm_elementwise:numerics.py:rcp.approx.f32,div.rn.f32,rsqrt.approx.f32/mul.rn.f32(allconstraints="=f,...")layernorm_modulate.py_rcp4:rcp.approx.f32 / fma.rn.f32 / sub.ftz.f32PTX is CUDA-only; the AMDGPU backend can't allocate the
'f'constraint, so the Triton JIT aborts at the first warmup forward. These helpers exist to reproduce NVIDIA aten LayerNorm bit-for-bit (SASS-level), so porting the PTX would break the documented contract. The module already guarantees bit-exact-or-eager-fallback (torch.equalgate +can_use_*), so the correct AMD behavior is to take the eager path.Fix
Gate the fused fast paths off on ROCm:
_is_bf16_cuda()(used by bothcan_use_fused_layernorm_modulateandcan_use_fused_qk_head_layernorm) now returnsFalsewhentorch.version.hip is not None, so ROCm falls back to the eager aten LayerNorm. CUDA behavior is unchanged.Test plan (offline, real hardware)
rocm/sgl-dev:v0.5.17-rocm720-mi30x-20260809.sglang serve --model-path black-forest-labs/FLUX.1-dev --model-type diffusion --num-gpus 1→couldn't allocate output register for constraint 'f'at warmup, health 503, never ready./health_generate= 200. Noallocate output registererror.Fixes #34351
cc @BBuf
CI States
Latest PR Test (Base): ❌ Run #31456475803
Latest PR Test (Extra): ❌ Run #31456475694