Skip to content

Commit 02baece

Browse files
committed
[NATIVECPU] Move Native CPU adapter to UR.
1 parent 0868c6e commit 02baece

33 files changed

+191
-62
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ source/adapters/hip @oneapi-src/unified-runtime-hip-write
1010
# OpenCL adapter
1111
source/adapters/opencl @oneapi-src/unified-runtime-opencl-write
1212

13+
# Native CPU adapter
14+
source/adapters/native_cpu @oneapi-src/unified-runtime-native-cpu-write
15+
1316
# Command-buffer experimental feature
1417
source/adapters/**/command_buffer.* @oneapi-src/unified-runtime-command-buffer-write
1518
scripts/core/EXP-COMMAND-BUFFER.rst @oneapi-src/unified-runtime-command-buffer-write

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ option(UR_BUILD_ADAPTER_L0 "build level 0 adapter from SYCL" OFF)
3939
option(UR_BUILD_ADAPTER_OPENCL "build opencl adapter from SYCL" OFF)
4040
option(UR_BUILD_ADAPTER_CUDA "build cuda adapter from SYCL" OFF)
4141
option(UR_BUILD_ADAPTER_HIP "build hip adapter from SYCL" OFF)
42+
option(UR_BUILD_ADAPTER_NATIVE_CPU "build native_cpu adapter from SYCL" OFF)
4243
option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF)
4344
option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF)
4445
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ List of options provided by CMake:
131131
| UR_BUILD_ADAPTER_OPENCL | Fetch and use opencl adapter from SYCL | ON/OFF | OFF |
132132
| UR_BUILD_ADAPTER_CUDA | Fetch and use cuda adapter from SYCL | ON/OFF | OFF |
133133
| UR_BUILD_ADAPTER_HIP | Fetch and use hip adapter from SYCL | ON/OFF | OFF |
134+
| UR_BUILD_ADAPTER_NATIVE_CPU | Fetch and use native-cpu adapter from SYCL | ON/OFF | OFF |
134135
| UR_HIP_PLATFORM | Build hip adapter for AMD or NVIDIA platform | AMD/NVIDIA | AMD |
135136
| UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD |
136137
| UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` |

source/adapters/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ endif()
4747
if(UR_BUILD_ADAPTER_OPENCL)
4848
add_subdirectory(opencl)
4949
endif()
50+
if(UR_BUILD_ADAPTER_NATIVE_CPU)
51+
add_subdirectory(native_cpu)
52+
endif()
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+
...
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
set(NATIVE_CPU_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Native CPU adapter directory")
7+
8+
set(TARGET_NAME ur_adapter_native_cpu)
9+
10+
add_ur_adapter(${TARGET_NAME}
11+
SHARED
12+
${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp
13+
${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
15+
${CMAKE_CURRENT_SOURCE_DIR}/common.hpp
16+
${CMAKE_CURRENT_SOURCE_DIR}/context.cpp
17+
${CMAKE_CURRENT_SOURCE_DIR}/context.hpp
18+
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
19+
${CMAKE_CURRENT_SOURCE_DIR}/device.hpp
20+
${CMAKE_CURRENT_SOURCE_DIR}/enqueue.cpp
21+
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
22+
${CMAKE_CURRENT_SOURCE_DIR}/image.cpp
23+
${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp
24+
${CMAKE_CURRENT_SOURCE_DIR}/kernel.hpp
25+
${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp
26+
${CMAKE_CURRENT_SOURCE_DIR}/memory.hpp
27+
${CMAKE_CURRENT_SOURCE_DIR}/nativecpu_state.hpp
28+
${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp
29+
${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp
30+
${CMAKE_CURRENT_SOURCE_DIR}/program.cpp
31+
${CMAKE_CURRENT_SOURCE_DIR}/program.hpp
32+
${CMAKE_CURRENT_SOURCE_DIR}/queue.cpp
33+
${CMAKE_CURRENT_SOURCE_DIR}/queue.hpp
34+
${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp
35+
${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp
36+
${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp
37+
${CMAKE_CURRENT_SOURCE_DIR}/usm.cpp
38+
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp
39+
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.hpp
40+
)
41+
42+
set_target_properties(${TARGET_NAME} PROPERTIES
43+
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
44+
SOVERSION "${PROJECT_VERSION_MAJOR}"
45+
)
46+
47+
find_package(Threads REQUIRED)
48+
49+
target_link_libraries(${TARGET_NAME} PRIVATE
50+
${PROJECT_NAME}::headers
51+
${PROJECT_NAME}::common
52+
${PROJECT_NAME}::unified_malloc_framework
53+
Threads::Threads
54+
)
55+
56+
target_include_directories(${TARGET_NAME} PRIVATE
57+
"${CMAKE_CURRENT_SOURCE_DIR}/../../"
58+
)

sycl/plugins/unified_runtime/ur/adapters/native_cpu/adapter.cpp renamed to source/adapters/native_cpu/adapter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//===---------------- adapter.cpp - Native CPU 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
//
79
//===----------------------------------------------------------------------===//

sycl/plugins/unified_runtime/ur/adapters/native_cpu/command_buffer.cpp renamed to source/adapters/native_cpu/command_buffer.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
//===--------- command_buffer.cpp - NativeCPU 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

1113
/// Stub implementations of UR experimental feature command-buffers
1214
/// Taken almost unchanged from another adapter. Perhaps going forward
1315
/// these stubs could be defined in core UR as the default which would
1416
/// reduce code duplication. Adapters could then "override" these defaults.
17+
/// Issue raised for this comment in
18+
/// https://github.com/oneapi-src/unified-runtime/issues/1064
1519

1620
UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
1721
ur_context_handle_t, ur_device_handle_t,

sycl/plugins/unified_runtime/ur/adapters/native_cpu/common.cpp renamed to source/adapters/native_cpu/common.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//===---------------- common.cpp - Native CPU 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
//
79
//===----------------------------------------------------------------------===//

sycl/plugins/unified_runtime/ur/adapters/native_cpu/common.hpp renamed to source/adapters/native_cpu/common.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//===----------- common.hpp - Native CPU 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
#pragma once
1012

0 commit comments

Comments
 (0)