From f3ffd7070c8440a477af417606fd4a36b7bad234 Mon Sep 17 00:00:00 2001 From: German Andryeyev <56892148+gandryey@users.noreply.github.com> Date: Wed, 3 Dec 2025 11:49:40 -0500 Subject: [PATCH] rocr: Change hsaKmtQueueRingDoorbell interface (#2068) WSL uses the call just for the thread wake-up, however under Windows KMD needs the actual value (SWDEV-568592). The interface is changed to avoid programming of a modified write_ptr value, which somewhat changes the client's logic. --- .../rocr-runtime/runtime/hsa-runtime/core/inc/thunk_loader.h | 3 ++- .../runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp | 2 +- .../runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/thunk_loader.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/thunk_loader.h index 3c0c5ee4f5..a7b344a2ce 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/thunk_loader.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/thunk_loader.h @@ -323,7 +323,8 @@ class ThunkLoader { HsaPcSamplingTraceId traceId); typedef HSAKMT_STATUS (HSAKMT_DEF(hsaKmtPcSamplingSupport))(void); typedef HSAKMT_STATUS (HSAKMT_DEF(hsaKmtModelEnabled))(bool* enable); - typedef HSAKMT_STATUS (HSAKMT_DEF(hsaKmtQueueRingDoorbell))(HSA_QUEUEID QueueId); + typedef HSAKMT_STATUS (HSAKMT_DEF(hsaKmtQueueRingDoorbell))(HSA_QUEUEID QueueId, \ + HSAuint64 value); typedef HSAKMT_STATUS (HSAKMT_DEF(hsaKmtAisReadWriteFile))(void *devicePtr, \ HSAuint64 size, \ HSAint32 fd, \ diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 979e27c871..396edeff7e 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -471,7 +471,7 @@ uint64_t AqlQueue::AddWriteIndexRelease(uint64_t value) { void AqlQueue::StoreRelaxed(hsa_signal_value_t value) { if (core::Runtime::runtime_singleton_->thunkLoader()->IsDTIF() || core::Runtime::runtime_singleton_->thunkLoader()->IsDXG()) { - HSAKMT_CALL(hsaKmtQueueRingDoorbell(queue_id_)); + HSAKMT_CALL(hsaKmtQueueRingDoorbell(queue_id_, value)); } else { // Hardware doorbell supports AQL semantics. _mm_sfence(); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp index e423e47cc2..3067f827d3 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp @@ -785,7 +785,7 @@ void BlitSdma::UpdateWriteAndDoorbellRegister(uint64_t curr_index, uint6 *reinterpret_cast(queue_resource_.Queue_DoorBell) = new_index; if (core::Runtime::runtime_singleton_->thunkLoader()->IsDXG() || core::Runtime::runtime_singleton_->thunkLoader()->IsDTIF()) { - HSAKMT_CALL(hsaKmtQueueRingDoorbell(queue_resource_.QueueId)); + HSAKMT_CALL(hsaKmtQueueRingDoorbell(queue_resource_.QueueId, new_index)); } atomic::Store(&cached_commit_index_, new_index, std::memory_order_release);