From a526a3fadb2ccb3f16e545253ef22618bfb35805 Mon Sep 17 00:00:00 2001 From: Flora Cui Date: Thu, 17 Oct 2024 14:26:54 +0800 Subject: [PATCH] wsl/hsakmt: implement hsaKmtCreateQueueExt ref to 1105472: libhsakmt: Extend thunk queue creation with recommended sdma engines | https://gerrit-git.amd.com/c/hsa/ec/rocr-runtime/+/1105472 Signed-off-by: Flora Cui --- queues.cpp | 36 ++++++++++++++++++++++++++++++------ topology.cpp | 1 + version.cpp | 2 +- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/queues.cpp b/queues.cpp index ae8ee471b3..f89c81ce83 100644 --- a/queues.cpp +++ b/queues.cpp @@ -38,10 +38,32 @@ uint32_t get_vgpr_size_per_cu(HSA_ENGINE_ID id) { return vgpr_size; } -HSAKMT_STATUS HSAKMTAPI hsaKmtCreateQueue( - HSAuint32 NodeId, HSA_QUEUE_TYPE Type, HSAuint32 QueuePercentage, - HSA_QUEUE_PRIORITY Priority, void *QueueAddress, HSAuint64 QueueSizeInBytes, - HsaEvent *Event, HsaQueueResource *QueueResource) { +HSAKMT_STATUS HSAKMTAPI hsaKmtCreateQueue(HSAuint32 NodeId, + HSA_QUEUE_TYPE Type, + HSAuint32 QueuePercentage, + HSA_QUEUE_PRIORITY Priority, + void *QueueAddress, + HSAuint64 QueueSizeInBytes, + HsaEvent *Event, + HsaQueueResource *QueueResource) +{ + if (Type == HSA_QUEUE_SDMA_BY_ENG_ID) + return HSAKMT_STATUS_ERROR; + + return hsaKmtCreateQueueExt(NodeId, Type, QueuePercentage, Priority, 0, + QueueAddress, QueueSizeInBytes, Event, + QueueResource); +} + +HSAKMT_STATUS HSAKMTAPI hsaKmtCreateQueueExt(HSAuint32 NodeId, + HSA_QUEUE_TYPE Type, + HSAuint32 QueuePercentage, + HSA_QUEUE_PRIORITY Priority, + HSAuint32 SdmaEngineId, + void *QueueAddress, + HSAuint64 QueueSizeInBytes, + HsaEvent *Event, + HsaQueueResource *QueueResource) { HSAKMT_STATUS result; CHECK_DXG_OPEN(); @@ -73,8 +95,10 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtCreateQueue( // for doorbell_signal.hardware_doorbell_ptr QueueResource->Queue_DoorBell_aql = queue_->GetDoorbellPtr(); } break; - case HSA_QUEUE_SDMA: { - uint32_t queue_engine = device_->GetSdmaEngine(0); // TODO: + case HSA_QUEUE_SDMA: + case HSA_QUEUE_SDMA_BY_ENG_ID: { + pr_debug("create sdma queue in engine %d\n", SdmaEngineId); + uint32_t queue_engine = device_->GetSdmaEngine(0); // TODO: SdmaEngineId bool use_hws = device_->IsHwsEnabled(queue_engine); auto queue_ = new wsl::thunk::SDMAQueue( device_, QueueAddress, QueueSizeInBytes, diff --git a/topology.cpp b/topology.cpp index 2c8be2c02b..92f1f39aa6 100644 --- a/topology.cpp +++ b/topology.cpp @@ -973,6 +973,7 @@ static HSAKMT_STATUS topology_sysfs_get_iolink_props(uint32_t node_id, props->Flags.ui32.NonCoherent = 1; props->Flags.ui32.NoAtomics32bit = !(device->SupportPlatformAtomic()); props->Flags.ui32.NoAtomics64bit = !(device->SupportPlatformAtomic()); + props->RecSdmaEngIdMask = 0; return HSAKMT_STATUS_SUCCESS; } diff --git a/version.cpp b/version.cpp index d3afc40662..27560b43a4 100644 --- a/version.cpp +++ b/version.cpp @@ -29,7 +29,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetVersion(HsaVersionInfo *VersionInfo) { CHECK_DXG_OPEN(); VersionInfo->KernelInterfaceMajorVersion = 1; - VersionInfo->KernelInterfaceMinorVersion = 16; + VersionInfo->KernelInterfaceMinorVersion = 17; return HSAKMT_STATUS_SUCCESS; }