From d2a89a467b06a9990df6c27912f6f74bb9d2f0a9 Mon Sep 17 00:00:00 2001 From: Benjamin Welton Date: Thu, 6 Mar 2025 20:52:54 +0000 Subject: [PATCH] rocr: Reset event_age when signals move Resets event_age when signals move. Prior to this PR, event_age can become unaligned with hsa_event, causing hangs if the event_age exceeds the true hsa_event age. --- runtime/hsa-runtime/core/runtime/runtime.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 4e98897b7f..124fc14f5d 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -1582,13 +1582,13 @@ void Runtime::AsyncEventsLoop(void* _eventsInfo) { if (hsa_events.size() <= unique_evts) { hsa_events.resize(unique_evts + 10); event_age.resize(unique_evts + 10); - } - hsa_events[unique_evts] = hsa_event; - if (init_age) { - event_age[unique_evts] = runtime_singleton_->KfdVersion().supports_event_age ? 1 : 0; - } - unique_evts++; - return true; + } + if (init_age || hsa_events[unique_evts] != hsa_event ) { + event_age[unique_evts] = runtime_singleton_->KfdVersion().supports_event_age ? 1 : 0; + } + hsa_events[unique_evts] = hsa_event; + unique_evts++; + return true; } };