forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
110 lines (100 loc) · 3.75 KB
/
Copy pathCMakeLists.txt
File metadata and controls
110 lines (100 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
message(STATUS "Including the PI API CUDA backend.")
# cannot rely on cmake support for CUDA; it assumes runtime API is being used.
# we only require the CUDA driver API to be used
# CUDA_CUDA_LIBRARY variable defines the path to libcuda.so, the CUDA Driver API library.
find_package(CUDA 10.1 REQUIRED)
# Make imported library global to use it within the project.
add_library(cudadrv SHARED IMPORTED GLOBAL)
if (WIN32)
set_target_properties(
cudadrv PROPERTIES
IMPORTED_IMPLIB ${CUDA_CUDA_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${CUDA_INCLUDE_DIRS}
)
else()
set_target_properties(
cudadrv PROPERTIES
IMPORTED_LOCATION ${CUDA_CUDA_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${CUDA_INCLUDE_DIRS}
)
endif()
if (SYCL_ENABLE_XPTI_TRACING)
# The following two if's can be removed when FindCUDA -> FindCUDAToolkit.
# CUDA_CUPTI_INCLUDE_DIR -> CUDAToolkit_CUPTI_INCLUDE_DIR
include(FindCUDACupti)
if(NOT CUDA_CUPTI_INCLUDE_DIR)
find_cuda_cupti_include_dir()
endif()
# CUDA_cupti_LIBRARY -> CUDAToolkit_cupti_LIBRARY
if(NOT CUDA_cupti_LIBRARY)
find_cuda_cupti_library()
endif()
set(XPTI_PROXY_SRC "${CMAKE_SOURCE_DIR}/../xpti/src/xpti_proxy.cpp")
set(XPTI_INCLUDE
"${CMAKE_SOURCE_DIR}/../xpti/include"
"${CUDA_CUPTI_INCLUDE_DIR}"
)
set(XPTI_LIBS
"${CMAKE_DL_LIBS}"
"${CUDA_cupti_LIBRARY}"
)
endif()
add_sycl_plugin(cuda
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/usm_allocator.cpp"
"../unified_runtime/ur/usm_allocator.hpp"
"../unified_runtime/ur/adapters/cuda/common.cpp"
"../unified_runtime/ur/adapters/cuda/common.hpp"
"../unified_runtime/ur/adapters/cuda/context.cpp"
"../unified_runtime/ur/adapters/cuda/context.hpp"
"../unified_runtime/ur/adapters/cuda/device.cpp"
"../unified_runtime/ur/adapters/cuda/device.hpp"
"../unified_runtime/ur/adapters/cuda/enqueue.cpp"
"../unified_runtime/ur/adapters/cuda/event.cpp"
"../unified_runtime/ur/adapters/cuda/event.hpp"
"../unified_runtime/ur/adapters/cuda/kernel.cpp"
"../unified_runtime/ur/adapters/cuda/kernel.hpp"
"../unified_runtime/ur/adapters/cuda/memory.cpp"
"../unified_runtime/ur/adapters/cuda/memory.hpp"
"../unified_runtime/ur/adapters/cuda/platform.cpp"
"../unified_runtime/ur/adapters/cuda/platform.hpp"
"../unified_runtime/ur/adapters/cuda/program.cpp"
"../unified_runtime/ur/adapters/cuda/program.hpp"
"../unified_runtime/ur/adapters/cuda/queue.cpp"
"../unified_runtime/ur/adapters/cuda/queue.hpp"
"../unified_runtime/ur/adapters/cuda/sampler.cpp"
"../unified_runtime/ur/adapters/cuda/sampler.hpp"
"../unified_runtime/ur/adapters/cuda/tracing.cpp"
"../unified_runtime/ur/adapters/cuda/ur_interface_loader.cpp"
"../unified_runtime/ur/adapters/cuda/usm.cpp"
"../unified_runtime/ur/adapters/cuda/command_buffer.hpp"
"../unified_runtime/ur/adapters/cuda/command_buffer.cpp"
"../unified_runtime/ur/adapters/cuda/usm_p2p.cpp"
# ---
"${sycl_inc_dir}/sycl/detail/pi.h"
"${sycl_inc_dir}/sycl/detail/pi.hpp"
"pi_cuda.hpp"
"pi_cuda.cpp"
${XPTI_PROXY_SRC}
INCLUDE_DIRS
${sycl_inc_dir}
${XPTI_INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/../unified_runtime
LIBRARIES
cudadrv
${XPTI_LIBS}
UnifiedRuntime-Headers
HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/features.hpp"
)
if (SYCL_ENABLE_XPTI_TRACING)
target_compile_definitions(pi_cuda PRIVATE
XPTI_ENABLE_INSTRUMENTATION
XPTI_STATIC_LIBRARY
)
endif()
set_target_properties(pi_cuda PROPERTIES LINKER_LANGUAGE CXX)