Skip to content

Commit

Permalink
Do not expect a genetic compiler to define SYCL_LANGUAGE_VERSION
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
  • Loading branch information
dmitriy-sobolev committed Oct 4, 2024
1 parent c97070f commit 96075e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions include/oneapi/dpl/pstl/onedpl_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@
but OpenMP headers are not found or the compiler does not support OpenMP"
#endif
#if (defined(SYCL_LANGUAGE_VERSION) || defined(CL_SYCL_LANGUAGE_VERSION)) && \
(__has_include(<sycl/sycl.hpp>) || __has_include(<CL/sycl.hpp>))
# define _ONEDPL_SYCL_AVAILABLE 1
#if defined(__INTEL_LLVM_COMPILER) && (defined(CL_SYCL_LANGUAGE_VERSION) || defined(SYCL_LANGUAGE_VERSION))
# define _ONEDPL_SYCL_ENABLED_FOR_INTEL_LLVM 1
#endif
#if (__has_include(<sycl/sycl.hpp>) || __has_include(<CL/sycl.hpp>))
// Intel(R) oneAPI DPC++/C++ Compiler is known to provide SYCL_LANGUAGE_VERSION with certain compiler options,
// while other implementations may require inclusion of sycl/sycl.hpp, which is not desired in onedpl_config.h
# if _ONEDPL_SYCL_ENABLED_FOR_INTEL_LLVM || !defined(__INTEL_LLVM_COMPILER)
# define _ONEDPL_SYCL_AVAILABLE 1
# endif
#endif
#if ONEDPL_USE_DPCPP_BACKEND && !_ONEDPL_SYCL_AVAILABLE
# error "Device execution policies are enabled, \
Expand Down
11 changes: 7 additions & 4 deletions test/support/test_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@
#define _PSTL_SYCL_TEST_USM 1

// Enable test when the DPC++ backend is available
#if ((defined(CL_SYCL_LANGUAGE_VERSION) || defined(SYCL_LANGUAGE_VERSION)) && \
(__has_include(<sycl/sycl.hpp>) || __has_include(<CL/sycl.hpp>))) && \
#if defined(__INTEL_LLVM_COMPILER) && (defined(CL_SYCL_LANGUAGE_VERSION) || defined(SYCL_LANGUAGE_VERSION))
# define TEST_SYCL_ENABLED_FOR_INTEL_LLVM 1
#endif
#if __has_include(<sycl/sycl.hpp>) || __has_include(<CL/sycl.hpp>) && \
(TEST_SYCL_ENABLED_FOR_INTEL_LLVM || !defined(__INTEL_LLVM_COMPILER)) && \
(!defined(ONEDPL_USE_DPCPP_BACKEND) || ONEDPL_USE_DPCPP_BACKEND != 0)
#define TEST_DPCPP_BACKEND_PRESENT 1
# define TEST_DPCPP_BACKEND_PRESENT 1
#else
#define TEST_DPCPP_BACKEND_PRESENT 0
# define TEST_DPCPP_BACKEND_PRESENT 0
#endif

#ifdef __SYCL_UNNAMED_LAMBDA__
Expand Down

0 comments on commit 96075e1

Please sign in to comment.