Skip to content

fix: native Linux CUDA/ROCm backend download (Resolves #767) - #851

Open
1337hero wants to merge 4 commits into
jamiepine:mainfrom
1337hero:feature/linux-gpu-backend-download
Open

fix: native Linux CUDA/ROCm backend download (Resolves #767)#851
1337hero wants to merge 4 commits into
jamiepine:mainfrom
1337hero:feature/linux-gpu-backend-download

Conversation

@1337hero

@1337hero 1337hero commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Build and publish Linux CUDA and ROCm GPU server binaries. Installing either backend on Linux now downloads a native ELF, not a Windows .exe.

TLDR

PR #817 shipped Linux ROCm setup — just setup-python picks the right PyTorch index for AMD or NVIDIA, and the Docker entrypoint grants GPU device access. But the downloadable GPU backends (Settings → GPU → Install) still only published Windows assets. On Linux, the download "succeeded" and extracted a Windows binary. Voicebox fell back to CPU silently. Whomp whomp.

Why the other approach falls short

PR #770 blocks the Linux CUDA download with a 409 Conflict and tells users to run a Python backend instead. It's an OKish error message, not a fix. It leaves the ROCm path untouched, does not publish Linux server binaries, and asks Linux GPU users to bypass the app's own backend management.

This PR closes the gap: the same download flow works on Windows and Linux. No alternate workflow, no "use something else."

What changed

Release pipeline (.github/workflows/release.yml)

  • New build-cuda-linux and build-rocm-linux jobs. Each installs the GPU-specific PyTorch index first, builds with PyInstaller, and packages into platform-qualified archives.
  • Existing Windows jobs now attach -windows-x86_64 to asset names.

Asset naming (all download URLs)

  • voicebox-server-cuda.tar.gzvoicebox-server-cuda-linux-x86_64.tar.gz
  • cuda-libs-cu128-v1.tar.gzcuda-libs-linux-x86_64-cu128-v1.tar.gz
  • Same pattern for ROCm. The platform token is selected at download time by server_asset_platform().

Linux ROCm torch (vs. Windows)

  • Windows ships ROCm runtime via separate rocm_sdk wheels. The PyInstaller hook collects them explicitly.
  • Linux torch wheels from download.pytorch.org/whl/rocm bundle HIP/rocBLAS/hipBLASLt/aotriton .so inside torch/lib/. PyInstaller collects them automatically. The build_binary.py --rocm path now gates the explicit rocm_sdk collection on Windows.

Packaging scripts (package_cuda.py, package_rocm.py)

  • --platform flag for cross-platform CI runs. Default auto-detects from the host.
  • Linux classifier: leading lib prefix, versioned .so (e.g. libaotriton_v2.so.0.11.2), torch/lib/<library>/ kernel-data trees, torch/share/miopen/ kernel DBs.
  • Added rocroller and aotriton to ROCm file prefixes.

ROCm download gate (UI)

  • is_amd_rocm_capable() replaces is_amd_gpu_windows(). On Linux it checks /dev/kfd. Both paths are gated on SUPPORTED_GPU_ASSET_PLATFORMS so unsupported arches (e.g. linux-arm64) are not offered a 404.

Tests

  • server_asset_platform() unit tests pin the exact platform tokens.
  • is_amd_rocm_capable() tests cover Linux with/without /dev/kfd, ARM rejection, macOS rejection.
  • ROCm download tests pin the platform token so the URL contract is exercised regardless of the host.
  • Package tests assert the new archive names.

Tested

  • Hardware: Arch Linux, 3× Radeon AI PRO R9700 (gfx1201, RDNA4), ROCm 7.2.4
  • Result: The built ELF reports gpu_available: true, backend_variant: "rocm". End-to-end TTS generation verified.
  • CUDA Linux path: Build- and test-verified only (no NVIDIA hardware available).

Closes #767

Summary by CodeRabbit

  • New Features
    • Added platform-qualified GPU release bundles for Linux (x86_64) for both CUDA and ROCm, with matching .sha256 files.
    • ROCm backend availability now reflects AMD systems when required driver support is present.
  • Bug Fixes
    • Fixed Linux GPU downloads using Linux-native archives (not incompatible Windows artifacts), preventing silent CPU fallbacks.
    • Improved health reporting of ROCm capability across Windows and Linux.
  • Tests
    • Updated GPU packaging/download tests to match the new platform-aware asset naming.
  • Documentation
    • Updated the Linux “Unreleased” changelog entry describing the fix.

1337hero added 2 commits July 1, 2026 06:48
Installing the CUDA or ROCm backend on Linux downloaded a Windows .exe and
silently fell back to CPU: the release assets weren't platform-specific and
only Windows binaries were published.

- Platform-qualify GPU server assets: voicebox-server-{cuda,rocm}-<plat>.tar.gz
  and {cuda,rocm}-libs-<plat>-<version>.tar.gz, selected at download time via
  server_asset_platform().
- Add build-cuda-linux / build-rocm-linux release jobs. ROCm pulls torch from
  the PyTorch ROCm index (whose wheels bundle the HIP/rocBLAS/hipBLASLt/aotriton
  runtime) instead of the Windows-only rocm_sdk wheels; GPU torch is installed
  before requirements.txt so pip never resolves the default CUDA stack.
- build_binary.py --rocm: gate the Windows rocm_sdk collection/hook on Windows;
  on Linux PyInstaller's torch hook collects the bundled .so runtime directly.
- package_{rocm,cuda}.py: --platform flag; Linux-aware classifier (leading-lib
  and versioned .so, torch/lib/<lib>/ + torch/share/miopen kernel-data trees).
- Offer the ROCm download on Linux AMD hosts (/dev/kfd), gated to platforms we
  actually build so unsupported arches aren't offered a 404.
- Pin free-disk-space by SHA; unit-test the asset-platform contract.

Verified end-to-end on Linux/gfx1201 (3x Radeon AI PRO R9700): the built ELF
reports gpu_available + ROCm + backend_variant=rocm. CUDA Linux path is
build/test-verified only (no NVIDIA hardware).
- require --platform in package_cuda/package_rocm; drop the triplicated
  platform_tag() auto-detect (CI always passes it explicitly)
- share matches_lib_prefix() and sha256_file() from package_cuda in
  package_rocm instead of copy-pasting
- collapse build-cuda-linux/build-rocm-linux into one matrixed
  build-gpu-linux job so the variants can't drift
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds platform-aware GPU asset naming across the release pipeline, introduces Linux ROCm capability detection, updates packaging and download flows to use platform-qualified archive names, and adds a Linux GPU release build job.

Changes

Platform-qualified GPU assets and Linux ROCm support

Layer / File(s) Summary
Platform token and ROCm capability detection
backend/utils/platform_detect.py, backend/routes/health.py, backend/models.py, app/src/lib/api/types.ts, app/src/components/ServerTab/GpuPage.tsx, backend/build_binary.py, backend/tests/test_amd_gpu_detect.py
Adds server_asset_platform() and is_amd_rocm_capable(), updates health reporting and comments to include Linux ROCm support, restricts ROCm SDK bundling in build_binary.py to Windows, and adds tests for the new helpers.
Packaging scripts accept --platform and reclassify library files
scripts/package_cuda.py, scripts/package_rocm.py, backend/tests/test_package_rocm.py
Adds a required --platform CLI argument to both packaging scripts, introduces shared matches_lib_prefix() for library classification, generates platform-tokenized archive/sha256 filenames, expands ROCm directory markers, and updates packaging tests to the Linux onedir layout.
Download services use platform-qualified asset names
backend/services/cuda.py, backend/services/rocm.py, backend/tests/test_rocm_download.py
CUDA and ROCm download services compute server_asset_platform() to build platform-suffixed release archive names, with tests pinning the platform and matching mocked download URLs.
Release workflow and changelog updates
.github/workflows/release.yml, CHANGELOG.md
Windows CUDA/ROCm packaging steps now pass --platform; upload asset lists use platform-suffixed names; a new build-gpu-linux job builds/packages CUDA and ROCm backends for Linux; the changelog documents the Linux fix.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant health.py
  participant platform_detect.py
  health.py->>platform_detect.py: is_amd_rocm_capable()
  platform_detect.py->>platform_detect.py: server_asset_platform()
  alt Windows
    platform_detect.py->>platform_detect.py: is_amd_gpu_windows()
  else Linux
    platform_detect.py->>platform_detect.py: check /dev/kfd exists
  end
  platform_detect.py-->>health.py: supports_rocm boolean
Loading
sequenceDiagram
  participant cuda.py / rocm.py
  participant platform_detect.py
  participant GitHub Release
  cuda.py / rocm.py->>platform_detect.py: server_asset_platform()
  platform_detect.py-->>cuda.py / rocm.py: platform token
  cuda.py / rocm.py->>GitHub Release: fetch server/libs archive with platform token in filename
  GitHub Release-->>cuda.py / rocm.py: archive + sha256
Loading

Possibly related PRs

  • jamiepine/voicebox#298: Extends the CUDA dual-archive split from that PR by adding platform-qualified naming via server_asset_platform() and a new --platform/plat argument in package_cuda.py/cuda.py.
  • jamiepine/voicebox#538: Shares the same ROCm download/packaging and health/asset-platform detection area, updating rocm.py and health.py in the same feature space.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing native Linux CUDA/ROCm backend downloads.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 367-381: The new write-permission job in release workflow needs
hardening around checkout and pip caching. Update the `actions/checkout@v4` step
in `build-gpu-linux` to disable persisted git credentials via
`persist-credentials: false`, and review the `actions/setup-python@v5` step so
`cache: "pip"` is either removed or narrowly scoped for this job because it can
be used before a release push. Use the `build-gpu-linux` job and the
`actions/checkout` / `actions/setup-python` steps as the identifiers to locate
the changes.

In `@backend/services/cuda.py`:
- Around line 290-292: The CUDA download path in cuda.py is using
server_asset_platform() without checking whether the host is actually supported,
which can produce a non-existent asset name on unsupported platforms. Add a
CUDA-specific platform guard in the download flow before constructing
server_archive and libs_archive, using the same kind of supported-platform check
pattern as SUPPORTED_GPU_ASSET_PLATFORMS, so unsupported hosts are rejected
before any download is attempted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63abd598-391d-4132-abc7-5a52c70d08e1

📥 Commits

Reviewing files that changed from the base of the PR and between b542768 and 7903735.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • .github/workflows/release.yml
  • CHANGELOG.md
  • app/src/components/ServerTab/GpuPage.tsx
  • app/src/lib/api/types.ts
  • backend/build_binary.py
  • backend/models.py
  • backend/routes/health.py
  • backend/services/cuda.py
  • backend/services/rocm.py
  • backend/tests/test_amd_gpu_detect.py
  • backend/tests/test_package_rocm.py
  • backend/tests/test_rocm_download.py
  • backend/utils/platform_detect.py
  • scripts/package_cuda.py
  • scripts/package_rocm.py

Comment thread .github/workflows/release.yml
Comment thread backend/services/cuda.py
…coping

- Add SUPPORTED_GPU_ASSET_PLATFORMS guard in CUDA download flow
  to reject unsupported platforms before constructing asset URLs
- Disable persisted git credentials in build-gpu-linux checkout step
- Remove unused pip cache from build-gpu-linux setup-python step

Both changes reduce the attack surface of write-permission release jobs
and prevent silent 404s on unsupported platforms.
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.

Bug: Linux CUDA backend download installs Windows executable (voicebox-server-cuda.exe)

1 participant