SDK: counter collection serialization per device (#1157)

Migrates profiler_serializer class in QueueController to have an instance per-agent instead of one globally. Other changes in this commit are to allow for maps of the queues associated with each agent to be passed to profiler_serializer when it is turned on/off. Existing test cases cover whether or not the kernels are serialized (multistream app). New test case added to show that this serialization only occurs on a per device level with a kernel launched on one device waiting for a value to be set on the other.
This commit is contained in:
Benjamin Welton authored and GitHub committed 2024-10-25 13:13:36 -07:00
1 szülő 5e1643cf81
commit 4a5b1d98c2
13 files changed
+275 -51

No files matched your search

@@ -334,10 +334,12 @@ DispatchThreadTracer::pre_kernel_call(const hsa::Queue& queue,
// and maybe adds barrier packets if the state is transitioning from serialized <->
// unserialized
auto maybe_add_serialization = [&](auto& gen_pkt) {
CHECK_NOTNULL(hsa::get_queue_controller())->serializer().rlock([&](const auto& serializer) {
for(auto& s_pkt : serializer.kernel_dispatch(queue))
gen_pkt->before_krn_pkt.push_back(s_pkt.ext_amd_aql_pm4);
});
CHECK_NOTNULL(hsa::get_queue_controller())
->serializer(&queue)
.rlock([&](const auto& serializer) {
for(auto& s_pkt : serializer.kernel_dispatch(queue))
gen_pkt->before_krn_pkt.push_back(s_pkt.ext_amd_aql_pm4);
});
};
auto control_flags = params.dispatch_cb_fn(queue.get_id(),
@@ -381,8 +383,9 @@ public:
auto* controller = hsa::get_queue_controller();
if(!controller) return;
controller->serializer().wlock(
[&](auto& serializer) { serializer.kernel_completion_signal(session.queue); });
controller->serializer(&session.queue).wlock([&](auto& serializer) {
serializer.kernel_completion_signal(session.queue);
});
}
const hsa::Queue::queue_info_session_t& session;
};