Skip to content

Commit cf5fc60

Browse files
authored
[SYCL][OpenCL] Fetch the adapter source from the UR repo (#11566)
1 parent 8fe166f commit cf5fc60

26 files changed

+24
-5279
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: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ endif()
2828
if("hip" IN_LIST SYCL_ENABLE_PLUGINS)
2929
set(UR_BUILD_ADAPTER_HIP ON)
3030
endif()
31-
# TODO: Set UR_BUILD_ADAPTER_OPENCL once adapter moved
31+
if("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
32+
set(UR_BUILD_ADAPTER_OPENCL ON)
33+
set(UR_OPENCL_ICD_LOADER_LIBRARY OpenCL-ICD)
34+
endif()
3235
# TODO: Set UR_BUILD_ADAPTER_NATIVE_CPU once adapter moved
3336

3437
# Disable errors from warnings while building the UR.
@@ -156,53 +159,6 @@ endif()
156159

157160
add_sycl_plugin(unified_runtime ${UNIFIED_RUNTIME_PLUGIN_ARGS})
158161

159-
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
160-
# Build OpenCL adapter
161-
add_sycl_library("ur_adapter_opencl" SHARED
162-
SOURCES
163-
"ur/ur.hpp"
164-
"ur/ur.cpp"
165-
"ur/adapters/opencl/adapter.cpp"
166-
"ur/adapters/opencl/adapter.hpp"
167-
"ur/adapters/opencl/command_buffer.hpp"
168-
"ur/adapters/opencl/command_buffer.cpp"
169-
"ur/adapters/opencl/common.cpp"
170-
"ur/adapters/opencl/common.hpp"
171-
"ur/adapters/opencl/context.cpp"
172-
"ur/adapters/opencl/context.hpp"
173-
"ur/adapters/opencl/device.cpp"
174-
"ur/adapters/opencl/device.hpp"
175-
"ur/adapters/opencl/enqueue.cpp"
176-
"ur/adapters/opencl/event.cpp"
177-
"ur/adapters/opencl/image.cpp"
178-
"ur/adapters/opencl/kernel.cpp"
179-
"ur/adapters/opencl/memory.cpp"
180-
"ur/adapters/opencl/platform.cpp"
181-
"ur/adapters/opencl/platform.hpp"
182-
"ur/adapters/opencl/program.cpp"
183-
"ur/adapters/opencl/queue.cpp"
184-
"ur/adapters/opencl/sampler.cpp"
185-
"ur/adapters/opencl/ur_interface_loader.cpp"
186-
"ur/adapters/opencl/usm.cpp"
187-
"ur/adapters/opencl/usm_p2p.cpp"
188-
INCLUDE_DIRS
189-
${sycl_inc_dir}
190-
LIBRARIES
191-
UnifiedRuntime-Headers
192-
Threads::Threads
193-
OpenCL-ICD
194-
)
195-
196-
# Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION.
197-
# Define all symbols up to OpenCL 3.0.
198-
target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300)
199-
200-
set_target_properties("ur_adapter_opencl" PROPERTIES
201-
VERSION "0.0.0"
202-
SOVERSION "0"
203-
)
204-
endif()
205-
206162
if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
207163
add_sycl_library("ur_adapter_native_cpu" SHARED
208164
SOURCES
@@ -281,3 +237,7 @@ endif()
281237
if("hip" IN_LIST SYCL_ENABLE_PLUGINS)
282238
add_dependencies(sycl-runtime-libraries ur_adapter_hip)
283239
endif()
240+
241+
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
242+
add_dependencies(sycl-runtime-libraries ur_adapter_opencl)
243+
endif()
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)