You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently broken on stable release — investigate nightly releases or other workarounds for Flash Linear Attention (FLA) on gfx1201 (RDNA4 / AMD R9700).
Status: investigated (brainstorm). Findings summarized below; full detail in the comments. Nothing committed to the tree yet.
TL;DR — two kernel stacks, two blockers
The original FLA question turned out to be one of two distinct gfx1201 problems, split by which model we're training:
flash-linear-attention==0.5.0 JIT-deadlocks at training step 0 on gfx1201. Root cause: Triton 3.6.0's tritonamdgpu-pipeline pass has a use-after-free when num_stages>=2 (gfx12xx isn't in Triton's verified target list). Same bug that crashes SageAttention.
Fix:make patch-fla-rocm (rewrites num_stages→1, num_warps→4) — confirmed working at seq 768.
Nightly status:not fixed upstream in any nightly; every fix in the wild is a downstream num_stages=1 workaround.
Alternatives:TRITON_DISABLE_AUTOTUNING=1 (cheapest, try first) · pin Triton 3.5.1 (avoids the 3.6.0 regression at the source) · TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1.
2. Gemma4-31B SFT blocker — NOT FLA, it's load-time CPU RAM
Gemma4 uses softmax attention (no FLA). The actual wall was OOM during model load: from_pretrained(load_in_4bit=True)stages the full ~62 GB BF16 model in CPU RAM before NF4 quantization (a bitsandbytes detail; low_cpu_mem_usage/offload don't prevent it). The 62 GB R9700 box thrashes into zram (~20 h just to load).
Fix: load a pre-quantized bnb checkpoint — unsloth/gemma-4-31B-it-unsloth-bnb-4bit (already NF4, ~19 GB; embedded quant config byte-matches our pipeline; it's the instruction-tuned variant). Drops load RAM from ~62 GB to ~16 GB.
The one gate common to both: bitsandbytes 4-bit runtime on gfx1201
Officially listed in bnb's RDNA arch table; verify with make test-gpu-stack (steps 4/5). May need a source build: cmake -DCOMPUTE_BACKEND=hip -DBNB_ROCM_ARCH="gfx1201".
Minimum viable: GPU ≥ 32 GB (R9700 / 5090) · 24 GB (3090) marginal · 20 GB (RTX 4000 Ada) won't fit. System RAM ~16 GB with the pre-quant checkpoint. Disk ~30 GB. Eval stays disabled (TRAIN_EVAL_STRATEGY=no) — its 256K-vocab logits.float() copy adds an ~8.6 GB spike that OOMs even 32 GB.
Corrections logged during the investigation
HSA_OVERRIDE_GFX_VERSION: our hang came from 11.0.0 (the RDNA3 value). The correct gfx1201 value is 12.0.1 — but on ROCm 7.2 no override should be needed at all.
expandable_segments:True:HANDOFF.md (05-25) says "unsupported on gfx1201"; the PR feat(stage2-sft): format fix, loaders, configs, DPO pair builder #79 session (05-26) re-added it as a working fix (releases freed BF16 shards from VRAM). The Makefile is correct; HANDOFF.md Issue 2 is stale.
Detailed notes (comments below)
Deep dive — FLA vs FA2 on gfx1201 (root cause, nightly status, reference map)
Currently broken on stable release — investigate nightly releases or other workarounds for Flash Linear Attention (FLA) on gfx1201 (RDNA4 / AMD R9700).
TL;DR — two kernel stacks, two blockers
The original FLA question turned out to be one of two distinct gfx1201 problems, split by which model we're training:
Makefile:342)1. FLA blocker (the Qwen targets)
flash-linear-attention==0.5.0JIT-deadlocks at training step 0 on gfx1201. Root cause: Triton 3.6.0'stritonamdgpu-pipelinepass has a use-after-free whennum_stages>=2(gfx12xx isn't in Triton's verified target list). Same bug that crashes SageAttention.make patch-fla-rocm(rewritesnum_stages→1,num_warps→4) — confirmed working at seq 768.num_stages=1workaround.TRITON_DISABLE_AUTOTUNING=1(cheapest, try first) · pin Triton 3.5.1 (avoids the 3.6.0 regression at the source) ·TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1.2. Gemma4-31B SFT blocker — NOT FLA, it's load-time CPU RAM
Gemma4 uses softmax attention (no FLA). The actual wall was OOM during model load:
from_pretrained(load_in_4bit=True)stages the full ~62 GB BF16 model in CPU RAM before NF4 quantization (a bitsandbytes detail;low_cpu_mem_usage/offload don't prevent it). The 62 GB R9700 box thrashes into zram (~20 h just to load).unsloth/gemma-4-31B-it-unsloth-bnb-4bit(already NF4, ~19 GB; embedded quant config byte-matches our pipeline; it's the instruction-tuned variant). Drops load RAM from ~62 GB to ~16 GB.The one gate common to both: bitsandbytes 4-bit runtime on gfx1201
Officially listed in bnb's RDNA arch table; verify with
make test-gpu-stack(steps 4/5). May need a source build:cmake -DCOMPUTE_BACKEND=hip -DBNB_ROCM_ARCH="gfx1201".Hardware estimate — Gemma4-31B QLoRA (seq 1280, batch 1×16, grad-ckpt on, eval off)
load_in_4bitfrom BF16Minimum viable: GPU ≥ 32 GB (R9700 / 5090) · 24 GB (3090) marginal · 20 GB (RTX 4000 Ada) won't fit. System RAM ~16 GB with the pre-quant checkpoint. Disk ~30 GB. Eval stays disabled (
TRAIN_EVAL_STRATEGY=no) — its 256K-vocablogits.float()copy adds an ~8.6 GB spike that OOMs even 32 GB.Corrections logged during the investigation
HSA_OVERRIDE_GFX_VERSION: our hang came from11.0.0(the RDNA3 value). The correct gfx1201 value is12.0.1— but on ROCm 7.2 no override should be needed at all.expandable_segments:True:HANDOFF.md(05-25) says "unsupported on gfx1201"; the PR feat(stage2-sft): format fix, loaders, configs, DPO pair builder #79 session (05-26) re-added it as a working fix (releases freed BF16 shards from VRAM). TheMakefileis correct;HANDOFF.mdIssue 2 is stale.Detailed notes (comments below)
Open / next
make test-gpu-stack; source build if needed) — gates both paths.TRITON_DISABLE_AUTOTUNING=1, then Triton 3.5.1, as cleaner FLA fixes than the per-uv syncpatch.Refs: PR #79 · apollo-mg RDNA4 gfx1201 gists ·
scripts/patch_fla_rocm.sh·docs/GPU_SUPPORT.md·HANDOFF.md.