diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp index 7621350b92..c9775f88a1 100644 --- a/rocclr/runtime/device/pal/paldevice.cpp +++ b/rocclr/runtime/device/pal/paldevice.cpp @@ -1281,6 +1281,13 @@ pal::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { } else if (owner.getMemFlags() & CL_MEM_USE_PERSISTENT_MEM_AMD) { // Attempt to allocate from persistent heap result = gpuMemory->create(Resource::Persistent); + // Disallow permanent map for Win7 only, since OS will move buffer to sysmem + if (IS_LINUX || + // Or Win10 + (properties().gpuMemoryProperties.flags.supportPerSubmitMemRefs == false)) { + void* address = gpuMemory->map(nullptr); + CondLog(address == nullptr, "PAL failed lock of persistent memory!"); + } } else if (directAccess || (type == Resource::Remote)) { // Check for system memory allocations if ((owner.getMemFlags() & (CL_MEM_ALLOC_HOST_PTR | CL_MEM_USE_HOST_PTR)) || diff --git a/rocclr/runtime/device/pal/palresource.cpp b/rocclr/runtime/device/pal/palresource.cpp index 1ee7d2ca37..cd336ebd44 100644 --- a/rocclr/runtime/device/pal/palresource.cpp +++ b/rocclr/runtime/device/pal/palresource.cpp @@ -1106,7 +1106,8 @@ void Resource::free() { } // Sanity check for the map calls - if ((mapCount_ != 0) && (memoryType() != Remote) && (memoryType() != RemoteUSWC)) { + if ((mapCount_ != 0) && (memoryType() != Remote) && + (memoryType() != RemoteUSWC) && (memoryType() != Persistent)) { LogWarning("Resource wasn't unlocked, but destroyed!"); } const bool wait =