Make sure runtime sync before CPU access

Change-Id: I52882788ded187b3f735257a188b1b08d8502147


[ROCm/clr commit: 3828a61413]
This commit is contained in:
German Andryeyev
2020-06-05 01:51:52 -04:00
rodzic 566684b6f4
commit d4a985dcd3
@@ -179,6 +179,9 @@ void* Memory::cpuMap(device::VirtualDevice& vDev, uint flags, uint startLayer, u
assert(mapTarget != nullptr);
// CPU access requires a stall of the current queue
static_cast<roc::VirtualGPU&>(vDev).releaseGpuMemoryFence();
if (!isHostMemDirectAccess() && !IsPersistentDirectMap()) {
if (!vDev.blitMgr().readBuffer(*this, mapTarget, amd::Coord3D(0), amd::Coord3D(size()), true)) {
decIndMapCount();
@@ -371,6 +374,8 @@ void Memory::syncCacheFromHost(VirtualGPU& gpu, device::Memory::SyncFlags syncFl
// If the last writer was another GPU, then make a writeback
if (!isHostMemDirectAccess() && (owner()->getLastWriter() != nullptr) &&
(&dev() != owner()->getLastWriter())) {
// Make sure GPU finished operation before synchronization with the backing store
gpu.releaseGpuMemoryFence();
mgpuCacheWriteBack();
}