[SWDEV-509876] Remove buffer requirement from device counting service (#132)

* [SWDEV-509876] Remove buffer requirement from device counting service

No longer require a buffer to be given when setting up device counting
service. This is to reduce performance overhead in cases where immediate
return of counting samples is being used (synchronous mode).

* Missed file

* Update source/include/rocprofiler-sdk/device_counting_service.h

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Update source/lib/rocprofiler-sdk/counters/controller.cpp

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Update source/lib/rocprofiler-sdk/counters/device_counting.cpp

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>

* Fixes for build

---------

Co-authored-by: Benjamin Welton <ben@amd.com>
Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
This commit is contained in:
Welton, Benjamin
2025-02-04 04:06:03 -08:00
committed by GitHub
parent d4a51e4102
commit 0c4a56c6bb
3 changed files with 9 additions and 5 deletions
@@ -132,7 +132,7 @@ agent_async_handler(hsa_signal_value_t /*signal_v*/, void* data)
*prof_config->agent, prof_config->required_special_counters, decoded_pkt);
auto* buf = buffer::get_buffer(callback_data.buffer.handle);
if(!buf)
if(!buf && callback_data.buffer != rocprofiler_buffer_id_t{.handle = 0})
{
ROCP_FATAL << fmt::format("Buffer {} destroyed before record was written",
callback_data.buffer.handle);
@@ -160,8 +160,9 @@ agent_async_handler(hsa_signal_value_t /*signal_v*/, void* data)
{
callback_data.cached_counters->push_back(val);
}
buf->emplace(
ROCPROFILER_BUFFER_CATEGORY_COUNTERS, ROCPROFILER_COUNTER_RECORD_VALUE, val);
if(buf)
buf->emplace(
ROCPROFILER_BUFFER_CATEGORY_COUNTERS, ROCPROFILER_COUNTER_RECORD_VALUE, val);
}
}