mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
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:
committed by
Compute-Runtime-Automation
parent
57614f9cd4
commit
34064811d2
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_stream/transfer_direction.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/hw_mapper.h"
|
||||
#include "shared/source/helpers/pipe_control_args.h"
|
||||
#include "shared/source/helpers/vec.h"
|
||||
@@ -326,6 +327,8 @@ struct CommandListCoreFamily : CommandListImp {
|
||||
static constexpr bool cmdListDefaultMediaSamplerClockGate = false;
|
||||
static constexpr bool cmdListDefaultGlobalAtomics = false;
|
||||
|
||||
NEO::L1CachePolicy l1CachePolicyData{};
|
||||
|
||||
int64_t currentSurfaceStateBaseAddress = NEO::StreamProperty64::initValue;
|
||||
int64_t currentDynamicStateBaseAddress = NEO::StreamProperty64::initValue;
|
||||
int64_t currentIndirectObjectBaseAddress = NEO::StreamProperty64::initValue;
|
||||
|
||||
@@ -178,6 +178,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
|
||||
commandContainer.doubleSbaWa = this->doubleSbaWa;
|
||||
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
|
||||
this->defaultMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
this->l1CachePolicyData.init(productHelper);
|
||||
commandContainer.l1CachePolicyData = &this->l1CachePolicyData;
|
||||
|
||||
if (device->isImplicitScalingCapable() && !this->internalUsage && !isCopyOnly()) {
|
||||
this->partitionCount = static_cast<uint32_t>(this->device->getNEODevice()->getDeviceBitfield().count());
|
||||
@@ -2381,6 +2383,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
|
||||
updateStreamPropertiesForRegularCommandLists(kernel, isCooperative, threadGroupDimensions, isIndirect);
|
||||
}
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
inline bool getFusedEuDisabled(Kernel &kernel, Device *device, const ze_group_count_t *threadGroupDimensions, bool isIndirect) {
|
||||
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
|
||||
@@ -2621,18 +2624,20 @@ void CommandListCoreFamily<gfxCoreFamily>::programStateBaseAddress(NEO::CommandC
|
||||
|
||||
bool isRcs = (this->engineGroupType == NEO::EngineGroupType::RenderCompute);
|
||||
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(*commandContainer.getCommandStream(), this->device->getNEODevice()->getRootDeviceEnvironment(), isRcs, this->dcFlushSupport);
|
||||
|
||||
uint32_t statelessMocsIndex = this->defaultMocsIndex;
|
||||
NEO::StateBaseAddressProperties *sbaProperties = useSbaProperties ? &this->finalStreamState.stateBaseAddress : nullptr;
|
||||
|
||||
STATE_BASE_ADDRESS sba;
|
||||
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(*commandContainer.getCommandStream(), this->device->getNEODevice()->getRootDeviceEnvironment(), isRcs, this->dcFlushSupport);
|
||||
|
||||
NEO::EncodeStateBaseAddressArgs<GfxFamily> encodeStateBaseAddressArgs = {
|
||||
&commandContainer, // container
|
||||
sba, // sbaCmd
|
||||
sbaProperties, // sbaProperties
|
||||
statelessMocsIndex, // statelessMocsIndex
|
||||
l1CachePolicyData.getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData.getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
false, // useGlobalAtomics
|
||||
this->partitionCount > 1, // multiOsContextCapable
|
||||
isRcs, // isRcs
|
||||
|
||||
@@ -70,7 +70,6 @@ struct CommandQueueHw : public CommandQueueImp {
|
||||
inline bool isNEODebuggerActive(Device *device);
|
||||
|
||||
NEO::StreamProperties cmdListBeginState{};
|
||||
|
||||
size_t spaceForResidency = 0;
|
||||
NEO::PreemptionMode preemptionMode{};
|
||||
NEO::PreemptionMode statePreemption{};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/source/helpers/state_base_address_bdw_and_later.inl"
|
||||
@@ -28,9 +29,10 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
auto csr = this->getCsr();
|
||||
bool isRcs = csr->isRcs();
|
||||
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
|
||||
|
||||
bool isRcs = this->getCsr()->isRcs();
|
||||
bool useGlobalSshAndDsh = false;
|
||||
bool isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
|
||||
|
||||
@@ -54,8 +56,9 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
|
||||
STATE_BASE_ADDRESS sbaCmd;
|
||||
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, rootDeviceEnvironment, isRcs, this->getCsr()->getDcFlushSupport());
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, rootDeviceEnvironment, isRcs, csr->getDcFlushSupport());
|
||||
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(commandStream, {}, true, rootDeviceEnvironment, isRcs);
|
||||
auto l1CachePolicyData = csr->getStoredL1CachePolicy();
|
||||
|
||||
NEO::StateBaseAddressHelperArgs<GfxFamily> stateBaseAddressHelperArgs = {
|
||||
gsba, // generalStateBaseAddress
|
||||
@@ -70,6 +73,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
nullptr, // ssh
|
||||
neoDevice->getGmmHelper(), // gmmHelper
|
||||
(device->getMOCS(cachedMOCSAllowed, false) >> 1), // statelessMocsIndex
|
||||
l1CachePolicyData->getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData->getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
true, // setGeneralStateBaseAddress
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/command_stream/csr_definitions.h"
|
||||
#include "shared/source/command_stream/scratch_space_controller.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/pipe_control_args.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
@@ -26,9 +27,10 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
uint32_t rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
|
||||
auto csr = this->getCsr();
|
||||
bool dispatchCommand = false;
|
||||
bool multiOsContextCapable = device->isImplicitScalingCapable();
|
||||
bool isRcs = this->getCsr()->isRcs();
|
||||
bool isRcs = csr->isRcs();
|
||||
auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
|
||||
bool setGeneralStateBaseAddress = false;
|
||||
bool useGlobalHeapsBaseAddress = false;
|
||||
@@ -40,6 +42,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
|
||||
NEO::StateBaseAddressProperties *sbaProperties = nullptr;
|
||||
|
||||
auto l1CachePolicyData = csr->getStoredL1CachePolicy();
|
||||
|
||||
if (streamProperties != nullptr) {
|
||||
dispatchCommand = true;
|
||||
sbaProperties = &streamProperties->stateBaseAddress;
|
||||
@@ -56,7 +60,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
|
||||
if (dispatchCommand) {
|
||||
auto gmmHelper = neoDevice->getGmmHelper();
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, neoDevice->getRootDeviceEnvironment(), isRcs, this->getCsr()->getDcFlushSupport());
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, neoDevice->getRootDeviceEnvironment(), isRcs, csr->getDcFlushSupport());
|
||||
|
||||
STATE_BASE_ADDRESS sbaCmd;
|
||||
NEO::StateBaseAddressHelperArgs<GfxFamily> stateBaseAddressHelperArgs = {
|
||||
@@ -72,6 +76,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
nullptr, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
(device->getMOCS(cachedMOCSAllowed, false) >> 1), // statelessMocsIndex
|
||||
l1CachePolicyData->getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData->getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
setGeneralStateBaseAddress, // setGeneralStateBaseAddress
|
||||
|
||||
@@ -25,6 +25,8 @@ class IndirectHeap;
|
||||
class LinearStream;
|
||||
class ReservedIndirectHeap;
|
||||
|
||||
struct L1CachePolicy;
|
||||
|
||||
using ResidencyContainer = std::vector<GraphicsAllocation *>;
|
||||
using CmdBufferContainer = std::vector<GraphicsAllocation *>;
|
||||
using HeapContainer = std::vector<GraphicsAllocation *>;
|
||||
@@ -162,6 +164,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
uint64_t currentLinearStreamStartOffset = 0u;
|
||||
uint32_t slmSize = std::numeric_limits<uint32_t>::max();
|
||||
uint32_t nextIddInBlock = 0;
|
||||
L1CachePolicy *l1CachePolicyData = nullptr;
|
||||
bool lastPipelineSelectModeRequired = false;
|
||||
bool lastSentUseGlobalAtomics = false;
|
||||
bool systolicModeSupport = false;
|
||||
|
||||
@@ -314,6 +314,8 @@ struct EncodeStateBaseAddressArgs {
|
||||
StateBaseAddressProperties *sbaProperties = nullptr;
|
||||
|
||||
uint32_t statelessMocsIndex = 0;
|
||||
uint32_t l1CachePolicy = 0;
|
||||
uint32_t l1CachePolicyDebuggerActive = 0;
|
||||
|
||||
bool useGlobalAtomics = false;
|
||||
bool multiOsContextCapable = false;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/pause_on_gpu_properties.h"
|
||||
#include "shared/source/helpers/pipe_control_args.h"
|
||||
@@ -206,12 +207,15 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
auto gmmHelper = container.getDevice()->getGmmHelper();
|
||||
uint32_t statelessMocsIndex =
|
||||
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
|
||||
auto l1CachePolicy = container.l1CachePolicyData->getL1CacheValue(false);
|
||||
auto l1CachePolicyDebuggerActive = container.l1CachePolicyData->getL1CacheValue(true);
|
||||
EncodeStateBaseAddressArgs<Family> encodeStateBaseAddressArgs = {
|
||||
&container, // container
|
||||
sba, // sbaCmd
|
||||
nullptr, // sbaProperties
|
||||
statelessMocsIndex, // statelessMocsIndex
|
||||
l1CachePolicy, // l1CachePolicy
|
||||
l1CachePolicyDebuggerActive, // l1CachePolicyDebuggerActive
|
||||
false, // useGlobalAtomics
|
||||
false, // multiOsContextCapable
|
||||
args.isRcs, // isRcs
|
||||
@@ -445,6 +449,8 @@ void EncodeStateBaseAddress<Family>::encode(EncodeStateBaseAddressArgs<Family> &
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
args.statelessMocsIndex, // statelessMocsIndex
|
||||
args.l1CachePolicy, // l1CachePolicy
|
||||
args.l1CachePolicyDebuggerActive, // l1CachePolicyDebuggerActive
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
false, // setInstructionStateBaseAddress
|
||||
false, // setGeneralStateBaseAddress
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_walk_order.h"
|
||||
@@ -230,12 +231,16 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
auto gmmHelper = container.getDevice()->getGmmHelper();
|
||||
uint32_t statelessMocsIndex =
|
||||
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
auto l1CachePolicy = container.l1CachePolicyData->getL1CacheValue(false);
|
||||
auto l1CachePolicyDebuggerActive = container.l1CachePolicyData->getL1CacheValue(true);
|
||||
|
||||
EncodeStateBaseAddressArgs<Family> encodeStateBaseAddressArgs = {
|
||||
&container, // container
|
||||
sbaCmd, // sbaCmd
|
||||
nullptr, // sbaProperties
|
||||
statelessMocsIndex, // statelessMocsIndex
|
||||
l1CachePolicy, // l1CachePolicy
|
||||
l1CachePolicyDebuggerActive, // l1CachePolicyDebuggerActive
|
||||
args.useGlobalAtomics, // useGlobalAtomics
|
||||
args.partitionCount > 1, // multiOsContextCapable
|
||||
args.isRcs, // isRcs
|
||||
@@ -543,6 +548,8 @@ void EncodeStateBaseAddress<Family>::encode(EncodeStateBaseAddressArgs<Family> &
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
args.statelessMocsIndex, // statelessMocsIndex
|
||||
args.l1CachePolicy, // l1CachePolicy
|
||||
args.l1CachePolicyDebuggerActive, // l1CachePolicyDebuggerActive
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
true, // setGeneralStateBaseAddress
|
||||
|
||||
@@ -94,6 +94,7 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi
|
||||
productHelper.fillPipelineSelectPropertiesSupportStructure(pipelineSupportFlags, hwInfo);
|
||||
productHelper.fillStateBaseAddressPropertiesSupportStructure(sbaSupportFlags);
|
||||
this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo);
|
||||
this->l1CachePolicyData.init(productHelper);
|
||||
}
|
||||
|
||||
CommandStreamReceiver::~CommandStreamReceiver() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/helpers/blit_properties_container.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/completion_stamp.h"
|
||||
#include "shared/source/helpers/options.h"
|
||||
#include "shared/source/utilities/spinlock.h"
|
||||
@@ -395,6 +396,10 @@ class CommandStreamReceiver {
|
||||
bool isTbxMode() const;
|
||||
bool ensureTagAllocationForRootDeviceIndex(uint32_t rootDeviceIndex);
|
||||
|
||||
L1CachePolicy *getStoredL1CachePolicy() {
|
||||
return &l1CachePolicyData;
|
||||
}
|
||||
|
||||
protected:
|
||||
void cleanupResources();
|
||||
void printDeviceIndex();
|
||||
@@ -428,6 +433,7 @@ class CommandStreamReceiver {
|
||||
FrontEndPropertiesSupport feSupportFlags{};
|
||||
PipelineSelectPropertiesSupport pipelineSupportFlags{};
|
||||
StateBaseAddressPropertiesSupport sbaSupportFlags{};
|
||||
L1CachePolicy l1CachePolicyData{};
|
||||
|
||||
uint64_t totalMemoryUsed = 0u;
|
||||
|
||||
|
||||
@@ -519,6 +519,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
ssh, // ssh
|
||||
device.getGmmHelper(), // gmmHelper
|
||||
this->latestSentStatelessMocsConfig, // statelessMocsIndex
|
||||
l1CachePolicyData.getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData.getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
this->lastMemoryCompressionState, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
true, // setGeneralStateBaseAddress
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -2920,3 +2920,10 @@ INSTANTIATE_TEST_CASE_P(MultiGpuGlobalAtomics,
|
||||
::testing::Bool(),
|
||||
::testing::Bool(),
|
||||
::testing::Bool()));
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, givenL1CachePolicyInitializedInCsrWhenGettingPolicySettingsThenExpectValueMatchProductHelper) {
|
||||
auto &productHelper = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->getHelper<ProductHelper>();
|
||||
auto l1CachePolicy = commandStreamReceiver->getStoredL1CachePolicy();
|
||||
EXPECT_EQ(productHelper.getL1CachePolicy(true), l1CachePolicy->getL1CacheValue(true));
|
||||
EXPECT_EQ(productHelper.getL1CachePolicy(false), l1CachePolicy->getL1CacheValue(false));
|
||||
}
|
||||
|
||||
@@ -507,6 +507,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(-1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
|
||||
@@ -538,6 +540,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(0);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
@@ -565,6 +568,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
@@ -1259,7 +1263,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, InterfaceDescriptorDataTests, givenVariousValuesWhen
|
||||
EXPECT_TRUE(idd.getBarrierEnable());
|
||||
}
|
||||
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
using BindlessCommandEncodeStatesTest = Test<BindlessCommandEncodeStatesFixture>;
|
||||
using BindlessCommandEncodeStatesContainerTest = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindlessModeEnabledWhenEncodingKernelThenCmdContainerHasNullptrSSH) {
|
||||
@@ -1271,6 +1275,8 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindles
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
pDevice->getNumGenericSubDevices() > 1,
|
||||
pDevice->getRootDeviceIndex(),
|
||||
@@ -1307,6 +1313,7 @@ HWTEST2_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindle
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
pDevice->getNumGenericSubDevices() > 1,
|
||||
pDevice->getRootDeviceIndex(),
|
||||
@@ -1346,6 +1353,7 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindfulKernelWhenBindles
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
pDevice->getNumGenericSubDevices() > 1,
|
||||
pDevice->getRootDeviceIndex(),
|
||||
@@ -1382,6 +1390,7 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessModeEnabledWhenD
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
pDevice->getNumGenericSubDevices() > 1,
|
||||
pDevice->getRootDeviceIndex(),
|
||||
@@ -1421,7 +1430,6 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
@@ -1473,7 +1481,6 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, givenBindlessModeDisabledelWithSamplerThenGlobalDshIsNotResidnecyContainer) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(0);
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
@@ -439,6 +439,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(-1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
@@ -472,6 +473,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(0);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
@@ -496,6 +498,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
|
||||
|
||||
@@ -69,7 +69,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenDebugVariableSetWhenCopyingSamplerStateT
|
||||
auto pSamplerState = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getCpuBase(), samplerStateOffset));
|
||||
EXPECT_EQ(pSamplerState->getLowQualityFilter(), SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE);
|
||||
}
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
using BindlessCommandEncodeStatesTest = Test<BindlessCommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithoutAlphaThenBorderColorPtrReturned) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
|
||||
@@ -21,6 +21,8 @@ void CommandEncodeStatesFixture::setUp() {
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
cmdContainer->systolicModeSupport = productHelper.isSystolicModeConfigurable(hwInfo);
|
||||
cmdContainer->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo);
|
||||
this->l1CachePolicyData.init(productHelper);
|
||||
cmdContainer->l1CachePolicyData = &this->l1CachePolicyData;
|
||||
}
|
||||
|
||||
void CommandEncodeStatesFixture::tearDown() {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
@@ -40,11 +41,14 @@ class CommandEncodeStatesFixture : public DeviceFixture {
|
||||
CommandContainer *container,
|
||||
typename FamilyType::STATE_BASE_ADDRESS &sbaCmd,
|
||||
uint32_t statelessMocs) {
|
||||
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = {
|
||||
container, // container
|
||||
sbaCmd, // sbaCmd
|
||||
nullptr, // sbaProperties
|
||||
statelessMocs, // statelessMocsIndex
|
||||
l1CachePolicyData.getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData.getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
false, // useGlobalAtomics
|
||||
false, // multiOsContextCapable
|
||||
false, // isRcs
|
||||
@@ -55,6 +59,7 @@ class CommandEncodeStatesFixture : public DeviceFixture {
|
||||
KernelDescriptor descriptor;
|
||||
KernelInfo kernelInfo;
|
||||
std::unique_ptr<MyMockCommandContainer> cmdContainer;
|
||||
NEO::L1CachePolicy l1CachePolicyData;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/test/unit_test/fixtures/front_window_fixture.h"
|
||||
|
||||
#include "shared/source/command_container/cmdcontainer.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/memory_manager/gfx_partition.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
@@ -24,6 +25,25 @@ void MemManagerFixture::setUp() {
|
||||
DeviceFixture::setUp();
|
||||
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*pDevice->getExecutionEnvironment()));
|
||||
}
|
||||
|
||||
void MemManagerFixture::tearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
|
||||
BindlessCommandEncodeStatesFixture::~BindlessCommandEncodeStatesFixture() {
|
||||
}
|
||||
|
||||
void BindlessCommandEncodeStatesFixture::setUp() {
|
||||
MemManagerFixture::setUp();
|
||||
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
this->l1CachePolicyData.init(productHelper);
|
||||
|
||||
cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
}
|
||||
|
||||
void BindlessCommandEncodeStatesFixture::tearDown() {
|
||||
cmdContainer.reset(nullptr);
|
||||
MemManagerFixture::tearDown();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,11 +7,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class CommandContainer;
|
||||
|
||||
class MemManagerFixture : public DeviceFixture {
|
||||
public:
|
||||
struct FrontWindowMemManagerMock : public MockMemoryManager {
|
||||
@@ -24,4 +27,15 @@ class MemManagerFixture : public DeviceFixture {
|
||||
|
||||
std::unique_ptr<FrontWindowMemManagerMock> memManager;
|
||||
};
|
||||
|
||||
struct BindlessCommandEncodeStatesFixture : public MemManagerFixture {
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
~BindlessCommandEncodeStatesFixture();
|
||||
|
||||
NEO::L1CachePolicy l1CachePolicyData;
|
||||
std::unique_ptr<CommandContainer> cmdContainer;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@@ -71,3 +72,9 @@ HWTEST2_F(ProductHelperTest, givenL1CachePolicyHelperWhenDebugFlagSetAndGetL1Cac
|
||||
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(false), 4u);
|
||||
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(true), 4u);
|
||||
}
|
||||
|
||||
HWTEST_F(ProductHelperTest, givenL1CachePolicyInitializedWhenGettingPolicySettingsThenExpectValueMatchProductHelper) {
|
||||
L1CachePolicy policy(*productHelper);
|
||||
EXPECT_EQ(productHelper->getL1CachePolicy(true), policy.getL1CacheValue(true));
|
||||
EXPECT_EQ(productHelper->getL1CachePolicy(false), policy.getL1CacheValue(false));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ HWTEST2_F(SbaTest,
|
||||
EXPECT_EQ(surfaceStateBaseAddress, cmd.getSurfaceStateBaseAddress());
|
||||
}
|
||||
|
||||
using SbaForBindlessTests = Test<DeviceFixture>;
|
||||
using SbaForBindlessTests = SbaTest;
|
||||
|
||||
HWTEST2_F(SbaForBindlessTests, givenGlobalBindlessBaseAddressWhenProgramStateBaseAddressThenSbaProgrammedCorrectly, IsAtLeastSkl) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
@@ -261,47 +261,67 @@ HWTEST2_F(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSetti
|
||||
auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress;
|
||||
|
||||
StateBaseAddressHelperArgs<FamilyType> args = createSbaHelperArgs<FamilyType>(&stateBaseAddress, pDevice->getGmmHelper(), &ssh, nullptr, nullptr);
|
||||
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
{
|
||||
DebugManagerStateRestore restore;
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(3);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(4);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
args.isDebuggerActive = true;
|
||||
{
|
||||
DebugManagerStateRestore restore;
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(3);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(4);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
@@ -322,14 +342,20 @@ HWTEST2_F(SbaTest, givenDebugFlagSetWhenAppendingSbaThenProgramCorrectL1CachePol
|
||||
StateBaseAddressHelperArgs<FamilyType> args = createSbaHelperArgs<FamilyType>(&sbaCmd, pDevice->getRootDeviceEnvironment().getGmmHelper(), &ssh, nullptr, nullptr);
|
||||
args.setGeneralStateBaseAddress = true;
|
||||
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
|
||||
for (const auto &input : testInputs) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(input.option);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(input.cachePolicy, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/memory_compression_state.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
@@ -16,6 +17,52 @@
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
struct SbaFixture : public NEO::DeviceFixture {
|
||||
void setUp() {
|
||||
NEO::DeviceFixture::setUp();
|
||||
size_t sizeStream = 512;
|
||||
size_t alignmentStream = 0x1000;
|
||||
|
||||
sshBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, sshBuffer);
|
||||
ssh.replaceBuffer(sshBuffer, sizeStream);
|
||||
auto graphicsAllocation = new MockGraphicsAllocation(sshBuffer, sizeStream);
|
||||
ssh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
dshBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, dshBuffer);
|
||||
dsh.replaceBuffer(dshBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(dshBuffer, sizeStream);
|
||||
dsh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
iohBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, iohBuffer);
|
||||
ioh.replaceBuffer(iohBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(iohBuffer, sizeStream);
|
||||
ioh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
linearStreamBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
commandStream.replaceBuffer(linearStreamBuffer, alignmentStream);
|
||||
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
l1CachePolicyData.init(productHelper);
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
alignedFree(linearStreamBuffer);
|
||||
|
||||
delete ssh.getGraphicsAllocation();
|
||||
alignedFree(sshBuffer);
|
||||
|
||||
delete dsh.getGraphicsAllocation();
|
||||
alignedFree(dshBuffer);
|
||||
|
||||
delete ioh.getGraphicsAllocation();
|
||||
alignedFree(iohBuffer);
|
||||
|
||||
NEO::DeviceFixture::tearDown();
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
StateBaseAddressHelperArgs<FamilyType> createSbaHelperArgs(typename FamilyType::STATE_BASE_ADDRESS *sbaCommand, GmmHelper *gmmHelper, IndirectHeap *ssh, IndirectHeap *dsh, IndirectHeap *ioh, StateBaseAddressProperties *sbaProperties) {
|
||||
StateBaseAddressHelperArgs<FamilyType> sbaArgs = {
|
||||
@@ -31,6 +78,8 @@ StateBaseAddressHelperArgs<FamilyType> createSbaHelperArgs(typename FamilyType::
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
0, // statelessMocsIndex
|
||||
l1CachePolicyData.getL1CacheValue(false), // l1CachePolicy
|
||||
l1CachePolicyData.getL1CacheValue(true), // l1CachePolicyDebuggerActive
|
||||
MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
false, // setInstructionStateBaseAddress
|
||||
false, // setGeneralStateBaseAddress
|
||||
@@ -59,54 +108,20 @@ StateBaseAddressHelperArgs<FamilyType> createSbaHelperArgs(typename FamilyType::
|
||||
return createSbaHelperArgs<FamilyType>(sbaCommand, gmmHelper, nullptr, nullptr, nullptr, sbaProperties);
|
||||
}
|
||||
|
||||
struct SbaFixture : public NEO::DeviceFixture {
|
||||
void setUp() {
|
||||
NEO::DeviceFixture::setUp();
|
||||
size_t sizeStream = 512;
|
||||
size_t alignmentStream = 0x1000;
|
||||
|
||||
sshBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, sshBuffer);
|
||||
ssh.replaceBuffer(sshBuffer, sizeStream);
|
||||
auto graphicsAllocation = new MockGraphicsAllocation(sshBuffer, sizeStream);
|
||||
ssh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
dshBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, dshBuffer);
|
||||
dsh.replaceBuffer(dshBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(dshBuffer, sizeStream);
|
||||
dsh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
iohBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
ASSERT_NE(nullptr, iohBuffer);
|
||||
ioh.replaceBuffer(iohBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(iohBuffer, sizeStream);
|
||||
ioh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
linearStreamBuffer = alignedMalloc(sizeStream, alignmentStream);
|
||||
commandStream.replaceBuffer(linearStreamBuffer, alignmentStream);
|
||||
template <typename FamilyType>
|
||||
void updateSbaHelperArgsL1CachePolicy(StateBaseAddressHelperArgs<FamilyType> &args, ProductHelper &productHelper) {
|
||||
l1CachePolicyData.init(productHelper);
|
||||
args.l1CachePolicy = l1CachePolicyData.getL1CacheValue(false);
|
||||
args.l1CachePolicyDebuggerActive = l1CachePolicyData.getL1CacheValue(true);
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
alignedFree(linearStreamBuffer);
|
||||
|
||||
delete ssh.getGraphicsAllocation();
|
||||
alignedFree(sshBuffer);
|
||||
|
||||
delete dsh.getGraphicsAllocation();
|
||||
alignedFree(dshBuffer);
|
||||
|
||||
delete ioh.getGraphicsAllocation();
|
||||
alignedFree(iohBuffer);
|
||||
|
||||
NEO::DeviceFixture::tearDown();
|
||||
}
|
||||
IndirectHeap ssh = {nullptr};
|
||||
IndirectHeap dsh = {nullptr};
|
||||
IndirectHeap ioh = {nullptr};
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
LinearStream commandStream;
|
||||
L1CachePolicy l1CachePolicyData;
|
||||
|
||||
void *sshBuffer = nullptr;
|
||||
void *dshBuffer = nullptr;
|
||||
|
||||
@@ -694,18 +694,23 @@ XE_HPC_CORETEST_F(XeHpcSbaTest, givenL1CachingOverrideWhenStateBaseAddressIsProg
|
||||
auto sbaCmd = FamilyType::cmdInitStateBaseAddress;
|
||||
StateBaseAddressHelperArgs<FamilyType> args = createSbaHelperArgs<FamilyType>(&sbaCmd, pDevice->getRootDeviceEnvironment().getGmmHelper(), &ssh, nullptr, nullptr);
|
||||
args.setGeneralStateBaseAddress = true;
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
|
||||
@@ -101,18 +101,22 @@ DG2TEST_F(Dg2SbaTest, givenL1CachingOverrideWhenStateBaseAddressIsProgrammedThen
|
||||
auto sbaCmd = FamilyType::cmdInitStateBaseAddress;
|
||||
StateBaseAddressHelperArgs<FamilyType> args = createSbaHelperArgs<FamilyType>(&sbaCmd, pDevice->getRootDeviceEnvironment().getGmmHelper(), &ssh, nullptr, nullptr);
|
||||
args.setGeneralStateBaseAddress = true;
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
|
||||
@@ -115,17 +115,22 @@ XE_HPG_CORETEST_F(XeHpgSbaTest, givenL1CachingOverrideWhenStateBaseAddressIsProg
|
||||
StateBaseAddressHelperArgs<FamilyType> args = createSbaHelperArgs<FamilyType>(&sbaCmd, pDevice->getRootDeviceEnvironment().getGmmHelper(), &ssh, nullptr, nullptr);
|
||||
args.setGeneralStateBaseAddress = true;
|
||||
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
updateSbaHelperArgsL1CachePolicy<FamilyType>(args, productHelper);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user