From 6a915378ee3c674a11ee72a1ed9d42a92faa7003 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 24 Apr 2018 19:17:55 -0400
Subject: [PATCH] P4 to Git Change 1545906 by gandryey@gera-lnx-rcf on
2018/04/24 19:10:41
SWDEV-79445 - OCL generic changes and code clean-up
- Report an error if persistent memory allocation failed. The original logic was switching to local memory, but SSG can't work with it. The logic should work properly under Linux, but in Windows OS never fails persistent allocation.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#86 edit
[ROCm/clr commit: 1c91644f1b0d71e185794ebeb581f23a8dab4986]
---
.../clr/rocclr/runtime/device/pal/paldevice.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
index 4fa5df210e..de97499a80 100644
--- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
@@ -1254,12 +1254,17 @@ 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 ||
+ if (result) {
+ // 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!");
+ void* address = gpuMemory->map(nullptr);
+ CondLog(address == nullptr, "PAL failed lock of persistent memory!");
+ }
+ } else {
+ delete gpuMemory;
+ return nullptr;
}
} else if (directAccess || (type == Resource::Remote)) {
// Check for system memory allocations