[clang] [clang-repl][CUDA] Move CUDA module registration to beginning of global_ctors (PR #66658)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 18 14:16:32 PDT 2023
================
@@ -794,7 +794,7 @@ void CodeGenModule::Release() {
AddGlobalCtor(ObjCInitFunction);
if (Context.getLangOpts().CUDA && CUDARuntime) {
if (llvm::Function *CudaCtorFunction = CUDARuntime->finalizeModule())
- AddGlobalCtor(CudaCtorFunction);
+ AddGlobalCtor(CudaCtorFunction, /*Priority=*/0);
----------------
Artem-B wrote:
I'd start with checking what NVCC generates for the initializers. Considering that ultimately we need to conform to CUDA runtime expectations and given lack of documentation, NVCC-generated code is the only reference we have.
Compile your example with -keep and see what NVCC-generated registration code looks like.
https://github.com/llvm/llvm-project/pull/66658
More information about the cfe-commits
mailing list