Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions sycl/include/sycl/detail/backend_traits_opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ template <> struct BackendReturn<backend::opencl, kernel> {
using graph = ext::oneapi::experimental::command_graph<
ext::oneapi::experimental::graph_state::executable>;
template <> struct BackendReturn<backend::opencl, graph> {
#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<backend::opencl> {
Expand Down
27 changes: 18 additions & 9 deletions sycl/include/sycl/detail/cl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@
#pragma once
#include <sycl/detail/ur.hpp>

// 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 <CL/cl.h>
#include <CL/cl_ext.h>
#else
Expand All @@ -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;
Expand All @@ -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__
Expand Down
Loading