Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix TorchCPP Ext accelerator detection ROCm#170784

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
thiagocrepaldi wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromtfernand/fix-torch-cpp-ext-build-dir

Conversation

@thiagocrepaldi
Copy link
Collaborator

@thiagocrepaldithiagocrepaldi commentedDec 18, 2025
edited by pytorch-botbot
Loading

Previously, _get_build_directory only checked for CUDA and defaulted to 'cpu' for all other cases, causing build directory conflicts when extensions were built for different GPU accelerators (ROCm/HIP, SYCL/XPU).

This fix extends accelerator detection to properly handle:

  • ROCm/HIP: Checks torch.version.hip first (highest priority)
  • CUDA: Uses torch.backends.cuda.is_built() and torch.version.cuda
  • SYCL/XPU: Checks torch.xpu._is_compiled() and torch.version.xpu
  • CPU: Default fallback

The build directory now includes the correct accelerator prefix (e.g., py310_rocm542, py310_cu118, py310_xpu2024, py310_cpu), preventing conflicts between extensions built for different accelerators on the same system.

Priority order: ROCm/HIP > CUDA > SYCL/XPU > CPU

Fixes#170778

cc@janeyx99@jeffdaily@sunway513@jithunnair-amd@pruthvistony@ROCmSupport@jataylo@hongxiayang@naromero77amd@pragupta@jerrymannil@xinyazhang

@pytorch-bot
Copy link

pytorch-botbot commentedDec 18, 2025
edited
Loading

🔗 Helpful Links

🧪 See artifacts and rendered test results athud.pytorch.org/pr/170784

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

✅ No Failures

As of commitc1549ae with merge base562a337 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-botpytorch-botbot added ciflow/rocm-mi300Trigger "default" config CI on ROCm MI300 module: rocmAMD GPU support for Pytorch labelsDec 18, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easyclabot commentedDec 18, 2025
edited
Loading

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: thiagocrepaldi / name: Thiago Crepaldi (c1549ae)

@thiagocrepaldithiagocrepaldiforce-pushed thetfernand/fix-torch-cpp-ext-build-dir branch from86b7930 to56d59f7CompareDecember 18, 2025 17:02
@thiagocrepaldi
Copy link
CollaboratorAuthor

@pytorchbot label "topic: not user facing"

pytorch-bot[bot] reacted with thumbs up emoji

@pytorch-botpytorch-botbot added the topic: not user facingtopic category labelDec 18, 2025
@thiagocrepaldithiagocrepaldiforce-pushed thetfernand/fix-torch-cpp-ext-build-dir branch from56d59f7 to4c23370CompareDecember 18, 2025 17:03
@thiagocrepaldithiagocrepaldiforce-pushed thetfernand/fix-torch-cpp-ext-build-dir branch 2 times, most recently from4fa05bc to65f5c63CompareDecember 18, 2025 17:11
Previously, _get_build_directory only checked for CUDA and defaulted to'cpu' for all other cases, causing build directory conflicts whenextensions were built for different GPU accelerators (ROCm/HIP, SYCL/XPU).This fix extends accelerator detection to properly handle:- ROCm/HIP: Checks torch.version.hip first (highest priority)- CUDA: Uses torch.backends.cuda.is_built() and torch.version.cuda- SYCL/XPU: Checks torch.xpu._is_compiled() and torch.version.xpu- CPU: Default fallbackThe build directory now includes the correct accelerator prefix(e.g., py310_rocm542, py310_cu118, py310_xpu2024, py310_cpu),preventing conflicts between extensions built for differentaccelerators on the same system.Priority order: ROCm/HIP > CUDA > SYCL/XPU > CPU
@thiagocrepaldithiagocrepaldiforce-pushed thetfernand/fix-torch-cpp-ext-build-dir branch from65f5c63 toc1549aeCompareDecember 18, 2025 17:11
@thiagocrepaldithiagocrepaldi added the module: cpp-extensionsRelated to torch.utils.cpp_extension labelDec 18, 2025
@thiagocrepaldi
Copy link
CollaboratorAuthor

is it possible to target it to milestone 2.10 due in January?

@thiagocrepaldithiagocrepaldi changed the titleFix TorchCPP Ext accelerator detection ROCm/XPUFix TorchCPP Ext accelerator detection ROCmDec 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@malfetmalfetmalfet approved these changes

@fmassafmassaAwaiting requested review from fmassafmassa is a code owner

@ezyangezyangAwaiting requested review from ezyangezyang is a code owner

Assignees

No one assigned

Labels

ciflow/rocm-mi300Trigger "default" config CI on ROCm MI300module: cpp-extensionsRelated to torch.utils.cpp_extensionmodule: rocmAMD GPU support for Pytorchopen sourcetopic: not user facingtopic category

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

torch-cpp incorrectly detect ROCm as CPU build

4 participants

@thiagocrepaldi@malfet@pytorchbot

[8]ページ先頭

©2009-2025 Movatter.jp