Enable queue interception with scratch reporting (#1069)
* Enable queue interception with scratch reporting
Scratch reporting reports agent ID in buffer and callback records, but
HSA runtime provides only queue ID in the scratch callback.
This change enables queue interception when scratch reporting is requested
* Validation test for rocprofv3 + scratch-memory-trace
* Simplify checks for whether context is tracing a domain
* Update changelog
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
[ROCm/rocprofiler-sdk commit: efbe4ea0a2]
이 커밋은 다음에 포함됨:
1 부모
db0f26f562
커밋
d008463d50
9 파일이 변경됨
+181
-6
검색과 일치하는 파일 없음
@@ -427,5 +427,25 @@ deregister_client_contexts(rocprofiler_client_id_t client_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename KindT>
|
||||
bool
|
||||
context::is_tracing(KindT _kind) const
|
||||
{
|
||||
constexpr auto is_callback_tracing =
|
||||
std::is_same<KindT, rocprofiler_callback_tracing_kind_t>::value;
|
||||
constexpr auto is_buffered_tracing =
|
||||
std::is_same<KindT, rocprofiler_buffer_tracing_kind_t>::value;
|
||||
static_assert(is_callback_tracing || is_buffered_tracing, "Unsupported domain type");
|
||||
|
||||
if constexpr(is_callback_tracing)
|
||||
return (callback_tracer && callback_tracer->domains(_kind));
|
||||
else if constexpr(is_buffered_tracing)
|
||||
return (buffered_tracer && buffered_tracer->domains(_kind));
|
||||
}
|
||||
|
||||
// explicitly instantiate
|
||||
template bool context::is_tracing(rocprofiler_callback_tracing_kind_t) const;
|
||||
template bool context::is_tracing(rocprofiler_buffer_tracing_kind_t) const;
|
||||
} // namespace context
|
||||
} // namespace rocprofiler
|
||||
@@ -130,6 +130,9 @@ struct context
|
||||
|
||||
std::unique_ptr<thread_trace::DispatchThreadTracer> dispatch_thread_trace = {};
|
||||
std::unique_ptr<thread_trace::AgentThreadTracer> agent_thread_trace = {};
|
||||
|
||||
template <typename KindT>
|
||||
bool is_tracing(KindT _kind) const;
|
||||
};
|
||||
|
||||
// set the client index needs to be called before allocate_context()
|
||||
|
||||
@@ -270,14 +270,15 @@ QueueController::init(CoreApiTable& core_table, AmdExtTable& ext_table)
|
||||
"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->callback_tracer &&
|
||||
itr->callback_tracer->domains(ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH)) ||
|
||||
(itr->buffered_tracer &&
|
||||
itr->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH));
|
||||
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 ||
|
||||
itr->agent_counter_collection || itr->agent_thread_trace || itr->dispatch_thread_trace)
|
||||
has_scratch_reporting || itr->agent_counter_collection || itr->agent_thread_trace ||
|
||||
itr->dispatch_thread_trace)
|
||||
{
|
||||
enable_intercepter = true;
|
||||
break;
|
||||
|
||||
새 이슈에서 참조
사용자 차단