From 509e8d863a5b1fa1fa17598b0995d05fea230820 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Thu, 5 Sep 2024 11:16:34 -0400 Subject: [PATCH] rocr: Reverse host-device copy engines on GFX94x GFX 9.4.x has better performance for CPU-GPU copies when using engines in reverse order from other devices. Change-Id: I1eaebf0e837bb7f44712f40d5115df618f6a73d7 --- runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index b3e708c734..496115f92d 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -825,6 +825,10 @@ void GpuAgent::InitDma() { *blits_[BlitHostToDev]; } + // gfx94x is more efficient with reverse order of SDMA0/1 for host<->device copies + if (!use_xgmi && isa_->GetMajorVersion() == 9 && isa_->GetMinorVersion() >= 4) + rec_eng = (rec_eng + 1) % properties_.NumSdmaEngines; + // Check support for targeted SDMA engines auto kfd_version = core::Runtime::runtime_singleton_->KfdVersion().version; if (!(kfd_version.KernelInterfaceMajorVersion > 1 ||