Skip to content

[ROCm/Windows] Support load_inline on windows#162577

Closed
jammm wants to merge 1 commit intopytorch:mainfrom
jammm:jam/rocm_loadinline_windows
Closed

[ROCm/Windows] Support load_inline on windows#162577
jammm wants to merge 1 commit intopytorch:mainfrom
jammm:jam/rocm_loadinline_windows

Conversation

@jammm
Copy link
Contributor

@jammm jammm commented Sep 10, 2025

Supports torch.utils.cpp_extension.load_inline on Windows with ROCm.
Tested on Windows with gfx1201.

Note that it currently only works when CC and CXX are set to clang-cl. This is also needed when building extensions via. setuptools due to linker errors when using cl directly.

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang @naromero77amd

@pytorch-bot pytorch-bot bot added the module: rocm AMD GPU support for Pytorch label Sep 10, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 10, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/162577

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 7f135b0 with merge base b494547 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@jammm
Copy link
Contributor Author

jammm commented Sep 10, 2025

cc @msaroufim

@jammm
Copy link
Contributor Author

jammm commented Sep 10, 2025

@pytorchbot label "release notes: rocm"
@pytorchbot label "module: rocm"

@pytorch-bot pytorch-bot bot added the release notes: rocm mandatorylabel label Sep 10, 2025
@jammm
Copy link
Contributor Author

jammm commented Sep 10, 2025

@pytorchbot label "module: rocm"

@jammm
Copy link
Contributor Author

jammm commented Sep 10, 2025

@pytorchbot label "module: windows"

@pytorch-bot pytorch-bot bot added the module: windows Windows support for PyTorch label Sep 10, 2025
@msaroufim
Copy link
Member

Do we have rocm windows machines in CI. Not sure how I'd go about testing this since I don't know an AMD gaming card either

@jammm
Copy link
Contributor Author

jammm commented Sep 10, 2025

Do we have rocm windows machines in CI. Not sure how I'd go about testing this since I don't know an AMD gaming card either

Not yet, it's WIP #160776

COMMON_HIP_FLAGS.extend(['-fms-runtime-lib=dll'])
cflags = common_cflags + ['/std:c++17'] + extra_cflags
cflags += COMMON_HIP_FLAGS if IS_HIP_EXTENSION else COMMON_MSVC_FLAGS
cflags += COMMON_MSVC_FLAGS + COMMON_HIP_FLAGS if IS_HIP_EXTENSION else []
Copy link
Contributor

Choose a reason for hiding this comment

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

hol' up, you got rid of COMMON_MSVC_FLAGS in the non IS_HIP_EXTENSION case!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks for the catch. How about cflags += COMMON_MSVC_FLAGS + (COMMON_HIP_FLAGS if IS_HIP_EXTENSION else []) ? Adding brackets around it so COMMON_MSVC_FLAGS is always added

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

non-HIP codepath affected

@jammm jammm force-pushed the jam/rocm_loadinline_windows branch from 0ebf64c to 7f135b0 Compare September 11, 2025 06:29
@jammm jammm requested a review from ezyang September 11, 2025 06:30
@ezyang
Copy link
Contributor

ezyang commented Sep 12, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 12, 2025
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / win-vs2022-cpu-py3 / build

Details for Dev Infra team Raised by workflow job

@jammm
Copy link
Contributor Author

jammm commented Sep 12, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 12, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
Supports `torch.utils.cpp_extension.load_inline` on Windows with ROCm.
Tested on Windows with gfx1201.

Note that it currently only works when CC and CXX are set to `clang-cl`. This is also needed when building extensions via. `setuptools` due to linker errors when using `cl` directly.

Pull Request resolved: pytorch#162577
Approved by: https://github.com/ezyang
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
Supports `torch.utils.cpp_extension.load_inline` on Windows with ROCm.
Tested on Windows with gfx1201.

Note that it currently only works when CC and CXX are set to `clang-cl`. This is also needed when building extensions via. `setuptools` due to linker errors when using `cl` directly.

Pull Request resolved: pytorch#162577
Approved by: https://github.com/ezyang
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
Supports `torch.utils.cpp_extension.load_inline` on Windows with ROCm.
Tested on Windows with gfx1201.

Note that it currently only works when CC and CXX are set to `clang-cl`. This is also needed when building extensions via. `setuptools` due to linker errors when using `cl` directly.

Pull Request resolved: pytorch#162577
Approved by: https://github.com/ezyang
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
Supports `torch.utils.cpp_extension.load_inline` on Windows with ROCm.
Tested on Windows with gfx1201.

Note that it currently only works when CC and CXX are set to `clang-cl`. This is also needed when building extensions via. `setuptools` due to linker errors when using `cl` directly.

Pull Request resolved: pytorch#162577
Approved by: https://github.com/ezyang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch module: windows Windows support for PyTorch open source release notes: rocm mandatorylabel triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants