[all-commits] [llvm/llvm-project] d430d8: [CIR][CUDA] Do Runtime Kernel Registration (#188926)
David Rivera via All-commits
all-commits at lists.llvm.org
Wed Apr 15 15:00:28 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d430d89d5550e2e5aa1a72c7e5e1232ef1766da6
https://github.com/llvm/llvm-project/commit/d430d89d5550e2e5aa1a72c7e5e1232ef1766da6
Author: David Rivera <davidriverg at gmail.com>
Date: 2026-04-15 (Wed, 15 Apr 2026)
Changed paths:
M clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
M clang/test/CIR/CodeGenCUDA/device-stub.cu
Log Message:
-----------
[CIR][CUDA] Do Runtime Kernel Registration (#188926)
Related:
https://github.com/issues/assigned?issue=llvm%7Cllvm-project%7C179278,
https://github.com/llvm/llvm-project/issues/175871
More registration shenanigans -> Generates `__cuda_register_globals`
that associates the fatbin with kernels that contain `__global__`
qualifiers with the runtime.
Generated equivalent runtime code:
``` C
// Called once per kernel to register it with the CUDA runtime.
void __cuda_register_globals(void **fatbinHandle) {
__cudaRegisterFunction(
fatbinHandle,
(const char *)&_Z25__device_stub__kernelfunciii, // host-side stub ptr
(char *)__cuda_kernelname_str, // device-side mangled name
(char *)__cuda_kernelname_str, // device-side mangled name
-1, // thread limit (-1 = no limit)
NULL, NULL, NULL, NULL, NULL
);
}
void __cuda_module_ctor() {
__cuda_gpubin_handle = __cudaRegisterFatBinary(&__cuda_fatbin_wrapper);
__cuda_register_globals(__cuda_gpubin_handle); // ==== NEW
// TODO: Register shadow variables
__cudaRegisterFatBinaryEnd(__cuda_gpubin_handle); // CUDA >= 10.1
atexit(__cuda_module_dtor);
}
```
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list