SWDEV-310181 - Fix for mGPU dtest failure

Change-Id: Id0898bd45e23f2d637bef25a3e69f26d9dc40785


[ROCm/clr commit: 2afeacc858]
This commit is contained in:
Sarbojit Sarkar
2021-11-08 08:10:57 +00:00
committed by Sarbojit Sarkar
parent b9d61c4cd8
commit 04745adf7a
2 changed files with 12 additions and 17 deletions
+11 -16
View File
@@ -504,24 +504,19 @@ bool TwoMemoryArgsCommand::validatePeerMemory(){
if (queue_device->settings().rocr_backend_) {
const std::vector<Device*>& srcDevices = memory1_->getContext().devices();
const std::vector<Device*>& dstDevices = memory2_->getContext().devices();
// destination and source devices are not same hence
// explicit allow access is needed for P2P access
if (srcDevices.size() == 1 &&
dstDevices.size() == 1 &&
srcDevices[0] != dstDevices[0]) {
device::Memory* mem1 = memory1_->getDeviceMemory(*srcDevices[0]);
if (!mem1->getAllowedPeerAccess()) {
void* src = reinterpret_cast<void*>(mem1->virtualAddress());
accessAllowed = srcDevices[0]->deviceAllowAccess(src);
mem1->setAllowedPeerAccess(true);
}
device::Memory* mem1 = memory1_->getDeviceMemory(*srcDevices[0]);
if (!mem1->getAllowedPeerAccess() && srcDevices.size() == 1) {
void* src = reinterpret_cast<void*>(mem1->virtualAddress());
accessAllowed = srcDevices[0]->deviceAllowAccess(src);
mem1->setAllowedPeerAccess(true);
}
device::Memory* mem2 = memory2_->getDeviceMemory(*dstDevices[0]);
if (!mem2->getAllowedPeerAccess()) {
void* dst = reinterpret_cast<void*>(mem2->virtualAddress());
accessAllowed &= dstDevices[0]->deviceAllowAccess(dst);
mem2->setAllowedPeerAccess(true);
}
device::Memory* mem2 = memory2_->getDeviceMemory(*dstDevices[0]);
if (!mem2->getAllowedPeerAccess() && dstDevices.size() == 1) {
void* dst = reinterpret_cast<void*>(mem2->virtualAddress());
accessAllowed &= dstDevices[0]->deviceAllowAccess(dst);
mem2->setAllowedPeerAccess(true);
}
}
return accessAllowed;
+1 -1
View File
@@ -459,7 +459,7 @@ bool Memory::setDestructorCallback(DestructorCallBackFunction callback, void* da
void Memory::signalWrite(const Device* writer) {
// Disable cache coherency layer for HIP
if (!amd::IS_HIP) {
// (the potential race condition below doesn't matter, no critical
// (The potential race condition below doesn't matter, no critical
// section needed)
++version_;
lastWriter_ = writer;