feature: split cache_policy_dg2_and_later.inl file

Move getCachingPolicyOptions method present in existing
cache_policy_dg2_and_later.inl in new
get_caching_policy_options.inl file.
This would help in reusing getCachingPolicyOptions
method in any newly created cache_policy_* file.

Related-To: NEO-8306

Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2024-05-27 16:27:58 +00:00
committed by Compute-Runtime-Automation
parent e9e08fb902
commit 5df982a85d
3 changed files with 36 additions and 23 deletions

View File

@@ -188,6 +188,7 @@ endif()
if(SUPPORT_DG2_AND_LATER)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_dg2_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/get_caching_policy_options.inl
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_dg2_and_later.inl
)
endif()

View File

@@ -5,32 +5,10 @@
*
*/
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/cache_policy_base.inl"
#include "shared/source/helpers/hw_mapper.h"
#include "shared/source/helpers/get_caching_policy_options.inl"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions(bool isDebuggerActive) {
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
static constexpr const char *writeBackCachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4";
static constexpr const char *writeByPassCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=4";
static constexpr const char *uncachedCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=2";
switch (L1CachePolicyHelper<gfxProduct>::getL1CachePolicy(isDebuggerActive)) {
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP:
return writeByPassCachingPolicy;
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB:
return writeBackCachingPolicy;
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC:
return uncachedCachingPolicy;
default:
return nullptr;
}
}
template <PRODUCT_FAMILY gfxProduct>
uint32_t L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy(bool isDebuggerActive) {
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/cache_policy_base.inl"
#include "shared/source/helpers/hw_mapper.h"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions(bool isDebuggerActive) {
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
static constexpr const char *writeBackCachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4";
static constexpr const char *writeByPassCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=4";
static constexpr const char *uncachedCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=2";
switch (L1CachePolicyHelper<gfxProduct>::getL1CachePolicy(isDebuggerActive)) {
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP:
return writeByPassCachingPolicy;
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB:
return writeBackCachingPolicy;
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC:
return uncachedCachingPolicy;
default:
return nullptr;
}
}
} // namespace NEO