Added kernel id to enqueue callback for kernel dispatch (#276)
Adds kernel id as parameter to rocprofiler_profile_counting_dispatch_callback_t. Small cleanup of code in core.cpp.
This commit is contained in:
@@ -132,6 +132,7 @@ queue_cb(const std::shared_ptr<counter_callback_info>& info,
|
||||
const hsa::Queue& queue,
|
||||
hsa::ClientID,
|
||||
const hsa::rocprofiler_packet& pkt,
|
||||
uint64_t kernel_id,
|
||||
const hsa::Queue::queue_info_session_t::external_corr_id_map_t& extern_corr_ids,
|
||||
const context::correlation_id* correlation_id)
|
||||
{
|
||||
@@ -154,6 +155,7 @@ queue_cb(const std::shared_ptr<counter_callback_info>& info,
|
||||
queue.get_agent().get_rocp_agent(),
|
||||
_corr_id_v,
|
||||
&pkt.kernel_dispatch,
|
||||
kernel_id,
|
||||
info->callback_args,
|
||||
&req_profile);
|
||||
if(req_profile.handle == 0) return nullptr;
|
||||
@@ -325,9 +327,10 @@ start_context(context::context* ctx)
|
||||
[=](const hsa::Queue& q,
|
||||
hsa::ClientID c,
|
||||
const hsa::rocprofiler_packet& kern_pkt,
|
||||
uint64_t kernel_id,
|
||||
const hsa::Queue::queue_info_session_t::external_corr_id_map_t& extern_corr_ids,
|
||||
const context::correlation_id* correlation_id) {
|
||||
return queue_cb(cb, q, c, kern_pkt, extern_corr_ids, correlation_id);
|
||||
return queue_cb(cb, q, c, kern_pkt, kernel_id, extern_corr_ids, correlation_id);
|
||||
},
|
||||
// Completion CB
|
||||
[=](const hsa::Queue& q,
|
||||
|
||||
@@ -365,6 +365,7 @@ WriteInterceptor(const void* packets,
|
||||
|
||||
// Copy kernel pkt, copy is to allow for signal to be modified
|
||||
rocprofiler_packet kernel_pkt = packets_arr[i];
|
||||
uint64_t kernel_id = get_kernel_id(kernel_pkt.kernel_dispatch.kernel_object);
|
||||
queue.create_signal(HSA_AMD_SIGNAL_AMD_GPU_ONLY,
|
||||
&kernel_pkt.ext_amd_aql_pm4.completion_signal);
|
||||
|
||||
@@ -378,8 +379,8 @@ WriteInterceptor(const void* packets,
|
||||
queue.signal_callback([&](const auto& map) {
|
||||
for(const auto& [client_id, cb_pair] : map)
|
||||
{
|
||||
if(auto maybe_pkt =
|
||||
cb_pair.first(queue, client_id, kernel_pkt, extern_corr_ids, corr_id))
|
||||
if(auto maybe_pkt = cb_pair.first(
|
||||
queue, client_id, kernel_pkt, kernel_id, extern_corr_ids, corr_id))
|
||||
{
|
||||
LOG_IF(FATAL, inst_pkt)
|
||||
<< "We do not support two injections into the HSA queue";
|
||||
@@ -435,7 +436,6 @@ WriteInterceptor(const void* packets,
|
||||
|
||||
LOG_IF(FATAL, packet_type != HSA_PACKET_TYPE_KERNEL_DISPATCH)
|
||||
<< "get_kernel_id below might need to be updated";
|
||||
uint64_t kernel_id = get_kernel_id(kernel_pkt.kernel_dispatch.kernel_object);
|
||||
|
||||
// Enqueue the signal into the handler. Will call completed_cb when
|
||||
// signal completes.
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
const Queue&,
|
||||
ClientID,
|
||||
const rocprofiler_packet&,
|
||||
uint64_t,
|
||||
const queue_info_session_t::external_corr_id_map_t&,
|
||||
const context::correlation_id*)>;
|
||||
// Signals the completion of the kernel packet.
|
||||
|
||||
Reference in New Issue
Block a user