fix: make misaligned user memory 2-Way coherent

Related-To: NEO-9004

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-03-20 10:00:35 +00:00
committed by Compute-Runtime-Automation
parent 52ad8f44c8
commit bb10290828
17 changed files with 93 additions and 17 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/allocation_type.h"
@@ -124,4 +125,13 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCaching
}
}
// Set 2-way coherency for allocations which are not aligned to cacheline
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageTypeForUserPtr(const void *userPtr, size_t size, const ProductHelper &productHelper) {
if (!isL3Capable(userPtr, size) && productHelper.isMisalignedUserPtr2WayCoherent()) {
return GMM_RESOURCE_USAGE_HW_CONTEXT;
} else {
return GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER;
}
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,6 +20,7 @@ struct RootDeviceEnvironment;
struct CacheSettingsHelper {
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper);
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageTypeForUserPtr(const void *userPtr, size_t size, const ProductHelper &productHelper);
static constexpr bool isUncachedType(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType) {
return ((gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC) ||