Skip to content

[SYCL][AOT] Define CL_TARGET_OPENCL_VERSION to OpenCL 2.2 #1608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2020
Merged
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
1 change: 1 addition & 0 deletions opencl-aot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if (NOT OpenCL_INCLUDE_DIRS)
STEP_TARGETS build
COMMENT "Downloading OpenCL headers."
)
add_definitions(-DCL_TARGET_OPENCL_VERSION=220)
else ()
add_custom_target(opencl-headers ALL
DEPENDS ${OpenCL_INCLUDE_DIRS}
Expand Down
4 changes: 4 additions & 0 deletions opencl-aot/source/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,18 @@ std::string getOpenCLErrorNameByErrorCode(cl_int CLErr) {
return "CL_INVALID_LINKER_OPTIONS";
case CL_INVALID_DEVICE_PARTITION_COUNT:
return "CL_INVALID_DEVICE_PARTITION_COUNT";
#ifdef CL_VERSION_2_0
case CL_INVALID_PIPE_SIZE:
return "CL_INVALID_PIPE_SIZE";
case CL_INVALID_DEVICE_QUEUE:
return "CL_INVALID_DEVICE_QUEUE";
#endif
#ifdef CL_VERSION_2_2
case CL_INVALID_SPEC_ID:
return "CL_INVALID_SPEC_ID";
case CL_MAX_SIZE_RESTRICTION_EXCEEDED:
return "CL_MAX_SIZE_RESTRICTION_EXCEEDED";
#endif
default:
return "Unknown error code";
}
Expand Down
1 change: 1 addition & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ if( NOT OpenCL_INCLUDE_DIRS )
STEP_TARGETS build
COMMENT "Downloading OpenCL headers."
)
add_definitions(-DCL_TARGET_OPENCL_VERSION=220)
else()
add_custom_target( ocl-headers ALL
DEPENDS ${OpenCL_INCLUDE_DIRS}
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/backend/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

#pragma once

#include <CL/cl.h>
#include <CL/sycl/accessor.hpp>
#include <CL/sycl/backend_types.hpp>
#include <CL/sycl/detail/cl.h>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
Expand Down
1 change: 0 additions & 1 deletion sycl/include/CL/sycl/detail/aligned_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include <CL/cl.h>
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/os_util.hpp>
#include <CL/sycl/range.hpp>
Expand Down
1 change: 0 additions & 1 deletion sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include <CL/cl.h>
#include <CL/sycl/access/access.hpp>
#include <CL/sycl/context.hpp>
#include <CL/sycl/detail/common.hpp>
Expand Down
18 changes: 18 additions & 0 deletions sycl/include/CL/sycl/detail/cl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//==---------------- cl.h - Include OpenCL headers -------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#pragma once

// Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION
// and define all symbols up to OpenCL 2.2
#ifndef CL_TARGET_OPENCL_VERSION
#define CL_TARGET_OPENCL_VERSION 220
#endif

#include <CL/cl.h>
#include <CL/cl_ext.h>
9 changes: 2 additions & 7 deletions sycl/include/CL/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@

#pragma once

#include <CL/cl_ext_intel.h>
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/detail/export.hpp>

// Suppress a compiler warning about undefined CL_TARGET_OPENCL_VERSION
// Khronos ICD supports only latest OpenCL version
#define CL_TARGET_OPENCL_VERSION 220
#include <CL/cl.h>
#include <CL/cl_ext.h>
#include <CL/cl_ext_intel.h>

#include <cstdint>
#include <string>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/memory_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#pragma once

#include <CL/cl.h>
#include <CL/sycl/access/access.hpp>
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/sycl_mem_obj_i.hpp>
#include <CL/sycl/range.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
// TODO: we need a mapping of PI to OpenCL somewhere, and this can be done
// elsewhere, e.g. in the pi_opencl, but constants/enums mapping is now
// done here, for efficiency and simplicity.
//

#include <CL/cl_usm_ext.h>
#include <CL/opencl.h>
#include <CL/sycl/detail/cl.h>
#include <cstdint>

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/usm_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// ===--------------------------------------------------------------------=== //
#pragma once

#include <CL/cl.h>
#include <CL/cl_usm_ext.h>
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/usm/usm_enums.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
///
/// \ingroup sycl_pi_ocl

#include "CL/opencl.h"
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/pi.h>

#include <cassert>
Expand Down
4 changes: 4 additions & 0 deletions sycl/source/detail/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ const char *stringifyErrorCode(cl_int error) {
return "CL_INVALID_LINKER_OPTIONS";
case CL_INVALID_DEVICE_PARTITION_COUNT:
return "CL_INVALID_DEVICE_PARTITION_COUNT";
#ifdef CL_VERSION_2_0
case CL_INVALID_PIPE_SIZE:
return "CL_INVALID_PIPE_SIZE";
case CL_INVALID_DEVICE_QUEUE:
return "CL_INVALID_DEVICE_QUEUE";
#endif
#ifdef CL_VERSION_2_2
case CL_INVALID_SPEC_ID:
return "CL_INVALID_SPEC_ID";
case CL_MAX_SIZE_RESTRICTION_EXCEEDED:
return "CL_MAX_SIZE_RESTRICTION_EXCEEDED";
#endif
/*
case CL_BUILD_NONE:
return "CL_BUILD_NONE";
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <detail/error_handling/error_handling.hpp>

#include "CL/sycl/access/access.hpp"
#include <CL/cl.h>
#include <CL/sycl/backend_types.hpp>
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/kernel_desc.hpp>
#include <CL/sycl/detail/memory_manager.hpp>
#include <CL/sycl/detail/stream_impl.hpp>
Expand Down
6 changes: 6 additions & 0 deletions sycl/tools/get_device_count_by_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
//
//===----------------------------------------------------------------------===//

// Suppress a compiler warning about undefined CL_TARGET_OPENCL_VERSION
// and define all symbols up to OpenCL 2.2
#ifndef CL_TARGET_OPENCL_VERSION
#define CL_TARGET_OPENCL_VERSION 220
#endif

#include <CL/cl.h>
#include <CL/cl_ext.h>

Expand Down
2 changes: 1 addition & 1 deletion sycl/unittests/scheduler/SchedulerTestUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#pragma once
#include <CL/cl.h>
#include <CL/sycl.hpp>
#include <CL/sycl/detail/cl.h>
#include <detail/queue_impl.hpp>
#include <detail/scheduler/scheduler.hpp>

Expand Down