[llvm] [Liboffload] Add function for checking ELF file device compatibility (PR #156259)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 02:30:59 PDT 2025
================
@@ -592,6 +592,27 @@ Error olGetDeviceInfoSize_impl(ol_device_handle_t Device,
return olGetDeviceInfoImplDetail(Device, PropName, 0, nullptr, PropSizeRet);
}
+Error olElfIsCompatibleWithDevice_impl(ol_device_handle_t Device,
+ const void *ElfData, size_t ElfSize,
+ bool *IsCompatible) {
+ GenericDeviceTy *DeviceTy = Device->Device;
+ int32_t DeviceId = DeviceTy->getDeviceId();
+ GenericPluginTy &DevicePlugin = DeviceTy->Plugin;
+
+ StringRef Image(reinterpret_cast<const char *>(ElfData), ElfSize);
+
+ Expected<bool> ResultOrErr = DevicePlugin.isELFCompatible(DeviceId, Image);
+ if (!ResultOrErr) {
+ consumeError(ResultOrErr.takeError());
+ return createOffloadError(
----------------
RossBrunton wrote:
`createOffloadError` has an overload which allows it to accept another error.
https://github.com/llvm/llvm-project/pull/156259
More information about the llvm-commits
mailing list