Skip to content

[SYCL][OpenCL] Fetch the adapter source from the UR repo #11566

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 2 commits into from
Oct 23, 2023
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
44 changes: 9 additions & 35 deletions sycl/plugins/opencl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,26 @@
#TODO:
#1. Figure out why CMP0057 has to be set. Should have been taken care of earlier in the build
#2. Use AddLLVM to modify the build and access config options
#cmake_policy(SET CMP0057 NEW)
#include(AddLLVM)

# Plugin for OpenCL
# Create Shared library for libpi_opencl.so.
#TODO: remove dependency on pi.h in sycl project.
#TODO: Currently, the pi.h header is common between sycl and plugin library sources.
#This can be changed by copying the pi.h file in the plugins project.

# Get the OpenCL adapter sources so they can be shared with the OpenCL PI plugin
get_target_property(UR_OPENCL_ADAPTER_SOURCES ur_adapter_opencl SOURCES)

add_sycl_plugin(opencl
SOURCES
${UR_OPENCL_ADAPTER_SOURCES}
# Some code is shared with the UR adapter
"../unified_runtime/pi2ur.hpp"
"../unified_runtime/pi2ur.cpp"
"../unified_runtime/ur/ur.hpp"
"../unified_runtime/ur/ur.cpp"
"../unified_runtime/ur/adapters/opencl/adapter.cpp"
"../unified_runtime/ur/adapters/opencl/adapter.hpp"
"../unified_runtime/ur/adapters/opencl/common.cpp"
"../unified_runtime/ur/adapters/opencl/common.hpp"
"../unified_runtime/ur/adapters/opencl/context.cpp"
"../unified_runtime/ur/adapters/opencl/context.hpp"
"../unified_runtime/ur/adapters/opencl/device.cpp"
"../unified_runtime/ur/adapters/opencl/device.hpp"
"../unified_runtime/ur/adapters/opencl/enqueue.cpp"
"../unified_runtime/ur/adapters/opencl/image.cpp"
"../unified_runtime/ur/adapters/opencl/kernel.cpp"
"../unified_runtime/ur/adapters/opencl/platform.cpp"
"../unified_runtime/ur/adapters/opencl/platform.hpp"
"../unified_runtime/ur/adapters/opencl/sampler.cpp"
"../unified_runtime/ur/adapters/opencl/memory.cpp"
"../unified_runtime/ur/adapters/opencl/usm.cpp"
"../unified_runtime/ur/adapters/opencl/program.cpp"
"../unified_runtime/ur/adapters/opencl/event.cpp"
"../unified_runtime/ur/adapters/opencl/queue.cpp"
"../unified_runtime/ur/adapters/opencl/command_buffer.hpp"
"../unified_runtime/ur/adapters/opencl/command_buffer.cpp"
"../unified_runtime/ur/adapters/opencl/usm_p2p.cpp"
# ---
"${sycl_inc_dir}/sycl/detail/pi.h"
"${sycl_inc_dir}/sycl/detail/pi.hpp"
"pi_opencl.cpp"
"pi_opencl.hpp"
INCLUDE_DIRS
${sycl_inc_dir}
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime # for Unified Runtime
${UNIFIED_RUNTIME_SOURCE_DIR}/source/ # for adapters/opencl
LIBRARIES
UnifiedRuntime-Headers
UnifiedRuntimeCommon
OpenCL-ICD
)

Expand Down
56 changes: 8 additions & 48 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ endif()
if("hip" IN_LIST SYCL_ENABLE_PLUGINS)
set(UR_BUILD_ADAPTER_HIP ON)
endif()
# TODO: Set UR_BUILD_ADAPTER_OPENCL once adapter moved
if("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
set(UR_BUILD_ADAPTER_OPENCL ON)
set(UR_OPENCL_ICD_LOADER_LIBRARY OpenCL-ICD)
endif()
# TODO: Set UR_BUILD_ADAPTER_NATIVE_CPU once adapter moved

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

add_sycl_plugin(unified_runtime ${UNIFIED_RUNTIME_PLUGIN_ARGS})

if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
# Build OpenCL adapter
add_sycl_library("ur_adapter_opencl" SHARED
SOURCES
"ur/ur.hpp"
"ur/ur.cpp"
"ur/adapters/opencl/adapter.cpp"
"ur/adapters/opencl/adapter.hpp"
"ur/adapters/opencl/command_buffer.hpp"
"ur/adapters/opencl/command_buffer.cpp"
"ur/adapters/opencl/common.cpp"
"ur/adapters/opencl/common.hpp"
"ur/adapters/opencl/context.cpp"
"ur/adapters/opencl/context.hpp"
"ur/adapters/opencl/device.cpp"
"ur/adapters/opencl/device.hpp"
"ur/adapters/opencl/enqueue.cpp"
"ur/adapters/opencl/event.cpp"
"ur/adapters/opencl/image.cpp"
"ur/adapters/opencl/kernel.cpp"
"ur/adapters/opencl/memory.cpp"
"ur/adapters/opencl/platform.cpp"
"ur/adapters/opencl/platform.hpp"
"ur/adapters/opencl/program.cpp"
"ur/adapters/opencl/queue.cpp"
"ur/adapters/opencl/sampler.cpp"
"ur/adapters/opencl/ur_interface_loader.cpp"
"ur/adapters/opencl/usm.cpp"
"ur/adapters/opencl/usm_p2p.cpp"
INCLUDE_DIRS
${sycl_inc_dir}
LIBRARIES
UnifiedRuntime-Headers
Threads::Threads
OpenCL-ICD
)

# Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION.
# Define all symbols up to OpenCL 3.0.
target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300)

set_target_properties("ur_adapter_opencl" PROPERTIES
VERSION "0.0.0"
SOVERSION "0"
)
endif()

if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
add_sycl_library("ur_adapter_native_cpu" SHARED
SOURCES
Expand Down Expand Up @@ -281,3 +237,7 @@ endif()
if("hip" IN_LIST SYCL_ENABLE_PLUGINS)
add_dependencies(sycl-runtime-libraries ur_adapter_hip)
endif()

if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
add_dependencies(sycl-runtime-libraries ur_adapter_opencl)
endif()
7 changes: 7 additions & 0 deletions sycl/plugins/unified_runtime/ur/adapters/opencl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# OpenCL adapter
The source for the OpenCL adapter has been moved to the
[adapters](https://github.com/oneapi-src/unified-runtime/tree/adapters) branch
of the [Unified Runtime](https://github.com/oneapi-src/unified-runtime/) repo.
Changes can be made by opening pull requests against that branch, and updating
the Unified Runtime commit in the parent
[CMakeLists.txt](../../../CMakeLists.txt).
80 changes: 0 additions & 80 deletions sycl/plugins/unified_runtime/ur/adapters/opencl/adapter.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions sycl/plugins/unified_runtime/ur/adapters/opencl/adapter.hpp

This file was deleted.

Loading