Skip to content

Comments

feat: add AMD ROCm GPU support#30

Merged
jamesbrink merged 3 commits intomainfrom
feat/rocm-support
Feb 20, 2026
Merged

feat: add AMD ROCm GPU support#30
jamesbrink merged 3 commits intomainfrom
feat/rocm-support

Conversation

@jamesbrink
Copy link
Member

Summary

  • Add AMD ROCm GPU support via pre-built PyTorch wheels (ROCm 7.1, tested on gfx1100/7900 XTX)
  • New nix run .#rocm app, dockerImageRocm, NixOS module gpuSupport = "rocm" option, and nix develop .#rocm dev shell
  • Replace cudaSupport boolean with gpuSupport enum ("cuda", "rocm", "none") across flake, packages, and NixOS module
  • ROCm Docker images and CI pipeline (ghcr.io/utensils/comfyui-nix:latest-rocm)

Cherry-picked from @pyqlsa's draft PR #28 (preserving authorship), with bug fixes and cleanup applied on top.

Closes #27

Changes from PR #28

  • Fix ROCm app incorrectly named cuda in nix/apps.nix (would shadow the actual CUDA app)
  • Fix mkPython passing boolean false instead of string "none" for gpuSupport
  • Fix flake description still referencing v0.12.2 instead of v0.14.2
  • Fix README Podman ROCm example referencing latest-cuda instead of latest-rocm
  • Fix ROCm torchaudio missing FFmpeg/sox autoPatchelfIgnoreMissingDeps (matching CUDA pattern)
  • Resolve all TODO/XXX review comments
  • Fix CHANGELOG footer links (missing [0.14.2] link, [Unreleased] pointing to v0.12.2)
  • Update CHANGELOG, CLAUDE.md, and README with ROCm documentation

Credit

ROCm implementation by @pyqlsa — thank you! Their commits are preserved with original authorship.

cc @pyqlsa @mr-bo-jangles

Test plan

  • nix flake check passes (ruff, pyright, nixfmt, shellcheck, package build)
  • nix build . — CPU default builds
  • nix build .#cuda — CUDA variant builds (regression check)
  • nix build .#rocm — ROCm variant builds
  • nix run .#rocm — hardware test on AMD GPU (needs @pyqlsa to verify on 7900 XTX)

pyqlsa and others added 3 commits February 19, 2026 20:58
Cherry-picked pyqlsa's ROCm implementation (commits 7e6f796, e2343fe)
and applied fixes on top:

- Fix ROCm app incorrectly named "cuda" in nix/apps.nix (would shadow CUDA)
- Fix mkPython passing boolean `false` instead of string `"none"` for gpuSupport
- Fix flake description still referencing v0.12.2 instead of v0.14.2
- Fix README Podman ROCm example referencing latest-cuda instead of latest-rocm
- Fix ROCm torchaudio missing FFmpeg/sox ignore deps (matching CUDA pattern)
- Resolve all TODO/XXX review comments left by pyqlsa
- Update CHANGELOG, CLAUDE.md, and README with ROCm documentation
- Fix CHANGELOG footer links (missing v0.14.2 link, Unreleased pointing to v0.12.2)

Closes #27
Co-authored-by: pyqlsa <26353308+pyqlsa@users.noreply.github.com>
@greptile-apps
Copy link

greptile-apps bot commented Feb 20, 2026

Greptile Summary

This PR adds comprehensive AMD ROCm GPU support to comfyui-nix, enabling AMD GPU acceleration via pre-built PyTorch wheels (ROCm 7.1, tested on gfx1100/7900 XTX).

Major changes:

  • Replaced boolean cudaSupport parameter with enum gpuSupport ("cuda", "rocm", "none") across flake, packages, and NixOS module
  • Added ROCm PyTorch wheel overrides (torch 2.10.0, torchvision 0.25.0, torchaudio 2.10.0) with proper autopatchelf configuration
  • Created nix run .#rocm app, dockerImageRocm, NixOS module gpuSupport = "rocm" option, and nix develop .#rocm dev shell
  • Extended CI pipeline to build and publish ROCm Docker images (ghcr.io/utensils/comfyui-nix:latest-rocm)
  • Fixed multiple bugs from the draft PR: app naming collision, incorrect false instead of "none", missing autopatchelf deps, outdated version references

Implementation quality:

  • Follows existing CUDA pattern consistently
  • Proper autopatchelf configuration with comprehensive missing deps list
  • Includes rocminfo in systemd service path to suppress startup warnings
  • Documentation thoroughly updated across README, CHANGELOG, and CLAUDE.md
  • Cherry-picked commits preserve original authorship from @pyqlsa

The refactor from boolean to enum is a clean architectural improvement that avoids future boolean parameter proliferation.

Confidence Score: 5/5

  • This PR is safe to merge with no significant issues
  • The implementation is thorough, well-tested, and follows established patterns from CUDA support. All bug fixes from the draft PR have been addressed, documentation is comprehensive, and the code follows project conventions. The refactor from boolean to enum is backwards-incompatible but necessary and well-documented.
  • No files require special attention - all changes follow consistent patterns

Important Files Changed

Filename Overview
.github/workflows/build.yml Added ROCm variant to CI matrix with proper build parallelism limits and manifest creation
flake.nix Replaced boolean cudaSupport with enum gpuSupport and added ROCm packages and dev shell
nix/modules/comfyui.nix Replaced boolean cuda option with enum gpuSupport for CUDA/ROCm/none selection
nix/python-overrides.nix Added ROCm PyTorch wheel overrides (torch, torchvision, torchaudio) with proper autopatchelf configuration
nix/versions.nix Added PyTorch ROCm 7.1 wheel URLs and hashes for torch 2.10.0, torchvision 0.25.0, torchaudio 2.10.0

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User: nix run .#rocm] --> B{gpuSupport Parameter}
    B -->|"none"| C[CPU PyTorch from nixpkgs]
    B -->|"cuda"| D[CUDA PyTorch 2.5.1 + cu124 wheels]
    B -->|"rocm"| E[ROCm PyTorch 2.10.0 + rocm7.1 wheels]
    
    E --> F[nix/python-overrides.nix]
    F --> G[torch wheel from pytorch.org]
    F --> H[torchvision wheel]
    F --> I[torchaudio wheel]
    
    G --> J[autoPatchelfHook]
    H --> J
    I --> J
    
    J --> K[ROCm libs: xz, zstd, bzip2]
    J --> L[Ignore bundled libs: libamdhip64, libMIOpen, etc.]
    
    E --> M[NixOS Module]
    M --> N{services.comfyui.gpuSupport}
    N -->|"rocm"| O[pkgs.comfy-ui-rocm]
    N -->|"cuda"| P[pkgs.comfy-ui-cuda]
    N -->|"none"| Q[pkgs.comfy-ui]
    
    O --> R[systemd service with rocminfo in path]
    
    E --> S[Docker Image]
    S --> T[comfy-ui:rocm]
    T --> U[--device /dev/kfd --device /dev/dri]
    
    E --> V[CI Pipeline]
    V --> W[Build with max-jobs 1, cores 2]
    W --> X[Push to ghcr.io/utensils/comfyui-nix:latest-rocm]
Loading

Last reviewed commit: 6d9a281

@jamesbrink jamesbrink mentioned this pull request Feb 20, 2026
@jamesbrink jamesbrink merged commit 8291491 into main Feb 20, 2026
9 checks passed
@jamesbrink jamesbrink deleted the feat/rocm-support branch February 20, 2026 16:39
@mr-bo-jangles
Copy link

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rocm support?

3 participants