Commit abd8cd9
committed
[CUDA][HIP] Fix linkage for -fgpu-rdc
Currently for explicit template function instantiation in CUDA/HIP device
compilation clang emits instantiated kernel with external linkage
and instantiated device function with internal linkage.
This is fine for -fno-gpu-rdc since there is only one TU.
However this causes duplicate symbols for kernels for -fgpu-rdc if
the same instantiation happen in multiple TU. Or missing symbols
if a device function calls an explicitly instantiated template function
in a different TU.
To make explicit template function instantiation work for
-fgpu-rdc we need to follow the C++ linkage paradigm, i.e.
use weak_odr linkage.
Differential Revision: https://reviews.llvm.org/D903111 parent c009d11 commit abd8cd9
File tree
2 files changed
+26
-4
lines changed- clang
- lib/CodeGen
- test/CodeGenCUDA
2 files changed
+26
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4483 | 4483 | | |
4484 | 4484 | | |
4485 | 4485 | | |
4486 | | - | |
| 4486 | + | |
4487 | 4487 | | |
4488 | | - | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
4489 | 4491 | | |
4490 | | - | |
| 4492 | + | |
4491 | 4493 | | |
4492 | | - | |
| 4494 | + | |
| 4495 | + | |
4493 | 4496 | | |
4494 | 4497 | | |
4495 | 4498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments