Skip to content

Commit 0486f79

Browse files
committed
[SYCL] Introduce backend macros
According to SYCL spec: backend macro should be specified for all supported backends (defined in the Khronos group). It also refers to extension macros (aka feature test macro) for other backends introduced by a vendor. Khronos group defines only OpenCL backend and other backends supported by DPC++ should be treated as extensions. The following macros are defined unconditionaly because backend support is always available on DPC++ compile stage: - OpenCL backed: SYCL_BACKEND_OPENCL - Level Zero backend: SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO - CUDA backend: SYCL_EXT_ONEAPI_BACKEND_CUDA - ESIMD_CPU backend: SYCL_EXT_INTEL_BACKEND_ESIMD_CPU - HIP backend: SYCL_EXT_ONEAPI_BACKEND_HIP Extra libs may be required to link DPC++ application and run it.
1 parent 69f4b4c commit 0486f79

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

sycl/include/CL/sycl/backend/opencl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <CL/sycl/detail/cl.h>
1717
#include <CL/sycl/kernel_bundle.hpp>
1818

19+
#define SYCL_BACKEND_OPENCL 1
1920
__SYCL_INLINE_NAMESPACE(cl) {
2021
namespace sycl {
2122

sycl/include/CL/sycl/feature_test.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ namespace sycl {
2929
#define SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY 1
3030
#define SYCL_EXT_INTEL_USM_ADDRESS_SPACES 1
3131
#define SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO 1
32+
#define SYCL_EXT_ONEAPI_BACKEND_CUDA 1
33+
#define SYCL_EXT_INTEL_BACKEND_ESIMD_CPU 1
34+
#define SYCL_EXT_ONEAPI_BACKEND_HIP 1
3235

3336
} // namespace sycl
3437
} // __SYCL_INLINE_NAMESPACE(cl)

0 commit comments

Comments
 (0)