diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c093a2e7f..709f45081f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,8 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif() set(ROCM_MAJOR_VERSION 6) -set(ROCM_MINOR_VERSION 3) -set(ROCM_PATCH_VERSION 1) +set(ROCM_MINOR_VERSION 4) +set(ROCM_PATCH_VERSION 0) ################################################################################ # Feature selection @@ -63,6 +63,7 @@ cmake_dependent_option(THEROCK_ENABLE_CORE "Enable building of core libraries" O cmake_dependent_option(THEROCK_ENABLE_COMM_LIBS "Enable building of comm libraries" ON "THEROCK_ENABLE_ALL" OFF) cmake_dependent_option(THEROCK_ENABLE_MATH_LIBS "Enable building of math libraries" ON "THEROCK_ENABLE_ALL" OFF) cmake_dependent_option(THEROCK_ENABLE_ML_LIBS "Enable building of ML libraries" ON "THEROCK_ENABLE_ALL" OFF) +cmake_dependent_option(THEROCK_ENABLE_PROFILER "Enable building the profiler libraries" ON "THEROCK_ENABLE_ALL" OFF) option(THEROCK_ENABLE_HOST_MATH "Build all bundled host math libraries by default" OFF) option(THEROCK_RESET_FEATURES "One-shot flag which forces all feature flags to their default state for this configuration run" OFF) @@ -99,6 +100,13 @@ therock_add_feature(HIP_RUNTIME REQUIRES COMPILER CORE_RUNTIME ) +# Profiler Features. +therock_add_feature(PROFILER_SDK + GROUP PROFILER + DESCRIPTION "Enables the rocprofiler-sdk project" + REQUIRES HIP_RUNTIME +) + # Comm-libs Features. therock_add_feature(RCCL GROUP COMM_LIBS @@ -210,6 +218,9 @@ add_subdirectory(base) if(NOT WIN32) add_subdirectory(compiler) add_subdirectory(core) + # Note that rocprofiler-register is in base and is what higher level clients + # depend on. The profiler itself is independent. + add_subdirectory(profiler) add_subdirectory(comm-libs) add_subdirectory(math-libs) add_subdirectory(ml-libs) diff --git a/HIP_VERSION.in b/HIP_VERSION.in index d703e9d617..60423a6fca 100644 --- a/HIP_VERSION.in +++ b/HIP_VERSION.in @@ -1,3 +1,3 @@ ${ROCM_MAJOR_VERSION} -0 -0 +${ROCM_MINOR_VERSION} +${ROCM_PATCH_VERSION} diff --git a/build_tools/fetch_sources.py b/build_tools/fetch_sources.py index d49e606a8a..f55dedf67c 100755 --- a/build_tools/fetch_sources.py +++ b/build_tools/fetch_sources.py @@ -117,6 +117,8 @@ def populate_ancillary_sources(args): but it is also often broken. So we just do the right thing here as a transitionary step to fixing the underlying software packages.""" populate_submodules_if_exists(args.dir / "rocprofiler-register") + populate_submodules_if_exists(args.dir / "rocprofiler-sdk") + populate_submodules_if_exists(args.dir / "rocprofiler-systems") def populate_submodules_if_exists(git_dir: Path): @@ -187,6 +189,9 @@ def main(argv): "rocm-core", "rocminfo", "rocprofiler-register", + "rocprofiler-compute", + "rocprofiler-sdk", + "rocprofiler-systems", "ROCR-Runtime", ], ) diff --git a/patches/amd-mainline/rocprofiler-sdk/0001-Extend-the-hack-to-propagate-HIP-usage-requirements-.patch b/patches/amd-mainline/rocprofiler-sdk/0001-Extend-the-hack-to-propagate-HIP-usage-requirements-.patch new file mode 100644 index 0000000000..80f77c007c --- /dev/null +++ b/patches/amd-mainline/rocprofiler-sdk/0001-Extend-the-hack-to-propagate-HIP-usage-requirements-.patch @@ -0,0 +1,69 @@ +From b6bd3ab99c8a9a15a8ad3d51d40807392aed27e8 Mon Sep 17 00:00:00 2001 +From: Stella Laurenzo +Date: Wed, 12 Feb 2025 18:38:02 -0800 +Subject: [PATCH] Extend the hack to propagate HIP usage requirements a bit + further. + +* Also fetches usage requirements from hip::amdhip64 -> rocprofiler-sdk-hip-nolink +* Adds rocprofiler-sdk-hip-nolink as a dependency of two libraries that indirectly depend on hip headers via hip.h. +* 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). +* 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. +--- + cmake/rocprofiler_config_interfaces.cmake | 11 ++++++++++- + source/lib/common/container/CMakeLists.txt | 1 + + source/lib/output/CMakeLists.txt | 3 ++- + 3 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/cmake/rocprofiler_config_interfaces.cmake b/cmake/rocprofiler_config_interfaces.cmake +index a01a6df..47c6eaf 100644 +--- a/cmake/rocprofiler_config_interfaces.cmake ++++ b/cmake/rocprofiler_config_interfaces.cmake +@@ -127,7 +127,14 @@ find_package( + ${rocm_version_DIR} + ${ROCM_PATH}) + target_link_libraries(rocprofiler-sdk-hip INTERFACE hip::host) ++# TODO: As of 2024/2/12, the hip::host target does not advertise its ++# include directory but amdhip64 does. This ordinarily wouldn't be an issue ++# because most folks just get it transitively, but here this is doing direct ++# property copying to get usage requirements. ++# The proper fix is for hip to export a hip::headers target with only usage ++# requirements and depend on that. + rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::host) ++rocprofiler_config_nolink_target(rocprofiler-sdk-hip-nolink hip::amdhip64) + + # ----------------------------------------------------------------------------------------# + # +@@ -218,7 +225,9 @@ find_library( + HINTS ${rocm_version_DIR} ${ROCM_PATH} + PATHS ${rocm_version_DIR} ${ROCM_PATH}) + +-target_link_libraries(rocprofiler-sdk-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library}) ++if(hsa-amd-aqlprofile64_library) ++ target_link_libraries(rocprofiler-sdk-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library}) ++endif() + + # ----------------------------------------------------------------------------------------# + # +diff --git a/source/lib/common/container/CMakeLists.txt b/source/lib/common/container/CMakeLists.txt +index f1ab957..b152ebd 100644 +--- a/source/lib/common/container/CMakeLists.txt ++++ b/source/lib/common/container/CMakeLists.txt +@@ -9,3 +9,4 @@ set(containers_sources ring_buffer.cpp record_header_buffer.cpp ring_buffer.cpp + + target_sources(rocprofiler-sdk-common-library PRIVATE ${containers_sources} + ${containers_headers}) ++target_link_libraries(rocprofiler-sdk-common-library PRIVATE rocprofiler-sdk-hip-nolink) +diff --git a/source/lib/output/CMakeLists.txt b/source/lib/output/CMakeLists.txt +index ca65538..fa2f3ad 100644 +--- a/source/lib/output/CMakeLists.txt ++++ b/source/lib/output/CMakeLists.txt +@@ -60,4 +60,5 @@ target_link_libraries( + rocprofiler-sdk::rocprofiler-sdk-common-library + rocprofiler-sdk::rocprofiler-sdk-cereal + rocprofiler-sdk::rocprofiler-sdk-perfetto +- rocprofiler-sdk::rocprofiler-sdk-otf2) ++ rocprofiler-sdk::rocprofiler-sdk-otf2 ++ rocprofiler-sdk-hip-nolink) +-- +2.43.0 + diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt new file mode 100644 index 0000000000..947937813e --- /dev/null +++ b/profiler/CMakeLists.txt @@ -0,0 +1,32 @@ +if(THEROCK_ENABLE_PROFILER_SDK) + + ############################################################################## + # rocprofiler-sdk + ############################################################################## + therock_cmake_subproject_declare(rocprofiler-sdk + EXTERNAL_SOURCE_DIR "rocprofiler-sdk" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + RUNTIME_DEPS + hip-clr + rocprofiler-register + ) + 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_activate(rocprofiler-sdk) + + therock_provide_artifact(rocprofiler-sdk + TARGET_NEUTRAL + DESCRIPTOR artifact-rocprofiler-sdk.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS + rocprofiler-sdk + ) + +endif(THEROCK_ENABLE_PROFILER_SDK) diff --git a/profiler/artifact-rocprofiler-sdk.toml b/profiler/artifact-rocprofiler-sdk.toml new file mode 100644 index 0000000000..860132a9cc --- /dev/null +++ b/profiler/artifact-rocprofiler-sdk.toml @@ -0,0 +1,19 @@ +# rocprofiler-sdk +[components.dbg."profiler/rocprofiler-sdk/stage"] +[components.dev."profiler/rocprofiler-sdk/stage"] +include = [ + "share/rocprofiler-sdk/samples/**", +] +[components.doc."profiler/rocprofiler-sdk/stage"] +[components.lib."profiler/rocprofiler-sdk/stage"] +include = [ + "libexec/rocprofiler-sdk/**", +] +[components.run."profiler/rocprofiler-sdk/stage"] +include = [ + "bin/**", +] +[components.test."profiler/rocprofiler-sdk/stage"] +include = [ + "share/rocprofiler-sdk/tests/**", +] \ No newline at end of file diff --git a/profiler/rocprofiler-compute b/profiler/rocprofiler-compute new file mode 120000 index 0000000000..48a40eef1f --- /dev/null +++ b/profiler/rocprofiler-compute @@ -0,0 +1 @@ +../sources/rocprofiler-compute \ No newline at end of file diff --git a/profiler/rocprofiler-sdk b/profiler/rocprofiler-sdk new file mode 120000 index 0000000000..33e8a4214b --- /dev/null +++ b/profiler/rocprofiler-sdk @@ -0,0 +1 @@ +../sources/rocprofiler-sdk \ No newline at end of file diff --git a/profiler/rocprofiler-systems b/profiler/rocprofiler-systems new file mode 120000 index 0000000000..005a069f5b --- /dev/null +++ b/profiler/rocprofiler-systems @@ -0,0 +1 @@ +../sources/rocprofiler-systems \ No newline at end of file