Move SCM related WAs logic from CSR to EncodeComputeMode

This will help with unifying the logic between APIs and GENs.

Related-To: NEO-6728

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2022-03-09 17:15:48 +00:00
committed by Compute-Runtime-Automation
parent 7d6bee26c7
commit 3eab7009ac
37 changed files with 325 additions and 293 deletions

View File

@@ -148,13 +148,14 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPoli
auto policyNotChangedFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.isDirty = true;
commandStreamReceiver.streamProperties.stateComputeMode.isCoherencyRequired.isDirty = true;
auto policyChangedPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
auto policyChangedFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
auto actualDifferenceForPreamble = policyChangedPreamble - policyNotChangedPreamble;
auto actualDifferenceForFlush = policyChangedFlush - policyNotChangedFlush;
auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize() +
commandStreamReceiver.getCmdSizeForComputeMode();
EncodeComputeMode<FamilyType>::getCmdSizeForComputeMode(*defaultHwInfo, false, commandStreamReceiver.isRcs());
EXPECT_EQ(0u, actualDifferenceForPreamble);
EXPECT_EQ(expectedDifference, actualDifferenceForFlush);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,19 +46,19 @@ struct Gen11CoherencyRequirements : public ::testing::Test {
GEN11TEST_F(Gen11CoherencyRequirements, GivenSettingsWhenCoherencyRequestedThenProgrammingIsCorrect) {
auto lriSize = sizeof(MI_LOAD_REGISTER_IMM);
overrideCoherencyRequest(false, false);
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(false, true);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(true, true);
retSize = csr->getCmdSizeForComputeMode();
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(lriSize, retSize);
overrideCoherencyRequest(true, false);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(lriSize, retSize);
}

View File

@@ -72,19 +72,19 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesWhenGettingCmdSi
}
overrideCoherencyRequest(false, false, false);
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(false, true, false);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(true, true, false);
retSize = csr->getCmdSizeForComputeMode();
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(cmdsSize, retSize);
overrideCoherencyRequest(true, false, false);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(cmdsSize, retSize);
}
@@ -99,19 +99,19 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesWhenGettingCmdSize
}
overrideCoherencyRequest(false, false, true);
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(false, true, true);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
EXPECT_FALSE(csr->isComputeModeNeeded());
overrideCoherencyRequest(true, true, true);
retSize = csr->getCmdSizeForComputeMode();
auto retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(cmdsSize, retSize);
overrideCoherencyRequest(true, false, true);
retSize = csr->getCmdSizeForComputeMode();
EXPECT_TRUE(csr->isComputeModeNeeded());
EXPECT_EQ(cmdsSize, retSize);
}

View File

@@ -1,29 +1,26 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
using namespace NEO;
typedef ::testing::Test Gen9CoherencyRequirements;
GEN9TEST_F(Gen9CoherencyRequirements, WhenMemoryManagerIsInitializedThenNoCoherencyProgramming) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->initializeMemoryManager();
CommandStreamReceiverHw<SKLFamily> csr(*executionEnvironment, 0, 1);
UltDeviceFactory deviceFactory{1, 0};
LinearStream stream;
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
auto &csr = deviceFactory.rootDevices[0]->getUltCommandStreamReceiver<FamilyType>();
auto retSize = csr.getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);