Skip to content

Commit 716ec3f

Browse files
Adds rocprofiler-sdk.
* Fixes a hard-coded minor/patch HIP version (which was lower than what rocprofiler-sdk was looking for). * Adds a PROFILER group and a PROFILER_SDK feature to gate. * Adds rocprofiler-(compute|systems) to fetch list but does not wire them up yet. * Includes a patch for some build issues: ROCm/rocprofiler-sdk#46
1 parent 49b8917 commit 716ec3f

File tree

9 files changed

+143
-4
lines changed

9 files changed

+143
-4
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
4949
endif()
5050

5151
set(ROCM_MAJOR_VERSION 6)
52-
set(ROCM_MINOR_VERSION 3)
53-
set(ROCM_PATCH_VERSION 1)
52+
set(ROCM_MINOR_VERSION 4)
53+
set(ROCM_PATCH_VERSION 0)
5454

5555
################################################################################
5656
# Feature selection
@@ -63,6 +63,7 @@ cmake_dependent_option(THEROCK_ENABLE_CORE "Enable building of core libraries" O
6363
cmake_dependent_option(THEROCK_ENABLE_COMM_LIBS "Enable building of comm libraries" ON "THEROCK_ENABLE_ALL" OFF)
6464
cmake_dependent_option(THEROCK_ENABLE_MATH_LIBS "Enable building of math libraries" ON "THEROCK_ENABLE_ALL" OFF)
6565
cmake_dependent_option(THEROCK_ENABLE_ML_LIBS "Enable building of ML libraries" ON "THEROCK_ENABLE_ALL" OFF)
66+
cmake_dependent_option(THEROCK_ENABLE_PROFILER "Enable building the profiler libraries" ON "THEROCK_ENABLE_ALL" OFF)
6667
option(THEROCK_ENABLE_HOST_MATH "Build all bundled host math libraries by default" OFF)
6768
option(THEROCK_RESET_FEATURES "One-shot flag which forces all feature flags to their default state for this configuration run" OFF)
6869

@@ -99,6 +100,13 @@ therock_add_feature(HIP_RUNTIME
99100
REQUIRES COMPILER CORE_RUNTIME
100101
)
101102

103+
# Profiler Features.
104+
therock_add_feature(PROFILER_SDK
105+
GROUP PROFILER
106+
DESCRIPTION "Enables the rocprofiler-sdk project"
107+
REQUIRES HIP_RUNTIME
108+
)
109+
102110
# Comm-libs Features.
103111
therock_add_feature(RCCL
104112
GROUP COMM_LIBS
@@ -210,6 +218,9 @@ add_subdirectory(base)
210218
if(NOT WIN32)
211219
add_subdirectory(compiler)
212220
add_subdirectory(core)
221+
# Note that rocprofiler-register is in base and is what higher level clients
222+
# depend on. The profiler itself is independent.
223+
add_subdirectory(profiler)
213224
add_subdirectory(comm-libs)
214225
add_subdirectory(math-libs)
215226
add_subdirectory(ml-libs)

HIP_VERSION.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
${ROCM_MAJOR_VERSION}
2-
0
3-
0
2+
${ROCM_MINOR_VERSION}
3+
${ROCM_PATCH_VERSION}

build_tools/fetch_sources.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def populate_ancillary_sources(args):
117117
but it is also often broken. So we just do the right thing here as a transitionary
118118
step to fixing the underlying software packages."""
119119
populate_submodules_if_exists(args.dir / "rocprofiler-register")
120+
populate_submodules_if_exists(args.dir / "rocprofiler-sdk")
121+
populate_submodules_if_exists(args.dir / "rocprofiler-systems")
120122

121123

122124
def populate_submodules_if_exists(git_dir: Path):
@@ -187,6 +189,9 @@ def main(argv):
187189
"rocm-core",
188190
"rocminfo",
189191
"rocprofiler-register",
192+
"rocprofiler-compute",
193+
"rocprofiler-sdk",
194+
"rocprofiler-systems",
190195
"ROCR-Runtime",
191196
],
192197
)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From b6bd3ab99c8a9a15a8ad3d51d40807392aed27e8 Mon Sep 17 00:00:00 2001
2+
From: Stella Laurenzo <stellaraccident@gmail.com>
3+
Date: Wed, 12 Feb 2025 18:38:02 -0800
4+
Subject: [PATCH] Extend the hack to propagate HIP usage requirements a bit
5+
further.
6+
7+
* Also fetches usage requirements from hip::amdhip64 -> rocprofiler-sdk-hip-nolink
8+
* Adds rocprofiler-sdk-hip-nolink as a dependency of two libraries that indirectly depend on hip headers via hip.h.
9+
* The above may not be completely as precise as it can be (it seems like there should be an intermediate library for this of some kind).
10+
* Also conditions the link of hsa-amd-aqlprofile64_library on whether the library was found. I have no idea if this is correct, but I don't have that library and lack an easy way to get it. Since the find_library can fail, I am left assuming it is optional (otherwise, there should be some error reporting). The resulting libraries seem to have all symbols defined.
11+
---
12+
cmake/rocprofiler_config_interfaces.cmake | 11 ++++++++++-
13+
source/lib/common/container/CMakeLists.txt | 1 +
14+
source/lib/output/CMakeLists.txt | 3 ++-
15+
3 files changed, 13 insertions(+), 2 deletions(-)
16+
17+
diff --git a/cmake/rocprofiler_config_interfaces.cmake b/cmake/rocprofiler_config_interfaces.cmake
18+
index a01a6df..47c6eaf 100644
19+
--- a/cmake/rocprofiler_config_interfaces.cmake
20+
+++ b/cmake/rocprofiler_config_interfaces.cmake
21+
@@ -127,7 +127,14 @@ find_package(
22+
${rocm_version_DIR}
23+
${ROCM_PATH})
24+
target_link_libraries(rocprofiler-sdk-hip INTERFACE hip::host)
25+
+# TODO: As of 2024/2/12, the hip::host target does not advertise its
26+
+# include directory but amdhip64 does. This ordinarily wouldn't be an issue
27+
+# because most folks just get it transitively, but here this is doing direct
28+
+# property copying to get usage requirements.
29+
+# The proper fix is for hip to export a hip::headers target with only usage
30+
+# requirements and depend on that.
31+
rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::host)
32+
+rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::amdhip64)
33+
34+
# ----------------------------------------------------------------------------------------#
35+
#
36+
@@ -218,7 +225,9 @@ find_library(
37+
HINTS ${rocm_version_DIR} ${ROCM_PATH}
38+
PATHS ${rocm_version_DIR} ${ROCM_PATH})
39+
40+
-target_link_libraries(rocprofiler-sdk-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library})
41+
+if(hsa-amd-aqlprofile64_library)
42+
+ target_link_libraries(rocprofiler-sdk-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library})
43+
+endif()
44+
45+
# ----------------------------------------------------------------------------------------#
46+
#
47+
diff --git a/source/lib/common/container/CMakeLists.txt b/source/lib/common/container/CMakeLists.txt
48+
index f1ab957..b152ebd 100644
49+
--- a/source/lib/common/container/CMakeLists.txt
50+
+++ b/source/lib/common/container/CMakeLists.txt
51+
@@ -9,3 +9,4 @@ set(containers_sources ring_buffer.cpp record_header_buffer.cpp ring_buffer.cpp
52+
53+
target_sources(rocprofiler-sdk-common-library PRIVATE ${containers_sources}
54+
${containers_headers})
55+
+target_link_libraries(rocprofiler-sdk-common-library PRIVATE rocprofiler-sdk-hip-nolink)
56+
diff --git a/source/lib/output/CMakeLists.txt b/source/lib/output/CMakeLists.txt
57+
index ca65538..fa2f3ad 100644
58+
--- a/source/lib/output/CMakeLists.txt
59+
+++ b/source/lib/output/CMakeLists.txt
60+
@@ -60,4 +60,5 @@ target_link_libraries(
61+
rocprofiler-sdk::rocprofiler-sdk-common-library
62+
rocprofiler-sdk::rocprofiler-sdk-cereal
63+
rocprofiler-sdk::rocprofiler-sdk-perfetto
64+
- rocprofiler-sdk::rocprofiler-sdk-otf2)
65+
+ rocprofiler-sdk::rocprofiler-sdk-otf2
66+
+ rocprofiler-sdk-hip-nolink)
67+
--
68+
2.43.0
69+

profiler/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
if(THEROCK_ENABLE_PROFILER_SDK)
2+
3+
##############################################################################
4+
# rocprofiler-sdk
5+
##############################################################################
6+
therock_cmake_subproject_declare(rocprofiler-sdk
7+
EXTERNAL_SOURCE_DIR "rocprofiler-sdk"
8+
BACKGROUND_BUILD
9+
CMAKE_ARGS
10+
-DHIP_PLATFORM=amd
11+
RUNTIME_DEPS
12+
hip-clr
13+
rocprofiler-register
14+
)
15+
therock_cmake_subproject_provide_package(rocprofiler-sdk rocprofiler-sdk lib/cmake/rocprofiler-sdk)
16+
therock_cmake_subproject_provide_package(rocprofiler-sdk rocprofiler-sdk-roctx lib/cmake/rocprofiler-sdk-roctx)
17+
therock_cmake_subproject_activate(rocprofiler-sdk)
18+
19+
therock_provide_artifact(rocprofiler-sdk
20+
TARGET_NEUTRAL
21+
DESCRIPTOR artifact-rocprofiler-sdk.toml
22+
COMPONENTS
23+
dbg
24+
dev
25+
doc
26+
lib
27+
run
28+
SUBPROJECT_DEPS
29+
rocprofiler-sdk
30+
)
31+
32+
endif(THEROCK_ENABLE_PROFILER_SDK)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# rocprofiler-sdk
2+
[components.dbg."profiler/rocprofiler-sdk/stage"]
3+
[components.dev."profiler/rocprofiler-sdk/stage"]
4+
include = [
5+
"share/rocprofiler-sdk/samples/**",
6+
]
7+
[components.doc."profiler/rocprofiler-sdk/stage"]
8+
[components.lib."profiler/rocprofiler-sdk/stage"]
9+
include = [
10+
"libexec/rocprofiler-sdk/**",
11+
]
12+
[components.run."profiler/rocprofiler-sdk/stage"]
13+
include = [
14+
"bin/**",
15+
]
16+
[components.test."profiler/rocprofiler-sdk/stage"]
17+
include = [
18+
"share/rocprofiler-sdk/tests/**",
19+
]

profiler/rocprofiler-compute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../sources/rocprofiler-compute

profiler/rocprofiler-sdk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../sources/rocprofiler-sdk

profiler/rocprofiler-systems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../sources/rocprofiler-systems

0 commit comments

Comments
 (0)