Agent Profiling Fixes for Broken/Improper API Usage (#1122)

Prevent's multiple setups of agent profiling on the same agent.

Fixes agent read context to only read agents that were setup.

Prevent copy of agent profiling internal data struct and reset
hsa_signal on move to prevent inadvertant delete.

[ROCm/rocprofiler-sdk commit: 788e687167]
このコミットが含まれているのは:
Benjamin Welton authored and GitHub committed 2024-10-18 15:48:22 -07:00
1 親 3a65aabe8b
コミット d89a46ca2e
5ファイル変更
+18 -2

検索条件に一致するファイルはありません

+1
ファイルの表示
@@ -91,6 +91,7 @@ struct dispatch_counter_collection_service
struct device_counting_service
{
std::unordered_set<uint64_t> conf_agents;
std::vector<rocprofiler::counters::agent_callback_data> agent_data;
enum class state
+5
ファイルの表示
@@ -92,6 +92,11 @@ CounterController::configure_agent_collection(rocprofiler_context_id_t context_i
std::make_unique<rocprofiler::context::device_counting_service>();
}
if(ctx.device_counter_collection->conf_agents.emplace(agent_id.handle).second == false)
{
return ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT;
}
ctx.device_counter_collection->agent_data.emplace_back();
ctx.device_counter_collection->agent_data.back().callback_data =
rocprofiler_user_data_t{.ptr = user_data};
+3 -1
ファイルの表示
@@ -280,6 +280,7 @@ read_agent_ctx(const context::context* ctx,
for(auto& callback_data : agent_ctx.agent_data)
{
if(!callback_data.profile || !callback_data.set_profile) continue;
const auto* agent = agent::get_agent_cache(callback_data.profile->agent);
// If the agent no longer exists or we don't have a profile queue, reading is an error
@@ -402,6 +403,8 @@ start_agent_ctx(const context::context* ctx)
break;
}
callback_data.set_profile = false;
// Ask the tool what profile we should use for this agent
callback_data.cb(
{.handle = ctx->context_idx},
@@ -455,7 +458,6 @@ start_agent_ctx(const context::context* ctx)
continue;
}
callback_data.set_profile = false;
CHECK(callback_data.profile);
// Generate necessary structures in the context (packet gen, etc) to process
+7 -1
ファイルの表示
@@ -73,7 +73,13 @@ struct agent_callback_data
, agent_id(rhs.agent_id)
, cb(rhs.cb)
, buffer(rhs.buffer)
{}
{
rhs.completion.handle = 0;
rhs.start_signal.handle = 0;
}
agent_callback_data& operator=(const agent_callback_data&) = delete;
agent_callback_data(const agent_callback_data&) = delete;
~agent_callback_data();
};