From 659cd52d5c705c9904521ef894b4e56f5a7598e1 Mon Sep 17 00:00:00 2001 From: Wenkai Du <43822138+wenkaidu@users.noreply.github.com> Date: Fri, 8 Jul 2022 09:52:27 -0700 Subject: [PATCH] Add more constraints to enable GDR (#579) * Add more constraints to enable GDR * Revert deleted line [ROCm/rccl commit: aa0d7ca8827acc9b8ad769f1ebd0e6806345c34b] --- projects/rccl/src/graph/xml.h | 2 ++ projects/rccl/src/transport/net_ib.cc | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/projects/rccl/src/graph/xml.h b/projects/rccl/src/graph/xml.h index 0e35f473ba..64f0b4cb8f 100644 --- a/projects/rccl/src/graph/xml.h +++ b/projects/rccl/src/graph/xml.h @@ -56,6 +56,8 @@ ncclResult_t ncclTopoFillNet(struct ncclXml* xml, const char* pciPath, const cha /* Remove unneeded parts */ ncclResult_t ncclTopoTrimXml(struct ncclXml* xml); +ncclResult_t ncclTopoGetStrFromSys(const char* path, const char* fileName, char* strValue); + /**************/ /* XML Struct */ /* Functions */ diff --git a/projects/rccl/src/transport/net_ib.cc b/projects/rccl/src/transport/net_ib.cc index ed0e5e7fbc..8b8849abc0 100644 --- a/projects/rccl/src/transport/net_ib.cc +++ b/projects/rccl/src/transport/net_ib.cc @@ -25,6 +25,7 @@ #include "timer.h" #include "ibvwrap.h" +#include "graph/xml.h" #define USE_RDMA_WRITE 1 #define MAXNAMESIZE 64 @@ -276,6 +277,14 @@ ncclResult_t ncclIbGdrSupport(int ibDev) { if (moduleLoaded == -1) { #if defined(__HIP_PLATFORM_HCC__) || defined(__HCC__) || defined(__HIPCC__) moduleLoaded = (access("/sys/kernel/mm/memory_peers/amdkfd/version", F_OK) == -1) ? 0 : 1; + char strValue[MAX_STR_LEN]; + NCCLCHECK(ncclTopoGetStrFromSys("/sys/devices/virtual/dmi/id", "bios_version", strValue)); + if (strncmp("Hyper-V UEFI Release", strValue, 20) == 0) { + int roMode = ncclParamIbPciRelaxedOrdering(); + NCCLCHECK(ncclTopoGetStrFromSys("/proc/sys/kernel", "numa_balancing", strValue)); + if (strcmp(strValue, "1") == 0 && roMode == 0) + moduleLoaded = 0; + } #else // Check for the nv_peer_mem module being loaded moduleLoaded = ((access("/sys/kernel/mm/memory_peers/nv_mem/version", F_OK) == -1) &&