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
此提交包含在:
@@ -1748,6 +1748,9 @@ bool ResourceCache::addCalResource(Resource::CalResourceDesc* desc, GslResourceR
|
||||
// Add the current resource to the cache
|
||||
resCache_.push_front({descCached, ref});
|
||||
cacheSize_ += size;
|
||||
if (desc->type_ == Resource::Local) {
|
||||
lclCacheSize_ += size;
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -1777,10 +1780,13 @@ GslResourceReference* ResourceCache::findCalResource(Resource::CalResourceDesc*
|
||||
(entry->mipLevels_ == desc->mipLevels_) && (entry->isAllocSVM_ == desc->isAllocSVM_) &&
|
||||
(entry->isAllocExecute_ == desc->isAllocExecute_)) {
|
||||
ref = it.second;
|
||||
cacheSize_ -= size;
|
||||
if (entry->type_ == Resource::Local) {
|
||||
lclCacheSize_ -= size;
|
||||
}
|
||||
delete it.first;
|
||||
// Remove the found etry from the cache
|
||||
resCache_.remove(it);
|
||||
cacheSize_ -= size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1823,12 +1829,16 @@ void ResourceCache::removeLast() {
|
||||
|
||||
size_t size = getResourceSize(entry.first);
|
||||
|
||||
cacheSize_ -= size;
|
||||
if (entry.first->type_ == Resource::Local) {
|
||||
lclCacheSize_ -= size;
|
||||
}
|
||||
|
||||
// Delete CalResourceDesc
|
||||
delete entry.first;
|
||||
|
||||
// Destroy GSL resource
|
||||
entry.second->release();
|
||||
cacheSize_ -= size;
|
||||
}
|
||||
|
||||
} // namespace gpu
|
||||
|
||||
新增問題並參考
封鎖使用者