Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d0ba73b
[SYCL][CUDA] Port CUDA plugin to Unified Runtime (#9512)
callumfare Jun 14, 2023
b504c5b
[SYCL][CUDA] Fix post merge errors from #9512 (#9872)
kbenzie Jun 14, 2023
6b4298a
[SYCL][CUDA][HIP] Block until the event is ready to start profiling. …
mmoadeli Jun 21, 2023
efac061
[SYCL][UR] Update Unified Runtime tag to support UR_DEVICE_INFO_IP_VE…
dm-vodopyanov Jun 21, 2023
47b134a
[SYCL] Fix self-build compilation after PR #9873 (#10018)
dm-vodopyanov Jun 22, 2023
b992d69
[SYCL][CUDA] Fix broken synchronization of CUstreams (#10031)
callumfare Jun 22, 2023
c71ee7c
Partially reverts back the update on guess local work size function. …
mmoadeli Jun 26, 2023
7381044
[SYCL][UR] Bump UR version and add missing values to pi2ur (#10049)
callumfare Jun 26, 2023
d74234e
[SYCL][CUDA] Remove size checks from USM allocations (#10034)
npmiller Jun 28, 2023
2fb0f02
[SYCL][Graph] L0 Backend support for SYCL Graphs (2/4) (#9992)
Bensuo Jul 4, 2023
0123900
[SYCL][UR][CUDA] Fix typo in ur_device_handle_t (#10130)
hdelan Jul 4, 2023
bbb6788
[SYCL][HIP] Ignore unused PI command-buffer parameters (#10192)
Jul 4, 2023
8558159
[SYCL][CUDA] Fix cuDeviceGetUuid for older CUDA version (#10205)
npmiller Jul 5, 2023
c4a620e
[SYCL][CUDA] Cached info from CUDA API calls to the kernel and device…
keyradical Jul 6, 2023
470aaf1
[SYCL][UR][CUDA] Remove unnecessary UR entry point validation (#9969)
callumfare Jul 7, 2023
80e7566
[SYCL][CUDA] Implement sycl_ext_oneapi_peer_access extension (#8303)
JackAKirk Jul 10, 2023
5967f17
[PI][UR] Report error from cuInit (#10353)
veselypeta Jul 13, 2023
4701e1e
[SYCL][CUDA] Remove SYCL dependencies from CUDA UR adapter (#10135)
pbalcer Jul 14, 2023
2859bb5
[SYCL][Bindless][2/4] Add experimental implementation of SYCL bindles…
isaacault Jul 18, 2023
26eba89
[SYCL][UR][CUDA] Fix some issues in cuda adapter's urDeviceGetInfo. (…
aarongreig Jul 18, 2023
a0ac77c
[SYCL][CUDA] Fix device creation from native handle (#10450)
kbenzie Jul 19, 2023
e1ae1e2
[SYCL][Bindless] Fix compiler Werrors (#10464)
Jul 19, 2023
6febad3
[SYCL][UR] Fix device partition queries (#10355)
Jul 19, 2023
771cd2c
[SYCL] [L0] Add user APIs to import / release host memory from USM. (…
rdeodhar Jul 19, 2023
66f109a
[CUDA][UR] Cache the max local mem size (#10577)
hdelan Jul 27, 2023
4e362cb
[SYCL][PI] Restore CUDA and HIP plugin ABI (#10518)
kbenzie Jul 27, 2023
4c12a32
[SYCL][UR] Bump UR and implement adapter handles (#10349)
callumfare Jul 28, 2023
7e0285e
[SYCL][CUDA] Make plugin specific error return an error (#10626)
hdelan Aug 2, 2023
be8a884
[SYCL][CUDA] Pass device from context in create queue. (#10491)
JackAKirk Aug 4, 2023
5817449
[SYCL][CUDA] ifdef cuda 11.5 datatypes (#10691)
hdelan Aug 14, 2023
a2797ff
[SYCL][CUDA] fix compilation of CUDA plugin on Windows with MSVC (#10…
freibold Aug 14, 2023
d18592c
[SYCL][UR][CUDA] Fix a few issues in the cuda adapter revealed by UR …
aarongreig Aug 15, 2023
00a84b3
[CUDA][HIP][UR] Fix race condition in adapters (#10826)
hdelan Aug 18, 2023
d835cd1
[SYCL][UR] Implement usm memory pool for cuda adapter. (#10758)
aarongreig Aug 21, 2023
2635ff3
[SYCL][CUDA] Add std::ignore for USM alloc args that are only used in…
aarongreig Aug 21, 2023
5309374
[UR][CUDA][HIP] Fix Set Arg Local (#10710)
veselypeta Aug 25, 2023
a75b944
[UR][CUDA][HIP][L0] Cleanup licence header (#10824)
veselypeta Aug 28, 2023
ea3c77e
[SYCL][HIP] Implemented supported make_* interop functions. (#10526)
JackAKirk Aug 30, 2023
da60f90
[UR][CUDA] Ifdef remaining CUDA 11 datatypes (#10922)
hdelan Aug 30, 2023
901787e
[SYCL][CUDA] Reintroduce removing of size checks from USM allocations…
omarahmed1111 Sep 4, 2023
2bf7ed0
[UR][CUDA][HIP] Replace `ur::assertion` with `UR_CHECK_ERROR` (#10986)
JackAKirk Sep 8, 2023
1cb9209
[SYCL][CUDA][Bindless] Add support for normalized channel types (#11120)
Sep 12, 2023
54cead7
[SYCL][UR][CUDA] Mirror SYCL_PI env vars with UR prefix (#10045)
callumfare Sep 12, 2023
2981a7d
[PI][UR][HIP][CUDA][L0][NCPU] Pull in latest UR fixes. (#11155)
veselypeta Sep 15, 2023
99735cc
[SYCL] Add esimd as an optional device feature (#10017)
sarnex Sep 19, 2023
40e0901
Revert "[PI][UR][HIP][CUDA][L0][NCPU] Pull in latest UR fixes." (#11227)
aelovikov-intel Sep 20, 2023
3315f42
[SYCL][CUDA] Multiple fixes for the CUDA adapter (#11121)
Sep 20, 2023
6cc3c4c
[SYCL][NFC] Make UR_CHECK_ERROR a void return macro (#11100)
Sep 22, 2023
9c3acb1
[SYCL][NFC] Remove unused lambda capture (#11269)
Sep 22, 2023
8985991
[L0] Add missing loader interfaces to L0 adapter
callumfare Sep 25, 2023
e04e2f9
[CUDA] Move adapter sources into the cuda adapter folder
Sep 26, 2023
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
2 changes: 0 additions & 2 deletions source/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ if(UR_BUILD_ADAPTER_L0)
endif()

if(UR_BUILD_ADAPTER_CUDA)
set(SYCL_ADAPTER_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/cuda")
FetchSource(https://github.com/intel/llvm.git ${INTEL_LLVM_TAG} "sycl/plugins/unified_runtime/ur" ${SYCL_ADAPTER_DIR})
add_subdirectory(cuda)
endif()

Expand Down
4 changes: 4 additions & 0 deletions source/adapters/cuda/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
Language: Cpp
BasedOnStyle: LLVM
...
72 changes: 39 additions & 33 deletions source/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(CUDA_DIR "${SYCL_ADAPTER_DIR}/sycl/plugins/unified_runtime/ur/adapters/cuda" CACHE PATH "CUDA adapter directory")
set(CUDA_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "CUDA adapter directory")

set(TARGET_NAME ur_adapter_cuda)

add_ur_adapter(${TARGET_NAME}
SHARED
${CUDA_DIR}/ur_interface_loader.cpp
${CUDA_DIR}/adapter.hpp
${CUDA_DIR}/adapter.cpp
${CUDA_DIR}/command_buffer.hpp
${CUDA_DIR}/command_buffer.cpp
${CUDA_DIR}/common.hpp
${CUDA_DIR}/common.cpp
${CUDA_DIR}/context.hpp
${CUDA_DIR}/context.cpp
${CUDA_DIR}/device.hpp
${CUDA_DIR}/device.cpp
${CUDA_DIR}/enqueue.cpp
${CUDA_DIR}/event.hpp
${CUDA_DIR}/event.cpp
${CUDA_DIR}/kernel.hpp
${CUDA_DIR}/kernel.cpp
${CUDA_DIR}/memory.hpp
${CUDA_DIR}/memory.cpp
${CUDA_DIR}/platform.hpp
${CUDA_DIR}/platform.cpp
${CUDA_DIR}/program.hpp
${CUDA_DIR}/program.cpp
${CUDA_DIR}/queue.hpp
${CUDA_DIR}/queue.cpp
${CUDA_DIR}/sampler.hpp
${CUDA_DIR}/sampler.cpp
${CUDA_DIR}/tracing.cpp
${CUDA_DIR}/usm.cpp
${CUDA_DIR}/usm_p2p.cpp
${CUDA_DIR}/../../ur.cpp
${CUDA_DIR}/../../ur.hpp
${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp
${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp
${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common.hpp
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/context.hpp
${CMAKE_CURRENT_SOURCE_DIR}/context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device.hpp
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enqueue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/event.hpp
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel.hpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory.hpp
${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp
${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/program.hpp
${CMAKE_CURRENT_SOURCE_DIR}/program.cpp
${CMAKE_CURRENT_SOURCE_DIR}/queue.hpp
${CMAKE_CURRENT_SOURCE_DIR}/queue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler.hpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tracing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/usm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.hpp
)

set_target_properties(${TARGET_NAME} PROPERTIES
Expand Down Expand Up @@ -67,6 +67,12 @@ else()
)
endif()

if(UMF_ENABLE_POOL_TRACKING)
target_compile_definitions("ur_adapter_cuda" PRIVATE UMF_ENABLE_POOL_TRACKING)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this option in the readme?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I know the UMF team are reworking stuff so that this option isn't needed, hopefully its days are numbered

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already an option in UR. It was just not being used in the adapter

else()
message(WARNING "CUDA adapter USM pools are disabled, set UMF_ENABLE_POOL_TRACKING to enable them")
endif()

target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
Expand All @@ -76,5 +82,5 @@ target_link_libraries(${TARGET_NAME} PRIVATE
)

target_include_directories(${TARGET_NAME} PRIVATE
${CUDA_DIR}/../../../
"${CMAKE_CURRENT_SOURCE_DIR}/../../"
)
89 changes: 89 additions & 0 deletions source/adapters/cuda/adapter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//===--------- adapter.cpp - CUDA Adapter ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These licenses will need updating too, but a follow up PR is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add this in a follow up PR

// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <ur_api.h>

#include "common.hpp"

void enableCUDATracing();
void disableCUDATracing();

struct ur_adapter_handle_t_ {
std::atomic<uint32_t> RefCount = 0;
std::mutex Mutex;
};

ur_adapter_handle_t_ adapter{};

UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t,
ur_loader_config_handle_t) {
return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) {
return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL
urAdapterGet(uint32_t NumEntries, ur_adapter_handle_t *phAdapters,
uint32_t *pNumAdapters) {
if (NumEntries > 0 && phAdapters) {
std::lock_guard<std::mutex> Lock{adapter.Mutex};
if (adapter.RefCount++ == 0) {
enableCUDATracing();
}

*phAdapters = &adapter;
}

if (pNumAdapters) {
*pNumAdapters = 1;
}

return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL urAdapterRetain(ur_adapter_handle_t) {
adapter.RefCount++;

return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL urAdapterRelease(ur_adapter_handle_t) {
std::lock_guard<std::mutex> Lock{adapter.Mutex};
if (--adapter.RefCount == 0) {
disableCUDATracing();
}
return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetLastError(
ur_adapter_handle_t, const char **ppMessage, int32_t *pError) {
std::ignore = pError;
*ppMessage = ErrorMessage;
return ErrorMessageCode;
}

UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t,
ur_adapter_info_t propName,
size_t propSize,
void *pPropValue,
size_t *pPropSizeRet) {
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);

switch (propName) {
case UR_ADAPTER_INFO_BACKEND:
return ReturnValue(UR_ADAPTER_BACKEND_CUDA);
case UR_ADAPTER_INFO_REFERENCE_COUNT:
return ReturnValue(adapter.RefCount.load());
default:
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

return UR_RESULT_SUCCESS;
}
11 changes: 11 additions & 0 deletions source/adapters/cuda/adapter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//===--------- adapter.hpp - CUDA Adapter ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

struct ur_adapter_handle_t_;

extern ur_adapter_handle_t_ adapter;
Loading