From a1202e54bed0de35f3672fe76651c7fa1e0f49c0 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 5 Dec 2014 11:07:57 -0500
Subject: [PATCH] P4 to Git Change 1102960 by gandryey@gera-dev-w7 on
2014/12/05 10:51:47
EPR #410824 - [CQE OCL][CZ][S/G][QR] Two Bolt sample failing on CPU; Faulty CL: 1101352
- The test performs double maps with different map flags. Optimization could choose different map schemes for each call and memory coherency could be broken. Add extra conditions to detect multiple maps and use the same path as the first map.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.hpp#45 edit
---
rocclr/runtime/device/gpu/gpumemory.hpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/rocclr/runtime/device/gpu/gpumemory.hpp b/rocclr/runtime/device/gpu/gpumemory.hpp
index 3709091a1a..0b95261598 100644
--- a/rocclr/runtime/device/gpu/gpumemory.hpp
+++ b/rocclr/runtime/device/gpu/gpumemory.hpp
@@ -205,8 +205,15 @@ public:
//! will cause a switch to indirect map for MAP_READ operations
bool isDirectMap(uint mapFlags)
{
- return (isCacheable() || (owner()->getMemFlags() & CL_MEM_ALLOC_HOST_PTR) ||
- !isHostMemDirectAccess() || !(mapFlags & CL_MAP_READ));
+ return (((isCacheable() || (owner()->getMemFlags() & CL_MEM_ALLOC_HOST_PTR) ||
+ !isHostMemDirectAccess() || !(mapFlags & CL_MAP_READ)) &&
+ // If map(indirect) memory isn't NULL,
+ // then it's a double map from the app with different map flags.
+ // If runtime will provide different regions,
+ // then it won't be able to guarantee coherency
+ (mapMemory_ == NULL)) ||
+ // Keep direct map always if the first map was direct already
+ ((indirectMapCount_ > 1) && (mapMemory_ == NULL)));
}
protected: