From af0f90800d45b8aff96abae3b13f73b77f391e71 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 18 Mar 2022 18:45:29 -0500 Subject: [PATCH] Ignore hive id for CPUs when selecting copy paths. Hive ID is used during copy path selection to locate an optimal pool of SDMA engines. However, for CPU-GPU connections we always want to use the host port facing engines, known generally as the PCIe optimzed engines. We want this selection even when the connection is XGMI hence dropping the hive id for CPUs. Change-Id: Iffe44174afecfc0bb3272b806fce549c930a49d9 --- runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index e61fb368e3..0bddcc4e2c 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -1564,9 +1564,13 @@ lazy_ptr& GpuAgent::GetBlitObject(const core::Agent& dst_agent, return blits_[BlitDevToDev]; } - // Acquire Hive Id of Src and Dst devices - uint64_t src_hive_id = src_agent.HiveId(); - uint64_t dst_hive_id = dst_agent.HiveId(); + // Acquire Hive Id of Src and Dst devices - ignore hive id for CPU devices. + // CPU-GPU connections should always use the host (aka pcie) facing SDMA engines, even if the + // connection is XGMI. + uint64_t src_hive_id = + (src_agent.device_type() == core::Agent::kAmdGpuDevice) ? src_agent.HiveId() : 0; + uint64_t dst_hive_id = + (dst_agent.device_type() == core::Agent::kAmdGpuDevice) ? dst_agent.HiveId() : 0; // Bind to a PCIe facing Blit object if the two // devices have different Hive Ids. This can occur