[llvm] [Offload] Implement the remaining initial Offload API (PR #122106)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 09:23:05 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);
----------------
jhuber6 wrote:
It's very distinct, `Image` means "look up up from an ELF I have right here" while `Device` means "Look it up using the vendor API after it's been loaded". The former is way faster.
https://github.com/llvm/llvm-project/pull/122106
More information about the llvm-commits
mailing list