diff --git a/source/lib/rocprofiler-sdk/counters/agent_profiling.cpp b/source/lib/rocprofiler-sdk/counters/agent_profiling.cpp index ab0911f800..effac090e8 100644 --- a/source/lib/rocprofiler-sdk/counters/agent_profiling.cpp +++ b/source/lib/rocprofiler-sdk/counters/agent_profiling.cpp @@ -92,9 +92,9 @@ header_pkt(hsa_packet_type_t type) } std::unique_ptr -construct_aql_pkt(const hsa::AgentCache& agent, std::shared_ptr& profile) +construct_aql_pkt(std::shared_ptr& profile) { - if(counter_callback_info::setup_profile_config(agent, profile) != ROCPROFILER_STATUS_SUCCESS) + if(counter_callback_info::setup_profile_config(profile) != ROCPROFILER_STATUS_SUCCESS) { return nullptr; } @@ -163,7 +163,7 @@ init_callback_data(rocprofiler::counters::agent_callback_data& callback_data, // we have already setup this ctx if(callback_data.packet) return; - callback_data.packet = construct_aql_pkt(agent, callback_data.profile); + callback_data.packet = construct_aql_pkt(callback_data.profile); callback_data.queue = agent.profile_queue(); callback_data.table = CHECK_NOTNULL(hsa::get_queue_controller())->get_core_table(); diff --git a/source/lib/rocprofiler-sdk/counters/core.cpp b/source/lib/rocprofiler-sdk/counters/core.cpp index 0150af79dd..5055d7e9aa 100644 --- a/source/lib/rocprofiler-sdk/counters/core.cpp +++ b/source/lib/rocprofiler-sdk/counters/core.cpp @@ -38,8 +38,7 @@ namespace rocprofiler namespace counters { rocprofiler_status_t -counter_callback_info::setup_profile_config(const hsa::AgentCache& agent, - std::shared_ptr& profile) +counter_callback_info::setup_profile_config(std::shared_ptr& profile) { if(profile->pkt_generator || !profile->reqired_hw_counters.empty()) { @@ -104,7 +103,7 @@ counter_callback_info::setup_profile_config(const hsa::AgentCache& age } profile->pkt_generator = std::make_unique( - agent.get_rocp_agent()->id, + config.agent->id, std::vector{profile->reqired_hw_counters.begin(), profile->reqired_hw_counters.end()}); return ROCPROFILER_STATUS_SUCCESS; @@ -112,13 +111,12 @@ counter_callback_info::setup_profile_config(const hsa::AgentCache& age rocprofiler_status_t counter_callback_info::get_packet(std::unique_ptr& ret_pkt, - const hsa::AgentCache& agent, std::shared_ptr& profile) { rocprofiler_status_t status; // Check packet cache profile->packets.wlock([&](auto& pkt_vector) { - status = counter_callback_info::setup_profile_config(agent, profile); + status = counter_callback_info::setup_profile_config(profile); if(!pkt_vector.empty() && status == ROCPROFILER_STATUS_SUCCESS) { ret_pkt = std::move(pkt_vector.back()); diff --git a/source/lib/rocprofiler-sdk/counters/core.hpp b/source/lib/rocprofiler-sdk/counters/core.hpp index 6110c94c90..04ead96342 100644 --- a/source/lib/rocprofiler-sdk/counters/core.hpp +++ b/source/lib/rocprofiler-sdk/counters/core.hpp @@ -66,11 +66,9 @@ struct counter_callback_info std::unordered_map>> packet_return_map{}; - static rocprofiler_status_t setup_profile_config(const hsa::AgentCache&, - std::shared_ptr&); + static rocprofiler_status_t setup_profile_config(std::shared_ptr&); rocprofiler_status_t get_packet(std::unique_ptr&, - const hsa::AgentCache&, std::shared_ptr&); }; diff --git a/source/lib/rocprofiler-sdk/counters/dispatch_handlers.cpp b/source/lib/rocprofiler-sdk/counters/dispatch_handlers.cpp index 9e30fcfbfa..8e716c8f3d 100644 --- a/source/lib/rocprofiler-sdk/counters/dispatch_handlers.cpp +++ b/source/lib/rocprofiler-sdk/counters/dispatch_handlers.cpp @@ -138,7 +138,7 @@ queue_cb(const context::context* ctx, CHECK(prof_config); std::unique_ptr ret_pkt; - auto status = info->get_packet(ret_pkt, queue.get_agent(), prof_config); + auto status = info->get_packet(ret_pkt, prof_config); CHECK_EQ(status, ROCPROFILER_STATUS_SUCCESS) << rocprofiler_get_status_string(status); maybe_add_serialization(ret_pkt); diff --git a/source/lib/rocprofiler-sdk/counters/tests/core.cpp b/source/lib/rocprofiler-sdk/counters/tests/core.cpp index ed0580bff7..b223f2e3e6 100644 --- a/source/lib/rocprofiler-sdk/counters/tests/core.cpp +++ b/source/lib/rocprofiler-sdk/counters/tests/core.cpp @@ -227,7 +227,7 @@ TEST(core, check_packet_generation) "Unable to create profile"); auto profile = counters::get_profile_config(cfg_id); ASSERT_TRUE(profile); - EXPECT_EQ(counters::counter_callback_info::setup_profile_config(agent, profile), + EXPECT_EQ(counters::counter_callback_info::setup_profile_config(profile), ROCPROFILER_STATUS_SUCCESS) << fmt::format("Could not build profile for {}", metric.name()); @@ -244,7 +244,7 @@ TEST(core, check_packet_generation) */ counters::counter_callback_info cb_info; std::unique_ptr pkt; - EXPECT_EQ(cb_info.get_packet(pkt, agent, profile), ROCPROFILER_STATUS_SUCCESS) + EXPECT_EQ(cb_info.get_packet(pkt, profile), ROCPROFILER_STATUS_SUCCESS) << "Unable to generate packet"; EXPECT_TRUE(pkt) << "Expected a packet to be generated"; cb_info.packet_return_map.wlock([&](const auto& data) {