Renamed agent profiling service to device counting service (#1132)

* Renamed agent profiling service to device counting service

Name more aptly represents what agent profiling did (device wide
counter collection). Conversion of existing user code can be
performed by the following find/sed command:

find . -type f -exec sed -i 's/rocprofiler_agent_profile_callback_t/rocprofiler_device_counting_service_callback_t/g; s/rocprofiler_configure_agent_profile_counting_service/rocprofiler_configure_device_counting_service/g; s/agent_profile.h/device_counting_service.h/g; s/rocprofiler_sample_agent_profile_counting_service/rocprofiler_sample_device_counting_service/g' {} +

* Converted dispatch profile to dispatch counting service

* Debug for functioal counters test

* Minor changes for CI

* Minor fix

* More fixes for CI

* Update evaluate_ast.cpp

---------

Co-authored-by: Benjamin Welton <ben@amd.com>
This commit is contained in:
Benjamin Welton
2024-10-18 01:44:11 -07:00
committato da GitHub
parent 320427b5f5
commit bb69467765
44 ha cambiato i file con 327 aggiunte e 264 eliminazioni
@@ -1,9 +1,9 @@
set(ROCPROFILER_LIB_COUNTERS_SOURCES
metrics.cpp dimensions.cpp evaluate_ast.cpp core.cpp id_decode.cpp
dispatch_handlers.cpp controller.cpp agent_profiling.cpp)
dispatch_handlers.cpp controller.cpp device_counting.cpp)
set(ROCPROFILER_LIB_COUNTERS_HEADERS
metrics.hpp dimensions.hpp evaluate_ast.hpp core.hpp id_decode.hpp
dispatch_handlers.hpp controller.hpp agent_profiling.hpp)
dispatch_handlers.hpp controller.hpp device_counting.hpp)
target_sources(rocprofiler-object-library PRIVATE ${ROCPROFILER_LIB_COUNTERS_SOURCES}
${ROCPROFILER_LIB_COUNTERS_HEADERS})
@@ -23,7 +23,7 @@
#include "lib/rocprofiler-sdk/counters/controller.hpp"
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/dispatch_profile.h>
#include <rocprofiler-sdk/dispatch_counting_service.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/rocprofiler.h>
@@ -64,11 +64,11 @@ CounterController::destroy_profile(uint64_t id)
}
rocprofiler_status_t
CounterController::configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_profile_callback_t cb,
void* user_data)
CounterController::configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_device_counting_service_callback_t cb,
void* user_data)
{
auto* ctx_p = rocprofiler::context::get_mutable_registered_context(context_id);
if(!ctx_p) return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
@@ -86,18 +86,18 @@ CounterController::configure_agent_collection(rocprofiler_context_id_t
return ROCPROFILER_STATUS_ERROR_BUFFER_NOT_FOUND;
}
if(!ctx.agent_counter_collection)
if(!ctx.device_counter_collection)
{
ctx.agent_counter_collection =
std::make_unique<rocprofiler::context::agent_counter_collection_service>();
ctx.device_counter_collection =
std::make_unique<rocprofiler::context::device_counting_service>();
}
ctx.agent_counter_collection->agent_data.emplace_back();
ctx.agent_counter_collection->agent_data.back().callback_data =
ctx.device_counter_collection->agent_data.emplace_back();
ctx.device_counter_collection->agent_data.back().callback_data =
rocprofiler_user_data_t{.ptr = user_data};
ctx.agent_counter_collection->agent_data.back().agent_id = agent_id;
ctx.agent_counter_collection->agent_data.back().cb = cb;
ctx.agent_counter_collection->agent_data.back().buffer = buffer_id;
ctx.device_counter_collection->agent_data.back().agent_id = agent_id;
ctx.device_counter_collection->agent_data.back().cb = cb;
ctx.device_counter_collection->agent_data.back().buffer = buffer_id;
return ROCPROFILER_STATUS_SUCCESS;
}
@@ -110,7 +110,7 @@ rocprofiler_status_t
CounterController::configure_dispatch(
rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_args,
rocprofiler_profile_counting_record_callback_t record_callback,
void* record_callback_args)
@@ -120,7 +120,7 @@ CounterController::configure_dispatch(
auto& ctx = *ctx_p;
if(ctx.agent_counter_collection) return ROCPROFILER_STATUS_ERROR_AGENT_DISPATCH_CONFLICT;
if(ctx.device_counter_collection) return ROCPROFILER_STATUS_ERROR_AGENT_DISPATCH_CONFLICT;
// FIXME: Due to the clock gating issue, counter collection and PC sampling service
// cannot coexist in the same context for now.
@@ -29,7 +29,7 @@
#include "lib/rocprofiler-sdk/counters/metrics.hpp"
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/dispatch_profile.h>
#include <rocprofiler-sdk/dispatch_counting_service.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/rocprofiler.h>
@@ -81,17 +81,18 @@ public:
static rocprofiler_status_t configure_dispatch(
rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_args,
rocprofiler_profile_counting_record_callback_t record_callback,
void* record_callback_args);
std::shared_ptr<profile_config> get_profile_cfg(rocprofiler_profile_config_id_t id);
static rocprofiler_status_t configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_profile_callback_t cb,
void* user_data);
static rocprofiler_status_t configure_agent_collection(
rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_device_counting_service_callback_t cb,
void* user_data);
private:
rocprofiler::common::Synchronized<std::unordered_map<uint64_t, std::shared_ptr<profile_config>>>
@@ -209,11 +209,11 @@ stop_context(const context::context* ctx)
}
rocprofiler_status_t
configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_profile_callback_t cb,
void* user_data)
configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_device_counting_service_callback_t cb,
void* user_data)
{
return get_controller().configure_agent_collection(
context_id, buffer_id, agent_id, cb, user_data);
@@ -222,7 +222,7 @@ configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_status_t
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_args)
{
CHECK_NE(buffer.handle, 0);
@@ -232,7 +232,7 @@ configure_buffered_dispatch(rocprofiler_context_id_t con
rocprofiler_status_t
configure_callback_dispatch(rocprofiler_context_id_t context_id,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_data_args,
rocprofiler_profile_counting_record_callback_t record_callback,
void* record_callback_args)
@@ -23,7 +23,7 @@
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/dispatch_profile.h>
#include <rocprofiler-sdk/dispatch_counting_service.h>
#include <rocprofiler-sdk/fwd.h>
#include <optional>
@@ -45,7 +45,7 @@ namespace counters
struct counter_callback_info
{
// User callback
rocprofiler_profile_counting_dispatch_callback_t user_cb{nullptr};
rocprofiler_dispatch_counting_service_callback_t user_cb{nullptr};
// User id
void* callback_args{nullptr};
// Link to the context this is associated with
@@ -81,22 +81,22 @@ destroy_counter_profile(uint64_t id);
rocprofiler_status_t
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_args);
rocprofiler_status_t
configure_callback_dispatch(rocprofiler_context_id_t context_id,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_data_args,
rocprofiler_profile_counting_record_callback_t record_callback,
void* record_callback_args);
rocprofiler_status_t
configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_profile_callback_t cb,
void* user_data);
configure_agent_collection(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_device_counting_service_callback_t cb,
void* user_data);
void
start_context(const context::context*);
@@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "lib/rocprofiler-sdk/counters/agent_profiling.hpp"
#include "lib/rocprofiler-sdk/counters/device_counting.hpp"
#include "lib/common/logging.hpp"
#include "lib/rocprofiler-sdk/buffer.hpp"
#include "lib/rocprofiler-sdk/context/context.hpp"
@@ -138,6 +138,13 @@ agent_async_handler(hsa_signal_value_t /*signal_v*/, void* data)
return false;
}
if(decoded_pkt.empty())
{
// reset the signal to allow another sample to start
hsa::get_core_table()->hsa_signal_store_relaxed_fn(callback_data.completion, 1);
return true;
}
// Write out the AQL data to the buffer
for(auto& ast : prof_config->asts)
{
@@ -249,13 +256,13 @@ read_agent_ctx(const context::context* ctx,
rocprofiler_counter_flag_t flags)
{
rocprofiler_status_t status = ROCPROFILER_STATUS_SUCCESS;
if(!ctx->agent_counter_collection)
if(!ctx->device_counter_collection)
{
ROCP_ERROR << fmt::format("Context {} has no agent counter collection", ctx->context_idx);
return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
}
auto& agent_ctx = *ctx->agent_counter_collection;
auto& agent_ctx = *ctx->device_counter_collection;
// If we have not initiualized HSA yet, nothing to read, return;
if(hsa_inited().load() == false)
@@ -264,9 +271,9 @@ read_agent_ctx(const context::context* ctx,
}
// Set the state to LOCKED to prevent other calls to start/stop/read.
auto expected = rocprofiler::context::agent_counter_collection_service::state::ENABLED;
auto expected = rocprofiler::context::device_counting_service::state::ENABLED;
if(!agent_ctx.status.compare_exchange_strong(
expected, rocprofiler::context::agent_counter_collection_service::state::LOCKED))
expected, rocprofiler::context::device_counting_service::state::LOCKED))
{
return ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR;
}
@@ -337,8 +344,7 @@ read_agent_ctx(const context::context* ctx,
}
}
agent_ctx.status.exchange(
rocprofiler::context::agent_counter_collection_service::state::ENABLED);
agent_ctx.status.exchange(rocprofiler::context::device_counting_service::state::ENABLED);
return status;
}
@@ -357,12 +363,12 @@ rocprofiler_status_t
start_agent_ctx(const context::context* ctx)
{
auto status = ROCPROFILER_STATUS_SUCCESS;
if(!ctx->agent_counter_collection)
if(!ctx->device_counter_collection)
{
return status;
}
auto& agent_ctx = *ctx->agent_counter_collection;
auto& agent_ctx = *ctx->device_counter_collection;
if(hsa_inited().load() == false)
{
@@ -370,9 +376,9 @@ start_agent_ctx(const context::context* ctx)
}
// Set the state to LOCKED to prevent other calls to start/stop/read.
auto expected = rocprofiler::context::agent_counter_collection_service::state::DISABLED;
auto expected = rocprofiler::context::device_counting_service::state::DISABLED;
if(!agent_ctx.status.compare_exchange_strong(
expected, rocprofiler::context::agent_counter_collection_service::state::LOCKED))
expected, rocprofiler::context::device_counting_service::state::LOCKED))
{
return ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED;
}
@@ -408,19 +414,19 @@ start_agent_ctx(const context::context* ctx)
auto config = rocprofiler::counters::get_profile_config(config_id);
if(!config) return ROCPROFILER_STATUS_ERROR_PROFILE_NOT_FOUND;
if(!cb_ctx->agent_counter_collection)
if(!cb_ctx->device_counter_collection)
{
return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
}
// Only allow profiles to be set in the locked state
if(cb_ctx->agent_counter_collection->status.load() !=
rocprofiler::context::agent_counter_collection_service::state::LOCKED)
if(cb_ctx->device_counter_collection->status.load() !=
rocprofiler::context::device_counting_service::state::LOCKED)
{
return ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED;
}
for(auto& agent_data : cb_ctx->agent_counter_collection->agent_data)
for(auto& agent_data : cb_ctx->device_counter_collection->agent_data)
{
// Find the agent that this profile is for and set it.
if(agent_data.agent_id.handle == config->agent->id.handle)
@@ -474,8 +480,7 @@ start_agent_ctx(const context::context* ctx)
HSA_WAIT_STATE_ACTIVE);
}
agent_ctx.status.exchange(
rocprofiler::context::agent_counter_collection_service::state::ENABLED);
agent_ctx.status.exchange(rocprofiler::context::device_counting_service::state::ENABLED);
return status;
}
@@ -490,21 +495,21 @@ rocprofiler_status_t
stop_agent_ctx(const context::context* ctx)
{
auto status = ROCPROFILER_STATUS_SUCCESS;
if(!ctx->agent_counter_collection)
if(!ctx->device_counter_collection)
{
return status;
}
auto& agent_ctx = *ctx->agent_counter_collection;
auto& agent_ctx = *ctx->device_counter_collection;
if(hsa_inited().load() == false)
{
return ROCPROFILER_STATUS_SUCCESS;
}
auto expected = rocprofiler::context::agent_counter_collection_service::state::ENABLED;
auto expected = rocprofiler::context::device_counting_service::state::ENABLED;
if(!agent_ctx.status.compare_exchange_strong(
expected, rocprofiler::context::agent_counter_collection_service::state::LOCKED))
expected, rocprofiler::context::device_counting_service::state::LOCKED))
{
// Status is already stopped or being enabled elsewhere.
return ROCPROFILER_STATUS_SUCCESS;
@@ -531,21 +536,48 @@ stop_agent_ctx(const context::context* ctx)
HSA_WAIT_STATE_ACTIVE);
}
agent_ctx.status.exchange(
rocprofiler::context::agent_counter_collection_service::state::DISABLED);
agent_ctx.status.exchange(rocprofiler::context::device_counting_service::state::DISABLED);
return status;
}
// Stop all contexts and prevent any further requests to start/stop/read.
// Waits until any current operation is complete before exiting.
rocprofiler_status_t
device_counting_service_finalize()
{
for(auto& ctx : context::get_registered_contexts())
{
std::vector<rocprofiler::context::device_counting_service::state> expected = {
rocprofiler::context::device_counting_service::state::DISABLED,
rocprofiler::context::device_counting_service::state::ENABLED,
rocprofiler::context::device_counting_service::state::EXIT};
if(!ctx->device_counter_collection) continue;
while(!ctx->device_counter_collection->status.compare_exchange_strong(
expected[0], rocprofiler::context::device_counting_service::state::EXIT) &&
!ctx->device_counter_collection->status.compare_exchange_strong(
expected[1], rocprofiler::context::device_counting_service::state::EXIT) &&
!ctx->device_counter_collection->status.compare_exchange_strong(
expected[2], rocprofiler::context::device_counting_service::state::EXIT))
{
// Note: Compare Exchange can modify expected even if the exchange fails
expected = {rocprofiler::context::device_counting_service::state::DISABLED,
rocprofiler::context::device_counting_service::state::ENABLED,
rocprofiler::context::device_counting_service::state::EXIT};
};
}
return ROCPROFILER_STATUS_SUCCESS;
}
// If we have ctx's that were started before HSA was initialized, we need to
// actually start those contexts now that we have an HSA instance.
rocprofiler_status_t
agent_profile_hsa_registration()
device_counting_service_hsa_registration()
{
hsa_inited().store(true);
for(auto& ctx : context::get_active_contexts())
{
if(!ctx->agent_counter_collection) continue;
if(!ctx->device_counter_collection) continue;
start_agent_ctx(ctx);
}
@@ -57,7 +57,7 @@ struct agent_callback_data
std::shared_ptr<rocprofiler::counters::profile_config> profile = {};
rocprofiler_agent_id_t agent_id = {.handle = 0};
rocprofiler_agent_profile_callback_t cb = nullptr;
rocprofiler_device_counting_service_callback_t cb = nullptr;
rocprofiler_buffer_id_t buffer = {.handle = 0};
bool set_profile = false;
@@ -78,11 +78,16 @@ struct agent_callback_data
~agent_callback_data();
};
// Stop all contexts and prevent any further requests to start/stop/read.
// Waits until any current operation is complete before exiting.
rocprofiler_status_t
device_counting_service_finalize();
// If we have contexts that are started before HSA init. This
// function will start those contexts. Should only be called
// as part of the HSA init process in rocprofiler.
rocprofiler_status_t
agent_profile_hsa_registration();
device_counting_service_hsa_registration();
// Send the AQL start packet to a queue on the agent to start
// collecting counter data. This function is synchronous and will
@@ -108,7 +108,7 @@ queue_cb(const context::context* ctx,
auto req_profile = rocprofiler_profile_config_id_t{.handle = 0};
auto dispatch_data =
common::init_public_api_struct(rocprofiler_profile_counting_dispatch_data_t{});
common::init_public_api_struct(rocprofiler_dispatch_counting_service_data_t{});
dispatch_data.correlation_id = _corr_id_v;
{
@@ -248,7 +248,7 @@ completed_cb(const context::context* ctx,
if(buf)
{
auto _header =
common::init_public_api_struct(rocprofiler_profile_counting_dispatch_record_t{});
common::init_public_api_struct(rocprofiler_dispatch_counting_service_record_t{});
_header.num_records = out.size();
_header.correlation_id = _corr_id_v;
if(dispatch_time.status == HSA_STATUS_SUCCESS)
@@ -270,7 +270,7 @@ completed_cb(const context::context* ctx,
CHECK(info->record_callback);
auto dispatch_data =
common::init_public_api_struct(rocprofiler_profile_counting_dispatch_data_t{});
common::init_public_api_struct(rocprofiler_dispatch_counting_service_data_t{});
dispatch_data.dispatch_info = session.callback_record.dispatch_info;
dispatch_data.correlation_id = _corr_id_v;
@@ -509,7 +509,11 @@ EvaluateAST::read_pkt(const aql::CounterPacketConstruct* pkt_gen, hsa::AQLPacket
return HSA_STATUS_SUCCESS;
},
&aql_data);
CHECK(status == HSA_STATUS_SUCCESS);
if(status != HSA_STATUS_SUCCESS)
{
ROCP_ERROR << "AqlProfile could not decode packet";
}
return ret;
}
@@ -56,8 +56,8 @@ target_link_libraries(
set(ROCPROFILER_LIB_COUNTER_TEST_SOURCES
metrics_test.cpp evaluate_ast_test.cpp dimension.cpp init_order.cpp core.cpp
code_object_loader.cpp agent_profiling.cpp)
set(ROCPROFILER_LIB_COUNTER_TEST_HEADERS code_object_loader.hpp agent_profiling.hpp)
code_object_loader.cpp device_counting.cpp)
set(ROCPROFILER_LIB_COUNTER_TEST_HEADERS code_object_loader.hpp device_counting.hpp)
add_executable(counter-test)
@@ -33,7 +33,7 @@
#include "lib/rocprofiler-sdk/kernel_dispatch/profiling_time.hpp"
#include "lib/rocprofiler-sdk/registration.hpp"
#include <rocprofiler-sdk/dispatch_profile.h>
#include <rocprofiler-sdk/dispatch_counting_service.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/registration.h>
#include <rocprofiler-sdk/rocprofiler.h>
@@ -165,7 +165,7 @@ buffered_callback(rocprofiler_context_id_t,
}
void
null_dispatch_callback(rocprofiler_profile_counting_dispatch_data_t,
null_dispatch_callback(rocprofiler_dispatch_counting_service_data_t,
rocprofiler_profile_config_id_t*,
rocprofiler_user_data_t*,
void*)
@@ -181,7 +181,7 @@ null_buffered_callback(rocprofiler_context_id_t,
{}
void
null_record_callback(rocprofiler_profile_counting_dispatch_data_t,
null_record_callback(rocprofiler_dispatch_counting_service_data_t,
rocprofiler_record_counter_t*,
size_t,
rocprofiler_user_data_t,
@@ -207,7 +207,7 @@ TEST(core, check_packet_generation)
/**
* Check profile construction
*/
rocprofiler_profile_config_id_t cfg_id = {};
rocprofiler_profile_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(
@@ -301,7 +301,7 @@ namespace
struct expected_dispatch
{
// To pass back
rocprofiler_profile_config_id_t id = {};
rocprofiler_profile_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;
@@ -313,7 +313,7 @@ struct expected_dispatch
};
void
user_dispatch_cb(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
user_dispatch_cb(rocprofiler_dispatch_counting_service_data_t dispatch_data,
rocprofiler_profile_config_id_t* config,
rocprofiler_user_data_t* user_data,
void* callback_data_args)
@@ -326,7 +326,7 @@ user_dispatch_cb(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
auto kernel_id = dispatch_data.dispatch_info.kernel_id;
auto dispatch_id = dispatch_data.dispatch_info.dispatch_id;
EXPECT_EQ(sizeof(rocprofiler_profile_counting_dispatch_data_t), dispatch_data.size);
EXPECT_EQ(sizeof(rocprofiler_dispatch_counting_service_data_t), dispatch_data.size);
EXPECT_EQ(expected.kernel_id, kernel_id);
EXPECT_EQ(expected.dispatch_id, dispatch_id);
EXPECT_EQ(expected.agent_id, agent_id);
@@ -533,7 +533,7 @@ TEST(core, start_stop_buffered_ctx)
&opt_buff_id),
"Could not create buffer");
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_profile_counting_service(
ROCPROFILER_CALL(rocprofiler_configure_buffered_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");
@@ -595,11 +595,11 @@ TEST(core, start_stop_callback_ctx)
ROCPROFILER_CALL(rocprofiler_create_context(&get_client_ctx()), "context creation failed");
ROCPROFILER_CALL(
rocprofiler_configure_callback_dispatch_profile_counting_service(get_client_ctx(),
null_dispatch_callback,
(void*) 0x12345,
null_record_callback,
(void*) 0x54321),
rocprofiler_configure_callback_dispatch_counting_service(get_client_ctx(),
null_dispatch_callback,
(void*) 0x12345,
null_record_callback,
(void*) 0x54321),
"Could not setup counting service");
ROCPROFILER_CALL(rocprofiler_start_context(get_client_ctx()), "start context");
@@ -33,7 +33,7 @@
#include "lib/rocprofiler-sdk/registration.hpp"
#include <rocprofiler-sdk/buffer.h>
#include <rocprofiler-sdk/dispatch_profile.h>
#include <rocprofiler-sdk/dispatch_counting_service.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/registration.h>
#include <rocprofiler-sdk/rocprofiler.h>
@@ -241,10 +241,10 @@ submitPacket(hsa_queue_t* queue, const void* packet)
} // namespace
class agent_profile_test : public ::testing::Test
class device_counting_service_test : public ::testing::Test
{
protected:
agent_profile_test() {}
device_counting_service_test() {}
static void test_run(rocprofiler_counter_flag_t flags = ROCPROFILER_COUNTER_FLAG_NONE,
const std::unordered_set<std::string>& test_metrics = {},
@@ -256,7 +256,7 @@ protected:
context::push_client(1);
test_init();
// rocprofiler_debugger_block();
counters::agent_profile_hsa_registration();
counters::device_counting_service_hsa_registration();
std::string kernel_name = "null_kernel";
@@ -336,14 +336,14 @@ protected:
/**
* Check profile construction
*/
rocprofiler_profile_config_id_t cfg_id = {};
rocprofiler_profile_config_id_t cfg_id = {.handle = 0};
rocprofiler_counter_id_t id = {.handle = metric.id()};
ROCPROFILER_CALL(
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
"Unable to create profile");
ROCPROFILER_CALL(
rocprofiler_configure_agent_profile_counting_service(
rocprofiler_configure_device_counting_service(
ctx,
opt_buff_id,
agent.get_rocp_agent()->id,
@@ -367,7 +367,7 @@ protected:
// construction This is a workaround for the test environment since we create
// contexts after AgentCache constructed.
agent::get_agent_cache(agent.get_rocp_agent())
->init_agent_profile_queue(get_api_table(), get_ext_table());
->init_device_counting_service_queue(get_api_table(), get_ext_table());
hsa_signal_store_screlease(completion_signal, 1);
hsa_signal_store_screlease(found_data, 0);
@@ -402,9 +402,9 @@ protected:
HSA_WAIT_STATE_BLOCKED);
// Sample the counting service.
ROCPROFILER_CALL(rocprofiler_sample_agent_profile_counting_service(
ctx, {.value = track_metric}, flags),
"Could not sample");
ROCPROFILER_CALL(
rocprofiler_sample_device_counting_service(ctx, {.value = track_metric}, flags),
"Could not sample");
ROCPROFILER_CALL(rocprofiler_stop_context(ctx), "Could not stop context");
rocprofiler_flush_buffer(opt_buff_id);
@@ -427,9 +427,9 @@ protected:
}
};
TEST_F(agent_profile_test, sync_counters) { test_run(); }
TEST_F(agent_profile_test, async_counters) { test_run(ROCPROFILER_COUNTER_FLAG_ASYNC); }
TEST_F(agent_profile_test, sync_grbm_verify)
TEST_F(device_counting_service_test, sync_counters) { test_run(); }
TEST_F(device_counting_service_test, async_counters) { test_run(ROCPROFILER_COUNTER_FLAG_ASYNC); }
TEST_F(device_counting_service_test, sync_grbm_verify)
{
test_run(ROCPROFILER_COUNTER_FLAG_NONE, {"GRBM_COUNT"}, 50000);
ROCP_ERROR << global_recs().size();
@@ -445,7 +445,7 @@ TEST_F(agent_profile_test, sync_grbm_verify)
}
}
TEST_F(agent_profile_test, sync_gpu_util_verify)
TEST_F(device_counting_service_test, sync_gpu_util_verify)
{
test_run(ROCPROFILER_COUNTER_FLAG_NONE, {"GPU_UTIL"}, 50000);
ROCP_ERROR << global_recs().size();
@@ -461,7 +461,7 @@ TEST_F(agent_profile_test, sync_gpu_util_verify)
}
}
TEST_F(agent_profile_test, sync_sq_waves_verify)
TEST_F(device_counting_service_test, sync_sq_waves_verify)
{
test_run(ROCPROFILER_COUNTER_FLAG_NONE, {"SQ_WAVES_sum"}, 50000);
ROCP_ERROR << global_recs().size();
@@ -122,7 +122,7 @@ buffered_callback(rocprofiler_context_id_t,
{}
void
dispatch_callback(rocprofiler_profile_counting_dispatch_data_t,
dispatch_callback(rocprofiler_dispatch_counting_service_data_t,
rocprofiler_profile_config_id_t*,
rocprofiler_user_data_t*,
void*)
@@ -163,7 +163,7 @@ TEST(counters_init_order, metric_map_order)
nullptr,
&get_buffer()),
"buffer creation failed");
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_profile_counting_service(
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_counting_service(
get_client_ctx(), get_buffer(), dispatch_callback, nullptr),
"Could not setup buffered service");
rocprofiler::registration::set_init_status(1);