oneDPL
oneDPL copied to clipboard
[test][cmake] Support customization of device target options in AOT mode
Our current CMake AOT compilation mode sets -fsycl-targets=spir64_gen
for GPU targets and -fsycl-targets=spir64_x86_64
for CPU targets. This is problematic for two reasons: The first is that some backends do not compile to SPIR-V (e.g. CUDA backend), so compiling oneDPL tests for CUDA devices is not possible using our AOT CMake options and requires users to set CXX compiler and linker flag variables themselves. Secondly, the icpx
compiler supports specialized target options for ease of use (e.g. intel_gpu_pvc
) which cannot be currently passed through our AOT options.
This PR adds a ONEDPL_AOT_TARGETS
option defaulted to the current hardcoded variables to resolve these issues. ONEDPL_AOT_TARGETS
can be set alongside ONEDPL_AOT_ARCH
or just set to a special target option with no need for specifying an architecture. With the defaulted value of ONEDPL_AOT_TARGETS
, the previous behavior of just setting ONEDPL_AOT_ARCH
is maintained.
I have ran some AOT tests with the following configurations to assess testing with different device types. The Codeplay oneAPI plugin for CUDA and hip backends was used with oneAPI 2024.2.0. GPU AOT compilation:
-
ONEDPL_AOT_TARGETS=nvptx64-nvidia-cuda
-
ONEDPL_AOT_TARGETS=nvidia_gpu_sm_xx
-
ONEDPL_AOT_TARGETS=intel_gpu_xxx
-
ONEDPL_AOT_TARGETS=amd_gpu_gfx90a
-
ONEDPL_AOT_ARCH=pvc
- No specialized AOT arch or target
CPU AOT compilation:
-
ONEDPL_AOT_ARCH=avx
-
ONEDPL_AOT_ARCH=avx2
- No specialized AOT arch or target