From b0fbddde381616d1f0e82899b0fc8c3cf7072c4d Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 17 Dec 2024 13:57:16 -0600 Subject: [PATCH] [OpenMP] Only put `retain` for NVPTX so it can be optimized out for AMD Summary: This is a hack that only NVPTX needs. --- offload/DeviceRTL/src/Misc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/offload/DeviceRTL/src/Misc.cpp b/offload/DeviceRTL/src/Misc.cpp index c1df477365bcb6..00935cce05e479 100644 --- a/offload/DeviceRTL/src/Misc.cpp +++ b/offload/DeviceRTL/src/Misc.cpp @@ -115,8 +115,12 @@ void *indirectCallLookup(void *HstPtr) { /// The openmp client instance used to communicate with the server. /// FIXME: This is marked as 'retain' so that it is not removed via /// `-mlink-builtin-bitcode` +#ifdef __NVPTX__ [[gnu::visibility("protected"), gnu::weak, gnu::retain]] rpc::Client Client asm("__llvm_rpc_client"); +#else +[[gnu::visibility("protected"), gnu::weak]] rpc::Client Client asm("__llvm_rpc_client"); +#endif } // namespace impl } // namespace ompx