AMDGPU target need -fvisibility hidden option for clang to
work around a limitation of no PLT support, otherwise there is compilation
error at -O0.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Could you elaborate on what exactly is the problem this patch fixes?
I don't see how internalizing the symbols connects to PLTs. My understanding is that PLTs are used to provide stubs for symbols to be resolved by dynamic linker at runtime. AFAICT AMD does not use shared libs on device side. What do I miss?
When AMDGPU backend generates ELF containing device ISA's, any non-kernel functions require
PLT support to be emitted to ELF. However AMDGPU backend currently does not support that,
which causes error.
Internalization will eliminate any non-kernel functions, therefore works around this limitation.
I could not find anything about PLTs in AMDGPU-ABI, nor could I find anything relevant on google.
I still have no idea why PLTs are required in this case. Without that info, the problem may as well be due to unintended requirement for PLT that this patch would hide.
I'm going to defer to someone more familiar with amdgpu to tell whether that's the right fix for the problem.
+Matt to confirm, but our executable format is a shared object and we eventually want to support preemptible symbols through the PLT. We already generate GOT entries for globals.
Currently we work around the lack of PLT support by internalizing all non-kernel functions, so for now this patch is required.
D51209 is the patch. I think HIP will need an additional patch, since I think it isn’t subclassing the amdgpu toolchain
Yes since HIP has different toolchain. This does not affect kernel's visibility, right?
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
255 ↗ | (On Diff #163186) | Nit: You could collapse multiple push_back calls into a single append({...}): |
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
256 ↗ | (On Diff #163196) | We should probably start subclassing the HIP toolchain from AMDGPU and share more of this |
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
256 ↗ | (On Diff #163196) | I'd like to defer the refactoring of HIP and AMDGPU toolchain to another patch. There are stuff in HIP toolchain which should go to AMDGPU toolchain. We need to sort out the relation between HIP and AMDGPU toolchain in that patch. |
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
256 ↗ | (On Diff #163196) | Yes |
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
256 ↗ | (On Diff #163196) | I also have a patch refactoring the AMDGPU toolchain that would conflict |
lib/Driver/ToolChains/HIP.cpp | ||
---|---|---|
256 ↗ | (On Diff #163196) | I will commit this patch then we will start reviewing your patch for refactoring AMDGPU toolchain. |