Skip to content

Commit

Permalink
[SYCL] Include backend-specific header if exists (#4783)
Browse files Browse the repository at this point in the history
https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:headers-and-namespaces
introduces the backend specific headers "sycl/backend/<backend_name>.hpp"
CTS tests assume that if backend macro is defined (e.g. SYCL_BACKEND_OPENCL)
it is fully functional without extra includes. So the patch adds
include of the backend specific header when the backend is enabled.

The change should fix the recent massive failure of CTS tests with the error:
implicit instantiation of undefined template 'sycl::interop<sycl::backend::opencl, sycl::platform>'
Co-authored-by: Mikhail Lychkov <[email protected]>
Co-authored-by: Mikhail Lychkov <[email protected]>
  • Loading branch information
vladimirlaz and mlychkov authored Oct 20, 2021
1 parent 8ee0d30 commit bc8a00a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sycl/include/CL/sycl/feature_test.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

#define SYCL_BACKEND_OPENCL 1

// Feature test macro definitions

// TODO: Move these feature-test macros to compiler driver.
Expand Down Expand Up @@ -46,3 +47,12 @@ namespace sycl {

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

#include <CL/sycl/backend/opencl.hpp>
// Level Zero backend header depends on external headers and should be
// included by user application directly
// #include <sycl/ext/oneapi/backend/level_zero.hpp>

#if SYCL_EXT_ONEAPI_BACKEND_CUDA
#include <CL/sycl/backend/cuda.hpp>
#endif

0 comments on commit bc8a00a

Please sign in to comment.