fix: Remove default setting of gmm flag Cacheable to true

- add debug flag EnableCpuCacheForResources to be able to allow coherency when
resources could be cacheable

Resolves: NEO-7194

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2023-05-15 13:22:05 +00:00
committed by Compute-Runtime-Automation
parent af2c61c54b
commit 004a3d875c
7 changed files with 32 additions and 5 deletions

View File

@@ -28,6 +28,13 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageType(AllocationType
}
}
bool CacheSettingsHelper::isResourceCacheableOnCpu(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType) {
if (DebugManager.flags.EnableCpuCacheForResources.get()) {
return !CacheSettingsHelper::isUncachedType(gmmResourceUsageType);
}
return false;
}
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper) {
switch (allocationType) {

View File

@@ -26,6 +26,8 @@ struct CacheSettingsHelper {
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
}
static bool isResourceCacheableOnCpu(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType);
protected:
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper);
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType);

View File

@@ -39,7 +39,7 @@ Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_
resourceParams.Usage = gmmResourceUsage;
resourceParams.Flags.Info.Linear = 1;
resourceParams.Flags.Info.Cacheable = !CacheSettingsHelper::isUncachedType(gmmResourceUsage);
resourceParams.Flags.Info.Cacheable = CacheSettingsHelper::isResourceCacheableOnCpu(gmmResourceUsage);
resourceParams.Flags.Gpu.Texture = 1;
if (alignedPtr) {