feat: detect AMD/ROCm GPUs and install ROCm PyTorch for extensions - #235
feat: detect AMD/ROCm GPUs and install ROCm PyTorch for extensions#235samuk10 wants to merge 2 commits into
Conversation
When no NVIDIA GPU is present but ROCm userspace is installed and rocminfo reports an AMD GPU (gfx*), pass torch_flavor='rocm' to extension setup.py so PyTorch is installed from the ROCm wheel index instead of falling through to CUDA/CPU. Enables pure-PyTorch extensions (e.g. Hunyuan3D Mini) on AMD GPUs like the Radeon RX 7600 (gfx1102). Co-Authored-By: Claude <noreply@anthropic.com>
Step-by-step for running Modly's pure-PyTorch extensions on AMD GPUs via ROCm: Python 3.12 (avoid the 3.14 wheel gap), ROCm/TheRock (gfx1102 supported), and the new app-side ROCm detection. Notes which extensions work on AMD and which (TripoSG/disso) do not. Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for this — ROCm support is a real gap, and the end-to-end validation on a 7600 with Hunyuan3D Mini is exactly the kind of legwork that makes a feature like this trustworthy. A few things to fix before this lands. 1. return /gfx\d{3}/.test(out)AMD gfx ids aren't all-digit. The pattern is also loose in the other direction: it matches any Something like 2. The existence guard and the executable lookup disagree if (!existsSync('/opt/rocm') && !existsSync('/usr/bin/rocminfo')) return false
const out = execFileSync('rocminfo', [], { … })The guard checks fixed paths, the probe resolves off 3.
4. const torchFlavor = process.platform === 'linux' && gpuSm === 0 && detectRocmGpu() ? 'rocm' : 'cuda'Two issues in one line. On the ROCm path And the else-branch hardcodes 5.
Also worth noting there: Minor: the header says "Tested on … ROCm 6.3" but step 3 tells the reader to expect One suggestion: |
|
hi, sorry about some mistakes in this PR. |
What & why
Modly's GPU detection (
detectGpuInfoinelectron/main/ipc-handlers.ts) only probesnvidia-smi. On an AMD machine there is no NVIDIA GPU, so it reportsaccelerator: 'cpu'and the extension installer passes the defaulttorch_flavor: 'cuda'— extensions then either fail to install PyTorch or install a CPU build, and the AMD GPU sits unused.Pure-PyTorch extensions like Hunyuan3D 2 Mini already support ROCm in their
setup.py(torch_flavor == "rocm"→ ROCm wheel index), but the app never passes that flag, so the branch is unreachable today.The fix
Add
detectRocmGpu()(Linux-only): when ROCm userspace is installed (/opt/rocmorrocminfopresent) androcminforeports an AMD GPU agent (gfx*), and no NVIDIA GPU is present, passtorch_flavor: 'rocm'to the extension'ssetup.py.gpuSm === 0).runExtensionSetupargs (no signature or call-site changes).Tested
AMD Radeon RX 7600 (
gfx1102), Ubuntu 26.04, ROCm 6.3:[setup] -> PyTorch + ROCm 7.2(previously fell through to cu118/CPU and failed on Python 3.14).Docs
Adds
docs/rocm-amd-setup.md— a step-by-step guide covering the two environment prerequisites (Python 3.12 to avoid the 3.14 PyTorch wheel gap; ROCm via TheRock, which officially supportsgfx1102), how to run, and which extensions work on AMD — including why TripoSG doesn't (itsdisodependency is a CUDA-only C++ extension).🤖 Generated with Claude Code