From d11027c522cc31986d555530bb517ef4e4d3c548 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Mon, 16 Nov 2020 23:28:52 +0000 Subject: [PATCH] Fix hipDeviceGetByPCIBusId SWDEV-260845 Change-Id: I2d6db15906d794c9ebfa85b745a2c1bbb6f3e731 --- hipamd/rocclr/hip_device_runtime.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hipamd/rocclr/hip_device_runtime.cpp b/hipamd/rocclr/hip_device_runtime.cpp index 31231a4949..08785b7942 100755 --- a/hipamd/rocclr/hip_device_runtime.cpp +++ b/hipamd/rocclr/hip_device_runtime.cpp @@ -337,12 +337,13 @@ hipError_t hipDeviceGetByPCIBusId(int* device, const char*pciBusIdstr) { int count = 0; ihipDeviceGetCount(&count); for (cl_int i = 0; i < count; i++) { - int pi = 0; hipDevice_t dev; hipDeviceGet(&dev, i); - hipDeviceGetAttribute(&pi, hipDeviceAttributePciBusId, dev); + hipDeviceProp_t prop; + hipGetDeviceProperties(&prop, dev); - if (pciBusID == pi) { + if ((pciBusID == prop.pciBusID) && (pciDomainID == prop.pciDomainID) + && (pciDeviceID == prop.pciDeviceID)) { *device = i; break; }