Skip to content

fix: remove hardcoded HSA_OVERRIDE_GFX_VERSION for RX 7000#736

Open
scarnago wants to merge 1 commit into
jamiepine:mainfrom
scarnago:fix/rocm-gfx1100-detection
Open

fix: remove hardcoded HSA_OVERRIDE_GFX_VERSION for RX 7000#736
scarnago wants to merge 1 commit into
jamiepine:mainfrom
scarnago:fix/rocm-gfx1100-detection

Conversation

@scarnago

@scarnago scarnago commented Jun 7, 2026

Copy link
Copy Markdown

Problem

The current backend/app.py hardcodes HSA_OVERRIDE_GFX_VERSION=10.3.0, which is the value for RX 6000 series (RDNA 2).

On newer GPUs like the RX 7900 XTX (gfx1100, RDNA 3), this prevents ROCm 7.2+ from auto-detecting the correct architecture, causing GPU initialization issues.

Solution

Remove the hardcoded default. ROCm 7.2+ auto-detects gfx architecture natively.

Users with older GPUs can still set HSA_OVERRIDE_GFX_VERSION manually if needed.

Testing

Verified on Linux + ROCm 7.2.1 + RX 7900 XTX:

  • Backend starts correctly
  • Health endpoint reports: GPU: ROCm (Radeon RX 7900 XTX)

Impact

  • Fixes: RX 7000 series (RDNA 3) support on Linux
  • Preserves: Manual override still possible via env var
  • Maintains: RX 6000 users can set HSA_OVERRIDE_GFX_VERSION=10.3.0 if needed

Summary by CodeRabbit

  • Documentation

    • Clarified AMD GPU environment variable requirements and noted improved auto-detection support for newer ROCm systems.
  • Changes

    • Removed unconditional defaulting of an AMD GPU environment variable; app now attempts safe auto-detection at startup and will leave settings unchanged if detection fails, requiring explicit configuration when needed.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a75f3678-1437-44d8-b84b-900ab78971af

📥 Commits

Reviewing files that changed from the base of the PR and between 8c4a7e0 and 0085cb9.

📒 Files selected for processing (1)
  • backend/app.py

📝 Walkthrough

Walkthrough

The PR removes the unconditional HSA_OVERRIDE_GFX_VERSION fallback, documents AMD import-order for torch, and adds logic: if the env var is unset, run rocminfo, extract a gfx### token, convert it to a major.minor.patch string, and set HSA_OVERRIDE_GFX_VERSION; errors are ignored.

Changes

AMD GPU Configuration Documentation

Layer / File(s) Summary
rocminfo-based HSA_OVERRIDE_GFX_VERSION detection
backend/app.py
Removed unconditional HSA_OVERRIDE_GFX_VERSION="10.3.0" defaulting; added import-order documentation and conditional startup logic that runs rocminfo, regex-parses a gfx### value to construct a major.minor.patch string, and sets HSA_OVERRIDE_GFX_VERSION in os.environ when the variable was unset; detection errors are swallowed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I checked the air for gfx and name,
rocminfo whispered, I set the frame.
If numbers hide, I let it be,
Torch can start — or quietly free.
A hop, a sniff, environment in tune.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: remove hardcoded HSA_OVERRIDE_GFX_VERSION for RX 7000' accurately summarizes the main change: removing a hardcoded GPU environment variable that was blocking RX 7000 GPU support.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@scarnago scarnago force-pushed the fix/rocm-gfx1100-detection branch from 1cd05a3 to 8c4a7e0 Compare June 7, 2026 21:39

@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: 1

🧹 Nitpick comments (1)
backend/app.py (1)

44-44: ⚡ Quick win

Split imports onto separate lines.

Per PEP 8 and Ruff E401, imports should be on separate lines for readability.

📦 Proposed fix
-        import subprocess, re
+        import re
+        import subprocess
🤖 Prompt for 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.

In `@backend/app.py` at line 44, The import statement "import subprocess, re"
should be split into separate lines to satisfy PEP 8 / Ruff E401; replace the
single combined import with two distinct imports (e.g., separate import
subprocess and import re) in backend/app.py where the current combined import
appears so each module is imported on its own line.

Source: Linters/SAST tools

🤖 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 `@backend/app.py`:
- Around line 52-55: The version-parsing code in backend/app.py currently uses
major.lstrip('0')/minor.lstrip('0')/patch.lstrip('0') which removes all leading
zeros incorrectly (e.g., "10" → "1"); change the logic to parse each slice as an
integer then convert back to string (e.g., int(major_slice) or 0) so gfx (the
gfx variable and the slices assigned to major/minor/patch) yields correct
version strings when building version in the version = f"...{...}.{...}.{...}"
expression; update the expressions that compute major, minor, patch and the
final version formation accordingly to use int(...) safely and fallback to 0.

---

Nitpick comments:
In `@backend/app.py`:
- Line 44: The import statement "import subprocess, re" should be split into
separate lines to satisfy PEP 8 / Ruff E401; replace the single combined import
with two distinct imports (e.g., separate import subprocess and import re) in
backend/app.py where the current combined import appears so each module is
imported on its own line.
🪄 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: f738a63d-4e4c-4873-89b7-cc9b47b8da28

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd05a3 and 8c4a7e0.

📒 Files selected for processing (1)
  • backend/app.py

Comment thread backend/app.py Outdated
Replaces the hardcoded HSA_OVERRIDE_GFX_VERSION=10.3.0 (RX 6000 series)
with dynamic detection using rocminfo. This enables out-of-the-box
support for newer GPUs like RX 7000 series (gfx1100 / RDNA 3).

Logic:
- If user already set HSA_OVERRIDE_GFX_VERSION, respect it
- Otherwise run rocminfo and parse gfxXXXX string
- Convert gfx1100 → 11.0.0, gfx1030 → 10.3.0, etc.
- If rocminfo fails or is missing, fall through silently

Verified on:
- Linux + ROCm 7.2.1 + RX 7900 XTX (gfx1100)
- Backend correctly detects: GPU: ROCm (Radeon RX 7900 XTX)
@scarnago scarnago force-pushed the fix/rocm-gfx1100-detection branch from 8c4a7e0 to 0085cb9 Compare June 7, 2026 21:51
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.

1 participant