Remove the tracer tool's constructor and destructor functions

Change-Id: I12d88af726074fb15f8159580c85c12888f72172
This commit is contained in:
Laurent Morichetti committed 2022-05-24 21:50:47 -07:00
1 parent 15f65a4d27
commit e9b3b7c9a0
7 files changed
+209 -146

No files matched your search

+4
View File
@@ -116,6 +116,10 @@ add_executable(backward_compat_test EXCLUDE_FROM_ALL app/backward_compat_test.cp
target_link_libraries(backward_compat_test roctracer)
add_dependencies(mytest backward_compat_test)
add_executable(load_unload_reload_test EXCLUDE_FROM_ALL hsa/load_unload_reload.cpp)
target_link_libraries(load_unload_reload_test hsa-runtime64::hsa-runtime64)
add_dependencies(mytest load_unload_reload_test)
## Copy the golden traces and test scripts
configure_file(run.sh ${PROJECT_BINARY_DIR} COPYONLY)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink run.sh ${PROJECT_BINARY_DIR}/run_ci.sh)
@@ -0,0 +1,24 @@
ROCTracer (pid=202688):
0x55a6e1bfa280 agent cpu
0x55a6e1bf9470 agent gpu
0x55a6e1c34d10 agent gpu
169339419628779
HSA-trace()
HSA-activity-trace()
169339419776888:169339419781697 202688:202688 hsa_amd_profiling_async_copy_enable(1) = 0
169339420102142:169339420102703 202688:202688 hsa_agent_get_info({handle=94175240364672}, 17, 0x7ffe818aff34) = 0
169339420104075:169339420104606 202688:202688 hsa_agent_get_info({handle=94175240361072}, 17, 0x7ffe818aff34) = 0
169339420105568:169339420106049 202688:202688 hsa_agent_get_info({handle=94175240604944}, 17, 0x7ffe818aff34) = 0
169339420105568:169339420106941 202688:202688 hsa_iterate_agents(1, 0) = 0
ROCTracer (pid=202688):
0x55a6e1bfa280 agent cpu
0x55a6e1c99260 agent gpu
0x55a6e1c95d50 agent gpu
169339843452619
HSA-trace()
HSA-activity-trace()
169339843601029:169339843605668 202688:202688 hsa_amd_profiling_async_copy_enable(1) = 0
169339843768255:169339843768816 202688:202688 hsa_agent_get_info({handle=94175240364672}, 17, 0x7ffe818aff34) = 0
169339843770028:169339843770549 202688:202688 hsa_agent_get_info({handle=94175241015904}, 17, 0x7ffe818aff34) = 0
169339843771491:169339843771962 202688:202688 hsa_agent_get_info({handle=94175241002320}, 17, 0x7ffe818aff34) = 0
169339843771491:169339843772854 202688:202688 hsa_iterate_agents(1, 0) = 0
@@ -13,6 +13,7 @@ MatrixTranspose_kfd_trace --check-events .*
MatrixTranspose_hip_input_trace --check-events .*
copy_hsa_trace --check-events .*
copy_hsa_input_trace --check-events .*
load_unload_reload_trace --check-order .*
hsa_co_trace --check-none
code_obj_trace --check-none
trace_buffer_trace --check-none
+50
View File
@@ -0,0 +1,50 @@
/* Copyright (c) 2022 Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#include <hsa.h>
#include <cassert>
#include <cstdlib>
#define CHECK(x) \
do { \
if ((x) != HSA_STATUS_SUCCESS) { \
assert(false); \
abort(); \
} \
} while (false);
int main() {
// Run 2 loops of {hsa_init(); hsa_iterate_agents(); hsa_shut_down()} to test that the
// tracer tool correctly unloaded after the 1st iteration and then reloaded for the 2nd
// iteration.
for (int i = 0; i < 2; ++i) {
hsa_init();
CHECK(hsa_iterate_agents(
[](hsa_agent_t agent, void*) {
hsa_device_type_t type;
return hsa_agent_get_info(agent, HSA_AGENT_INFO_DEVICE, &type);
},
nullptr));
hsa_shut_down();
}
}
+3
View File
@@ -172,6 +172,9 @@ export ROCP_INPUT=test/input.xml
eval_test "tool HSA test input" ./test/copy copy_hsa_input_trace
unset ROCP_INPUT
# Check that the tracer tool can be unloaded and then reloaded.
eval_test "Load/Unload/Reload the tracer tool" ./test/load_unload_reload_test load_unload_reload_trace
export HSA_TOOLS_LIB="$ROCTRACER_LIB_PATH/libroctracer64.so ./test/libhsaco_test.so"
eval_test "tool HSA codeobj" ./test/MatrixTranspose hsa_co_trace