From 4f899d487c3042de028785c1ebeb90787eeb9623 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Mon, 7 Oct 2019 01:41:52 -0700 Subject: [PATCH] Fix PCI Domain ID query (#1424) * Fix PCI Domain ID query * Update BDF comment [ROCm/hip commit: 96530cba3b9ad80464c454d5ddf3d742614e816d] --- projects/hip/src/hip_hcc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/hip/src/hip_hcc.cpp b/projects/hip/src/hip_hcc.cpp index f509409334..7150140e12 100644 --- a/projects/hip/src/hip_hcc.cpp +++ b/projects/hip/src/hip_hcc.cpp @@ -787,11 +787,13 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) { err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_BDFID, &bdf_id); DeviceErrorCheck(err); - // BDFID is 16bit uint: [8bit - BusID | 5bit - Device ID | 3bit - Function/DomainID] - prop->pciDomainID = bdf_id & 0x7; + // BDFID is 16bit uint: [8bit - BusID | 5bit - Device ID | 3bit - FunctionID] prop->pciDeviceID = (bdf_id >> 3) & 0x1F; prop->pciBusID = (bdf_id >> 8) & 0xFF; + err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_DOMAIN, &prop->pciDomainID); + DeviceErrorCheck(err); + // Masquerade as a 3.0-level device. This will change as more HW functions are properly // supported. Application code should use the arch.has* to do detailed feature detection. prop->major = 3;