From 526db8bbaa2adc7cd24befb9ac740c777465467e Mon Sep 17 00:00:00 2001
From: "Ma, Li"
Date: Tue, 13 May 2025 17:42:15 +0800
Subject: [PATCH] rocr: Expose all available DMA engines (#165)
When copying for inter devices, Currently only XGMI as exposed. Now
SDMA0/1 will be exposed as well for inter device copies especially that
they are one of the recommended engines.
Signed-off-by: Li Ma
[ROCm/ROCR-Runtime commit: e38dd989149a91ef0bf9860cbbe80622174615c0]
---
.../hsa-runtime/core/runtime/amd_gpu_agent.cpp | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp
index 0e90f8c7d0..d8b804d7e8 100644
--- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp
+++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp
@@ -1215,9 +1215,17 @@ hsa_status_t GpuAgent::DmaCopyStatus(core::Agent& dst_agent, core::Agent& src_ag
dst_agent.HiveId() && src_agent.HiveId() == dst_agent.HiveId() &&
properties_.NumSdmaXgmiEngines) {
//Find a free xGMI SDMA engine
- for (int i = 0; i < properties_.NumSdmaXgmiEngines; i++) {
- if (DmaEngineIsFree(DefaultBlitCount + i)) {
- *engine_ids_mask |= (HSA_AMD_SDMA_ENGINE_2 << i);
+ if (rec_sdma_eng_override_) {
+ for (int i = 0; i < (properties_.NumSdmaEngines + properties_.NumSdmaXgmiEngines); i++) {
+ if (DmaEngineIsFree(BlitHostToDev + i)) {
+ *engine_ids_mask |= (HSA_AMD_SDMA_ENGINE_0 << i);
+ }
+ }
+ } else {
+ for (int i = 0; i < properties_.NumSdmaXgmiEngines; i++) {
+ if (DmaEngineIsFree(DefaultBlitCount + i)) {
+ *engine_ids_mask |= (HSA_AMD_SDMA_ENGINE_2 << i);
+ }
}
}
} else {