Skip to content

[CUDA][HIP] incorrect linkage of shadow variable for inline device variable  #90749

Closed
@yxsamliu

Description

@yxsamliu

C++17 inline variables have weak linkage in ELF files, which means multiple copies in different translation units are merged into one copy by the linker.

nvcc emits it as weak in both device and host:

https://godbolt.org/z/n8EjvWKxe

currently clang only emits it as weak in device but not host. This causes multiple shadow variables registered for the same device variable.

https://godbolt.org/z/Maz7aMhcP

This caused issue in HIP:

ROCm/hip#3463

Metadata

Metadata

Assignees

Labels

cudaquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions