Skip to content

Commit

Permalink
Unify logic for dpcpp compilers
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitriy Sobolev <[email protected]>
  • Loading branch information
dmitriy-sobolev committed Oct 21, 2024
1 parent 96e4ac3 commit 6e6e985
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/oneapi/dpl/pstl/hetero_backend_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
#ifndef _ONEDPL_HETERO_BACKEND_CONFIG
#define _ONEDPL_HETERO_BACKEND_CONFIG

// Detect both Intel(R) oneAPI DPC++/C++ Compiler and oneAPI DPC++ compiler
// Rely on an extension attribute, which is present in both compilers
#if __has_cpp_attribute(intel::kernel_args_restrict)
# define _ONEDPL_DPCPP_COMPILER 1
#else
# define _ONEDPL_DPCPP_COMPILER 0
#endif

// --------------------------------------------------------------------------------------------------------------------
// Enablement of heterogeneous backends
// --------------------------------------------------------------------------------------------------------------------
Expand All @@ -28,8 +36,8 @@
#if _ONEDPL_SYCL_HEADER_PRESENT
# if _ONEDPL_SYCL_LANGUAGE_VERSION_PRESENT
# define _ONEDPL_SYCL_AVAILABLE 1
// Intel(R) oneAPI DPC++/C++ Compiler pre-defines SYCL_LANGUAGE_VERSION with -fsycl option
# elif !defined(__INTEL_LLVM_COMPILER)
// DPC++/C++ Compiler pre-defines SYCL_LANGUAGE_VERSION with -fsycl option
# elif _ONEDPL_DPCPP_COMPILER
// Other implementations might define the macro in the SYCL header
# define _ONEDPL_SYCL_POSSIBLY_AVAILABLE 1
# endif
Expand Down

0 comments on commit 6e6e985

Please sign in to comment.