[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:28:51 PDT 2025


RossBrunton wrote:

Thanks for making this - We've had to work around this in UR by querying the device itself and branching on AMD/Nvidia.

I agree with the prior comments that this should accept any image, rather than just ELF binaries.

However, I also wonder if this is the best way of doing it. It'd be nice to allow users to check whether a backend supports a specific format before they load (or even compile) a binary. I think a better design might be two new device info queries:

```
getDeviceInfo(OL_DEVICE_INFO_IMAGE_FORMAT) -> { IMAGE_FORMAT_ELF, IMAGE_FORMAT_ELF_BUNDLED }
getDeviceInfo(OL_DEVICE_INFO_IMAGE_TARGET) -> { IMAGE_TARGET_AMD }
```

Both of which returning arrays of what formats/targets they support in priority order. Then the user can query ahead of time and load only the appropriate binary.

https://github.com/llvm/llvm-project/pull/156259


More information about the llvm-commits mailing list