[llvm] [Offload] Support loading CUDA fat binaries (PR #156955)
Jonas Greifenhain via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 13:45:57 PDT 2025
================
@@ -556,7 +657,19 @@ struct CUDADeviceTy : public GenericDeviceTy {
// Allocate and initialize the image object.
CUDADeviceImageTy *CUDAImage = Plugin.allocate<CUDADeviceImageTy>();
- new (CUDAImage) CUDADeviceImageTy(ImageId, *this, TgtImage);
+
+ uint32_t Magic = *reinterpret_cast<const uint32_t *>(TgtImage->ImageStart);
+ if (Magic == 0x466243b1 || Magic == 0xba55ed50) {
+ // It's a fatbin or a wrapped fatbin
----------------
cadivus wrote:
The way I got it, they wrap it at runtime and have it unwrapped if you store it as a file.
I think dealing with both here is the easier.
https://github.com/llvm/llvm-project/pull/156955
More information about the llvm-commits
mailing list