From 1ced9040b65d8c2a67b7b9c1719139dde2728f09 Mon Sep 17 00:00:00 2001 From: Alex Xie Date: Wed, 27 Oct 2021 02:27:48 -0400 Subject: [PATCH] SWDEV-305752 - OCL WIN Conformance select test fail unmap should complete before working on the other mapping API Change-Id: I27517888f3112d1113894cdbcb7a786321a3e554 --- opencl/amdocl/cl_memobj.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/opencl/amdocl/cl_memobj.cpp b/opencl/amdocl/cl_memobj.cpp index d9990718d6..f241cd6437 100644 --- a/opencl/amdocl/cl_memobj.cpp +++ b/opencl/amdocl/cl_memobj.cpp @@ -3518,13 +3518,24 @@ RUNTIME_ENTRY(cl_int, clEnqueueUnmapMemObject, return CL_MEM_OBJECT_ALLOCATION_FAILURE; } + device::Memory* mem = amdMemory->getDeviceMemory(hostQueue.device()); + bool blocking = false; + if (mem->isPersistentMapped()) { + blocking = true; + } + + amdMemory->decMapCount(); command->enqueue(); + if (blocking) { + LogInfo("blocking wait in unmapping function"); + command->awaitCompletion(); + } + *not_null(event) = as_cl(&command->event()); if (event == NULL) { command->release(); } - amdMemory->decMapCount(); return CL_SUCCESS; } RUNTIME_EXIT