Remove unnecessary AgentCache argument from profile construction (#931)

This argument is not necessary. Removed.

Co-authored-by: Benjamin Welton <ben@amd.com>
This commit is contained in:
Benjamin Welton
2024-06-13 16:21:49 -07:00
zatwierdzone przez GitHub
rodzic 06d46ba3a0
commit ef156c3bee
5 zmienionych plików z 10 dodań i 14 usunięć
@@ -92,9 +92,9 @@ header_pkt(hsa_packet_type_t type)
}
std::unique_ptr<hsa::CounterAQLPacket>
construct_aql_pkt(const hsa::AgentCache& agent, std::shared_ptr<profile_config>& profile)
construct_aql_pkt(std::shared_ptr<profile_config>& 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();
@@ -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_config>& profile)
counter_callback_info::setup_profile_config(std::shared_ptr<profile_config>& 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<rocprofiler::aql::CounterPacketConstruct>(
agent.get_rocp_agent()->id,
config.agent->id,
std::vector<counters::Metric>{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<rocprofiler::hsa::AQLPacket>& ret_pkt,
const hsa::AgentCache& agent,
std::shared_ptr<profile_config>& 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());
@@ -66,11 +66,9 @@ struct counter_callback_info
std::unordered_map<rocprofiler::hsa::AQLPacket*, std::shared_ptr<profile_config>>>
packet_return_map{};
static rocprofiler_status_t setup_profile_config(const hsa::AgentCache&,
std::shared_ptr<profile_config>&);
static rocprofiler_status_t setup_profile_config(std::shared_ptr<profile_config>&);
rocprofiler_status_t get_packet(std::unique_ptr<rocprofiler::hsa::AQLPacket>&,
const hsa::AgentCache&,
std::shared_ptr<profile_config>&);
};
@@ -138,7 +138,7 @@ queue_cb(const context::context* ctx,
CHECK(prof_config);
std::unique_ptr<rocprofiler::hsa::AQLPacket> 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);
@@ -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<hsa::AQLPacket> 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) {