diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index 3de326f185..2edd35554b 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -487,7 +487,8 @@ bool OneMemoryArgCommand::validatePeerMemory() { // extra memory objects. if (queue_device->settings().rocr_backend_) { const std::vector& srcDevices = memory_->getContext().devices(); - if (srcDevices.size() == 1 && queue_device != srcDevices[0]) { + if (!memory_->isArena() && + srcDevices.size() == 1 && queue_device != srcDevices[0]) { // current device and source device are not same hence // explicit allow access is needed for P2P access device::Memory* mem = memory_->getDeviceMemory(*srcDevices[0]); @@ -533,14 +534,16 @@ bool TwoMemoryArgsCommand::validatePeerMemory(){ const std::vector& dstDevices = memory2_->getContext().devices(); // explicit allow access is needed for P2P access device::Memory* mem1 = memory1_->getDeviceMemory(*srcDevices[0]); - if (!mem1->getAllowedPeerAccess() && srcDevices.size() == 1) { + if (!memory1_->isArena() && + !mem1->getAllowedPeerAccess() && srcDevices.size() == 1) { void* src = reinterpret_cast(mem1->originalDeviceAddress()); accessAllowed = srcDevices[0]->deviceAllowAccess(src); mem1->setAllowedPeerAccess(true); } device::Memory* mem2 = memory2_->getDeviceMemory(*dstDevices[0]); - if (!mem2->getAllowedPeerAccess() && dstDevices.size() == 1) { + if (!memory2_->isArena() && + !mem2->getAllowedPeerAccess() && dstDevices.size() == 1) { void* dst = reinterpret_cast(mem2->originalDeviceAddress()); accessAllowed &= dstDevices[0]->deviceAllowAccess(dst); mem2->setAllowedPeerAccess(true); diff --git a/rocclr/platform/memory.hpp b/rocclr/platform/memory.hpp index 4cf413ddbb..f37df7a083 100644 --- a/rocclr/platform/memory.hpp +++ b/rocclr/platform/memory.hpp @@ -377,6 +377,8 @@ class Memory : public amd::RuntimeObject { //!save the user data during memory allocation UserData& getUserData() { return userData_; } + //!find if memory object is Arena memory + virtual bool isArena() { return false; } }; //! Buffers are a specialization of memory. Just a wrapper, really, @@ -673,6 +675,7 @@ public: ArenaMemory(Context& context) : Buffer(context, 0, std::numeric_limits::max(), reinterpret_cast(kArenaMemoryPtr)) {} + bool isArena() { return true; } }; } // namespace amd