2
0

rocr/dtif: add hsaKmtQueueRingDoorbell in thunk loader

hsaKmtQueueRingDoorbell is specfic to DTIF backend

Signed-off-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Jiadong Zhu <Jiadong.Zhu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Shane Xiao <shane.xiao@amd.com>
Reviewed-by: David Yat Sin <David.YatSin@amd.com>


[ROCm/ROCR-Runtime commit: e2d767879d]
Este cometimento está contido em:
Jiadong Zhu
2024-12-25 16:37:03 +08:00
cometido por Yat Sin, David
ascendente 008bbd94d5
cometimento a0dc167541
3 ficheiros modificados com 11 adições e 2 eliminações
@@ -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);
@@ -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;
}
@@ -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;