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 d7b549a291..4b8addb0f8 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 @@ -318,6 +318,7 @@ 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); /* drm API */ typedef int (DRM_DEF(amdgpu_device_initialize))(int fd, \ @@ -454,6 +455,7 @@ class ThunkLoader { HSAKMT_DEF(hsaKmtPcSamplingStop)* HSAKMT_PFN(hsaKmtPcSamplingStop); HSAKMT_DEF(hsaKmtPcSamplingSupport)* HSAKMT_PFN(hsaKmtPcSamplingSupport); HSAKMT_DEF(hsaKmtModelEnabled)* HSAKMT_PFN(hsaKmtModelEnabled); + HSAKMT_DEF(hsaKmtQueueRingDoorbell)* HSAKMT_PFN(hsaKmtQueueRingDoorbell); DRM_DEF(amdgpu_device_initialize)* DRM_PFN(amdgpu_device_initialize); DRM_DEF(amdgpu_device_deinitialize)* DRM_PFN(amdgpu_device_deinitialize); 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 4b25eb63a4..65a323e200 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 @@ -474,8 +474,12 @@ uint64_t AqlQueue::AddWriteIndexRelease(uint64_t value) { void AqlQueue::StoreRelaxed(hsa_signal_value_t value) { if (doorbell_type_ == 2) { - // Hardware doorbell supports AQL semantics. - atomic::Store(signal_.hardware_doorbell_ptr, uint64_t(value), std::memory_order_release); + if (core::Runtime::runtime_singleton_->flag().enable_dtif()) { + HSAKMT_CALL(hsaKmtQueueRingDoorbell(queue_id_)); + } else { + // Hardware doorbell supports AQL semantics. + atomic::Store(signal_.hardware_doorbell_ptr, uint64_t(value), std::memory_order_release); + } return; } diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/thunk_loader.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/thunk_loader.cpp index f82a6067cd..eea7ade330 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/thunk_loader.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/thunk_loader.cpp @@ -348,6 +348,9 @@ namespace core { HSAKMT_PFN(hsaKmtModelEnabled) = (HSAKMT_DEF(hsaKmtModelEnabled)*)dlsym(dtif_handle, "hsaKmtModelEnabled"); if (HSAKMT_PFN(hsaKmtModelEnabled) == NULL) goto ERROR; + HSAKMT_PFN(hsaKmtQueueRingDoorbell) = (HSAKMT_DEF(hsaKmtQueueRingDoorbell)*)dlsym(dtif_handle, "hsaKmtQueueRingDoorbell"); + if (HSAKMT_PFN(hsaKmtQueueRingDoorbell) == NULL) goto ERROR; + DRM_PFN(amdgpu_device_initialize) = (DRM_DEF(amdgpu_device_initialize)*)dlsym(dtif_handle, "amdgpu_device_initialize"); if (DRM_PFN(amdgpu_device_initialize) == NULL) goto ERROR;