nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From https://raw.githubusercontent.com/AphidGit/rocm_compile/refs/heads/main/rocprofiler.patch
2diff --git a/cmake_modules/rocprofiler_env.cmake b/cmake_modules/rocprofiler_env.cmake
3index 7b7c472..0aba3ed 100644
4--- a/cmake_modules/rocprofiler_env.cmake
5+++ b/cmake_modules/rocprofiler_env.cmake
6@@ -36,6 +36,7 @@ if(ROCPROFILER_DEBUG_TRACE)
7 target_compile_definitions(rocprofiler-build-flags INTERFACE DEBUG_TRACE=1)
8 endif()
9
10+set(ROCPROFILER_LD_AQLPROFILE false)
11 # Enable direct loading of AQL-profile HSA extension
12 if(ROCPROFILER_LD_AQLPROFILE)
13 target_compile_definitions(rocprofiler-build-flags INTERFACE ROCP_LD_AQLPROFILE=1)
14@@ -80,9 +81,3 @@ if("${ROCM_ROOT_DIR}" STREQUAL "")
15 message(FATAL_ERROR "ROCM_ROOT_DIR is not found.")
16 endif()
17
18-find_library(
19- HSA_AMD_AQLPROFILE_LIBRARY
20- NAMES hsa-amd-aqlprofile64
21- HINTS ${CMAKE_PREFIX_PATH}
22- PATHS ${ROCM_ROOT_DIR}
23- PATH_SUFFIXES lib REQUIRED)
24diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt
25index 61782f0..16c83bf 100644
26--- a/src/api/CMakeLists.txt
27+++ b/src/api/CMakeLists.txt
28@@ -51,15 +51,6 @@ find_file(
29 NO_DEFAULT_PATH REQUIRED)
30 get_filename_component(HSA_RUNTIME_INC_PATH ${HSA_H} DIRECTORY)
31
32-find_library(
33- AQLPROFILE_LIB "libhsa-amd-aqlprofile64.so"
34- HINTS ${CMAKE_PREFIX_PATH}
35- PATHS ${ROCM_PATH}
36- PATH_SUFFIXES lib)
37-
38-if(NOT AQLPROFILE_LIB)
39- message(FATAL_ERROR "AQL_PROFILE not installed. Please install hsa-amd-aqlprofile!")
40-endif()
41
42 # ########################################################################################
43 # Adding Old Library Files
44@@ -247,7 +238,7 @@ target_include_directories(
45 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/rocprofiler>
46 PRIVATE ${LIB_DIR} ${ROOT_DIR} ${PROJECT_SOURCE_DIR}/include/rocprofiler)
47 target_link_libraries(
48- ${ROCPROFILER_TARGET} PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 c stdc++
49+ ${ROCPROFILER_TARGET} PRIVATE hsa-runtime64::hsa-runtime64 c stdc++
50 dl rocprofiler::build-flags rocprofiler::memcheck)
51
52 get_target_property(ROCPROFILER_LIBRARY_V1_NAME ${ROCPROFILER_TARGET} NAME)
53@@ -325,8 +316,7 @@ target_link_options(
54 -Wl,--no-undefined)
55 target_link_libraries(
56 rocprofiler-v2
57- PRIVATE ${AQLPROFILE_LIB}
58- hsa-runtime64::hsa-runtime64
59+ PRIVATE hsa-runtime64::hsa-runtime64
60 Threads::Threads
61 atomic
62 numa
63diff --git a/src/util/hsa_rsrc_factory.cpp b/src/util/hsa_rsrc_factory.cpp
64index 2c47186..6b39634 100644
65--- a/src/util/hsa_rsrc_factory.cpp
66+++ b/src/util/hsa_rsrc_factory.cpp
67@@ -155,17 +155,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool initialize_hsa) : initialize_hsa_(initialize
68 if (kern_arg_pool_ == nullptr)
69 CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR);
70
71- // Get AqlProfile API table
72- aqlprofile_api_ = {};
73-#ifdef ROCP_LD_AQLPROFILE
74- status = LoadAqlProfileLib(&aqlprofile_api_);
75-#else
76- status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE,
77- hsa_ven_amd_aqlprofile_VERSION_MAJOR,
78- sizeof(aqlprofile_api_), &aqlprofile_api_);
79-#endif
80- CHECK_STATUS("aqlprofile API table load failed", status);
81-
82 // Get Loader API table
83 loader_api_ = {};
84 status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_LOADER, 1,
85diff --git a/test/util/hsa_rsrc_factory.cpp b/test/util/hsa_rsrc_factory.cpp
86index 0a44d18..fab5b75 100644
87--- a/test/util/hsa_rsrc_factory.cpp
88+++ b/test/util/hsa_rsrc_factory.cpp
89@@ -137,17 +137,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool initialize_hsa) : initialize_hsa_(initialize
90 if (cpu_pool_ == NULL) CHECK_STATUS("CPU memory pool is not found", HSA_STATUS_ERROR);
91 if (kern_arg_pool_ == NULL) CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR);
92
93- // Get AqlProfile API table
94- aqlprofile_api_ = {0};
95-#ifdef ROCP_LD_AQLPROFILE
96- status = LoadAqlProfileLib(&aqlprofile_api_);
97-#else
98- status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE,
99- hsa_ven_amd_aqlprofile_VERSION_MAJOR,
100- sizeof(aqlprofile_api_), &aqlprofile_api_);
101-#endif
102- CHECK_STATUS("aqlprofile API table load failed", status);
103-
104 // Get Loader API table
105 loader_api_ = {0};
106 status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_LOADER, 1,
107diff --git a/tests-v2/unittests/core/CMakeLists.txt b/tests-v2/unittests/core/CMakeLists.txt
108index 107cb51..0f6d4bf 100644
109--- a/tests-v2/unittests/core/CMakeLists.txt
110+++ b/tests-v2/unittests/core/CMakeLists.txt
111@@ -235,8 +235,7 @@ set_target_properties(runCoreUnitTests PROPERTIES
112 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/tests")
113 target_link_libraries(
114 runCoreUnitTests
115- PRIVATE ${AQLPROFILE_LIB}
116- test_hsatool_library
117+ PRIVATE test_hsatool_library
118 hsa-runtime64::hsa-runtime64
119 Threads::Threads
120 GTest::gtest GTest::gtest_main
121@@ -285,4 +284,4 @@ endif()
122 # for the *_FilePlugin tests
123 if(NOT EXISTS "${PROJECT_BINARY_DIR}/test-output")
124 file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/test-output")
125-endif()
126\ No newline at end of file
127+endif()
128diff --git a/tests-v2/unittests/profiler/CMakeLists.txt b/tests-v2/unittests/profiler/CMakeLists.txt
129index 53180d5..0c4d4a7 100644
130--- a/tests-v2/unittests/profiler/CMakeLists.txt
131+++ b/tests-v2/unittests/profiler/CMakeLists.txt
132@@ -122,7 +122,7 @@ target_compile_definitions(
133 PRIVATE PROF_API_IMPL HIP_PROF_HIP_API_STRING=1 __HIP_PLATFORM_AMD__=1)
134
135 target_link_libraries(
136- runUnitTests PRIVATE rocprofiler-v2 ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64
137+ runUnitTests PRIVATE rocprofiler-v2 hsa-runtime64::hsa-runtime64
138 GTest::gtest GTest::gtest_main stdc++fs ${PCIACCESS_LIBRARIES} dw elf c dl)
139
140 add_dependencies(tests runUnitTests)
141@@ -158,4 +158,4 @@ endif()
142 # for the *_FilePlugin tests
143 if(NOT EXISTS "${PROJECT_BINARY_DIR}/test-output")
144 file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/test-output")
145-endif()
146\ No newline at end of file
147+endif()