Fixing rocprofilerv2 naming and CMake issues

Change-Id: Ib6d336349a056731e5c0f35151296d6fea671360


[ROCm/rocprofiler commit: dc69331379]
This commit is contained in:
Ammar ELWazir
2023-02-17 11:12:27 -06:00
parent 38080f727a
commit ff80dd4dfa
62 changed files with 228 additions and 234237 deletions
+50 -40
View File
@@ -1,56 +1,66 @@
# ###############################################################################
# # 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.
# ###############################################################################
# ##############################################################################
# # 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.
# ##############################################################################
find_library(
ROCPROFV2_ATT rocprofv2_att
HINTS ${CMAKE_INSTALL_PREFIX}
PATHS ${ROCM_PATH}
PATH_SUFFIXES hsa-amd-aqlprofile)
set(ENV{ROCPROFV2_ATT_LIB_PATH} $ROCPROFV2_ATT)
# Building att plugin library
file(GLOB ROCMTOOLS_UTIL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/utils/helper.cpp)
file(GLOB ROCPROFILER_UTIL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/utils/helper.cpp)
file(GLOB FILE_SOURCES att.cpp)
add_library(att_plugin SHARED ${FILE_SOURCES} ${ROCMTOOLS_UTIL_SRC_FILES})
add_library(att_plugin SHARED ${FILE_SOURCES} ${ROCPROFILER_UTIL_SRC_FILES})
set_target_properties(att_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden
LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../exportmap
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(
att_plugin
PROPERTIES CXX_VISIBILITY_PRESET hidden
LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../exportmap
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
target_compile_definitions(att_plugin
PRIVATE HIP_PROF_HIP_API_STRING=1 __HIP_PLATFORM_HCC__=1)
target_compile_definitions(att_plugin PRIVATE HIP_PROF_HIP_API_STRING=1
__HIP_PLATFORM_HCC__=1)
target_include_directories(att_plugin PRIVATE ${PROJECT_SOURCE_DIR}/inc ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_link_options(att_plugin PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exportmap -Wl,--no-undefined)
target_link_libraries(att_plugin PRIVATE ${ROCPROFILER_TARGET} systemd hsa-runtime64::hsa-runtime64 stdc++fs)
target_include_directories(
att_plugin PRIVATE ${PROJECT_SOURCE_DIR}/inc ${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
target_link_options(
att_plugin PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exportmap
-Wl,--no-undefined)
target_link_libraries(att_plugin PRIVATE ${ROCPROFILER_TARGET} systemd
hsa-runtime64::hsa-runtime64 stdc++fs)
install(TARGETS att_plugin LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT runtime)
install(TARGETS att_plugin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT runtime)
configure_file(att.py att/att.py COPYONLY)
configure_file(trace_view.py att/trace_view.py COPYONLY)
#configure_file(t.db att/t.db COPYONLY)
# configure_file(t.db att/t.db COPYONLY)
configure_file(ui/index.html att/ui/index.html COPYONLY)
configure_file(ui/logo.svg att/ui/logo.svg COPYONLY)
configure_file(ui/styles.css att/ui/styles.css COPYONLY)
#configure_file(ui/trace.json att/ui/trace.json COPYONLY)
install(DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/att
# configure_file(ui/trace.json att/ui/trace.json COPYONLY)
install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/att
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler
USE_SOURCE_PERMISSIONS
COMPONENT runtime)
+2 -2
View File
@@ -71,10 +71,10 @@ class att_plugin_t {
}
size_t name_length;
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME,
att_tracer_record->kernel_id, &name_length));
const char* kernel_name_c = static_cast<const char*>(malloc(name_length * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME,
att_tracer_record->kernel_id, &kernel_name_c));
std::string name_demangled = rocmtools::truncate_name(rocmtools::cxx_demangle(kernel_name_c));
+3 -2
View File
@@ -102,11 +102,12 @@ class ReturnInfo(ctypes.Structure):
('num_events', ctypes.c_uint64),
('perfevents', POINTER(PerfEvent))]
rocprofv2_att_lib = os.getenv('ROCPROFV2_ATT_LIB_PATH')
try: # For build dir
path_to_parser = os.path.abspath('/usr/lib/hsa-amd-aqlprofile/librocprofv2_att.so')
path_to_parser = os.path.abspath(rocprofv2_att_lib)
SO = CDLL(path_to_parser)
except: # For installed dir
path_to_parser = os.path.abspath('/usr/local/lib/hsa-amd-aqlprofile/librocprofv2_att.so')
path_to_parser = os.path.abspath('/opt/rocm/lib/hsa-amd-aqlprofile/librocprofv2_att.so')
SO = CDLL(path_to_parser)
SO.AnalyseBinary.restype = ReturnInfo
+4 -4
View File
@@ -1,8 +1,8 @@
= CTF plugin for ROCMTools
= CTF plugin for ROCProfiler
13 December 2022
Philippe Proulx
This plugin writes the received ROCMTools tracer and profiler records to
This plugin writes the received ROCProfiler tracer and profiler records to
a https://diamon.org/ctf/[CTF] trace.
== Build requirements
@@ -77,7 +77,7 @@ All CTF event records have the following common fields:
Correlation ID.
--
+
For each ROCMTools HSA API tracer record for the HSA function named
For each ROCProfiler HSA API tracer record for the HSA function named
`__name__`, this plugin writes two event records:
+
`__name___begin`:::
@@ -112,7 +112,7 @@ All CTF event records have the following common fields:
Kernel name (empty string if not available).
--
+
For each ROCMTools HIP API tracer record for the HIP function named
For each ROCProfiler HIP API tracer record for the HIP function named
`__name__`, this plugin writes two event records:
+
`__name__Begin`:::
+8 -8
View File
@@ -776,7 +776,7 @@ namespace {
constexpr std::uint64_t ns_per_s = 1'000'000'000ULL;
// Samples the ROCMTools clock and returns the value.
// Samples the ROCProfiler clock and returns the value.
std::uint64_t GetClkVal() {
rocprofiler_timestamp_t ts;
[[maybe_unused]] const auto ret = rocprofiler_get_timestamp(&ts);
@@ -786,16 +786,16 @@ std::uint64_t GetClkVal() {
}
// Updates `offset` and `delta`, if needed, to a more accurate clock
// class offset and a smaller ROCMTools clock value delta.
// class offset and a smaller ROCProfiler clock value delta.
//
// This function samples the ROCMTools clock twice, also sampling the
// real-time clock in between, and uses the average ROCMTools clock
// This function samples the ROCProfiler clock twice, also sampling the
// real-time clock in between, and uses the average ROCProfiler clock
// value to approximate the actual clock class offset.
//
// This strategy is based on the measure_single_clock_offset() function
// of the LTTng-tools project <https://lttng.org/>.
void UpdateClkClsOffsetAndDelta(std::uint64_t& offset, std::uint64_t& delta) {
// Sample ROCMTools clock (first time).
// Sample ROCProfiler clock (first time).
const auto rocm_clk_val1 = GetClkVal();
// Sample real-time clock.
@@ -804,10 +804,10 @@ void UpdateClkClsOffsetAndDelta(std::uint64_t& offset, std::uint64_t& delta) {
assert(ret == 0);
// Sample ROCMTools clock (second time).
// Sample ROCProfiler clock (second time).
const auto rocm_clk_val2 = GetClkVal();
// Compute the current ROCMTools clock value delta.
// Compute the current ROCProfiler clock value delta.
const auto this_delta = rocm_clk_val2 - rocm_clk_val1;
if (this_delta > delta) {
@@ -815,7 +815,7 @@ void UpdateClkClsOffsetAndDelta(std::uint64_t& offset, std::uint64_t& delta) {
return;
}
// Compute the average ROCMTools clock value.
// Compute the average ROCProfiler clock value.
const auto rocm_clk_val_avg = (rocm_clk_val1 + rocm_clk_val2) >> 1;
// Compute the real-time clock value in nanoseconds.
+15 -15
View File
@@ -162,7 +162,7 @@ class file_plugin_t {
output_file_t begin_ts("begin_ts_file.txt");
[[maybe_unused]] rocprofiler_timestamp_t app_begin_timestamp = {};
CHECK_ROCMTOOLS(rocprofiler_get_timestamp(&app_begin_timestamp));
CHECK_ROCPROFILER(rocprofiler_get_timestamp(&app_begin_timestamp));
begin_ts << std::dec << app_begin_timestamp.value << std::endl;
if (begin_ts.fail()) {
@@ -215,12 +215,12 @@ class file_plugin_t {
}
if (tracer_record.domain == ACTIVITY_DOMAIN_HSA_API) {
size_t function_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info_size(
session_id, ROCPROFILER_HSA_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_size));
if (function_name_size > 1) {
char* function_name_c = (char*)malloc(function_name_size);
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info(
session_id, ROCPROFILER_HSA_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_c));
if (function_name_c) function_name = std::string(function_name_c);
@@ -228,23 +228,23 @@ class file_plugin_t {
}
if (tracer_record.domain == ACTIVITY_DOMAIN_HIP_API) {
size_t function_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_size));
if (function_name_size > 1) {
char* function_name_c = (char*)malloc(function_name_size);
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_c));
if (function_name_c) function_name = std::string(function_name_c);
}
size_t kernel_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_KERNEL_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &kernel_name_size));
if (kernel_name_size > 1) {
char* kernel_name_str = (char*)malloc(kernel_name_size * sizeof(char));
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_KERNEL_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &kernel_name_str));
if (kernel_name_str) kernel_name = rocmtools::cxx_demangle(std::string(kernel_name_str));
@@ -252,26 +252,26 @@ class file_plugin_t {
}
if (tracer_record.domain == ACTIVITY_DOMAIN_ROCTX) {
size_t roctx_message_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info_size(
session_id, ROCPROFILER_ROCTX_MESSAGE, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_message_size));
if (roctx_message_size > 1) {
[[maybe_unused]] char* roctx_message_str =
static_cast<char*>(malloc(roctx_message_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info(
session_id, ROCPROFILER_ROCTX_MESSAGE, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_message_str));
if (roctx_message_str)
roctx_message = rocmtools::cxx_demangle(std::string(strdup(roctx_message_str)));
}
size_t roctx_id_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info_size(
session_id, ROCPROFILER_ROCTX_ID, tracer_record.api_data_handle, tracer_record.operation_id,
&roctx_id_size));
if (roctx_id_size > 1) {
[[maybe_unused]] char* roctx_id_str =
static_cast<char*>(malloc(roctx_id_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info(
session_id, ROCPROFILER_ROCTX_ID, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_id_str));
if (roctx_id_str) {
@@ -299,14 +299,14 @@ class file_plugin_t {
size_t name_length = 0;
output_file_t* output_file{nullptr};
output_file = get_output_file(output_type_t::COUNTER);
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME,
profiler_record->kernel_id, &name_length));
// Taken from rocprofiler: The size hasn't changed in recent past
static const uint32_t lds_block_size = 128 * 4;
const char* kernel_name_c;
if (name_length > 1) {
kernel_name_c = static_cast<const char*>(malloc(name_length * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME, profiler_record->kernel_id,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME, profiler_record->kernel_id,
&kernel_name_c));
}
*output_file << std::string("dispatch[") << std::to_string(profiler_record->header.id.handle)
@@ -355,12 +355,12 @@ class file_plugin_t {
for (uint64_t i = 0; i < profiler_record->counters_count.value; i++) {
if (profiler_record->counters[i].counter_handler.handle > 0) {
size_t counter_name_length = 0;
CHECK_ROCMTOOLS(rocprofiler_query_counter_info_size(
CHECK_ROCPROFILER(rocprofiler_query_counter_info_size(
session_id, ROCPROFILER_COUNTER_NAME, profiler_record->counters[i].counter_handler,
&counter_name_length));
if (counter_name_length > 1) {
const char* name_c = static_cast<const char*>(malloc(name_length * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_counter_info(
CHECK_ROCPROFILER(rocprofiler_query_counter_info(
session_id, ROCPROFILER_COUNTER_NAME, profiler_record->counters[i].counter_handler,
&name_c));
*output_file << ", " << name_c << " ("
@@ -74,14 +74,14 @@ static std::string output_file_name;
std::string get_kernel_name(rocprofiler_record_profiler_t& profiler_record) {
std::string kernel_name = "";
size_t name_length = 1;
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME, profiler_record.kernel_id,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info_size(ROCPROFILER_KERNEL_NAME, profiler_record.kernel_id,
&name_length));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wstringop-overread"
if (name_length > 1) {
const char* kernel_name_c = static_cast<const char*>(malloc(name_length * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME, profiler_record.kernel_id,
CHECK_ROCPROFILER(rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME, profiler_record.kernel_id,
&kernel_name_c));
if (kernel_name_c && strlen(kernel_name_c) > 1)
kernel_name = rocmtools::cxx_demangle(strdup(kernel_name_c));
@@ -327,12 +327,12 @@ class perfetto_plugin_t {
for (uint64_t i = 0; i < profiler_record.counters_count.value; i++) {
if (profiler_record.counters[i].counter_handler.handle > 0) {
size_t name_length = 0;
CHECK_ROCMTOOLS(rocprofiler_query_counter_info_size(
CHECK_ROCPROFILER(rocprofiler_query_counter_info_size(
session_id, ROCPROFILER_COUNTER_NAME, profiler_record.counters[i].counter_handler,
&name_length));
if (name_length > 1) {
const char* name_c = static_cast<const char*>(malloc(name_length * sizeof(char)));
CHECK_ROCMTOOLS(
CHECK_ROCPROFILER(
rocprofiler_query_counter_info(session_id, ROCPROFILER_COUNTER_NAME,
profiler_record.counters[i].counter_handler, &name_c));
@@ -435,24 +435,24 @@ class perfetto_plugin_t {
auto& roctx_track = roctx_track_it->second;
size_t roctx_message_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info_size(
session_id, ROCPROFILER_ROCTX_MESSAGE, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_message_size));
if (roctx_message_size > 1) {
char* roctx_message_str = static_cast<char*>(malloc(roctx_message_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info(
session_id, ROCPROFILER_ROCTX_MESSAGE, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_message_str));
if (roctx_message_str)
roctx_message = rocmtools::cxx_demangle(std::string(strdup(roctx_message_str)));
}
size_t roctx_id_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info_size(
session_id, ROCPROFILER_ROCTX_ID, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_id_size));
if (roctx_id_size > 1) {
char* roctx_id_str = static_cast<char*>(malloc(roctx_id_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_roctx_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_roctx_tracer_api_data_info(
session_id, ROCPROFILER_ROCTX_ID, tracer_record.api_data_handle,
tracer_record.operation_id, &roctx_id_str));
if (roctx_id_str) {
@@ -499,12 +499,12 @@ class perfetto_plugin_t {
}
auto& hsa_track = hsa_track_it->second;
size_t function_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info_size(
session_id, ROCPROFILER_HSA_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_size));
if (function_name_size > 1) {
function_name = static_cast<char*>(malloc(function_name_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info(
session_id, ROCPROFILER_HSA_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name));
}
@@ -540,23 +540,23 @@ class perfetto_plugin_t {
}
auto& hip_track = hip_track_it->second;
size_t function_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name_size));
if (function_name_size > 1) {
function_name = static_cast<char*>(malloc(function_name_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_FUNCTION_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &function_name));
}
size_t kernel_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_KERNEL_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &kernel_name_size));
char* kernel_name_str;
if (kernel_name_size > 1) {
kernel_name_str = static_cast<char*>(malloc(kernel_name_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_KERNEL_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &kernel_name_str));
if (kernel_name_str) {
@@ -584,13 +584,13 @@ class perfetto_plugin_t {
uint64_t stream_id = 0;
size_t stream_id_str_size = 0;
char* stream_id_str;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_STREAM_ID, rocprofiler_tracer_api_data_handle_t{nullptr, 0},
rocprofiler_tracer_operation_id_t{(uint32_t)tracer_record.correlation_id.value},
&stream_id_str_size));
if (stream_id_str_size > 1) {
stream_id_str = static_cast<char*>(malloc(stream_id_str_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_STREAM_ID, rocprofiler_tracer_api_data_handle_t{nullptr, 0},
rocprofiler_tracer_operation_id_t{(uint32_t)tracer_record.correlation_id.value},
&stream_id_str));
@@ -627,12 +627,12 @@ class perfetto_plugin_t {
perfetto::Flow::ProcessScoped(tracer_record.correlation_id.value));
} else {
size_t activity_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info_size(
session_id, ROCPROFILER_HIP_ACTIVITY_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &activity_name_size));
if (activity_name_size > 1) {
activity_name = static_cast<char*>(malloc(activity_name_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hip_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hip_tracer_api_data_info(
session_id, ROCPROFILER_HIP_ACTIVITY_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &activity_name));
} else {
@@ -673,12 +673,12 @@ class perfetto_plugin_t {
}
auto& queue_track = queue_track_it->second;
size_t activity_name_size = 0;
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info_size(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info_size(
session_id, ROCPROFILER_HSA_ACTIVITY_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &activity_name_size));
if (activity_name_size > 1) {
activity_name = static_cast<char*>(malloc(activity_name_size * sizeof(char)));
CHECK_ROCMTOOLS(rocprofiler_query_hsa_tracer_api_data_info(
CHECK_ROCPROFILER(rocprofiler_query_hsa_tracer_api_data_info(
session_id, ROCPROFILER_HSA_ACTIVITY_NAME, tracer_record.api_data_handle,
tracer_record.operation_id, &activity_name));
}
+3 -3
View File
@@ -36,10 +36,10 @@
#include "src/utils/helper.h"
// Macro to check ROCMTools calls status
#define CHECK_ROCMTOOLS(call) \
// Macro to check ROCProfiler calls status
#define CHECK_ROCPROFILER(call) \
do { \
if ((call) != ROCPROFILER_STATUS_SUCCESS) rocmtools::fatal("Error: ROCMTools API Call Error!"); \
if ((call) != ROCPROFILER_STATUS_SUCCESS) rocmtools::fatal("Error: ROCProfiler API Call Error!"); \
} while (false)
namespace {