I scanned 12 popular PyTorch repos for ROCm portability. One hard blocker, and it's not where you'd expect

I come from the CUDA side and wanted a straight answer to “will this repo run on ROCm?” before spending cloud credits finding out. So I wrote a static checker and pointed it at repositories people actually train with.

The one rule I held it to: a finding may only say “breaks on ROCm” if it cites a vendor doc, or a check that CI re-runs on every push. Everything else is a pointer for a person to look at, not a verdict.

Repository CUDA wheel pin flash-attn xformers bitsandbytes CUDA sources hardcoded fp8
NVIDIA-NeMo/Speech 1 2 1 1 · ·
unslothai/unsloth · 5 8 16 · 12
axolotl-ai-cloud/axolotl · 7 5 22 5 36
huggingface/diffusers · 1 57 89 · 12
microsoft/DeepSpeed · 4 · · 60 1
huggingface/peft · 2 3 36 1 1
Lightning-AI/litgpt · · · 11 · ·
pytorch/torchtune · · · 2 · ·
timm, sam2 · · · · sam2: 2 ·
whisper, nanoGPT · · · · · ·

(distinct files per rule; the full table with apex, Transformer Engine and capability gates, plus the exact commit of each repo, is in the survey doc mentioned below)

What I took from it:

  1. Plain PyTorch ports clean. whisper and nanoGPT produce nothing. torch.cuda and init_process_group("nccl") aren’t problems; ROCm answers to the same API and routes NCCL to RCCL.
  2. The only blocker is narrow: one example’s frozen conda env in NeMo pins cupy-cuda12x. Not NeMo’s core install.
  3. The real porting work is the acceleration libraries. bitsandbytes shows up in 7 of 12, flash-attn in 6, xformers in 5. Each has a ROCm path of different maturity, and which version and which kernels you use is the actual question.
  4. Hardcoded float8_e4m3fn (5 repos) is the one that fails quietly. MI300 runs e4m3fnuz: max 240, no infinity. 448 is an ordinary e4m3fn value and becomes NaN; so does a -inf attention-mask fill. Checked on CPU, no GPU needed.

Caveat, stated plainly: static analysis only. I haven’t run any of these on AMD hardware yet. That’s the part I’d like help with.

Two asks:

  • Reply with a repo (yours or one you depend on) and I’ll scan it and post the report in this thread.
  • If you have an MI300 box: I’d love to turn one REVIEW row into a measured result. The fp8 row is the one I’d pick.

Code and reproduction: rocm-devops-starter on my GitHub (Lingikaushikreddy), the same repo I shared in the MI300X numeric-formats thread. The survey is docs/SURVEY-2026-09.md, make survey rescans all 12 at the pinned commits in about 70 s with no GPU, and python -m rocm_portscan path/to/repo runs it on your own code. (New account, so the forum won’t let me link GitHub again yet.)

Related work here: ROCmPorter (topic 814) and RepoMind (topic 717) translate CUDA code with an LLM. This is the step before that: a deterministic check that tells you whether you need to translate anything at all.

Hello, rather than a repo, one refinement to ROCM005. Your hip-aware fixture treats fnuz-if-torch.version.hip as portable, but vLLM only picks fnuz when the arch contains gfx94, and uses OCP e4m3fn on every other AMD GPU it supports fp8 on, which covers MI355X and RDNA4. So that pattern gets blessed while disagreeing with vLLM past MI300. Keying on the arch like vLLM does would fix it: vllm/vllm/platforms/rocm.py at main · vllm-project/vllm · GitHub

You’re right, and thanks. That fixture was blessing exactly the wrong thing.

I checked it in two places before changing anything. vLLM’s is_fp8_fnuz() is "gfx94" in _GCN_ARCH, and PyTorch’s own _meta_registrations.py only expects fnuz for scaled_mm when "gfx94" in gcnArchName. So a torch.version.hip switch is right on MI300 and wrong on MI355X and RDNA4.

What changed in the scanner:

  • A fnuz/e4m3fn choice keyed on torch.version.hip (or is_hip/is_rocm) is now its own REVIEW rule, ROCM108, citing the vLLM lines.
  • A choice keyed on the arch stays quiet. That includes PyTorch’s form, where torch.version.hip only guards the gcnArchName lookup and gfx94 decides.
  • ROCM005 stopped firing on the e4m3fn default/fallback in code that does choose, and on lookup tables that name both formats.

On the 12 repos in the table it changes nothing: none of them uses the ROCm-wide switch. It does turn up in current benchmark scripts in pytorch/ao and tilelang, both written float8_e4m3fnuz if torch.version.hip is not None else float8_e4m3fn.

One correction of my own while I was in there, since the forum no longer lets me edit the original: with the scanner’s latest false-positive fixes, the bitsandbytes counts for diffusers, peft and litgpt are each one lower than in my table (88, 35 and 10, not 89, 36 and 11). Nothing in the conclusions moves. The survey doc in the repo has the corrected table and a dated log of both changes.

1 Like