Files
llvm/offload/liboffload
Joseph Huber 51e3c3d51b [Offload] Implement 'olIsValidBinary' in offload and clean up (#159658)
Summary:
This exposes the 'isDeviceCompatible' routine for checking if a binary
*can* be loaded. This is useful if people don't want to consume errors
everywhere when figuring out which image to put to what device.

I don't know if this is a good name, I was thining like `olIsCompatible`
or whatever. Let me know what you think.

Long term I'd like to be able to do something similar to what OpenMP
does where we can conditionally only initialize devices if we need them.
That's going to be support needed if we want this to be more
generic.
2025-09-19 12:15:57 -05:00
..

Liboffload

This directory contains the implementation of the work-in-progress new API for Offload. It builds on top of the existing plugin implementations but provides a single level of abstraction suitable for implementation of many offloading language runtimes, rather than just OpenMP.

Testing liboffload

The main test suite for liboffload can be run with the check-offload-unit target, which runs the offload.unittests executable. The test suite will automatically run on every available device, but can be restricted to a single platform (CUDA, AMDGPU) with a command line argument:

$ ./offload.unittests --platform=CUDA

Tracing of Offload API calls can be enabled by setting the OFFLOAD_TRACE environment variable. This works with any program that uses liboffload.

$ OFFLOAD_TRACE=1 ./offload.unittests
---> olInit()-> OL_SUCCESS
# etc

The host plugin is not currently supported.

Modifying liboffload

The main header (OffloadAPI.h) and some implementation details are autogenerated with tablegen. See the API definition README for implementation details.