-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
291 lines (274 loc) · 9.92 KB
/
CMakeLists.txt
File metadata and controls
291 lines (274 loc) · 9.92 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
if(THEROCK_ENABLE_ROCPROFV3)
set(_rocprofiler_sdk_optional_deps)
##############################################################################
# rocprof-trace-decoder-binary
# The trace decoder is responsible for decoding advanced thread traces from
# the GPU. It is a binary-only dependency of ROCm which is enabled at
# runtime via `rocprofv3 --att`. If an appropriate shared library is adjacent
# to the profiler shared libraries, it will be used by default.
# See: https://github.com/ROCm/rocprof-trace-decoder/
# The binaries are contained in the submodule rocprof-trace-decoder/binaries
# Our CMakeLists which installs them is local to this project.
##############################################################################
if(THEROCK_ENABLE_ROCPROF_TRACE_DECODER_BINARY)
therock_cmake_subproject_declare(rocprof-trace-decoder
EXTERNAL_SOURCE_DIR "rocprof-trace-decoder"
BACKGROUND_BUILD
)
therock_cmake_subproject_activate(rocprof-trace-decoder)
list(APPEND _rocprofiler_sdk_optional_deps rocprof-trace-decoder)
endif()
##############################################################################
# aqlprofile
##############################################################################
therock_cmake_subproject_declare(aqlprofile
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/aqlprofile"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/aqlprofile"
BACKGROUND_BUILD
CMAKE_ARGS
-DAQLPROFILE_BUILD_TESTS=${THEROCK_BUILD_TESTING}
-DHIP_PLATFORM="amd"
COMPILER_TOOLCHAIN
amd-hip
INTERFACE_LINK_DIRS
lib # So that dependents can find the aqlprofile library via find_library
BUILD_DEPS
therock-googletest
RUNTIME_DEPS
hip-clr
amd-llvm
ROCR-Runtime
)
therock_cmake_subproject_glob_c_sources(aqlprofile
SUBDIRS .
)
therock_cmake_subproject_activate(aqlprofile)
if(THEROCK_BUILD_TESTING)
therock_provide_artifact(aqlprofile-tests
TARGET_NEUTRAL
DESCRIPTOR artifact-aqlprofile.toml
COMPONENTS
test
SUBPROJECT_DEPS
aqlprofile
)
endif(THEROCK_BUILD_TESTING)
##############################################################################
# rocprofiler-sdk
##############################################################################
# Detect available Default Python3 version on the system or
# use explicitly provided Python3 versions
therock_detect_python_versions(_detected_python_executables _detected_python_versions)
# Use detected versions or fall back to default if none found
if(NOT _detected_python_versions)
message(FATAL_ERROR "No Python versions detected for rocprofiler-sdk")
set(_detected_python_versions_str "")
else()
message(STATUS "Detected Python versions for rocprofiler-sdk python bindings: ${_detected_python_versions}")
message(STATUS "Python executables: ${_detected_python_executables}")
# Join all detected Python versions into a single string separated by semicolons.
# This is a workaround because therock_cmake_subproject_declare does not support passing lists directly.
list(JOIN _detected_python_versions "\;" _detected_python_versions_str)
endif()
therock_cmake_subproject_declare(rocprofiler-sdk
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocprofiler-sdk"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocprofiler-sdk"
BACKGROUND_BUILD
CMAKE_ARGS
-DHIP_PLATFORM=amd
-DROCPROFILER_PYTHON_VERSIONS:STRING="${_detected_python_versions_str}"
CMAKE_INCLUDES
therock_explicit_finders.cmake
COMPILER_TOOLCHAIN
amd-hip
RUNTIME_DEPS
aqlprofile
hip-clr
rocprofiler-register
${_rocprofiler_sdk_optional_deps}
${THEROCK_BUNDLED_ELFUTILS}
${THEROCK_BUNDLED_LIBDRM}
${THEROCK_BUNDLED_SQLITE3}
INTERFACE_INCLUDE_DIRS
include
INTERFACE_LINK_DIRS
lib
lib/rocm_sysdeps/lib
INTERFACE_INSTALL_RPATH_DIRS
lib
lib/rocm_sysdeps/lib
)
therock_cmake_subproject_glob_c_sources(rocprofiler-sdk
SUBDIRS .
)
therock_cmake_subproject_provide_package(rocprofiler-sdk rocprofiler-sdk lib/cmake/rocprofiler-sdk)
therock_cmake_subproject_provide_package(rocprofiler-sdk rocprofiler-sdk-roctx lib/cmake/rocprofiler-sdk-roctx)
therock_cmake_subproject_provide_package(rocprofiler-sdk rocprofiler-sdk-rocpd lib/cmake/rocprofiler-sdk-rocpd)
therock_cmake_subproject_activate(rocprofiler-sdk)
##############################################################################
# rocprofiler-compute
##############################################################################
therock_cmake_subproject_declare(rocprofiler-compute
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocprofiler-compute"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocprofiler-compute"
BACKGROUND_BUILD
DEFAULT_GPU_TARGETS
gfx942
CMAKE_ARGS
-DHIP_PLATFORM=amd
-DENABLE_TESTS=${THEROCK_BUILD_TESTING}
-DINSTALL_TESTS=${THEROCK_BUILD_TESTING}
-DTEST_FROM_INSTALL=${THEROCK_BUILD_TESTING}
-DCHECK_PYTHON_DEPS=OFF
CMAKE_INCLUDES
therock_explicit_finders.cmake
COMPILER_TOOLCHAIN
amd-hip
RUNTIME_DEPS
rocprofiler-sdk
aqlprofile
hip-clr
rocprofiler-register
${_rocprofiler_sdk_optional_deps}
${THEROCK_BUNDLED_ELFUTILS}
${THEROCK_BUNDLED_LIBDRM}
${THEROCK_BUNDLED_SQLITE3}
)
therock_cmake_subproject_glob_c_sources(rocprofiler-compute
SUBDIRS .
)
therock_cmake_subproject_activate(rocprofiler-compute)
##############################################################################
# roctracer
# This is a very old, deprecated library with a number of quirks. Long term,
# everything is supposed to migrate to rocprofiler-sdk, which has runtime
# support to intercept any old roctracer clients when tracing is active.
# To prepare for removal, anything that depends on roctracer should also
# depend on rocprofiler-sdk.
##############################################################################
therock_cmake_subproject_declare(roctracer
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/roctracer"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/roctracer"
BACKGROUND_BUILD
COMPILER_TOOLCHAIN
# Must build with the HIP compiler.
amd-hip
CMAKE_ARGS
-DHIP_PLATFORM=amd
INTERFACE_INCLUDE_DIRS
# All old clients of roctx64 expect to just be able to find its include
# with no further qualification. Bad design, but also deprecated, so meh.
include
INTERFACE_LINK_DIRS
# So that dependents can find the roctx library via find_library()
lib
RUNTIME_DEPS
hip-clr
ROCR-Runtime
)
therock_cmake_subproject_glob_c_sources(roctracer
SUBDIRS .
)
therock_cmake_subproject_activate(roctracer)
##############################################################################
# Artifacts
##############################################################################
therock_provide_artifact(rocprofiler-sdk
TARGET_NEUTRAL
DESCRIPTOR artifact-rocprofiler-sdk.toml
COMPONENTS
dbg
dev
doc
lib
run
test
SUBPROJECT_DEPS
aqlprofile
rocprofiler-sdk
roctracer
${_rocprofiler_sdk_optional_deps}
)
therock_provide_artifact(rocprofiler-compute
TARGET_NEUTRAL
DESCRIPTOR artifact-rocprofiler-compute.toml
COMPONENTS
dbg
dev
doc
lib
run
test
SUBPROJECT_DEPS
aqlprofile
rocprofiler-sdk
rocprofiler-compute
)
##############################################################################
# rocprofiler-systems
##############################################################################
# rocprofiler-systems requires GCC, but sanitizer builds use Clang.
# Skip enabling rocprofiler-systems when building with sanitizers.
if (THEROCK_ENABLE_ROCPROFSYS AND THEROCK_SANITIZER STREQUAL "")
# Escape semicolons in GPU targets list to prevent shell interpretation
if (THEROCK_DIST_AMDGPU_TARGETS STREQUAL "THEROCK_DIST_AMDGPU_TARGETS-NOTFOUND")
set(_ROCPROFSYS_GFX_TARGETS_ESCAPED "")
else()
string(REPLACE ";" "\\;" _ROCPROFSYS_GFX_TARGETS_ESCAPED "${THEROCK_DIST_AMDGPU_TARGETS}")
endif()
therock_cmake_subproject_declare(rocprofiler-systems
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocprofiler-systems"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocprofiler-systems"
BACKGROUND_BUILD
CMAKE_ARGS
-DHIP_PLATFORM=amd
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_DYNINST=ON
-DROCPROFSYS_BUILD_FOR_THEROCK=ON
-DROCPROFSYS_GFX_TARGETS="${_ROCPROFSYS_GFX_TARGETS_ESCAPED}"
-DROCPROFSYS_BUILD_SPDLOG=OFF
INSTALL_RPATH_DIRS
"lib"
"lib/rocprofiler-systems"
"llvm/lib"
CMAKE_INCLUDES
therock_explicit_finders.cmake
RUNTIME_DEPS
amdsmi
aqlprofile
hip-clr
rocprofiler-register
rocprofiler-sdk
therock-spdlog
therock-fmt
${THEROCK_BUNDLED_LIBDRM}
${THEROCK_BUNDLED_SQLITE3}
)
therock_cmake_subproject_glob_c_sources(rocprofiler-systems
SUBDIRS .
)
therock_cmake_subproject_activate(rocprofiler-systems)
therock_provide_artifact(rocprofiler-systems
TARGET_NEUTRAL
DESCRIPTOR artifact-rocprofiler-systems.toml
COMPONENTS
dbg
dev
doc
lib
run
SUBPROJECT_DEPS
amdsmi
rocprofiler-sdk
rocprofiler-systems
)
endif(THEROCK_ENABLE_ROCPROFSYS AND THEROCK_SANITIZER STREQUAL "")
endif(THEROCK_ENABLE_ROCPROFV3)