Skip to content

[ROCm] Rename duplicate hiprtc names for jit to avoid symbol collision#185656

Closed
alugorey wants to merge 1 commit into
pytorch:mainfrom
alugorey:hiprc_fp2bf16_fix
Closed

[ROCm] Rename duplicate hiprtc names for jit to avoid symbol collision#185656
alugorey wants to merge 1 commit into
pytorch:mainfrom
alugorey:hiprc_fp2bf16_fix

Conversation

@alugorey

@alugorey alugorey commented May 29, 2026

Copy link
Copy Markdown
Contributor

This file is excluded from hipify (see tools/amd_build/build_amd.py), so it
ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled fuser
kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime header
(hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time value
that does not reliably track whether the runtime hiprtc actually provides
these symbols), we keep PyTorch's own round-to-nearest-even implementation
and rename our private definitions via the preprocessor so they cannot
clash. hiprtc's definitions remain (parsed earlier in the translation unit)
but go unused. These #defines must stay in effect for the rest of the kernel
source -- do NOT #undef them, since the emitted kernel body calls these
conversions after this header is spliced in.

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

@pytorch-bot

pytorch-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 45db00f with merge base 56dc9a4 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot Bot added module: rocm AMD GPU support for Pytorch release notes: jit release notes category labels May 29, 2026
@alugorey
alugorey force-pushed the hiprc_fp2bf16_fix branch from efa00b1 to 8717a95 Compare June 8, 2026 21:29
@alugorey alugorey changed the title [ROCm] Add version checking in resource_strings [ROCm] Rename duplicate hiprtc names for jit to avoid symbol collision Jun 8, 2026
@alugorey
alugorey marked this pull request as ready for review June 8, 2026 21:48
@jithunnair-amd jithunnair-amd added ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/trunk Trigger trunk jobs on your pull request ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR labels Jun 8, 2026
@ezyang
ezyang requested a review from jeffdaily June 10, 2026 15:49
@ezyang ezyang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 10, 2026
@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -r

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch push -f https://github.com/alugorey/pytorch.git pull/185656/head:hiprc_fp2bf16_fix returned non-zero exit code 128

remote: Personal access tokens (classic) are forbidden from accessing this repository.
fatal: unable to access 'https://github.com/alugorey/pytorch.git/': The requested URL returned error: 403

Raised by https://github.com/pytorch/pytorch/actions/runs/27291278683

@pytorchmergebot

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@alugorey
alugorey force-pushed the hiprc_fp2bf16_fix branch from 8717a95 to 45db00f Compare June 10, 2026 18:03
@pytorch-bot

pytorch-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
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

dnikolaev-amd pushed a commit to dnikolaev-amd/rocm-pytorch that referenced this pull request Jun 12, 2026
pytorch#185656)

This file is excluded from hipify (see tools/amd_build/build_amd.py), so it
ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled fuser
kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime header
(hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time value
that does not reliably track whether the *runtime* hiprtc actually provides
these symbols), we keep PyTorch's own round-to-nearest-even implementation
and rename our private definitions via the preprocessor so they cannot
clash. hiprtc's definitions remain (parsed earlier in the translation unit)
but go unused. These #defines must stay in effect for the rest of the kernel
source -- do NOT #undef them, since the emitted kernel body calls these
conversions after this header is spliced in.

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

(cherry picked from commit 5ca8c13)
zjliu-amd pushed a commit to zjliu-amd/pytorch that referenced this pull request Jun 15, 2026
pytorch#185656)

This file is excluded from hipify (see tools/amd_build/build_amd.py), so it
ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled fuser
kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime header
(hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time value
that does not reliably track whether the *runtime* hiprtc actually provides
these symbols), we keep PyTorch's own round-to-nearest-even implementation
and rename our private definitions via the preprocessor so they cannot
clash. hiprtc's definitions remain (parsed earlier in the translation unit)
but go unused. These #defines must stay in effect for the rest of the kernel
source -- do NOT #undef them, since the emitted kernel body calls these
conversions after this header is spliced in.

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

(cherry picked from commit 5ca8c13)
pragupta pushed a commit to ROCm/pytorch that referenced this pull request Jun 15, 2026
…collision (#3303)

This file is excluded from hipify (see tools/amd_build/build_amd.py), so
it ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled
fuser kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime
header (hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time
value that does not reliably track whether the *runtime* hiprtc actually
provides these symbols), we keep PyTorch's own round-to-nearest-even
implementation and rename our private definitions via the preprocessor
so they cannot clash. hiprtc's definitions remain (parsed earlier in the
translation unit) but go unused. These #defines must stay in effect for
the rest of the kernel source -- do NOT #undef them, since the emitted
kernel body calls these conversions after this header is spliced in.

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

(cherry picked from commit 5ca8c13)

https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.

Co-authored-by: Andy Lugo <Andy.LugoReyes@amd.com>
pragupta pushed a commit to ROCm/pytorch that referenced this pull request Jun 17, 2026
#3310)

…collision (pytorch#185656)

This file is excluded from hipify (see tools/amd_build/build_amd.py), so
it ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled
fuser kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime
header (hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time
value that does not reliably track whether the *runtime* hiprtc actually
provides these symbols), we keep PyTorch's own round-to-nearest-even
implementation and rename our private definitions via the preprocessor
so they cannot clash. hiprtc's definitions remain (parsed earlier in the
translation unit) but go unused. These #defines must stay in effect for
the rest of the kernel source -- do NOT #undef them, since the emitted
kernel body calls these conversions after this header is spliced in.

Pull Request resolved: pytorch#185656
Approved by: https://github.com/jeffdaily
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
pytorch#185656)

This file is excluded from hipify (see tools/amd_build/build_amd.py), so it
ships its own self-contained __nv_bfloat16 type plus the
__float2bfloat16/__bfloat162float conversions for the runtime-compiled fuser
kernel. Starting with ROCm 7.x, hiprtc auto-injects a runtime header
(hiprtc_runtime.h) that also defines __float2bfloat16 returning
__hip_bfloat16. Since C++ cannot overload on return type alone, the two
definitions collide. Rather than gate on ROCM_VERSION (a build-time value
that does not reliably track whether the *runtime* hiprtc actually provides
these symbols), we keep PyTorch's own round-to-nearest-even implementation
and rename our private definitions via the preprocessor so they cannot
clash. hiprtc's definitions remain (parsed earlier in the translation unit)
but go unused. These #defines must stay in effect for the rest of the kernel
source -- do NOT #undef them, since the emitted kernel body calls these
conversions after this header is spliced in.

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

Labels

ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source release notes: jit release notes 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.

6 participants