Skip to content

Commit 628c06f

Browse files
committed
[SYCL][OpenCL] Fetch the adapter source from the UR repo
1 parent 8c481bd commit 628c06f

26 files changed

+28
-5282
lines changed

sycl/plugins/opencl/CMakeLists.txt

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,26 @@
1-
#TODO:
2-
#1. Figure out why CMP0057 has to be set. Should have been taken care of earlier in the build
3-
#2. Use AddLLVM to modify the build and access config options
4-
#cmake_policy(SET CMP0057 NEW)
5-
#include(AddLLVM)
6-
71
# Plugin for OpenCL
82
# Create Shared library for libpi_opencl.so.
9-
#TODO: remove dependency on pi.h in sycl project.
10-
#TODO: Currently, the pi.h header is common between sycl and plugin library sources.
11-
#This can be changed by copying the pi.h file in the plugins project.
3+
4+
# Get the OpenCL adapter sources so they can be shared with the OpenCL PI plugin
5+
get_target_property(UR_OPENCL_ADAPTER_SOURCES ur_adapter_opencl SOURCES)
126

137
add_sycl_plugin(opencl
148
SOURCES
9+
${UR_OPENCL_ADAPTER_SOURCES}
1510
# Some code is shared with the UR adapter
1611
"../unified_runtime/pi2ur.hpp"
1712
"../unified_runtime/pi2ur.cpp"
18-
"../unified_runtime/ur/ur.hpp"
19-
"../unified_runtime/ur/ur.cpp"
20-
"../unified_runtime/ur/adapters/opencl/adapter.cpp"
21-
"../unified_runtime/ur/adapters/opencl/adapter.hpp"
22-
"../unified_runtime/ur/adapters/opencl/common.cpp"
23-
"../unified_runtime/ur/adapters/opencl/common.hpp"
24-
"../unified_runtime/ur/adapters/opencl/context.cpp"
25-
"../unified_runtime/ur/adapters/opencl/context.hpp"
26-
"../unified_runtime/ur/adapters/opencl/device.cpp"
27-
"../unified_runtime/ur/adapters/opencl/device.hpp"
28-
"../unified_runtime/ur/adapters/opencl/enqueue.cpp"
29-
"../unified_runtime/ur/adapters/opencl/image.cpp"
30-
"../unified_runtime/ur/adapters/opencl/kernel.cpp"
31-
"../unified_runtime/ur/adapters/opencl/platform.cpp"
32-
"../unified_runtime/ur/adapters/opencl/platform.hpp"
33-
"../unified_runtime/ur/adapters/opencl/sampler.cpp"
34-
"../unified_runtime/ur/adapters/opencl/memory.cpp"
35-
"../unified_runtime/ur/adapters/opencl/usm.cpp"
36-
"../unified_runtime/ur/adapters/opencl/program.cpp"
37-
"../unified_runtime/ur/adapters/opencl/event.cpp"
38-
"../unified_runtime/ur/adapters/opencl/queue.cpp"
39-
"../unified_runtime/ur/adapters/opencl/command_buffer.hpp"
40-
"../unified_runtime/ur/adapters/opencl/command_buffer.cpp"
41-
"../unified_runtime/ur/adapters/opencl/usm_p2p.cpp"
42-
# ---
4313
"${sycl_inc_dir}/sycl/detail/pi.h"
14+
"${sycl_inc_dir}/sycl/detail/pi.hpp"
4415
"pi_opencl.cpp"
16+
"pi_opencl.hpp"
4517
INCLUDE_DIRS
4618
${sycl_inc_dir}
47-
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime
19+
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime # for Unified Runtime
20+
${UNIFIED_RUNTIME_SOURCE_DIR}/source/ # for adapters/opencl
4821
LIBRARIES
4922
UnifiedRuntime-Headers
23+
UnifiedRuntimeCommon
5024
OpenCL-ICD
5125
)
5226

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D
44
include(FetchContent)
55

66
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
7-
#commit b38855ed815ffd076bfde5e5e06170ca4f723dc1
8-
#Merge: e6343f4 6a2c548
9-
#Author: Piotr Balcer <piotr.balcer@intel.com>
10-
#Date: Thu Oct 5 12:15:42 2023 +0200
11-
# Merge pull request #920 from jsji/localcopy
12-
# [UR][L0] Copy prebuilt L0 to avoid leaking shared folder path
13-
set(UNIFIED_RUNTIME_TAG b38855ed815ffd076bfde5e5e06170ca4f723dc1)
7+
# commit 3653e582e00737302ba0469a978aadc16448b3ea
8+
# Author: Fabio <fabio.mestre@codeplay.com>
9+
# Date: Wed Oct 18 16:25:29 2023 +0100
10+
# [OpenCL] Allow upstream to manually set the OpenCL target (#969)
11+
set(UNIFIED_RUNTIME_TAG 3653e582e00737302ba0469a978aadc16448b3ea)
1412

1513
if ("level_zero" IN_LIST SYCL_ENABLE_PLUGINS)
1614
set(UR_BUILD_ADAPTER_L0 ON)
@@ -23,6 +21,12 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D
2321
if ("hip" IN_LIST SYCL_ENABLE_PLUGINS)
2422
set(UR_BUILD_ADAPTER_HIP ON)
2523
endif()
24+
25+
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
26+
set(UR_BUILD_ADAPTER_OPENCL ON)
27+
set(UR_OPENCL_ICD_LOADER_LIBRARY OpenCL-ICD)
28+
endif()
29+
2630
set(UMF_ENABLE_POOL_TRACKING ON)
2731
message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}")
2832
FetchContent_Declare(unified-runtime
@@ -115,50 +119,7 @@ if ("cuda" IN_LIST SYCL_ENABLE_PLUGINS)
115119
endif()
116120

117121
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
118-
# Build OpenCL adapter
119-
add_sycl_library("ur_adapter_opencl" SHARED
120-
SOURCES
121-
"ur/ur.hpp"
122-
"ur/ur.cpp"
123-
"ur/adapters/opencl/adapter.cpp"
124-
"ur/adapters/opencl/adapter.hpp"
125-
"ur/adapters/opencl/command_buffer.hpp"
126-
"ur/adapters/opencl/command_buffer.cpp"
127-
"ur/adapters/opencl/common.cpp"
128-
"ur/adapters/opencl/common.hpp"
129-
"ur/adapters/opencl/context.cpp"
130-
"ur/adapters/opencl/context.hpp"
131-
"ur/adapters/opencl/device.cpp"
132-
"ur/adapters/opencl/device.hpp"
133-
"ur/adapters/opencl/enqueue.cpp"
134-
"ur/adapters/opencl/event.cpp"
135-
"ur/adapters/opencl/image.cpp"
136-
"ur/adapters/opencl/kernel.cpp"
137-
"ur/adapters/opencl/memory.cpp"
138-
"ur/adapters/opencl/platform.cpp"
139-
"ur/adapters/opencl/platform.hpp"
140-
"ur/adapters/opencl/program.cpp"
141-
"ur/adapters/opencl/queue.cpp"
142-
"ur/adapters/opencl/sampler.cpp"
143-
"ur/adapters/opencl/ur_interface_loader.cpp"
144-
"ur/adapters/opencl/usm.cpp"
145-
"ur/adapters/opencl/usm_p2p.cpp"
146-
INCLUDE_DIRS
147-
${sycl_inc_dir}
148-
LIBRARIES
149-
UnifiedRuntime-Headers
150-
Threads::Threads
151-
OpenCL-ICD
152-
)
153-
154-
# Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION.
155-
# Define all symbols up to OpenCL 3.0.
156-
target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300)
157-
158-
set_target_properties("ur_adapter_opencl" PROPERTIES
159-
VERSION "0.0.0"
160-
SOVERSION "0"
161-
)
122+
add_dependencies(sycl-runtime-libraries ur_adapter_opencl)
162123
endif()
163124

164125
if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# OpenCL adapter
2+
The source for the OpenCL adapter has been moved to the
3+
[adapters](https://github.com/oneapi-src/unified-runtime/tree/adapters) branch
4+
of the [Unified Runtime](https://github.com/oneapi-src/unified-runtime/) repo.
5+
Changes can be made by opening pull requests against that branch, and updating
6+
the Unified Runtime commit in the parent
7+
[CMakeLists.txt](../../../CMakeLists.txt).

sycl/plugins/unified_runtime/ur/adapters/opencl/adapter.cpp

Lines changed: 0 additions & 80 deletions
This file was deleted.

sycl/plugins/unified_runtime/ur/adapters/opencl/adapter.hpp

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)