Summary: This PR adds a pointer argument to the initialization routine to be used for global options. Right now this is used to allow the user to constrain which backends they wish to use. If a null argument is passed, the same behavior as before is observed. This is epxected to be extensible by forcing the user to encode the size of the struct. So, old executables will encode which fields they have access to. We use a macro helper to get this struct rather than a runtime call so that the current state of the size is baked into the executable rather than something looked up by the runtime. Otherwise it would just return the size that the (potentially newer) runtime would see
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
# 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:
|
|
|
|
```sh
|
|
$ ./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.
|
|
|
|
```sh
|
|
$ OFFLOAD_TRACE=1 ./offload.unittests
|
|
---> olInit(nullptr)-> 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](API/README.md)
|
|
for implementation details.
|