Refactor state base address programing 4/n

- This change gets level one cache policy from cached values instead
of calling virtual methods

Related-To: NEO-5055

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-02-24 16:55:21 +00:00
committed by Compute-Runtime-Automation
parent 57614f9cd4
commit 34064811d2
30 changed files with 283 additions and 94 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/os_interface/hw_info_config.h"
namespace NEO {
@@ -21,4 +22,9 @@ bool isL3Capable(const NEO::GraphicsAllocation &graphicsAllocation) {
return isL3Capable(graphicsAllocation.getUnderlyingBuffer(), graphicsAllocation.getUnderlyingBufferSize());
}
void L1CachePolicy::init(const ProductHelper &helper) {
defaultDebuggerActive = helper.getL1CachePolicy(true);
defaultDebuggerInactive = helper.getL1CachePolicy(false);
}
} // namespace NEO

View File

@@ -13,6 +13,8 @@
namespace NEO {
class GraphicsAllocation;
class ProductHelper;
bool isL3Capable(void *ptr, size_t size);
bool isL3Capable(const GraphicsAllocation &graphicsAllocation);
@@ -28,4 +30,19 @@ struct L1CachePolicyHelper {
static uint32_t getL1CachePolicy(bool isDebuggerActive);
};
struct L1CachePolicy {
L1CachePolicy() = default;
L1CachePolicy(const ProductHelper &helper) {
init(helper);
}
void init(const ProductHelper &helper);
uint32_t getL1CacheValue(bool isDebuggerActive) {
return isDebuggerActive ? defaultDebuggerActive : defaultDebuggerInactive;
}
protected:
uint32_t defaultDebuggerActive = 0;
uint32_t defaultDebuggerInactive = 0;
};
} // namespace NEO

View File

@@ -41,6 +41,8 @@ struct StateBaseAddressHelperArgs {
GmmHelper *gmmHelper = nullptr;
uint32_t statelessMocsIndex = 0;
uint32_t l1CachePolicy = 0;
uint32_t l1CachePolicyDebuggerActive = 0;
MemoryCompressionState memoryCompressionState;
bool setInstructionStateBaseAddress = false;

View File

@@ -8,8 +8,8 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/state_base_address_base.inl"
#include "shared/source/os_interface/hw_info_config.h"
namespace NEO {
@@ -127,8 +127,7 @@ uint32_t StateBaseAddressHelper<GfxFamily>::getMaxBindlessSurfaceStates() {
template <typename GfxFamily>
void StateBaseAddressHelper<GfxFamily>::appendExtraCacheSettings(StateBaseAddressHelperArgs<GfxFamily> &args) {
auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().template getHelper<ProductHelper>();
auto cachePolicy = productHelper.getL1CachePolicy(args.isDebuggerActive);
auto cachePolicy = args.isDebuggerActive ? args.l1CachePolicyDebuggerActive : args.l1CachePolicy;
args.stateBaseAddressCmd->setL1CachePolicyL1CacheControl(static_cast<typename STATE_BASE_ADDRESS::L1_CACHE_POLICY>(cachePolicy));
if (DebugManager.flags.ForceStatelessL1CachingPolicy.get() != -1 &&