API Tracing Overhaul (#437)

* Update include/rocprofiler-sdk/hsa/*

- split HSA API IDs into separate enumerations
- add support for finalize ext table

* Update include/rocprofiler-sdk/hip/*

- remove compiler_api_args.h
- rocprofiler_hip_api_args_t contains all for HIP runtime and HIP compiler
- ROCPROFILER_HIP_API_ID_ -> ROCPROFILER_HIP_RUNTIME_API_ID_

* Update include/rocprofiler-sdk/marker/table_api_id.h

- ROCPROFILER_MARKER_API_TABLE_ID_ -> ROCPROFILER_MARKER_TABLE_ID_

* Update include/rocprofiler-sdk/*/table_api_id.h

- table_api_id.h -> table_id.h

* Update include/rocprofiler-sdk/*/table_api_id.h

- table_api_id.h -> table_id.h

* Update include/rocprofiler-sdk/fwd.h

- ROCPROFILER_CALLBACK_TRACING_HSA_API split into 4 enum values:
  - ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API
  - ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API
  - ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API
  - ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API
- ROCPROFILER_BUFFER_TRACING_HSA_API split into 4 enum values:
  - ROCPROFILER_BUFFER_TRACING_HSA_CORE_API
  - ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API
  - ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API
  - ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API
- rocprofiler_callback_tracing_code_object_operation_t renamed to rocprofiler_code_object_operation_t (more consistent)
- doxygen updates

* Update include/rocprofiler-sdk/buffer_tracing.h

- improved doxygen comments
- removed unused rocprofiler_buffer_tracing_queue_scheduling_record_t
- removed unused rocprofiler_buffer_tracing_correlation_record_t

* Update include/rocprofiler-sdk/callback_tracing.h

- removed rocprofiler_callback_tracing_hip_compiler_api_data_t
  - rocprofiler_hip_api_args_t and rocprofiler_hip_compiler_api_args_t were combined
  - rocprofiler_hsa_api_retval_t and rocprofiler_hsa_compiler_api_retval_t were combined

* Update lib/rocprofiler-sdk/hsa/*

- utils.hpp
  - formatters for hsa_ext_program_t and hsa_ext_control_directives_t
- defines.hpp
  - removed variadic macros from lib/common/defines.hpp
  - HSA_API_META_DEFINITION, HSA_API_INFO_DEFINITION_0, HSA_API_INFO_DEFINITION_V specialize on table id
- async_copy.cpp
  - ROCPROFILER_HSA_API_ID_* -> ROCPROFILER_HSA_AMD_EXT_API_ID_*
  - add table id to templates
  - improve async_copy_fini
- hsa.hpp
  - add hsa_table_id_lookup
  - add hsa_domain_info
  - add table id to templates
  - add copy_table function
- hsa.cpp
  - add table id to templates
  - require hsa tables to be trivial and standard layout
  - remove set_data_args specialization for hsa_amd_memory_async_copy_rect
  - implement copy_table function
- hsa.def.cpp
  - update enums

* Update lib/rocprofiler-sdk/hip/*

- defines.hpp
  - use lib/common/defines.hpp
  - add hip_table_id_lookup to HIP_API_TABLE_LOOKUP_DEFINITION
- hip.hpp
  - hip_table_id_lookup
  - template iterate_args on table id
  - templated copy_table and update_table
- hip.cpp
  - replaced api_id_bounds with hip_domain_info
  - templated iterate_args on table id
  - templated copy_table and update_table

* Update lib/rocprofiler-sdk/marker/*

- defines.hpp
  - use lib/common/defines.hpp
- marker.cpp
  - updated enums
- marker.def.cpp
  - updated enums

* Update lib/rocprofiler-sdk/tests

- common.hpp
  - ROCPROFILER_CALL_EXPECT
  - callback_data_ext
  - update get_callback_tracing_names with new enums
  - update get_buffer_tracing_names with new enums
- external_correlation.cpp
  - support new HSA API enums
- intercept_table.cpp
  - use test/common.hpp
  - update to new HSA API enums
- registration.cpp
  - support new HSA API enums
- naming.cpp
  - validation for all get_ids(), get_names(), name_by_id(), id_by_name(), etc.

* Update lib/common

- defines.hpp
  - Move IMPL_DETAIL_FOR_EACH_NARG, GET_ADDR_MEMBER_FIELDS, and GET_NAMED_MEMBER_FIELDS here
    - used by HSA, HIP, and Marker
- static_object.hpp
  - is_trivial_standard_layout static constexpr member function
  - suppress register_static_dtor when is_trivial_standard_layout

* Update lib/rocprofiler-sdk/hsa/code_object.*

- name_by_id
- id_by_name
- get_names
- get_ids

* Update lib/rocprofiler-sdk/registration.cpp

- Update rocprofiler_set_api_table for HSA

* Update lib/rocprofiler-sdk/callback_tracing.cpp

- Update for new HSA enums
- Rework to use switch statement
  - rocprofiler_query_callback_tracing_kind_operation_name
  - rocprofiler_iterate_callback_tracing_kind_operations
  - rocprofiler_iterate_callback_tracing_kind_operation_args

* Update lib/rocprofiler-sdk/buffer_tracing.cpp

- Update for new HSA enums
- Rework to use switch statement
  - rocprofiler_query_buffer_tracing_kind_operation_name
  - rocprofiler_iterate_buffer_tracing_kind_operations

* Update lib/rocprofiler-sdk-tool

- helper.cpp
  - update get_buffer_id_names with new enums
  - update get_callback_id_names with new enums
- tools.cpp
  - update to use new HSA enums

* Update samples/common

- added call_stack.hpp
  - source_location struct
  - call_stack_t alias
  - print_call_stack function
- added name_info.hpp
  - utils for getting buffer/callback domain and operation names

* Update samples/api_buffered_tracing/client.cpp

- use samples/common/call_stack.hpp
- use samples/common/name_info.hpp
- update for new HSA enums

* Update samples/api_callback_tracing/client.cpp

- use samples/common/call_stack.hpp
- use samples/common/name_info.hpp
- update for new HSA enums

* Update tests/tools/json-tool.cpp

- update for new HSA enums

* Update tests/rocprofv3/tracing/validate.py

- update for new HSA domain names

* Update samples/counter_collection/main.cpp

- reduce number of kernels to 50,000 since 200,000 causes issues with thread sanitizer

[ROCm/rocprofiler-sdk commit: 3f39339926]
Tento commit je obsažen v:
Jonathan R. Madsen
2024-01-30 12:14:26 -06:00
odevzdal GitHub
rodič 65231c485c
revize e84f4a7cad
58 změnil soubory, kde provedl 3733 přidání a 2695 odebrání
@@ -11,7 +11,8 @@ include(GoogleTest)
#
# -------------------------------------------------------------------------------------- #
set(rocprofiler_lib_sources agent.cpp buffer.cpp hsa.cpp timestamp.cpp version.cpp)
set(rocprofiler_lib_sources agent.cpp buffer.cpp hsa.cpp naming.cpp timestamp.cpp
version.cpp)
add_executable(rocprofiler-lib-tests)
target_sources(rocprofiler-lib-tests PRIVATE ${rocprofiler_lib_sources} details/agent.cpp)
+45 -10
Zobrazit soubor
@@ -22,6 +22,7 @@
#pragma once
#include <rocprofiler-sdk/registration.h>
#include <rocprofiler-sdk/rocprofiler.h>
#include "lib/common/defines.hpp"
@@ -31,6 +32,7 @@
#include <cstdint>
#include <map>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
@@ -41,6 +43,13 @@
EXPECT_EQ(_status, ROCPROFILER_STATUS_SUCCESS) << MSG << " :: " << #ARG; \
}
#define ROCPROFILER_CALL_EXPECT(ARG, MSG, STATUS) \
{ \
auto _status = (ARG); \
EXPECT_EQ(_status, STATUS) << MSG << " (" << _status << "=" \
<< rocprofiler_get_status_string(_status) << ") :: " << #ARG; \
}
namespace
{
struct callback_data
@@ -57,15 +66,33 @@ struct callback_data
int64_t max_depth = 0;
};
struct callback_data_ext
{
using callback_count_data_t = std::pair<uint64_t, uint64_t>;
using callback_count_map_t = std::map<std::string_view, callback_count_data_t>;
rocprofiler_client_id_t* client_id = nullptr;
rocprofiler_client_finalize_t client_fini_func = nullptr;
rocprofiler_context_id_t client_hsa_ctx = {};
rocprofiler_context_id_t client_hip_ctx = {};
rocprofiler_buffer_id_t client_buffer = {};
rocprofiler_callback_thread_t client_thread = {};
uint64_t client_workflow_count = {};
uint64_t client_elapsed = {};
int64_t current_depth = 0;
int64_t max_depth = 0;
callback_count_map_t client_callback_count = {};
};
struct agent_data
{
uint64_t agent_count = 0;
std::vector<hsa_device_type_t> agents = {};
};
using callback_kind_names_t = std::map<rocprofiler_callback_tracing_kind_t, const char*>;
using callback_kind_names_t = std::map<rocprofiler_callback_tracing_kind_t, std::string_view>;
using callback_kind_operation_names_t =
std::map<rocprofiler_callback_tracing_kind_t, std::map<uint32_t, const char*>>;
std::map<rocprofiler_callback_tracing_kind_t, std::map<uint32_t, std::string_view>>;
struct callback_name_info
{
@@ -77,12 +104,16 @@ inline auto
get_callback_tracing_names()
{
static const auto supported_kinds = std::unordered_set<rocprofiler_callback_tracing_kind_t>{
ROCPROFILER_CALLBACK_TRACING_HSA_API,
ROCPROFILER_CALLBACK_TRACING_HIP_API,
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_NAME_API,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT,
};
auto cb_name_info = callback_name_info{};
@@ -133,9 +164,9 @@ get_callback_tracing_names()
return cb_name_info;
}
using buffer_kind_names_t = std::map<rocprofiler_buffer_tracing_kind_t, const char*>;
using buffer_kind_names_t = std::map<rocprofiler_buffer_tracing_kind_t, std::string_view>;
using buffer_kind_operation_names_t =
std::map<rocprofiler_buffer_tracing_kind_t, std::map<uint32_t, const char*>>;
std::map<rocprofiler_buffer_tracing_kind_t, std::map<uint32_t, std::string_view>>;
struct buffer_name_info
{
@@ -147,13 +178,17 @@ inline buffer_name_info
get_buffer_tracing_names()
{
static const auto supported_kinds = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{
ROCPROFILER_BUFFER_TRACING_HSA_API,
ROCPROFILER_BUFFER_TRACING_HIP_API,
ROCPROFILER_BUFFER_TRACING_HSA_CORE_API,
ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API,
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
ROCPROFILER_BUFFER_TRACING_MARKER_CORE_API,
ROCPROFILER_BUFFER_TRACING_MARKER_CONTROL_API,
ROCPROFILER_BUFFER_TRACING_MARKER_NAME_API};
ROCPROFILER_BUFFER_TRACING_MARKER_NAME_API,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
};
auto cb_name_info = buffer_name_info{};
//
@@ -45,6 +45,7 @@
#include <string_view>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ROCPROFILER_CALL(ARG, MSG) \
@@ -162,6 +163,12 @@ tool_tracing_buffered(rocprofiler_context_id_t context,
auto v_records = std::vector<rocprofiler_buffer_tracing_hsa_api_record_t*>{};
v_records.reserve(num_headers);
static const auto supported =
std::unordered_set<uint32_t>{ROCPROFILER_BUFFER_TRACING_HSA_CORE_API,
ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API};
for(size_t i = 0; i < num_headers; ++i)
{
auto* header = headers[i];
@@ -170,7 +177,7 @@ tool_tracing_buffered(rocprofiler_context_id_t context,
auto hash = rocprofiler_record_header_compute_hash(header->category, header->kind);
EXPECT_EQ(header->hash, hash);
EXPECT_TRUE(header->category == ROCPROFILER_BUFFER_CATEGORY_TRACING &&
header->kind == ROCPROFILER_BUFFER_TRACING_HSA_API);
supported.count(header->kind) != 0);
v_records.emplace_back(
static_cast<rocprofiler_buffer_tracing_hsa_api_record_t*>(header->payload));
@@ -243,14 +250,16 @@ TEST(rocprofiler_lib, callback_external_correlation)
ROCPROFILER_CALL(rocprofiler_create_context(&cb_data->client_ctx),
"failed to create context");
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(cb_data->client_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_API,
nullptr,
0,
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
for(auto itr : {ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API})
{
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(
cb_data->client_ctx, itr, nullptr, 0, tool_tracing_callback, client_data),
"callback tracing service failed to configure");
}
int valid_ctx = 0;
ROCPROFILER_CALL(rocprofiler_context_is_valid(cb_data->client_ctx, &valid_ctx),
@@ -391,13 +400,15 @@ TEST(rocprofiler_lib, buffered_external_correlation)
&cb_data->client_buffer),
"buffer creation failed");
ROCPROFILER_CALL(
rocprofiler_configure_buffer_tracing_service(cb_data->client_ctx,
ROCPROFILER_BUFFER_TRACING_HSA_API,
nullptr,
0,
cb_data->client_buffer),
"buffer tracing service failed to configure");
for(auto itr : {ROCPROFILER_BUFFER_TRACING_HSA_CORE_API,
ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API})
{
ROCPROFILER_CALL(rocprofiler_configure_buffer_tracing_service(
cb_data->client_ctx, itr, nullptr, 0, cb_data->client_buffer),
"buffer tracing service failed to configure");
}
ROCPROFILER_CALL(rocprofiler_create_callback_thread(&cb_data->client_thread),
"failure creating callback thread");
@@ -30,6 +30,7 @@
#include "lib/common/filesystem.hpp"
#include "lib/common/units.hpp"
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/tests/common.hpp"
#include <gtest/gtest.h>
#include <hip/hip_runtime_api.h>
@@ -49,58 +50,8 @@
#include <unordered_map>
#include <vector>
#define ROCPROFILER_CALL(ARG, MSG) \
{ \
auto _status = (ARG); \
EXPECT_EQ(_status, ROCPROFILER_STATUS_SUCCESS) \
<< MSG << " (" << _status << "=" << rocprofiler_get_status_string(_status) \
<< ") :: " << #ARG; \
}
#define ROCPROFILER_CALL_EXPECT(ARG, MSG, STATUS) \
{ \
auto _status = (ARG); \
EXPECT_EQ(_status, STATUS) << MSG << " (" << _status << "=" \
<< rocprofiler_get_status_string(_status) << ") :: " << #ARG; \
}
namespace
{
struct callback_data
{
using callback_count_data_t = std::pair<uint64_t, uint64_t>;
using callback_count_map_t = std::map<std::string_view, callback_count_data_t>;
rocprofiler_client_id_t* client_id = nullptr;
rocprofiler_client_finalize_t client_fini_func = nullptr;
rocprofiler_context_id_t client_hsa_ctx = {};
rocprofiler_context_id_t client_hip_ctx = {};
rocprofiler_buffer_id_t client_buffer = {};
rocprofiler_callback_thread_t client_thread = {};
uint64_t client_workflow_count = {};
uint64_t client_elapsed = {};
int64_t current_depth = 0;
int64_t max_depth = 0;
callback_count_map_t client_callback_count = {};
};
struct agent_data
{
uint64_t agent_count = 0;
std::vector<hsa_device_type_t> agents = {};
};
using callback_kind_names_t = std::map<rocprofiler_callback_tracing_kind_t, const char*>;
using callback_kind_operation_names_t =
std::map<rocprofiler_callback_tracing_kind_t, std::map<uint32_t, const char*>>;
using wrap_count_t = std::pair<std::string_view, size_t>;
struct callback_name_info
{
callback_kind_names_t kind_names = {};
callback_kind_operation_names_t operation_names = {};
};
auto&
get_preincrement()
{
@@ -118,65 +69,16 @@ get_postincrement()
auto&
get_client_callback_data()
{
static auto _v = callback_data{};
static auto _v = callback_data_ext{};
return _v;
}
auto
get_callback_tracing_names()
{
auto cb_name_info = callback_name_info{};
//
// callback for each kind operation
//
static auto tracing_kind_operation_cb =
[](rocprofiler_callback_tracing_kind_t kindv, uint32_t operation, void* data_v) {
auto* name_info_v = static_cast<callback_name_info*>(data_v);
if(kindv == ROCPROFILER_CALLBACK_TRACING_HSA_API)
{
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_operation_name(
kindv, operation, &name, nullptr),
"query callback tracing kind operation name");
if(name) name_info_v->operation_names[kindv][operation] = name;
}
return 0;
};
//
// callback for each callback kind (i.e. domain)
//
static auto tracing_kind_cb = [](rocprofiler_callback_tracing_kind_t kind, void* data) {
// store the callback kind name
auto* name_info_v = static_cast<callback_name_info*>(data);
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_name(kind, &name, nullptr),
"query callback tracing kind operation name");
if(name) name_info_v->kind_names[kind] = name;
if(kind == ROCPROFILER_CALLBACK_TRACING_HSA_API)
{
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kind_operations(
kind, tracing_kind_operation_cb, static_cast<void*>(data)),
"iterating callback tracing kind operations");
}
return 0;
};
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kinds(tracing_kind_cb,
static_cast<void*>(&cb_name_info)),
"iterating callback tracing kinds");
return cb_name_info;
}
void
tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
rocprofiler_user_data_t* /*user_data*/,
void* client_data)
{
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
static auto name_map = get_callback_tracing_names();
if(record.phase == ROCPROFILER_CALLBACK_PHASE_ENTER)
@@ -201,7 +103,7 @@ generate_wrapper(const char* name, RetT (*func)(Args...))
static auto func_name = std::string_view{name};
get_client_callback_data().client_callback_count.emplace(
std::string_view{name}, callback_data::callback_count_data_t{0, 0});
std::string_view{name}, callback_data_ext::callback_count_data_t{0, 0});
static functor_type wrapped_func = [](Args... args) -> RetT {
get_client_callback_data().client_callback_count.at(func_name).first +=
@@ -224,7 +126,7 @@ api_registration_callback(rocprofiler_intercept_table_t type,
uint64_t num_tables,
void* client_data)
{
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
cb_data->client_workflow_count++;
@@ -278,7 +180,7 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing)
static init_func_t tool_init = [](rocprofiler_client_finalize_t fini_func,
void* client_data) -> int {
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
cb_data->client_workflow_count++;
cb_data->client_fini_func = fini_func;
@@ -286,19 +188,19 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing)
ROCPROFILER_CALL(rocprofiler_create_context(&cb_data->client_hsa_ctx),
"failed to create context");
auto operations = std::vector<uint32_t>{ROCPROFILER_HSA_API_ID_hsa_init,
ROCPROFILER_HSA_API_ID_hsa_iterate_agents,
ROCPROFILER_HSA_API_ID_hsa_agent_get_info,
ROCPROFILER_HSA_API_ID_hsa_shut_down};
auto operations = std::vector<uint32_t>{ROCPROFILER_HSA_CORE_API_ID_hsa_init,
ROCPROFILER_HSA_CORE_API_ID_hsa_iterate_agents,
ROCPROFILER_HSA_CORE_API_ID_hsa_agent_get_info,
ROCPROFILER_HSA_CORE_API_ID_hsa_shut_down};
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(cb_data->client_hsa_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_API,
operations.data(),
operations.size(),
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
ROCPROFILER_CALL(rocprofiler_configure_callback_tracing_service(
cb_data->client_hsa_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
operations.data(),
operations.size(),
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
int valid_ctx = 0;
ROCPROFILER_CALL(rocprofiler_context_is_valid(cb_data->client_hsa_ctx, &valid_ctx),
@@ -314,11 +216,11 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing)
};
static fini_func_t tool_fini = [](void* client_data) -> void {
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
ROCPROFILER_CALL(rocprofiler_stop_context(cb_data->client_hsa_ctx),
"rocprofiler context stop failed");
static_cast<callback_data*>(client_data)->client_workflow_count++;
static_cast<callback_data_ext*>(client_data)->client_workflow_count++;
};
static auto& cb_data = get_client_callback_data();
@@ -435,7 +337,7 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing_disable_context)
static init_func_t tool_init = [](rocprofiler_client_finalize_t fini_func,
void* client_data) -> int {
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
cb_data->client_workflow_count++;
cb_data->client_fini_func = fini_func;
@@ -443,19 +345,19 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing_disable_context)
ROCPROFILER_CALL(rocprofiler_create_context(&cb_data->client_hsa_ctx),
"failed to create context");
auto operations = std::vector<uint32_t>{ROCPROFILER_HSA_API_ID_hsa_init,
ROCPROFILER_HSA_API_ID_hsa_iterate_agents,
ROCPROFILER_HSA_API_ID_hsa_agent_get_info,
ROCPROFILER_HSA_API_ID_hsa_shut_down};
auto operations = std::vector<uint32_t>{ROCPROFILER_HSA_CORE_API_ID_hsa_init,
ROCPROFILER_HSA_CORE_API_ID_hsa_iterate_agents,
ROCPROFILER_HSA_CORE_API_ID_hsa_agent_get_info,
ROCPROFILER_HSA_CORE_API_ID_hsa_shut_down};
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(cb_data->client_hsa_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_API,
operations.data(),
operations.size(),
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
ROCPROFILER_CALL(rocprofiler_configure_callback_tracing_service(
cb_data->client_hsa_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
operations.data(),
operations.size(),
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
int valid_ctx = 0;
ROCPROFILER_CALL(rocprofiler_context_is_valid(cb_data->client_hsa_ctx, &valid_ctx),
@@ -471,7 +373,7 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing_disable_context)
};
static fini_func_t tool_fini = [](void* client_data) -> void {
auto* cb_data = static_cast<callback_data*>(client_data);
auto* cb_data = static_cast<callback_data_ext*>(client_data);
ROCPROFILER_CALL_EXPECT(rocprofiler_stop_context(cb_data->client_hsa_ctx),
"rocprofiler context stop",
ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND);
@@ -480,11 +382,11 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing_disable_context)
"rocprofiler context start",
ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED);
static_cast<callback_data*>(client_data)->client_workflow_count++;
static_cast<callback_data_ext*>(client_data)->client_workflow_count++;
};
static auto& cb_data = get_client_callback_data();
cb_data = callback_data{};
cb_data = callback_data_ext{};
static auto cfg_result =
rocprofiler_tool_configure_result_t{sizeof(rocprofiler_tool_configure_result_t),
@@ -520,7 +422,7 @@ TEST(rocprofiler_lib, intercept_table_and_callback_tracing_disable_context)
EXPECT_EQ(rocprofiler_force_configure(rocp_init), ROCPROFILER_STATUS_SUCCESS);
hsa_iterate_agents_cb_t agent_cb = [](hsa_agent_t agent, void* data) {
auto* _data = static_cast<std::pair<agent_data*, callback_data*>*>(data);
auto* _data = static_cast<std::pair<agent_data*, callback_data_ext*>*>(data);
_data->first->agent_count++;
if(int _is_active = 0;
+309
Zobrazit soubor
@@ -0,0 +1,309 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// 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 <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/hip/table_id.h>
#include <rocprofiler-sdk/hsa/table_id.h>
#include <rocprofiler-sdk/marker/table_id.h>
#include <rocprofiler-sdk/rocprofiler.h>
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/hip/hip.hpp"
#include "lib/rocprofiler-sdk/hsa/hsa.hpp"
#include "lib/rocprofiler-sdk/marker/marker.hpp"
#include "lib/rocprofiler-sdk/tests/common.hpp"
#include <gtest/gtest.h>
TEST(rocprofiler_lib, api_id_names)
{
auto callback_names = get_callback_tracing_names();
auto buffered_names = get_buffer_tracing_names();
EXPECT_EQ(callback_names.kind_names.size(), ROCPROFILER_CALLBACK_TRACING_LAST);
EXPECT_EQ(buffered_names.kind_names.size(), ROCPROFILER_BUFFER_TRACING_LAST);
// HSA callback
EXPECT_EQ(callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API).size(),
ROCPROFILER_HSA_CORE_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API).size(),
ROCPROFILER_HSA_AMD_EXT_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API).size(),
ROCPROFILER_HSA_IMAGE_EXT_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API).size(),
ROCPROFILER_HSA_FINALIZE_EXT_API_ID_LAST);
// HSA buffer
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HSA_CORE_API).size(),
ROCPROFILER_HSA_CORE_API_ID_LAST);
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API).size(),
ROCPROFILER_HSA_AMD_EXT_API_ID_LAST);
EXPECT_EQ(
buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API).size(),
ROCPROFILER_HSA_IMAGE_EXT_API_ID_LAST);
EXPECT_EQ(
buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API).size(),
ROCPROFILER_HSA_FINALIZE_EXT_API_ID_LAST);
// HIP callback
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API).size(),
ROCPROFILER_HIP_RUNTIME_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API).size(),
ROCPROFILER_HIP_COMPILER_API_ID_LAST);
// HIP buffer
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API).size(),
ROCPROFILER_HIP_RUNTIME_API_ID_LAST);
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API).size(),
ROCPROFILER_HIP_COMPILER_API_ID_LAST);
// Marker callback
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API).size(),
ROCPROFILER_MARKER_CORE_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API).size(),
ROCPROFILER_MARKER_CONTROL_API_ID_LAST);
EXPECT_EQ(
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_NAME_API).size(),
ROCPROFILER_MARKER_NAME_API_ID_LAST);
// Marker buffer
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_MARKER_CORE_API).size(),
ROCPROFILER_MARKER_CORE_API_ID_LAST);
EXPECT_EQ(
buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_MARKER_CONTROL_API).size(),
ROCPROFILER_MARKER_CONTROL_API_ID_LAST);
EXPECT_EQ(buffered_names.operation_names.at(ROCPROFILER_BUFFER_TRACING_MARKER_NAME_API).size(),
ROCPROFILER_MARKER_NAME_API_ID_LAST);
// Code object callback
EXPECT_EQ(callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT).size(),
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_LAST);
{
auto hsa_core_ids = ::rocprofiler::hsa::get_ids<ROCPROFILER_HSA_TABLE_ID_Core>();
auto hsa_amd_ext_ids = ::rocprofiler::hsa::get_ids<ROCPROFILER_HSA_TABLE_ID_AmdExt>();
auto hsa_img_ext_ids = ::rocprofiler::hsa::get_ids<ROCPROFILER_HSA_TABLE_ID_ImageExt>();
auto hsa_fini_ext_ids = ::rocprofiler::hsa::get_ids<ROCPROFILER_HSA_TABLE_ID_FinalizeExt>();
auto hsa_core_names = ::rocprofiler::hsa::get_names<ROCPROFILER_HSA_TABLE_ID_Core>();
auto hsa_amd_ext_names = ::rocprofiler::hsa::get_names<ROCPROFILER_HSA_TABLE_ID_AmdExt>();
auto hsa_img_ext_names = ::rocprofiler::hsa::get_names<ROCPROFILER_HSA_TABLE_ID_ImageExt>();
auto hsa_fini_ext_names =
::rocprofiler::hsa::get_names<ROCPROFILER_HSA_TABLE_ID_FinalizeExt>();
ASSERT_EQ(hsa_core_ids.size(), hsa_core_names.size());
ASSERT_EQ(hsa_amd_ext_ids.size(), hsa_amd_ext_names.size());
ASSERT_EQ(hsa_img_ext_ids.size(), hsa_img_ext_names.size());
ASSERT_EQ(hsa_fini_ext_ids.size(), hsa_fini_ext_names.size());
for(auto itr : hsa_core_ids)
{
EXPECT_EQ(std::string_view{hsa_core_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hsa::id_by_name<ROCPROFILER_HSA_TABLE_ID_Core>(
hsa_core_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hsa::name_by_id<ROCPROFILER_HSA_TABLE_ID_Core>(itr)},
std::string_view{hsa_core_names.at(itr)});
}
for(auto itr : hsa_amd_ext_ids)
{
EXPECT_EQ(
std::string_view{hsa_amd_ext_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hsa::id_by_name<ROCPROFILER_HSA_TABLE_ID_AmdExt>(
hsa_amd_ext_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hsa::name_by_id<ROCPROFILER_HSA_TABLE_ID_AmdExt>(itr)},
std::string_view{hsa_amd_ext_names.at(itr)});
}
for(auto itr : hsa_img_ext_ids)
{
EXPECT_EQ(
std::string_view{hsa_img_ext_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hsa::id_by_name<ROCPROFILER_HSA_TABLE_ID_ImageExt>(
hsa_img_ext_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hsa::name_by_id<ROCPROFILER_HSA_TABLE_ID_ImageExt>(itr)},
std::string_view{hsa_img_ext_names.at(itr)});
}
for(auto itr : hsa_fini_ext_ids)
{
EXPECT_EQ(
std::string_view{hsa_fini_ext_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hsa::id_by_name<ROCPROFILER_HSA_TABLE_ID_FinalizeExt>(
hsa_fini_ext_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hsa::name_by_id<ROCPROFILER_HSA_TABLE_ID_FinalizeExt>(itr)},
std::string_view{hsa_fini_ext_names.at(itr)});
}
}
{
auto hip_comp_ids = ::rocprofiler::hip::get_ids<ROCPROFILER_HIP_TABLE_ID_Compiler>();
auto hip_run_ids = ::rocprofiler::hip::get_ids<ROCPROFILER_HIP_TABLE_ID_Runtime>();
auto hip_comp_names = ::rocprofiler::hip::get_names<ROCPROFILER_HIP_TABLE_ID_Compiler>();
auto hip_run_names = ::rocprofiler::hip::get_names<ROCPROFILER_HIP_TABLE_ID_Runtime>();
ASSERT_EQ(hip_comp_ids.size(), hip_comp_names.size());
ASSERT_EQ(hip_run_ids.size(), hip_run_names.size());
for(auto itr : hip_comp_ids)
{
EXPECT_EQ(
std::string_view{hip_comp_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hip::id_by_name<ROCPROFILER_HIP_TABLE_ID_Compiler>(
hip_comp_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hip::name_by_id<ROCPROFILER_HIP_TABLE_ID_Compiler>(itr)},
std::string_view{hip_comp_names.at(itr)});
}
for(auto itr : hip_run_ids)
{
EXPECT_EQ(
std::string_view{hip_run_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::hip::id_by_name<ROCPROFILER_HIP_TABLE_ID_Runtime>(
hip_run_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::hip::name_by_id<ROCPROFILER_HIP_TABLE_ID_Runtime>(itr)},
std::string_view{hip_run_names.at(itr)});
}
}
{
auto marker_core_ids =
::rocprofiler::marker::get_ids<ROCPROFILER_MARKER_TABLE_ID_RoctxCore>();
auto marker_ctrl_ids =
::rocprofiler::marker::get_ids<ROCPROFILER_MARKER_TABLE_ID_RoctxControl>();
auto marker_name_ids =
::rocprofiler::marker::get_ids<ROCPROFILER_MARKER_TABLE_ID_RoctxName>();
auto marker_core_names =
::rocprofiler::marker::get_names<ROCPROFILER_MARKER_TABLE_ID_RoctxCore>();
auto marker_ctrl_names =
::rocprofiler::marker::get_names<ROCPROFILER_MARKER_TABLE_ID_RoctxControl>();
auto marker_name_names =
::rocprofiler::marker::get_names<ROCPROFILER_MARKER_TABLE_ID_RoctxName>();
ASSERT_EQ(marker_core_ids.size(), marker_core_names.size());
ASSERT_EQ(marker_ctrl_ids.size(), marker_ctrl_names.size());
ASSERT_EQ(marker_name_ids.size(), marker_name_names.size());
for(auto itr : marker_core_ids)
{
EXPECT_EQ(
std::string_view{marker_core_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::marker::id_by_name<ROCPROFILER_MARKER_TABLE_ID_RoctxCore>(
marker_core_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::marker::name_by_id<ROCPROFILER_MARKER_TABLE_ID_RoctxCore>(itr)},
std::string_view{marker_core_names.at(itr)});
}
for(auto itr : marker_ctrl_ids)
{
EXPECT_EQ(
std::string_view{marker_ctrl_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::marker::id_by_name<ROCPROFILER_MARKER_TABLE_ID_RoctxControl>(
marker_ctrl_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::marker::name_by_id<ROCPROFILER_MARKER_TABLE_ID_RoctxControl>(
itr)},
std::string_view{marker_ctrl_names.at(itr)});
}
for(auto itr : marker_name_ids)
{
EXPECT_EQ(
std::string_view{marker_name_names.at(itr)},
callback_names.operation_names.at(ROCPROFILER_CALLBACK_TRACING_MARKER_NAME_API)
.at(itr));
EXPECT_EQ(itr,
::rocprofiler::marker::id_by_name<ROCPROFILER_MARKER_TABLE_ID_RoctxName>(
marker_name_names.at(itr)));
EXPECT_EQ(
std::string_view{
::rocprofiler::marker::name_by_id<ROCPROFILER_MARKER_TABLE_ID_RoctxName>(itr)},
std::string_view{marker_name_names.at(itr)});
}
}
}
@@ -20,6 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/registration.h>
#include <rocprofiler-sdk/rocprofiler.h>
@@ -65,14 +66,6 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
static auto name_map = get_callback_tracing_names();
EXPECT_EQ(name_map.kind_names.size(), ROCPROFILER_CALLBACK_TRACING_LAST);
EXPECT_EQ(name_map.operation_names.at(ROCPROFILER_CALLBACK_TRACING_HSA_API).size(),
ROCPROFILER_HSA_API_ID_LAST);
std::cout << "[" << __FILE__ << ":" << __LINE__ << "] "
<< name_map.operation_names[record.kind][record.operation] << "\n"
<< std::flush;
cb_data->client_callback_count++;
if(record.phase == ROCPROFILER_CALLBACK_PHASE_ENTER)
{
@@ -115,9 +108,9 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kind_operation_args(
record, info_data_cb, static_cast<void*>(&info_data_v)),
"Failure iterating trace operation args");
if(record.kind == ROCPROFILER_CALLBACK_TRACING_HSA_API &&
!(record.operation == ROCPROFILER_HSA_API_ID_hsa_init ||
record.operation == ROCPROFILER_HSA_API_ID_hsa_shut_down))
if(record.kind == ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API &&
!(record.operation == ROCPROFILER_HSA_CORE_API_ID_hsa_init ||
record.operation == ROCPROFILER_HSA_CORE_API_ID_hsa_shut_down))
{
EXPECT_GT(info_data_v.num_args, 0)
<< name_map.operation_names[record.kind][record.operation] << info_data_v.arg_ss.str();
@@ -141,13 +134,15 @@ tool_tracing_buffered(rocprofiler_context_id_t context,
static auto name_map = get_buffer_tracing_names();
EXPECT_EQ(name_map.kind_names.size(), ROCPROFILER_BUFFER_TRACING_LAST);
EXPECT_EQ(name_map.operation_names.at(ROCPROFILER_BUFFER_TRACING_HSA_API).size(),
ROCPROFILER_HSA_API_ID_LAST);
auto v_records = std::vector<rocprofiler_buffer_tracing_hsa_api_record_t*>{};
v_records.reserve(num_headers);
static const auto supported =
std::unordered_set<uint32_t>{ROCPROFILER_BUFFER_TRACING_HSA_CORE_API,
ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API};
for(size_t i = 0; i < num_headers; ++i)
{
auto* header = headers[i];
@@ -156,7 +151,7 @@ tool_tracing_buffered(rocprofiler_context_id_t context,
auto hash = rocprofiler_record_header_compute_hash(header->category, header->kind);
EXPECT_EQ(header->hash, hash);
EXPECT_TRUE(header->category == ROCPROFILER_BUFFER_CATEGORY_TRACING &&
header->kind == ROCPROFILER_BUFFER_TRACING_HSA_API);
supported.count(header->kind) > 0);
v_records.emplace_back(
static_cast<rocprofiler_buffer_tracing_hsa_api_record_t*>(header->payload));
@@ -181,7 +176,6 @@ tool_tracing_buffered(rocprofiler_context_id_t context,
static int64_t last_corr_id = -1;
auto corr_id = static_cast<int64_t>(record->correlation_id.internal);
std::cout << info.str() << "\n" << std::flush;
EXPECT_GE(context.handle, 0) << info.str();
EXPECT_GT(record->thread_id, 0) << info.str();
EXPECT_GT(record->kind, 0) << info.str();
@@ -252,14 +246,16 @@ TEST(rocprofiler_lib, callback_registration_lambda_with_result)
ROCPROFILER_CALL(rocprofiler_create_context(&cb_data->client_ctx),
"failed to create context");
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(cb_data->client_ctx,
ROCPROFILER_CALLBACK_TRACING_HSA_API,
nullptr,
0,
tool_tracing_callback,
client_data),
"callback tracing service failed to configure");
for(auto itr : {ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API})
{
ROCPROFILER_CALL(
rocprofiler_configure_callback_tracing_service(
cb_data->client_ctx, itr, nullptr, 0, tool_tracing_callback, client_data),
"callback tracing service failed to configure");
}
int valid_ctx = 0;
ROCPROFILER_CALL(rocprofiler_context_is_valid(cb_data->client_ctx, &valid_ctx),
@@ -393,13 +389,15 @@ TEST(rocprofiler_lib, buffer_registration_lambda_with_result)
&cb_data->client_buffer),
"buffer creation failed");
ROCPROFILER_CALL(
rocprofiler_configure_buffer_tracing_service(cb_data->client_ctx,
ROCPROFILER_BUFFER_TRACING_HSA_API,
nullptr,
0,
cb_data->client_buffer),
"buffer tracing service failed to configure");
for(auto itr : {ROCPROFILER_BUFFER_TRACING_HSA_CORE_API,
ROCPROFILER_BUFFER_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_BUFFER_TRACING_HSA_FINALIZE_EXT_API})
{
ROCPROFILER_CALL(rocprofiler_configure_buffer_tracing_service(
cb_data->client_ctx, itr, nullptr, 0, cb_data->client_buffer),
"buffer tracing service failed to configure");
}
ROCPROFILER_CALL(rocprofiler_create_callback_thread(&cb_data->client_thread),
"failure creating callback thread");