P4 to Git Change 1576247 by gandryey@gera-w8 on 2018/07/04 16:55:54

SWDEV-158017 - CL_DEVICE_GLOBAL_FREE_MEMORY_AMD doesn't work correctly on PAL backend
	- Change the free memory detection to account possible memory allocation with oversubscription.
	- Make sure resource cache isn't counted as allocated memory

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#593 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#244 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.hpp#88 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#94 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#31 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#68 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.hpp#25 edit
This commit is contained in:
foreman
2018-07-04 17:04:53 -04:00
parent 6e589b7de6
commit 7e185b873e
7 changed files with 84 additions and 56 deletions
+8 -1
View File
@@ -428,7 +428,10 @@ class ResourceCache : public amd::HeapObject {
public:
//! Default constructor
ResourceCache(size_t cacheSizeLimit)
: lockCacheOps_("CAL resource cache", true), cacheSize_(0), cacheSizeLimit_(cacheSizeLimit) {}
: lockCacheOps_("CAL resource cache", true)
, cacheSize_(0)
, lclCacheSize_(0)
, cacheSizeLimit_(cacheSizeLimit) {}
//! Default destructor
~ResourceCache();
@@ -446,6 +449,9 @@ class ResourceCache : public amd::HeapObject {
//! Destroys cache
bool free(size_t minCacheEntries = 0);
//! Returns the size of local memory, stored in the cache
size_t lclCacheSize() const { return lclCacheSize_; }
private:
//! Disable copy constructor
ResourceCache(const ResourceCache&);
@@ -462,6 +468,7 @@ class ResourceCache : public amd::HeapObject {
amd::Monitor lockCacheOps_; //!< Lock to serialise cache access
size_t cacheSize_; //!< Current cache size in bytes
size_t lclCacheSize_; //!< Local memory stored in the cache
size_t cacheSizeLimit_; //!< Cache size limit in bytes
//! CAL resource cache