|
| 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 | + |
0 commit comments