diff --git a/sycl/include/sycl/detail/backend_traits_opencl.hpp b/sycl/include/sycl/detail/backend_traits_opencl.hpp index a122b8b2e799b..c3b9ddaa0f4fb 100644 --- a/sycl/include/sycl/detail/backend_traits_opencl.hpp +++ b/sycl/include/sycl/detail/backend_traits_opencl.hpp @@ -133,12 +133,7 @@ template <> struct BackendReturn { using graph = ext::oneapi::experimental::command_graph< ext::oneapi::experimental::graph_state::executable>; template <> struct BackendReturn { -#ifndef cl_khr_command_buffer - // Old cl_ext.h OpenCL-Header files might not have the command-buffer - // extension defined. - typedef struct _cl_command_buffer_khr *cl_command_buffer_khr; -#endif - using type = cl_command_buffer_khr; + using type = OpenCLExtCommandBufferKHRT; }; template <> struct InteropFeatureSupportMap { diff --git a/sycl/include/sycl/detail/cl.h b/sycl/include/sycl/detail/cl.h index 8ad2ab5334a24..ff743a7cc9813 100644 --- a/sycl/include/sycl/detail/cl.h +++ b/sycl/include/sycl/detail/cl.h @@ -9,23 +9,25 @@ #pragma once #include -// Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION -// and define all symbols up to OpenCL 3.0 +// FIXME: Drop OpenCL headers from both host and device. +// Can not do that under preview breaking changes, because +// SYCL CTS use -fpreview-breaking-changes and rely on +// SYCL headers to include OpenCL headers. We need to fix +// such tests before we can drop OpenCL headers. +#ifndef __SYCL_IGC_COMPILER__ + +// Pin the OpenCL API version, otherwise CL/cl_version.h emits a #pragma +// message and defaults to 3.0 anyway. #ifndef CL_TARGET_OPENCL_VERSION #define CL_TARGET_OPENCL_VERSION 300 #endif -// Include symbols for beta extensions +// Include symbols for beta extensions. +// Required for _cl_command_buffer_khr. #ifndef CL_ENABLE_BETA_EXTENSIONS #define CL_ENABLE_BETA_EXTENSIONS #endif -// FIXME: Drop OpenCL headers from both host and device. -// Can not do that under preview breaking changes, because -// SYCL CTS use -fpreview-breaking-changes and rely on -// SYCL headers to include OpenCL headers. We need to fix -// such tests before we can drop OpenCL headers. -#ifndef __SYCL_IGC_COMPILER__ #include #include #else @@ -44,6 +46,12 @@ typedef struct _cl_program *cl_program; typedef struct _cl_sampler *cl_sampler; #endif +// Old cl_ext.h OpenCL-Header files might not have the command-buffer +// extension defined. +#ifndef cl_khr_command_buffer +typedef struct _cl_command_buffer_khr *cl_command_buffer_khr; +#endif + namespace sycl { inline namespace _V1 { using OpenCLCommandQueueT = cl_command_queue; @@ -55,6 +63,7 @@ using OpenCLMemT = cl_mem; using OpenCLPlatformT = cl_platform_id; using OpenCLProgramT = cl_program; using OpenCLSamplerT = cl_sampler; +using OpenCLExtCommandBufferKHRT = cl_command_buffer_khr; namespace detail { #ifdef __SYCL_DEVICE_ONLY__