[PATCH] D60141: [HIP-Clang] Fat binary should not be produced for non GPU code
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 13:48:38 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357526: [HIP-Clang] Fat binary should not be produced for non GPU code 2 (authored by aaronenyeshi, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D60141?vs=193328&id=193360#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60141/new/
https://reviews.llvm.org/D60141
Files:
cfe/trunk/lib/CodeGen/CGCUDANV.cpp
cfe/trunk/test/CodeGenCUDA/device-stub.cu
Index: cfe/trunk/lib/CodeGen/CGCUDANV.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGCUDANV.cpp
+++ cfe/trunk/lib/CodeGen/CGCUDANV.cpp
@@ -468,11 +468,13 @@
/// \endcode
llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
bool IsHIP = CGM.getLangOpts().HIP;
+ bool IsCUDA = CGM.getLangOpts().CUDA;
// No need to generate ctors/dtors if there is no GPU binary.
StringRef CudaGpuBinaryFileName = CGM.getCodeGenOpts().CudaGpuBinaryFileName;
if (CudaGpuBinaryFileName.empty() && !IsHIP)
return nullptr;
- if (IsHIP && EmittedKernels.empty() && DeviceVars.empty())
+ if ( (IsHIP || (IsCUDA && !RelocatableDeviceCode) )
+ && EmittedKernels.empty() && DeviceVars.empty())
return nullptr;
// void __{cuda|hip}_register_globals(void* handle);
Index: cfe/trunk/test/CodeGenCUDA/device-stub.cu
===================================================================
--- cfe/trunk/test/CodeGenCUDA/device-stub.cu
+++ cfe/trunk/test/CodeGenCUDA/device-stub.cu
@@ -227,20 +227,14 @@
// There should be no __[[PREFIX]]_register_globals if we have no
// device-side globals, but we still need to register GPU binary.
// Skip GPU binary string first.
-// CUDANOGLOBALS: @{{.*}} = private constant{{.*}}
+// CUDANOGLOBALS-NOT: @{{.*}} = private constant{{.*}}
// HIPNOGLOBALS-NOT: @{{.*}} = internal constant{{.*}}
// NOGLOBALS-NOT: define internal void @__{{.*}}_register_globals
-// CUDANOGLOBALS: define internal void @__[[PREFIX:cuda|hip]]_module_ctor
-// CUDANOGLOBALS: call{{.*}}[[PREFIX]]RegisterFatBinary{{.*}}__[[PREFIX]]_fatbin_wrapper
+// NOGLOBALS-NOT: define internal void @__[[PREFIX:cuda|hip]]_module_ctor
+// NOGLOBALS-NOT: call{{.*}}[[PREFIX]]RegisterFatBinary{{.*}}__[[PREFIX]]_fatbin_wrapper
// NOGLOBALS-NOT: call void @__[[PREFIX]]_register_globals
-// CUDANOGLOBALS: define internal void @__[[PREFIX]]_module_dtor
-// CUDANOGLOBALS: call void @__[[PREFIX]]UnregisterFatBinary
-
-// There should be no fat binary functions when no device-code is found for HIP.
-// HIPNOGLOBALS-NOT: define internal void @__[[PREFIX:cuda|hip]]_module_ctor
-// HIPNOGLOBALS-NOT: call{{.*}}[[PREFIX]]RegisterFatBinary{{.*}}__[[PREFIX]]_fatbin_wrapper
-// HIPNOGLOBALS-NOT: define internal void @__[[PREFIX]]_module_dtor
-// HIPNOGLOBALS-NOT: call void @__[[PREFIX]]UnregisterFatBinary
+// NOGLOBALS-NOT: define internal void @__[[PREFIX]]_module_dtor
+// NOGLOBALS-NOT: call void @__[[PREFIX]]UnregisterFatBinary
// There should be no constructors/destructors if we have no GPU binary.
// NOGPUBIN-NOT: define internal void @__[[PREFIX]]_register_globals
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60141.193360.patch
Type: text/x-patch
Size: 2644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190402/4d847227/attachment.bin>
More information about the llvm-commits
mailing list