From b7ab73b6db2086536d638c6882f2295d0ea5a2d6 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 18 Jul 2019 18:18:09 -0400 Subject: [PATCH] P4 to Git Change 1970157 by gandryey@gera-win10 on 2019/07/18 18:06:12 SWDEV-189140 - Add P2P support in PAL path - Don't add host mem direct access flag for P2P buffers - Avoid sync cocherency logic for P2P buffers Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.cpp#27 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.hpp#13 edit --- rocclr/runtime/device/pal/palmemory.cpp | 7 +++---- rocclr/runtime/device/pal/palmemory.hpp | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rocclr/runtime/device/pal/palmemory.cpp b/rocclr/runtime/device/pal/palmemory.cpp index f6ca8bab8e..010628f6e3 100644 --- a/rocclr/runtime/device/pal/palmemory.cpp +++ b/rocclr/runtime/device/pal/palmemory.cpp @@ -123,7 +123,6 @@ bool Memory::create(Resource::MemoryType memType, Resource::CreateParams* params switch (memoryType()) { case Resource::Pinned: case Resource::ExternalPhysical: - case Resource::P2PAccess: // Marks memory object for direct GPU access to the host memory flags_ |= HostMemoryDirectAccess; break; @@ -407,13 +406,13 @@ Memory::~Memory() { void Memory::syncCacheFromHost(VirtualGPU& gpu, device::Memory::SyncFlags syncFlags) { // If the last writer was another GPU, then make a writeback - if (!isHostMemDirectAccess() && (owner()->getLastWriter() != nullptr) && + if (isChacheCoherencySync() && (owner()->getLastWriter() != nullptr) && (&dev() != owner()->getLastWriter())) { mgpuCacheWriteBack(); } // If host memory doesn't have direct access, then we have to synchronize - if (!isHostMemDirectAccess() && (nullptr != owner()->getHostMem())) { + if (isChacheCoherencySync() && (nullptr != owner()->getHostMem())) { bool hasUpdates = true; // Make sure the parent of subbuffer is up to date @@ -526,7 +525,7 @@ void Memory::syncHostFromCache(device::Memory::SyncFlags syncFlags) { assert(owner() != nullptr); // If host memory doesn't have direct access, then we have to synchronize - if (!isHostMemDirectAccess()) { + if (isChacheCoherencySync()) { bool hasUpdates = true; // Make sure the parent of subbuffer is up to date diff --git a/rocclr/runtime/device/pal/palmemory.hpp b/rocclr/runtime/device/pal/palmemory.hpp index 54c74f20ab..c9dbf58e3e 100644 --- a/rocclr/runtime/device/pal/palmemory.hpp +++ b/rocclr/runtime/device/pal/palmemory.hpp @@ -152,6 +152,11 @@ class Memory : public device::Memory, public Resource { Resource::updateView(view, offset, size); } + //! Check if memory object requires cache coherency sync + bool isChacheCoherencySync() const { + return (!isHostMemDirectAccess() && (memoryType() != P2PAccess)); + } + protected: //! Decrement map count void decIndMapCount();