Reduce usage of global gfx core helper getter [5/n]

Related-To: NEO-6853
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2022-12-19 12:25:44 +00:00 committed by Compute-Runtime-Automation
parent f50ea2903c
commit 8cf93c23a4
17 changed files with 64 additions and 43 deletions

View File

@ -2431,17 +2431,18 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
auto &hwInfo = device->getHwInfo();
auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment();
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
if (!containsAnyKernel) {
requiredStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, true, -1, hwInfo);
requiredStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo);
if (this->stateComputeModeTracking) {
requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), hwInfo);
requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), rootDeviceEnvironment);
finalStreamState = requiredStreamState;
} else {
finalStreamState = requiredStreamState;
requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), hwInfo);
requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), rootDeviceEnvironment);
}
containsAnyKernel = true;
}
@ -2481,7 +2482,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
}
}
finalStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), hwInfo);
finalStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), rootDeviceEnvironment);
if (finalStreamState.stateComputeMode.isDirty() && logicalStateHelperBlock) {
bool isRcs = (this->engineGroupType == NEO::EngineGroupType::RenderCompute);
NEO::PipelineSelectArgs pipelineSelectArgs;

View File

@ -890,7 +890,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnoughMemoryOnlyForPreambleWh
csrCS.getSpace(csrCS.getAvailableSpace() - sizeNeededForPreamble);
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(flushTaskFlags.requiresCoherency, flushTaskFlags.numGrfRequired,
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, pDevice->getRootDeviceEnvironment());
flushTask(commandStreamReceiver);
EXPECT_EQ(sizeNeeded, csrCS.getUsed());
@ -924,7 +924,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnoughMemoryOnlyForPreambleAn
csrCS.getSpace(csrCS.getAvailableSpace() - sizeNeededForPreamble - sizeNeededForStateBaseAddress);
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(flushTaskFlags.requiresCoherency, flushTaskFlags.numGrfRequired,
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, pDevice->getRootDeviceEnvironment());
flushTask(commandStreamReceiver);
EXPECT_EQ(sizeNeeded, csrCS.getUsed());
@ -962,7 +962,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnoughMemoryOnlyForPreambleAn
flushTaskFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(mockDevice->getHardwareInfo());
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(flushTaskFlags.requiresCoherency, flushTaskFlags.numGrfRequired,
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, pDevice->getRootDeviceEnvironment());
commandStreamReceiver.flushTask(
commandStream,
0,

View File

@ -1044,7 +1044,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, GivenPreambleSe
expectedUsed = alignUp(expectedUsed, MemoryConstants::cacheLineSize);
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(flushTaskFlags.requiresCoherency, flushTaskFlags.numGrfRequired,
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
flushTaskFlags.threadArbitrationPolicy, PreemptionMode::Disabled, pDevice->getRootDeviceEnvironment());
commandStreamReceiver.flushTask(commandStream, 0, &dsh, &ioh, &ssh, taskLevel, flushTaskFlags, *pDevice);
// Verify that we didn't grab a new CS buffer

View File

@ -8,36 +8,37 @@
#include "shared/source/helpers/ray_tracing_helper.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
using namespace NEO;
using MatcherIsRTCapable = IsAtLeastXeHpgCore;
struct CommandStreamReceiverHwTestDg2AndLater : public ClDeviceFixture,
struct CommandStreamReceiverHwTestDg2AndLater : public DeviceFixture,
public HardwareParse,
public ::testing::Test {
void SetUp() override {
ClDeviceFixture::setUp();
DeviceFixture::setUp();
HardwareParse::setUp();
}
void TearDown() override {
HardwareParse::tearDown();
ClDeviceFixture::tearDown();
DeviceFixture::tearDown();
}
};
HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenGen12AndLaterWhenRayTracingEnabledThenCommandIsAddedToBatchBuffer, MatcherIsRTCapable) {
using _3DSTATE_BTD = typename FamilyType::_3DSTATE_BTD;
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto osContext = pDevice->getDefaultEngine().osContext;
commandStreamReceiver.setupContext(*osContext);
auto cmdSize = commandStreamReceiver.getCmdSizeForPerDssBackedBuffer(pDevice->getHardwareInfo());
@ -97,7 +98,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskDg2AndLaterTests, givenProgramExtendedPi
dispatchFlags.threadArbitrationPolicy = gfxCoreHelper.getDefaultThreadArbitrationPolicy();
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(dispatchFlags.requiresCoherency, dispatchFlags.numGrfRequired,
dispatchFlags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
dispatchFlags.threadArbitrationPolicy, PreemptionMode::Disabled, pDevice->getRootDeviceEnvironment());
auto cmdSizeForAllCommands = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice);
commandStreamReceiver.flushTask(commandStream,
0,
@ -145,6 +146,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskDg2AndLaterTests, givenProgramExtendedPi
HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenGen12AndLaterWhenRayTracingEnabledButAlreadySentThenCommandIsNotAddedToBatchBuffer, MatcherIsRTCapable) {
using _3DSTATE_BTD = typename FamilyType::_3DSTATE_BTD;
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto osContext = pDevice->getDefaultEngine().osContext;
commandStreamReceiver.setupContext(*osContext);
auto cmdSize = commandStreamReceiver.getCmdSizeForPerDssBackedBuffer(pDevice->getHardwareInfo());
@ -166,6 +168,7 @@ HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenGen12AndLaterWhenRayTraci
HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenNotXE_HP_COREWhenCheckingNewResourceImplicitFlushThenReturnFalse, IsAtLeastXeHpgCore) {
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto osContext = pDevice->getDefaultEngine().osContext;
commandStreamReceiver.setupContext(*osContext);
EXPECT_FALSE(commandStreamReceiver.checkPlatformSupportsNewResourceImplicitFlush());
@ -173,6 +176,7 @@ HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenNotXE_HP_COREWhenChecking
HWTEST2_F(CommandStreamReceiverHwTestDg2AndLater, givenNotXE_HP_COREWhenCheckingNewResourceGpuIdleThenReturnFalse, IsAtLeastXeHpgCore) {
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto osContext = pDevice->getDefaultEngine().osContext;
commandStreamReceiver.setupContext(*osContext);
EXPECT_FALSE(commandStreamReceiver.checkPlatformSupportsGpuIdleImplicitFlush());

View File

@ -153,7 +153,7 @@ struct UltCommandStreamReceiverTest
commandStreamReceiver.lastSentUseGlobalAtomics = false;
commandStreamReceiver.streamProperties.pipelineSelect.setProperties(true, false, false, *defaultHwInfo);
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(0, GrfConfig::DefaultGrfNumber,
gfxCoreHelper.getDefaultThreadArbitrationPolicy(), pDevice->getPreemptionMode(), *defaultHwInfo);
gfxCoreHelper.getDefaultThreadArbitrationPolicy(), pDevice->getPreemptionMode(), pDevice->getRootDeviceEnvironment());
commandStreamReceiver.streamProperties.frontEndState.setProperties(false, false, false, -1, *defaultHwInfo);
auto logicalStateHelper = commandStreamReceiver.getLogicalStateHelper();

View File

@ -357,7 +357,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
auto requiresCoherency = gfxCoreHelper.forceNonGpuCoherencyWA(dispatchFlags.requiresCoherency);
this->streamProperties.stateComputeMode.setProperties(requiresCoherency, dispatchFlags.numGrfRequired,
dispatchFlags.threadArbitrationPolicy, device.getPreemptionMode(), hwInfo);
dispatchFlags.threadArbitrationPolicy, device.getPreemptionMode(), peekRootDeviceEnvironment());
csrSizeRequestFlags.l3ConfigChanged = this->lastSentL3Config != newL3Config;
csrSizeRequestFlags.preemptionRequestChanged = this->lastPreemptionMode != dispatchFlags.preemptionMode;

View File

@ -10,6 +10,7 @@
#include "shared/source/helpers/hw_info.h"
namespace NEO {
struct RootDeviceEnvironment;
struct StateComputeModePropertiesSupport {
bool coherencyRequired = false;
@ -28,7 +29,7 @@ struct StateComputeModeProperties {
StreamProperty threadArbitrationPolicy{};
StreamProperty devicePreemptionMode{};
void setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy, PreemptionMode devicePreemptionMode, const HardwareInfo &hwInfo);
void setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy, PreemptionMode devicePreemptionMode, const RootDeviceEnvironment &rootDeviceEnvironment);
void setProperties(const StateComputeModeProperties &properties);
bool isDirty() const;

View File

@ -9,6 +9,7 @@
#include "shared/source/command_stream/thread_arbitration_policy.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/kernel/grf_config.h"
#include "shared/source/os_interface/hw_info_config.h"
@ -16,15 +17,15 @@
using namespace NEO;
void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy, PreemptionMode devicePreemptionMode,
const HardwareInfo &hwInfo) {
const RootDeviceEnvironment &rootDeviceEnvironment) {
if (this->propertiesSupportLoaded == false) {
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
productHelper.fillScmPropertiesSupportStructure(this->scmPropertiesSupport);
this->propertiesSupportLoaded = true;
}
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
clearIsDirty();
if (this->scmPropertiesSupport.coherencyRequired) {

View File

@ -14,6 +14,7 @@
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
@ -64,8 +65,10 @@ TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectVal
StreamProperties properties;
FrontEndPropertiesSupport frontEndPropertiesSupport = {};
auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily);
productHelper->fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport, *defaultHwInfo);
MockExecutionEnvironment executionEnvironment{};
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
productHelper.fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport, *defaultHwInfo);
for (auto isEngineInstanced : ::testing::Bool()) {
for (auto isCooperativeKernel : ::testing::Bool()) {
@ -104,8 +107,10 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
DebugManager.flags.ForceThreadArbitrationPolicyProgrammingWithScm.set(1);
StateComputeModePropertiesSupport scmPropertiesSupport = {};
auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily);
productHelper->fillScmPropertiesSupportStructure(scmPropertiesSupport);
MockExecutionEnvironment executionEnvironment{};
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
productHelper.fillScmPropertiesSupportStructure(scmPropertiesSupport);
int32_t threadArbitrationPolicyValues[] = {
ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin,
@ -118,7 +123,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
for (auto requiresCoherency : ::testing::Bool()) {
for (auto largeGrf : ::testing::Bool()) {
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
properties.stateComputeMode.setProperties(requiresCoherency, largeGrf ? 256 : 128, threadArbitrationPolicy, preemptionMode, *defaultHwInfo);
properties.stateComputeMode.setProperties(requiresCoherency, largeGrf ? 256 : 128, threadArbitrationPolicy, preemptionMode, rootDeviceEnvironment);
EXPECT_EQ(largeGrf, properties.stateComputeMode.largeGrfMode.value);
if (scmPropertiesSupport.coherencyRequired) {
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
@ -141,7 +146,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
for (auto forceZPassAsyncComputeThreadLimit : ::testing::Bool()) {
DebugManager.flags.ForceZPassAsyncComputeThreadLimit.set(forceZPassAsyncComputeThreadLimit);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, rootDeviceEnvironment);
if (scmPropertiesSupport.zPassAsyncComputeThreadLimit) {
EXPECT_EQ(forceZPassAsyncComputeThreadLimit, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
} else {
@ -151,7 +156,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
for (auto forcePixelAsyncComputeThreadLimit : ::testing::Bool()) {
DebugManager.flags.ForcePixelAsyncComputeThreadLimit.set(forcePixelAsyncComputeThreadLimit);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, rootDeviceEnvironment);
if (scmPropertiesSupport.pixelAsyncComputeThreadLimit) {
EXPECT_EQ(forcePixelAsyncComputeThreadLimit, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
} else {
@ -161,7 +166,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
DebugManager.flags.OverrideThreadArbitrationPolicy.set(threadArbitrationPolicy);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, rootDeviceEnvironment);
if (scmPropertiesSupport.threadArbitrationPolicy) {
EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value);
} else {

View File

@ -10,6 +10,7 @@
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
@ -79,9 +80,11 @@ HWTEST2_F(CommandEncodeStatesTestPvcAndLater, givenVariousValuesWhenCallingSetBa
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTestPvcAndLater, givenCommandContainerWhenNumGrfRequiredIsGreaterThanDefaultThenLargeGrfModeEnabled) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily);
MockExecutionEnvironment executionEnvironment{};
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
StreamProperties streamProperties{};
streamProperties.stateComputeMode.setProperties(false, GrfConfig::LargeGrfNumber, 0u, PreemptionMode::Disabled, *defaultHwInfo);
streamProperties.stateComputeMode.setProperties(false, GrfConfig::LargeGrfNumber, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*cmdContainer->getCommandStream(), streamProperties.stateComputeMode, *defaultHwInfo, nullptr);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());

View File

@ -516,11 +516,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenDispatchInterfaceWhen
DebugManager.flags.ForceGrfNumProgrammingWithScm.set(1);
StreamProperties streamProperties{};
streamProperties.stateComputeMode.setProperties(false, 128, 0u, PreemptionMode::Disabled, *defaultHwInfo);
streamProperties.stateComputeMode.setProperties(false, 128, 0u, PreemptionMode::Disabled, *defaultHwInfo);
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
streamProperties.stateComputeMode.setProperties(false, 128, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
streamProperties.stateComputeMode.setProperties(false, 128, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
EXPECT_FALSE(streamProperties.stateComputeMode.isDirty());
streamProperties.stateComputeMode.setProperties(false, 256, 0u, PreemptionMode::Disabled, *defaultHwInfo);
streamProperties.stateComputeMode.setProperties(false, 256, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
EXPECT_TRUE(streamProperties.stateComputeMode.isDirty());
}

View File

@ -21,7 +21,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenCommandContainerWhenN
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
StreamProperties streamProperties{};
streamProperties.stateComputeMode.setProperties(false, GrfConfig::DefaultGrfNumber, 0u, PreemptionMode::Disabled, *defaultHwInfo);
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
streamProperties.stateComputeMode.setProperties(false, GrfConfig::DefaultGrfNumber, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*cmdContainer->getCommandStream(), streamProperties.stateComputeMode, *defaultHwInfo, nullptr);
GenCmdList commands;
@ -56,8 +57,9 @@ HWTEST2_F(CommandEncodeStatesTest, givenLargeGrfModeProgrammedThenExpectedComman
auto usedSpaceBefore = cmdContainer->getCommandStream()->getUsed();
NEO::EncodeComputeMode<GfxFamily>::adjustPipelineSelect(*cmdContainer, descriptor);
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
StreamProperties streamProperties{};
streamProperties.stateComputeMode.setProperties(false, 256u, 0u, PreemptionMode::Disabled, *defaultHwInfo);
streamProperties.stateComputeMode.setProperties(false, 256u, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
NEO::EncodeComputeMode<GfxFamily>::programComputeModeCommand(*cmdContainer->getCommandStream(), streamProperties.stateComputeMode, *defaultHwInfo, nullptr);
auto usedSpaceAfter = cmdContainer->getCommandStream()->getUsed();

View File

@ -451,7 +451,7 @@ HWTEST2_F(CommandEncodeStatesTest, whenGetCmdSizeForComputeModeThenCorrectValueI
UltDeviceFactory deviceFactory{1, 0};
auto &csr = deviceFactory.rootDevices[0]->getUltCommandStreamReceiver<FamilyType>();
csr.streamProperties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::AgeBased, PreemptionMode::Disabled, *defaultHwInfo);
csr.streamProperties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::AgeBased, PreemptionMode::Disabled, csr.peekRootDeviceEnvironment());
EXPECT_EQ(expectedScmSize, csr.getCmdSizeForComputeMode());
}

View File

@ -34,10 +34,11 @@ GEN12LPTEST_F(CommandEncoderTest, WhenAdjustComputeModeIsCalledThenStateComputeM
ASSERT_EQ(CommandContainer::ErrorCode::SUCCESS, ret);
auto usedSpaceBefore = cmdContainer.getCommandStream()->getUsed();
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
// Adjust the State Compute Mode which sets FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT
StreamProperties properties{};
properties.stateComputeMode.setProperties(false, GrfConfig::DefaultGrfNumber, 0, PreemptionMode::Disabled, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, GrfConfig::DefaultGrfNumber, 0, PreemptionMode::Disabled, rootDeviceEnvironment);
NEO::EncodeComputeMode<FamilyType>::programComputeModeCommand(*cmdContainer.getCommandStream(),
properties.stateComputeMode, *defaultHwInfo, nullptr);

View File

@ -184,7 +184,7 @@ HWTEST2_F(XeHpcComputeModeRequirements, giventhreadArbitrationPolicyWithoutShare
};
getCsrHw<FamilyType>()->streamProperties.stateComputeMode.setProperties(flags.requiresCoherency, flags.numGrfRequired,
flags.threadArbitrationPolicy, PreemptionMode::Disabled, *defaultHwInfo);
flags.threadArbitrationPolicy, PreemptionMode::Disabled, device->getRootDeviceEnvironment());
flushTask(true);
findCmd(productHelper.isThreadArbitrationPolicyReportedWithScm()); // first time

View File

@ -15,6 +15,7 @@
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
#include "shared/test/unit_test/helpers/state_base_address_tests.h"
@ -256,7 +257,8 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenAdjustComputeModeIsCalledThenC
auto &productHelper = *NEO::ProductHelper::get(defaultHwInfo->platform.eProductFamily);
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::AgeBased, PreemptionMode::Disabled, *defaultHwInfo);
MockExecutionEnvironment executionEnvironment{};
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::AgeBased, PreemptionMode::Disabled, *executionEnvironment.rootDeviceEnvironments[0]);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties.stateComputeMode, *defaultHwInfo, nullptr);
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
if (productHelper.isThreadArbitrationPolicyReportedWithScm()) {
@ -266,7 +268,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenAdjustComputeModeIsCalledThenC
}
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobin, PreemptionMode::Disabled, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobin, PreemptionMode::Disabled, *executionEnvironment.rootDeviceEnvironments[0]);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties.stateComputeMode, *defaultHwInfo, nullptr);
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
if (productHelper.isThreadArbitrationPolicyReportedWithScm()) {
@ -276,7 +278,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenAdjustComputeModeIsCalledThenC
}
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobinAfterDependency, PreemptionMode::Disabled, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobinAfterDependency, PreemptionMode::Disabled, *executionEnvironment.rootDeviceEnvironments[0]);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties.stateComputeMode, *defaultHwInfo, nullptr);
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
if (productHelper.isThreadArbitrationPolicyReportedWithScm()) {
@ -286,7 +288,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenAdjustComputeModeIsCalledThenC
}
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::NotPresent, PreemptionMode::Disabled, *defaultHwInfo);
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::NotPresent, PreemptionMode::Disabled, *executionEnvironment.rootDeviceEnvironments[0]);
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties.stateComputeMode, *defaultHwInfo, nullptr);
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT, pScm->getEuThreadSchedulingModeOverride());

View File

@ -57,13 +57,13 @@ XE_HPG_CORETEST_F(ComputeModeRequirementsXeHpgCore, GivenVariousSettingsWhenComp
{STATE_COMPUTE_MODE::Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT_MAX_56, STATE_COMPUTE_MODE::PIXEL_ASYNC_COMPUTE_THREAD_LIMIT_DISABLED},
{STATE_COMPUTE_MODE::Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT_MAX_48, STATE_COMPUTE_MODE::PIXEL_ASYNC_COMPUTE_THREAD_LIMIT_DISABLED},
};
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
for (auto testValue : testValues) {
DebugManager.flags.ForceZPassAsyncComputeThreadLimit.set(testValue.zPassThreadLimit);
DebugManager.flags.ForcePixelAsyncComputeThreadLimit.set(testValue.pixelThreadLimit);
pCsr->streamProperties.stateComputeMode = {};
pCsr->streamProperties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::Disabled, *defaultHwInfo);
pCsr->streamProperties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
LinearStream stream(buff, 1024);
pCsr->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());
@ -84,7 +84,7 @@ XE_HPG_CORETEST_F(ComputeModeRequirementsXeHpgCore, GivenVariousSettingsWhenComp
DebugManager.flags.ForcePixelAsyncComputeThreadLimit.set(-1);
pCsr->streamProperties.stateComputeMode = {};
pCsr->streamProperties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::Disabled, *defaultHwInfo);
pCsr->streamProperties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::Disabled, rootDeviceEnvironment);
LinearStream stream(buff, 1024);
pCsr->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());