Skip to content

Commit 1f149fb

Browse files
committed
[OpenCL] Follow up changes after moving the adapter
- Update Cmake to use local adapter source files - Update license headers - Add virtual memory entrypoints to interface_loader - Add .clang-format - Update CODEOWNERS file for OpenCL adapter
1 parent 7c755c4 commit 1f149fb

25 files changed

+172
-93
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ source/adapters/level_zero @oneapi-src/unified-runtime-level-zero-write
66
# CUDA and HIP adapters
77
source/adapters/cuda @oneapi-src/unified-runtime-cuda-write
88
source/adapters/hip @oneapi-src/unified-runtime-hip-write
9+
10+
# OpenCL adapter
11+
source/adapters/opencl @oneapi-src/unified-runtime-opencl-write

source/adapters/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,5 @@ if(UR_BUILD_ADAPTER_HIP)
4545
endif()
4646

4747
if(UR_BUILD_ADAPTER_OPENCL)
48-
# Temporarily fetch the opencl adapter from a fork until the PR has been merged.
49-
set(SYCL_ADAPTER_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/opencl")
50-
FetchSource(https://github.com/fabiomestre/llvm.git opencl_adapter_unofficial "sycl/plugins/unified_runtime/ur" ${SYCL_ADAPTER_DIR})
5148
add_subdirectory(opencl)
5249
endif()

source/adapters/opencl/.clang-format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
...

source/adapters/opencl/CMakeLists.txt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,37 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
set(OPENCL_DIR "${SYCL_ADAPTER_DIR}/sycl/plugins/unified_runtime/ur/adapters/opencl" CACHE PATH "OpenCL adapter directory")
6+
set(OPENCL_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "OpenCL adapter directory")
77

88
set(TARGET_NAME ur_adapter_opencl)
99

1010
add_ur_adapter(${TARGET_NAME}
1111
SHARED
12-
${OPENCL_DIR}/ur_interface_loader.cpp
13-
${OPENCL_DIR}/adapter.hpp
14-
${OPENCL_DIR}/adapter.cpp
15-
${OPENCL_DIR}/command_buffer.hpp
16-
${OPENCL_DIR}/command_buffer.cpp
17-
${OPENCL_DIR}/common.hpp
18-
${OPENCL_DIR}/common.cpp
19-
${OPENCL_DIR}/context.cpp
20-
${OPENCL_DIR}/context.hpp
21-
${OPENCL_DIR}/device.cpp
22-
${OPENCL_DIR}/device.hpp
23-
${OPENCL_DIR}/enqueue.cpp
24-
${OPENCL_DIR}/event.cpp
25-
${OPENCL_DIR}/image.cpp
26-
${OPENCL_DIR}/kernel.cpp
27-
${OPENCL_DIR}/memory.cpp
28-
${OPENCL_DIR}/platform.cpp
29-
${OPENCL_DIR}/platform.hpp
30-
${OPENCL_DIR}/program.cpp
31-
${OPENCL_DIR}/queue.cpp
32-
${OPENCL_DIR}/sampler.cpp
33-
${OPENCL_DIR}/usm.cpp
34-
${OPENCL_DIR}/usm_p2p.cpp
35-
${OPENCL_DIR}/../../ur.cpp
36-
${OPENCL_DIR}/../../ur.hpp
12+
${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp
13+
${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp
15+
${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp
16+
${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp
17+
${CMAKE_CURRENT_SOURCE_DIR}/common.hpp
18+
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
19+
${CMAKE_CURRENT_SOURCE_DIR}/context.hpp
20+
${CMAKE_CURRENT_SOURCE_DIR}/context.cpp
21+
${CMAKE_CURRENT_SOURCE_DIR}/device.hpp
22+
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
23+
${CMAKE_CURRENT_SOURCE_DIR}/enqueue.cpp
24+
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
25+
${CMAKE_CURRENT_SOURCE_DIR}/image.cpp
26+
${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp
27+
${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp
28+
${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp
29+
${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp
30+
${CMAKE_CURRENT_SOURCE_DIR}/program.cpp
31+
${CMAKE_CURRENT_SOURCE_DIR}/queue.cpp
32+
${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp
33+
${CMAKE_CURRENT_SOURCE_DIR}/usm.cpp
34+
${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp
35+
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp
36+
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.hpp
3737
)
3838

3939
set_target_properties(${TARGET_NAME} PROPERTIES
@@ -53,7 +53,7 @@ message(STATUS "OpenCL_INCLUDE_DIR: ${OpenCL_INCLUDE_DIR}")
5353

5454
# Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION.
5555
# Define all symbols up to OpenCL 3.0.
56-
target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300)
56+
target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300 CL_USE_DEPRECATED_OPENCL_1_2_APIS)
5757

5858
# Make imported library global to use it within the project.
5959
add_library(OpenCL-ICD SHARED IMPORTED GLOBAL)
@@ -81,6 +81,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE
8181
)
8282

8383
target_include_directories(${TARGET_NAME} PRIVATE
84-
${OPENCL_DIR}/../../../
84+
"${CMAKE_CURRENT_SOURCE_DIR}/../../"
8585
${OpenCL_INCLUDE_DIR}
8686
)

source/adapters/opencl/adapter.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===-------------- adapter.cpp - OpenCL Adapter ---------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
#include "common.hpp"
1012

source/adapters/opencl/adapter.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===-------------- adapter.hpp - OpenCL Adapter ---------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
struct ur_adapter_handle_t_;
1012

source/adapters/opencl/command_buffer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===--------- command_buffer.cpp - OpenCL Adapter ---------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
#include "command_buffer.hpp"
1012
#include "common.hpp"

source/adapters/opencl/command_buffer.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===--------- command_buffer.hpp - OpenCL Adapter ---------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
#include <ur/ur.hpp>
1012

source/adapters/opencl/common.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===--------- common.hpp - OpenCL Adapter ---------------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
#include "common.hpp"
1012

source/adapters/opencl/context.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===--------- context.cpp - OpenCL Adapter ---------------------------===//
22
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
3+
// Copyright (C) 2023 Intel Corporation
4+
//
5+
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM
6+
// Exceptions. See LICENSE.TXT
57
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68
//
7-
//===-----------------------------------------------------------------===//
9+
//===----------------------------------------------------------------------===//
810

911
#include "context.hpp"
1012

0 commit comments

Comments
 (0)