Contexts update + buffer flushing + cleanup (#338)
* Update lib/rocprofiler-sdk/context/context.*
- get_registered_contexts functions (local copy)
* Update lib/rocprofiler-sdk/hsa/{queue,queue_controller}.cpp
- remove ROCPROFILER_BUFFER_TRACING_MEMORY_COPY code
* Update tests/kernel-tracing/kernel-tracing.cpp
- move stop() and flush() in tool_fini to before reporting of sizes of data collected
* Update lib/rocprofiler-sdk/hsa/hsa.*
- remove stale set_callback / activity_functor_t code
* Update lib/rocprofiler-sdk/buffer.cpp
- full wait instead of returning busy when buffer is busy
- use task_group::join instead of task_group::wait to fully wait for tasks to finish (bug fix)
* Update lib/rocprofiler-sdk/agent.cpp
- support agent mapping for CPU agents
* Remove direct access to vector of registered contexts
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c5e45803e9
Коммит
199f0b5421
@@ -80,8 +80,7 @@ bool
|
||||
context_filter(const context::context* ctx)
|
||||
{
|
||||
return (ctx->buffered_tracer &&
|
||||
(ctx->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH) ||
|
||||
ctx->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_MEMORY_COPY)));
|
||||
(ctx->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH)));
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -120,23 +119,6 @@ AsyncSignalHandler(hsa_signal_value_t /*signal_v*/, void* data)
|
||||
<< " returned dispatch times where the end time (" << dispatch_time.end
|
||||
<< ") was less than the start time (" << dispatch_time.start << ")";
|
||||
|
||||
// try to extract the async copy time. this will return HSA_STATUS_ERROR if there
|
||||
// is not an async copy agent associated with the signal so we just predicate
|
||||
// putting something into the buffer based on whether or not
|
||||
// hsa_amd_profiling_get_async_copy_time returns HSA_STATUS_SUCCESS.
|
||||
auto copy_time = hsa_amd_profiling_async_copy_time_t{};
|
||||
auto copy_time_status =
|
||||
queue_info_session.queue.ext_api().hsa_amd_profiling_get_async_copy_time_fn(_signal,
|
||||
©_time);
|
||||
|
||||
// if we encounter this in CI, it will cause test to fail
|
||||
ROCP_CI_LOG_IF(ERROR,
|
||||
copy_time_status == HSA_STATUS_SUCCESS && copy_time.end < copy_time.start)
|
||||
<< "hsa_amd_profiling_get_async_copy_time for kernel_id=" << _kern_id
|
||||
<< " on rocprofiler_agent=" << _rocp_agent->id.handle
|
||||
<< " returned async times where the end time (" << copy_time.end
|
||||
<< ") was less than the start time (" << copy_time.start << ")";
|
||||
|
||||
for(const auto* itr : ctxs)
|
||||
{
|
||||
auto* _buffer = buffer::get_buffer(
|
||||
@@ -181,26 +163,6 @@ AsyncSignalHandler(hsa_signal_value_t /*signal_v*/, void* data)
|
||||
record);
|
||||
}
|
||||
}
|
||||
|
||||
if(itr->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_MEMORY_COPY))
|
||||
{
|
||||
if(copy_time_status == HSA_STATUS_SUCCESS)
|
||||
{
|
||||
auto record = rocprofiler_buffer_tracing_memory_copy_record_t{
|
||||
sizeof(rocprofiler_buffer_tracing_memory_copy_record_t),
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
|
||||
_corr_id_v,
|
||||
copy_time.start,
|
||||
copy_time.end,
|
||||
_rocp_agent->id,
|
||||
_queue_id,
|
||||
_kern_id};
|
||||
|
||||
CHECK_NOTNULL(_buffer)->emplace(ROCPROFILER_BUFFER_CATEGORY_TRACING,
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
|
||||
record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,20 +484,6 @@ Queue::Queue(const AgentCache& agent,
|
||||
_ext_api.hsa_amd_queue_intercept_register_fn(_intercept_queue, WriteInterceptor, this))
|
||||
<< "Could not register interceptor";
|
||||
|
||||
bool enable_async_copy = false;
|
||||
for(const auto& itr : context::get_registered_contexts())
|
||||
{
|
||||
if(itr->buffered_tracer &&
|
||||
itr->buffered_tracer->domains(ROCPROFILER_BUFFER_TRACING_MEMORY_COPY))
|
||||
enable_async_copy = true;
|
||||
}
|
||||
|
||||
if(enable_async_copy)
|
||||
{
|
||||
LOG_IF(FATAL, _ext_api.hsa_amd_profiling_async_copy_enable_fn(true) != HSA_STATUS_SUCCESS)
|
||||
<< "Could not enable async copy timing";
|
||||
}
|
||||
|
||||
*queue = _intercept_queue;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user