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.
Tento commit je obsažen v:
@@ -142,6 +142,7 @@ dispatch_callback(rocprofiler_queue_id_t /*queue_id*/,
|
||||
const rocprofiler_agent_t* agent,
|
||||
rocprofiler_correlation_id_t /*correlation_id*/,
|
||||
const hsa_kernel_dispatch_packet_t* /*dispatch_packet*/,
|
||||
uint64_t /*kernel_id*/,
|
||||
void* /*callback_data_args*/,
|
||||
rocprofiler_profile_config_id_t* config)
|
||||
{
|
||||
|
||||
@@ -111,6 +111,7 @@ dispatch_callback(rocprofiler_queue_id_t /*queue_id*/,
|
||||
const rocprofiler_agent_t* agent,
|
||||
rocprofiler_correlation_id_t /*correlation_id*/,
|
||||
const hsa_kernel_dispatch_packet_t* /*dispatch_packet*/,
|
||||
uint64_t /*kernel_id*/,
|
||||
void* /*callback_data_args*/,
|
||||
rocprofiler_profile_config_id_t* config)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
* @param [in] agent Agent of this queue
|
||||
* @param [in] correlation_id Correlation ID for this dispatch
|
||||
* @param [in] dispatch_packet Kernel dispatch packet about to be enqueued into HSA
|
||||
* @param [in] kernel_id Kernel identifier
|
||||
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
|
||||
* @param [out] config Profile config detailing the counters to collect for this kernel
|
||||
*/
|
||||
@@ -56,6 +57,7 @@ typedef void (*rocprofiler_profile_counting_dispatch_callback_t)(
|
||||
const rocprofiler_agent_t* agent,
|
||||
rocprofiler_correlation_id_t correlation_id,
|
||||
const hsa_kernel_dispatch_packet_t* dispatch_packet,
|
||||
uint64_t kernel_id,
|
||||
void* callback_data_args,
|
||||
rocprofiler_profile_config_id_t* config);
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele