Skip to content
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

[SYCL][NATIVECPU] Move Native CPU adapter to UR. #11804

Merged
merged 1 commit into from
Nov 14, 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
47 changes: 18 additions & 29 deletions sycl/plugins/native_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
# Plugin for SYCL Native CPU
# Create shared library for libpi_nativecpu.so

# Get the Native CPU adapter sources so they can be shared with the Native CPU PI plugin
get_target_property(UR_NATIVE_CPU_ADAPTER_SOURCES ur_adapter_native_cpu SOURCES)

add_sycl_plugin(native_cpu
SOURCES
"pi_native_cpu.cpp"
${UR_NATIVE_CPU_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/native_cpu/adapter.cpp"
"../unified_runtime/ur/adapters/native_cpu/command_buffer.cpp"
"../unified_runtime/ur/adapters/native_cpu/common.cpp"
"../unified_runtime/ur/adapters/native_cpu/common.hpp"
"../unified_runtime/ur/adapters/native_cpu/context.cpp"
"../unified_runtime/ur/adapters/native_cpu/context.hpp"
"../unified_runtime/ur/adapters/native_cpu/device.cpp"
"../unified_runtime/ur/adapters/native_cpu/device.hpp"
"../unified_runtime/ur/adapters/native_cpu/enqueue.cpp"
"../unified_runtime/ur/adapters/native_cpu/event.cpp"
"../unified_runtime/ur/adapters/native_cpu/image.cpp"
"../unified_runtime/ur/adapters/native_cpu/kernel.cpp"
"../unified_runtime/ur/adapters/native_cpu/kernel.hpp"
"../unified_runtime/ur/adapters/native_cpu/memory.cpp"
"../unified_runtime/ur/adapters/native_cpu/memory.hpp"
"../unified_runtime/ur/adapters/native_cpu/platform.cpp"
"../unified_runtime/ur/adapters/native_cpu/platform.hpp"
"../unified_runtime/ur/adapters/native_cpu/program.cpp"
"../unified_runtime/ur/adapters/native_cpu/program.hpp"
"../unified_runtime/ur/adapters/native_cpu/queue.cpp"
"../unified_runtime/ur/adapters/native_cpu/queue.hpp"
"../unified_runtime/ur/adapters/native_cpu/sampler.cpp"
"../unified_runtime/ur/adapters/native_cpu/ur_interface_loader.cpp"
"../unified_runtime/ur/adapters/native_cpu/usm.cpp"
"../unified_runtime/ur/adapters/native_cpu/usm_p2p.cpp"
"${sycl_inc_dir}/sycl/detail/pi.h"
"${sycl_inc_dir}/sycl/detail/pi.hpp"
"pi_native_cpu.cpp"
"pi_native_cpu.hpp"
INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime
${sycl_inc_dir}
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime # for Unified Runtime
${UNIFIED_RUNTIME_SOURCE_DIR}/source/ # for adapters/native_cpu
LIBRARIES
sycl
UnifiedRuntime-Headers
UnifiedRuntimeCommon
)

set_target_properties(pi_native_cpu PROPERTIES LINKER_LANGUAGE CXX)
14 changes: 7 additions & 7 deletions sycl/plugins/native_cpu/pi_native_cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

#include <pi2ur.hpp>

#include <ur/adapters/native_cpu/context.hpp>
#include <ur/adapters/native_cpu/device.hpp>
#include <ur/adapters/native_cpu/kernel.hpp>
#include <ur/adapters/native_cpu/memory.hpp>
#include <ur/adapters/native_cpu/platform.hpp>
#include <ur/adapters/native_cpu/program.hpp>
#include <ur/adapters/native_cpu/queue.hpp>
#include <adapters/native_cpu/context.hpp>
#include <adapters/native_cpu/device.hpp>
#include <adapters/native_cpu/kernel.hpp>
#include <adapters/native_cpu/memory.hpp>
#include <adapters/native_cpu/platform.hpp>
#include <adapters/native_cpu/program.hpp>
#include <adapters/native_cpu/queue.hpp>

struct _pi_context : ur_context_handle_t_ {
using ur_context_handle_t_::ur_context_handle_t_;
Expand Down
63 changes: 13 additions & 50 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ 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
if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
set(UR_BUILD_ADAPTER_NATIVE_CPU ON)
endif()

# Disable errors from warnings while building the UR.
# And remember origin flags before doing that.
Expand All @@ -54,13 +56,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit 192e9404392c38ac43d09116d6c97e153c66f46b
# Merge: 2f44433c f65473d9
# commit 659d3f469faa99a886fa680a3d6d20449b109578
# Merge: 192e9404 f94550b4
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Fri Nov 10 13:25:42 2023 +0000
# Merge pull request #1044 from aarongreig/aaron/clCTSFixMegaBranch
# [OpenCL] Combined CTS fixes
set(UNIFIED_RUNTIME_TAG 192e9404392c38ac43d09116d6c97e153c66f46b)
# Date: Tue Nov 14 16:45:24 2023 +0000
# Merge pull request #1059 from martygrant/martin/moveNativeCPUAdapterToUR
# [NATIVECPU] Move Native CPU adapter to UR.
set(UNIFIED_RUNTIME_TAG 659d3f469faa99a886fa680a3d6d20449b109578)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down Expand Up @@ -159,49 +161,6 @@ endif()

add_sycl_plugin(unified_runtime ${UNIFIED_RUNTIME_PLUGIN_ARGS})

if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
add_sycl_library("ur_adapter_native_cpu" SHARED
SOURCES
"ur/ur.cpp"
"ur/ur.hpp"
"ur/adapters/native_cpu/adapter.cpp"
"ur/adapters/native_cpu/command_buffer.cpp"
"ur/adapters/native_cpu/common.cpp"
"ur/adapters/native_cpu/common.hpp"
"ur/adapters/native_cpu/context.cpp"
"ur/adapters/native_cpu/context.hpp"
"ur/adapters/native_cpu/device.cpp"
"ur/adapters/native_cpu/device.hpp"
"ur/adapters/native_cpu/enqueue.cpp"
"ur/adapters/native_cpu/event.cpp"
"ur/adapters/native_cpu/image.cpp"
"ur/adapters/native_cpu/kernel.cpp"
"ur/adapters/native_cpu/kernel.hpp"
"ur/adapters/native_cpu/memory.cpp"
"ur/adapters/native_cpu/memory.hpp"
"ur/adapters/native_cpu/platform.cpp"
"ur/adapters/native_cpu/platform.hpp"
"ur/adapters/native_cpu/program.cpp"
"ur/adapters/native_cpu/program.hpp"
"ur/adapters/native_cpu/queue.cpp"
"ur/adapters/native_cpu/queue.hpp"
"ur/adapters/native_cpu/sampler.cpp"
"ur/adapters/native_cpu/ur_interface_loader.cpp"
"ur/adapters/native_cpu/usm.cpp"
"ur/adapters/native_cpu/usm_p2p.cpp"
LIBRARIES
UnifiedRuntime-Headers
Threads::Threads
OpenCL-Headers
)

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


if(TARGET UnifiedRuntimeLoader)
set_target_properties(hello_world PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
# Install the UR loader.
Expand Down Expand Up @@ -238,3 +197,7 @@ endif()
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
add_dependencies(sycl-runtime-libraries ur_adapter_opencl)
endif()

if ("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS)
add_dependencies(sycl-runtime-libraries ur_adapter_native_cpu)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Native CPU adapter
The source for the SYCL Native CPU 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).
71 changes: 0 additions & 71 deletions sycl/plugins/unified_runtime/ur/adapters/native_cpu/adapter.cpp

This file was deleted.

This file was deleted.

Loading