This patch implements full support for the target-offload-icv and regulates the library's behavior in case of offload failure. There are three offload kinds: DEFAULT, DISABLED and MANDATORY.
Initially, the offload kind is retrieved from libomp. If the offload kind is set to DEFAULT, then libomptarget behaves as if the ICV were set to MANDATORY if at least one device is detected in the system, otherwise it falls back to DISABLED.
The behavior of libomptarget is defined as follows:
- If the ICV has been set to MANDATORY: If target offload fails, then libomptarget prints a warning and aborts the application. The warning is printed unconditionally, independently from debug/release configuration or the value of LIBOMPTARGET_DEBUG.
- If the ICV has been set to DISABLED: Offloading is disabled and all calls to __tgt_* functions return immediately.
- If the ICV is set to DEFAULT and an offload operation fails, then there are two cases: (i) If there have been previous successful offload operations then libomptarget prints out a warning and terminates the application. It is not safe to fall back onto the host as the host may not have the most up-to-date version of the application's data. (ii) If there are no previous successful offload operations, then the ICV is set to DISABLED and execution (including any subsequent offload operations) continues on the host.
If we are exiting, this shouldn't say WARNING. I think the word failure is enough here?