-
Notifications
You must be signed in to change notification settings - Fork 548
feat: AMD ROCm GPU support — device enumeration, compile mode, SDPA fix #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nikopueringer
merged 7 commits into
nikopueringer:main
from
JamesNyeVRGuy:feat/amd-rocm-support
Mar 27, 2026
+440
−209
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5acb900
feat: AMD ROCm GPU support — device enumeration, compile mode, SDPA fix
JamesNyeVRGuy a15655a
refactor: address PR review — deduplicate ROCm detection, harden parsing
JamesNyeVRGuy a9a49fe
cleanup: address self-review — remove dead code, fix comments, improv…
JamesNyeVRGuy f71edff
feat: add rocm as a proper uv extra instead of manual pip install
JamesNyeVRGuy ebe684d
chore: update uv.lock with rocm extra
JamesNyeVRGuy dfdf14d
fix: make setup_rocm_env() run before torch import, fix HIP_PATH docs…
JamesNyeVRGuy fe61b01
style: format test_pyproject_structure.py
JamesNyeVRGuy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,11 @@ cuda = [ | |
| mlx = [ | ||
| "corridorkey-mlx ; python_version >= '3.11'", | ||
| ] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rocm = [
"torch==2.8.0",
"torchvision==0.23.0",
] |
||
| rocm = [ | ||
| "torch==2.8.0", | ||
| "torchvision==0.23.0", | ||
| "pytorch-triton-rocm==3.4.0 ; platform_machine == 'x86_64' and sys_platform == 'linux'", | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = ["pytest", "pytest-cov", "ruff", "hypothesis"] | ||
|
|
@@ -111,6 +116,7 @@ conflicts = [ | |
| [ | ||
| { extra = "cuda" }, | ||
| { extra = "mlx" }, | ||
| { extra = "rocm" }, | ||
| ], | ||
| ] | ||
|
|
||
|
|
@@ -120,9 +126,22 @@ url = "https://download.pytorch.org/whl/cu128" # CUDA 12.6 doesn't support RTX 5 | |
| explicit = true | ||
| extra = "cuda" | ||
|
|
||
| [[tool.uv.index]] | ||
| name = "pytorch-rocm" | ||
| url = "https://download.pytorch.org/whl/rocm6.3" | ||
| explicit = true | ||
| extra = "rocm" | ||
|
|
||
| [tool.uv.sources] | ||
| # Use Hiera fix in order to utilize the FlashAttention Kernel | ||
| timm = { git = "https://github.com/Raiden129/pytorch-image-models-fix", branch = "fix/hiera-flash-attention-global-4d" } | ||
| torch = { index = "pytorch", extra = "cuda" } | ||
| torchvision = { index = "pytorch", extra = "cuda" } | ||
| torch = [ | ||
| { index = "pytorch", extra = "cuda" }, | ||
| { index = "pytorch-rocm", extra = "rocm" }, | ||
| ] | ||
| torchvision = [ | ||
| { index = "pytorch", extra = "cuda" }, | ||
| { index = "pytorch-rocm", extra = "rocm" }, | ||
| ] | ||
| pytorch-triton-rocm = { index = "pytorch-rocm", extra = "rocm" } | ||
| corridorkey-mlx = { git = "https://github.com/nikopueringer/corridorkey-mlx.git", extra = "mlx" } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that the WSL2 section in the README uses different wheels -> torch 2.9.1 from
repo.radeon.comwhich are AMD's WSL-specific builds. Those were originally there because the standard ROCm wheels weren't tested on WSL2 at the time.Now that
uv sync --extra rocmworks, the WSL2 section could potentially just point to that instead. The separate AMD WSL wheels + manual ROCm driver install may still be needed for some setups though (older drivers, specific GPU quirks), so I'm inclined to keep both paths documented.