KEMBAR78
[ROCm][Windows] Fixing undefined symbol linker error after exposing MIOpen symbols by tvukovic-amd · Pull Request #156479 · pytorch/pytorch · GitHub
Skip to content

Conversation

@tvukovic-amd
Copy link
Contributor

@tvukovic-amd tvukovic-amd commented Jun 20, 2025

Fixing undefined symbol linker error after exposing MIOpen symbols.
This fix:

  • Hipifies aten/src/ATen/miopen and aten/src/ATen/native/miopen files
  • Adds aten/src/ATen/miopen and aten/src/ATen/native/miopen hipified source files to all_hip_cpp list

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang @naromero77amd

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 20, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (1 Unrelated Failure)

As of commit 981cdb0 with merge base 2d39a48 (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot pytorch-bot bot added the module: rocm AMD GPU support for Pytorch label Jun 20, 2025
@tvukovic-amd
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Jun 20, 2025
@jerryzh168 jerryzh168 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 21, 2025
@jeffdaily
Copy link
Collaborator

I don't understand why this is needed. We're not getting missing symbols in our CI or nightly wheels on linux.

@tvukovic-amd
Copy link
Contributor Author

I don't understand why this is needed. We're not getting missing symbols in our CI or nightly wheels on linux.

TORCH_CUDA_CPP_API macro is added in aten/src/ATen/miopen and aten/src/ATen/native/miopen files. It defines __declspec(dllexport)/__declspec(dllimport) for Windows or __attribute__((__visibility__("default"))) for Linux.
On Windows this leads to lld-link: error: undefined symbol: __declspec(dllimport) error for all structs from aten/src/ATen/miopen and aten/src/ATen/native/miopen while linking torch_hip.dll.
TORCH_CUDA_CPP_API needs to be hipified to TORCH_HIP_CPP_API on ROCm usage according to [ROCm][Windows] Fix export macros, so hipified files should be used to link with torch_hip.dll.

Copy link
Collaborator

@jeffdaily jeffdaily left a comment

Choose a reason for hiding this comment

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

The miopen source files should not be hipified. They should contain the necessary HIP calls directly. Please try manually hipifiying those symbols under the miopen source tree.

TORCH_CUDA_CPP_API --> TORCH_HIP_CPP_API

Then commit those changes to this PR.

@jeffdaily jeffdaily self-requested a review June 24, 2025 21:48
@jeffdaily jeffdaily added the ciflow/rocm Trigger "default" config CI on ROCm label Jun 24, 2025
@tvukovic-amd
Copy link
Contributor Author

The miopen source files should not be hipified. They should contain the necessary HIP calls directly. Please try manually hipifiying those symbols under the miopen source tree.

TORCH_CUDA_CPP_API --> TORCH_HIP_CPP_API

Then commit those changes to this PR.

I rebuilt pytorch with this change to double check and it works on Windows as expected, I see that you already pushed changes.

@jeffdaily
Copy link
Collaborator

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased fix_miopen_hipify onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout fix_miopen_hipify && git pull --rebase)

@pytorch-bot pytorch-bot bot removed the ciflow/rocm Trigger "default" config CI on ROCm label Jun 26, 2025
@jeffdaily jeffdaily added the ciflow/rocm Trigger "default" config CI on ROCm label Jun 27, 2025
@jeffdaily
Copy link
Collaborator

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 27, 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

tvukovic-amd added a commit to ROCm/pytorch that referenced this pull request Jul 23, 2025
…IOpen symbols (pytorch#156479)

Fixing undefined symbol linker error after [exposing MIOpen symbols](pytorch#154545).
This fix:

- Hipifies `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` files
- Adds `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` hipified source files to `all_hip_cpp` list

Pull Request resolved: pytorch#156479
Approved by: https://github.com/jeffdaily

Co-authored-by: Jeff Daily <jeff.daily@amd.com>
tvukovic-amd added a commit to ROCm/pytorch that referenced this pull request Jul 23, 2025
…IOpen symbols (pytorch#156479)

Fixing undefined symbol linker error after [exposing MIOpen symbols](pytorch#154545).
This fix:

- Hipifies `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` files
- Adds `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` hipified source files to `all_hip_cpp` list

Pull Request resolved: pytorch#156479
Approved by: https://github.com/jeffdaily

Co-authored-by: Jeff Daily <jeff.daily@amd.com>
tvukovic-amd added a commit to ROCm/pytorch that referenced this pull request Jul 25, 2025
…IOpen symbols (pytorch#156479)

Fixing undefined symbol linker error after [exposing MIOpen symbols](pytorch#154545).
This fix:

- Hipifies `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` files
- Adds `aten/src/ATen/miopen` and `aten/src/ATen/native/miopen` hipified source files to `all_hip_cpp` list

Pull Request resolved: pytorch#156479
Approved by: https://github.com/jeffdaily

Co-authored-by: Jeff Daily <jeff.daily@amd.com>
jeffdaily added a commit to ROCm/pytorch that referenced this pull request Aug 25, 2025
…IOpen symbols (#2415)

Changing TORCH_CUDA_CPP_API macros to TORCH_HIP_CPP in MIOpen header
files according to closed
[PR](pytorch#156479) in pytorch
upstream.

---------

Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@amd.com>
Co-authored-by: Jithun Nair <jithun.nair@amd.com>
Co-authored-by: Ethan Wee <Ethan.Wee@amd.com>
Co-authored-by: Jithun Nair <37884920+jithunnair-amd@users.noreply.github.com>
Co-authored-by: Xinya Zhang <Xinya.Zhang@amd.com>
Co-authored-by: Prachi Gupta <pracgupt@amd.com>
Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
Co-authored-by: iupaikov-amd <Iurii.Paikov@amd.com>
Co-authored-by: omkar kakarparthi <75638701+okakarpa@users.noreply.github.com>
Co-authored-by: Jeff Daily <jeff.daily@amd.com>
Co-authored-by: rocm-mici <49319081+rocm-mici@users.noreply.github.com>
Co-authored-by: Michael Halkenhäuser <michaelhalk@web.de>
Co-authored-by: Hashem Hashemi <hashem.hashemi@amd.com>
Co-authored-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@amd.com>
Co-authored-by: Andres Lugo <108368282+alugorey@users.noreply.github.com>
Co-authored-by: pmaybank <113125070+pmaybank@users.noreply.github.com>
Co-authored-by: pnikolic-amd <pnikolic@amd.com>
Co-authored-by: Jerry Mannil <65309407+jerrymannil@users.noreply.github.com>
Co-authored-by: Sampsa Riikonen <sriikone@amd.com>
Co-authored-by: Ramya Ramineni <62723901+rraminen@users.noreply.github.com>
Co-authored-by: pytorchbot <soumith+bot@pytorch.org>
Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com>
Co-authored-by: rzou <zou3519@gmail.com>
Co-authored-by: atalman <atalman@fb.com>
Co-authored-by: David Berard <dberard@fb.com>
Co-authored-by: Frank Lin <eee4017@gmail.com>
Co-authored-by: Wei Wang <weiwan@nvidia.com>
Co-authored-by: Cao E <e.cao@intel.com>
Co-authored-by: Sidharth Subbarao <55903556+Sidharth123-cpu@users.noreply.github.com>
Co-authored-by: Camyll Harajli <camyllh@meta.com>
Co-authored-by: Aditya Tewari <aditya.tewari@arm.com>
Co-authored-by: Christopher Sidebottom <chris.sidebottom@arm.com>
Co-authored-by: Ryo Suzuki <ryo.suzuki@arm.com>
Co-authored-by: Ye Tao <ye.tao@arm.com>
Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
Co-authored-by: Eli Uriegas <1700823+seemethere@users.noreply.github.com>
Co-authored-by: Luca Wehrstedt <lcw@meta.com>
Co-authored-by: Robert Hardwick <robert.hardwick@arm.com>
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Co-authored-by: Michael Lazos <mlazos@meta.com>
Co-authored-by: bobrenjc93 <bobren@meta.com>
Co-authored-by: Nikita Shulga <nshulga@meta.com>
Co-authored-by: Jane Xu <janeyx@meta.com>
Co-authored-by: charlifu <charlifu@amd.com>
Co-authored-by: Jack Taylor <108682042+jataylo@users.noreply.github.com>
Co-authored-by: Nichols A. Romero <165712832+naromero77amd@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Sriram Kumar <skishore@amd.com>
Co-authored-by: Divin Honnappa <divin.honnappa@amd.com>
Co-authored-by: akashveramd <Akash.Verma3@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rocm Trigger "default" config CI on ROCm ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source topic: not user facing topic category 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.

5 participants