From a224dc2a7b1a61560daff831d86ef99f6d4c258e Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 14 Oct 2020 02:57:53 +0000 Subject: [PATCH] Fix PCI bus domain ID SWDEV-256338 Change-Id: I09afdca4f1a08f99ce662a4c4ed8a51d85500699 --- rocclr/device/device.hpp | 3 +++ rocclr/device/rocm/rocdevice.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp index ba7d2a276c..973ad458df 100755 --- a/rocclr/device/device.hpp +++ b/rocclr/device/device.hpp @@ -455,6 +455,9 @@ struct Info : public amd::EmbeddedObject { //! Returns the topology for the device cl_device_topology_amd deviceTopology_; + //! Returns PCI Bus Domain ID + uint32_t pciDomainID; + //! Semaphore information uint32_t maxSemaphores_; uint32_t maxSemaphoreSize_; diff --git a/rocclr/device/rocm/rocdevice.cpp b/rocclr/device/rocm/rocdevice.cpp index 315903909f..fee8445865 100755 --- a/rocclr/device/rocm/rocdevice.cpp +++ b/rocclr/device/rocm/rocdevice.cpp @@ -618,6 +618,13 @@ bool Device::create() { info_.deviceTopology_.pcie.bus = (hsa_bdf_id & (0xFF << 8)) >> 8; info_.deviceTopology_.pcie.device = (hsa_bdf_id & (0x1F << 3)) >> 3; info_.deviceTopology_.pcie.function = (hsa_bdf_id & 0x07); + uint32_t pci_domain_id = 0; + if (HSA_STATUS_SUCCESS != + hsa_agent_get_info(_bkendDevice, + static_cast(HSA_AMD_AGENT_INFO_DOMAIN), &pci_domain_id)) { + return false; + } + info_.pciDomainID = pci_domain_id; #ifdef WITH_AMDGPU_PRO // Create amdgpu-pro device interface for SSG support