SWDEV-333438 - Fix for hipEnablePeerAccess segfault

Change-Id: I60720d1d9b9c522d15fe17dcfbc609571a4fd266
This commit is contained in:
Sarbojit Sarkar
2022-04-25 10:09:15 +00:00
committed by Sarbojit Sarkar
parent 8cffe6d427
commit 6b15e0a1cc
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -106,6 +106,7 @@ std::vector<hsa_agent_t> roc::Device::gpu_agents_;
std::vector<AgentInfo> roc::Device::cpu_agents_;
address Device::mg_sync_ = nullptr;
amd::Monitor Device::lockP2P_("Lock P2P ON/OFF");
bool NullDevice::create(const amd::Isa &isa) {
if (!isa.runtimeRocSupported()) {
@@ -2016,7 +2017,7 @@ void Device::hostFree(void* ptr, size_t size) const { memFree(ptr, size); }
bool Device::enableP2P(amd::Device* ptrDev) {
assert(ptrDev != nullptr);
amd::ScopedLock lock(lockP2P_);
Device* peerDev = static_cast<Device*>(ptrDev);
if (std::find(enabled_p2p_devices_.begin(), enabled_p2p_devices_.end(), peerDev) ==
enabled_p2p_devices_.end()) {
@@ -2029,7 +2030,7 @@ bool Device::enableP2P(amd::Device* ptrDev) {
bool Device::disableP2P(amd::Device* ptrDev) {
assert(ptrDev != nullptr);
amd::ScopedLock lock(lockP2P_);
Device* peerDev = static_cast<Device*>(ptrDev);
//if device is present then remove
auto it = std::find(enabled_p2p_devices_.begin(), enabled_p2p_devices_.end(), peerDev);
+1
View File
@@ -586,6 +586,7 @@ class Device : public NullDevice {
static std::vector<hsa_agent_t> gpu_agents_;
static std::vector<AgentInfo> cpu_agents_;
static amd::Monitor lockP2P_;
hsa_agent_t cpu_agent_;
uint32_t preferred_numa_node_;
std::vector<hsa_agent_t> p2p_agents_; //!< List of P2P agents available for this device