[SDK] Release 1.0 Public API Modifications (#277)

* Make sure all structs/enums can be forward declared

* Updates to counter collection

- consistency updates and cleanup

* Conversion of dimension information to info struct

* Added deprecated folder

* Testing changes

* merge changes

* Fix shadowed variable

* Source code formatting

* Fix shadowed variable

* Update rocprofiler_counter_info_v1_t member names

* Split version.h into version.h and ext_version.h

- ext_version.h contains external version info, e.g. ROCPROFILER_HSA_API_TABLE_MAJOR_VERSION, ROCPROFILER_HSA_RUNTIME_VERSION
- this reduces amount of recompilation after a commit since version.h gets updated with the git revision

* profile_config -> counter_config

* EOF new line

* [Samples] Reduce header includes + reorg counter collection samples

* Misc compilation fixes

- shadowed variables
- use of [[deprecated("...")]] in C code
- unused variables

* Minor misc modifications

- use common:: instead of rocprofiler::common:: when inside rocprofiler namespace
- counters.cpp
  - move local anon namespace functions into rocprofiler::counters:: anon namespace
  - use std::string_view for get_static_string
  - const ref for get_static_ptr
  - misc namespace shortening

* [Public API] rocprofiler_get_version_triplet + rocprofiler_version_triplet_t

- struct rocprofiler_version_triplet_t containing fields for the major, minor, and patch version
- public API function: rocprofiler_get_version_triplet
- define C++ operators for rocprofiler_version_triplet_t
- C++ function compute_version_triplet

* [Tests] Improve async-copy-testing test

- relax constraints
- improve logging

* Update counter_config.h doxygen docs

* ROCPROFILER_SDK_BETA_COMPAT

- ppdef which helps with renaming when set to 1

* Remove spurious include

* Fix includes for cxx/version.hpp

* Doxygen fixes for rocprofiler_get_version and rocprofiler_get_version_triplet

* Public API Experimental Designation

- ROCPROFILER_SDK_EXPERIMENTAL added to experimental function
- "(experimental)" added to doxygen @brief entries

* Fix use of assert instead of static_assert in hip/stream.cpp

* Use typedef instead of define for rocprofiler_profile_config_id_t

* Use inline rocprofiler_{create,destroy}_profile_config instead of ppdef

- added <rocprofiler-sdk/deprecated/profile_config.h>

* Doxygen for rocprofiler_{create,destroy}_profile_config

* ROCPROFILER_SDK_DEPRECATED_WARNINGS

* Temporarily comment out ROCPROFILER_SDK_DEPRECATED_WARNINGS=1

* cmake formatting

* Misc variable renaming in samples and tests

* Fix declarations of types

* Fix hip stream tracing service struct name

- rocprofiler_callback_tracing_stream_handle_data_t renamed to rocprofiler_callback_tracing_hip_stream_api_data_t

* Rename "HIP_STREAM_API" to "HIP_STREAM"

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
This commit is contained in:
Welton, Benjamin
2025-03-23 23:37:33 -07:00
committed by GitHub
parent cd4676ae6f
commit 4cd121e27b
127 changed files with 1629 additions and 988 deletions
@@ -168,7 +168,7 @@ buffered_callback(rocprofiler_context_id_t,
void
null_dispatch_callback(rocprofiler_dispatch_counting_service_data_t,
rocprofiler_profile_config_id_t*,
rocprofiler_counter_config_id_t*,
rocprofiler_user_data_t*,
void*)
{}
@@ -209,15 +209,15 @@ TEST(core, check_packet_generation)
/**
* Check profile construction
*/
rocprofiler_profile_config_id_t cfg_id = {.handle = 0};
rocprofiler_counter_config_id_t cfg_id = {.handle = 0};
rocprofiler_counter_id_t id = {.handle = metric.id()};
ROCP_ERROR << fmt::format("Generating packet for {}", metric);
ROCPROFILER_CALL(
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
"Unable to create profile");
auto profile = counters::get_profile_config(cfg_id);
auto profile = counters::get_counter_config(cfg_id);
ASSERT_TRUE(profile);
EXPECT_EQ(counters::counter_callback_info::setup_profile_config(profile),
EXPECT_EQ(counters::counter_callback_info::setup_counter_config(profile),
ROCPROFILER_STATUS_SUCCESS)
<< fmt::format("Could not build profile for {}", metric.name());
@@ -304,7 +304,7 @@ namespace
struct expected_dispatch
{
// To pass back
rocprofiler_profile_config_id_t id = {.handle = 0};
rocprofiler_counter_config_id_t id = {.handle = 0};
rocprofiler_queue_id_t queue_id = {.handle = 0};
rocprofiler_agent_id_t agent_id = {.handle = 0};
uint64_t kernel_id = 0;
@@ -312,12 +312,12 @@ struct expected_dispatch
rocprofiler_async_correlation_id_t correlation_id = {.internal = 0, .external = {.value = 0}};
rocprofiler_dim3_t workgroup_size = {0, 0, 0};
rocprofiler_dim3_t grid_size = {0, 0, 0};
rocprofiler_profile_config_id_t* config = nullptr;
rocprofiler_counter_config_id_t* config = nullptr;
};
void
user_dispatch_cb(rocprofiler_dispatch_counting_service_data_t dispatch_data,
rocprofiler_profile_config_id_t* config,
rocprofiler_counter_config_id_t* config,
rocprofiler_user_data_t* user_data,
void* callback_data_args)
{
@@ -402,9 +402,9 @@ TEST(core, check_callbacks)
expected_dispatch expected = {};
rocprofiler_counter_id_t id = {.handle = metric.id()};
ROCPROFILER_CALL(
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
"Unable to create profile");
auto profile = counters::get_profile_config(expected.id);
auto profile = counters::get_counter_config(expected.id);
ASSERT_TRUE(profile);
std::shared_ptr<counters::counter_callback_info> cb_info =
@@ -502,14 +502,14 @@ TEST(core, destroy_counter_profile)
expected_dispatch expected = {};
rocprofiler_counter_id_t id = {.handle = metric.id()};
ROCPROFILER_CALL(
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
"Unable to create profile");
ROCPROFILER_CALL(rocprofiler_destroy_profile_config(expected.id),
ROCPROFILER_CALL(rocprofiler_destroy_counter_config(expected.id),
"Could not delete profile id");
/**
* Check the profile was actually destroyed
*/
auto profile = counters::get_profile_config(expected.id);
auto profile = counters::get_counter_config(expected.id);
EXPECT_FALSE(profile);
}
}
@@ -538,7 +538,7 @@ TEST(core, start_stop_buffered_ctx)
&opt_buff_id),
"Could not create buffer");
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_counting_service(
ROCPROFILER_CALL(rocprofiler_configure_buffer_dispatch_counting_service(
get_client_ctx(), opt_buff_id, null_dispatch_callback, (void*) 0x12345),
"Could not setup buffered service");
ROCPROFILER_CALL(rocprofiler_start_context(get_client_ctx()), "start context");
@@ -671,16 +671,16 @@ TEST(core, test_profile_incremental)
}
}
rocprofiler_profile_config_id_t cfg_id = {};
rocprofiler_counter_config_id_t cfg_id = {};
// Add one counter from each block to incrementally to make sure we can
// add them incrementally
for(const auto& [block_name, block_metrics] : metric_blocks)
{
rocprofiler_profile_config_id_t old_id = cfg_id;
rocprofiler_counter_config_id_t old_id = cfg_id;
rocprofiler_counter_id_t id = {.handle = block_metrics.front().id()};
ROCPROFILER_CALL(
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
"Unable to create profile incrementally when we should be able to");
EXPECT_NE(old_id.handle, cfg_id.handle)
<< "We expect that the handle changes this is due to the existing profile being "
@@ -697,7 +697,7 @@ TEST(core, test_profile_incremental)
*/
rocprofiler_counter_id_t id = {.handle = metric.id()};
if(status =
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id);
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id);
status != ROCPROFILER_STATUS_SUCCESS)
{
break;