[llvm] [Offload] Implement the remaining initial Offload API (PR #122106)
Callum Fare via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 09:33:13 PST 2025
================
@@ -1327,6 +1327,34 @@ class CUDAGlobalHandlerTy final : public GenericGlobalHandlerTy {
DeviceGlobal.setPtr(reinterpret_cast<void *>(CUPtr));
return Plugin::success();
}
+
+ Error getGlobalMetadataFromImage(GenericDeviceTy &Device,
+ DeviceImageTy &Image,
+ GlobalTy &ImageGlobal) override {
+ // If the image is an ELF we can use the generic path, otherwise fall back
+ // and use cuModuleGetGlobal to query the image.
+ if (utils::elf::isELF(Image.getMemoryBuffer().getBuffer())) {
+ return GenericGlobalHandlerTy::getGlobalMetadataFromImage(Device, Image,
+ ImageGlobal);
+ }
+
+ CUDADeviceImageTy &CUDAImage = static_cast<CUDADeviceImageTy &>(Image);
----------------
callumfare wrote:
Right, that makes a lot sense, thanks. I'll aim for a more sensible fix in a follow-up PR.
https://github.com/llvm/llvm-project/pull/122106
More information about the llvm-commits
mailing list