clover: implement CLOVER_DEVICE_TYPE like RUSTICL_DEVICE_TYPE
Allows to make Clover devices appearing as cpu
, gpu
or accelerator
by setting the CLOVER_DEVICE_TYPE
environment variable like
the RUSTICL_DEVICE_TYPE
environment variable does.
For example it can make the CPU llvmpipe device appear as GPU or GPU devices appear as CPU. This is useful for testing OpenCL with applications that may use different code path given the OpenCL device is a CPU or a GPU.
The initial motivation for RUSTICL_DEVICE_TYPE
implementation was to test
rusticl with llvmipe on applications ignoring CPU devices.
This brings Clover on par with rusticl on that topic.
CL_DEVICE_TYPE_CUSTOM
isn't implemented or applications may crash when
iterating devices because CL_DEVICE_TYPE_CUSTOM
is OpenCL 1.2 and Clover
is OpenCL 1.1.
In this example llvmpipe is listed as a GPU (instead of being listed as a CPU by default):