HIP Streams to Queues Translation (#235)
* rocprofiler_stream_id_t: opaque handle for a stream - e.g. HIP stream - the same HIP stream may map to different HSA queues at different points in the application - added to: - rocprofiler_buffer_tracing_hip_api_record_t - rocprofiler_buffer_tracing_memory_copy_record_t - rocprofiler_callback_tracing_hip_api_data_t - rocprofiler_callback_tracing_memory_copy_data_t --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com> Co-authored-by: Mark Meserve <mark.meserve@amd.com> Co-authored-by: Elwazir, Ammar <Ammar.Elwazir@amd.com> Co-authored-by: Ammar ELWazir <aelwazir@amd.com> Co-authored-by: Jakaraddi, Manjunath <Manjunath.Jakaraddi@amd.com> Co-authored-by: Bhardwaj, Gopesh <Gopesh.Bhardwaj@amd.com> Co-authored-by: Nagaraj, Sriraksha <Sriraksha.Nagaraj@amd.com> Co-authored-by: U, Srihari <Srihari.U@amd.com> Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com> Co-authored-by: Welton, Benjamin <Benjamin.Welton@amd.com> Co-authored-by: Benjamin Welton <ben@amd.com> Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com> Co-authored-by: Benjamin Welton <bewelton@amd.com>
This commit is contained in:
@@ -274,31 +274,7 @@ QueueController::init(CoreApiTable& core_table, AmdExtTable& ext_table)
|
||||
}
|
||||
}
|
||||
|
||||
auto enable_intercepter = false;
|
||||
for(const auto& itr : context::get_registered_contexts())
|
||||
{
|
||||
constexpr auto expected_context_size = 216UL;
|
||||
static_assert(
|
||||
sizeof(context::context) == expected_context_size,
|
||||
"If you added a new field to context struct, make sure there is a check here if it "
|
||||
"requires queue interception. Once you have done so, increment expected_context_size");
|
||||
|
||||
bool has_kernel_tracing = itr->is_tracing(ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH) ||
|
||||
itr->is_tracing(ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH);
|
||||
|
||||
bool has_scratch_reporting = itr->is_tracing(ROCPROFILER_CALLBACK_TRACING_SCRATCH_MEMORY) ||
|
||||
itr->is_tracing(ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY);
|
||||
|
||||
if(itr->counter_collection || itr->pc_sampler || has_kernel_tracing ||
|
||||
has_scratch_reporting || itr->device_counter_collection || itr->agent_thread_trace ||
|
||||
itr->dispatch_thread_trace)
|
||||
{
|
||||
enable_intercepter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(enable_intercepter)
|
||||
if(enable_queue_intercept())
|
||||
{
|
||||
core_table.hsa_queue_create_fn = hsa::create_queue;
|
||||
core_table.hsa_queue_destroy_fn = hsa::destroy_queue;
|
||||
@@ -475,6 +451,32 @@ get_queue_controller()
|
||||
return controller;
|
||||
}
|
||||
|
||||
bool
|
||||
enable_queue_intercept()
|
||||
{
|
||||
for(const auto& itr : context::get_registered_contexts())
|
||||
{
|
||||
constexpr auto expected_context_size = 216UL;
|
||||
static_assert(
|
||||
sizeof(context::context) == expected_context_size,
|
||||
"If you added a new field to context struct, make sure there is a check here if it "
|
||||
"requires queue interception. Once you have done so, increment expected_context_size");
|
||||
|
||||
bool has_kernel_tracing = itr->is_tracing(ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH) ||
|
||||
itr->is_tracing(ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH);
|
||||
|
||||
bool has_scratch_reporting = itr->is_tracing(ROCPROFILER_CALLBACK_TRACING_SCRATCH_MEMORY) ||
|
||||
itr->is_tracing(ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY);
|
||||
|
||||
if(itr->counter_collection || itr->pc_sampler || has_kernel_tracing ||
|
||||
has_scratch_reporting || itr->device_counter_collection || itr->agent_thread_trace ||
|
||||
itr->dispatch_thread_trace)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
queue_controller_init(HsaApiTable* table)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user