refactor: don't use global ProductHelper getter 12/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-01-26 03:58:18 +00:00
committed by Compute-Runtime-Automation
parent 438ae37aef
commit b101f9f2f5
93 changed files with 405 additions and 376 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,14 +7,16 @@
#pragma once
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/hw_helper.h"
namespace NEO {
template <typename GfxFamily>
struct UltMemorySynchronizationCommands : MemorySynchronizationCommands<GfxFamily> {
static size_t getExpectedPipeControlCount(const HardwareInfo &hwInfo) {
return (MemorySynchronizationCommands<GfxFamily>::getSizeForBarrierWithPostSyncOperation(hwInfo, false) -
static size_t getExpectedPipeControlCount(const RootDeviceEnvironment &rootDeviceEnvironment) {
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
return (MemorySynchronizationCommands<GfxFamily>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) -
MemorySynchronizationCommands<GfxFamily>::getSizeForAdditonalSynchronization(hwInfo)) /
sizeof(typename GfxFamily::PIPE_CONTROL);
}

View File

@@ -420,7 +420,7 @@ HWTEST_F(DirectSubmissionTest,
EXPECT_TRUE(ret);
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo);
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment);
size_t disabledSizeEnd = directSubmission.getSizeEnd(false);
EXPECT_EQ(disabledSizeEnd, regularSizeEnd + tagUpdateSize);
@@ -502,7 +502,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSection
EXPECT_TRUE(ret);
Dispatcher::dispatchMonitorFence(directSubmission.ringCommandStream, 0ull, 0ull, directSubmission.rootDeviceEnvironment, false, false, directSubmission.dcFlushRequired);
EXPECT_NE(0x0u, directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo), directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment), directSubmission.ringCommandStream.getUsed());
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchEndingSectionThenExpectCorrectSizeUsed) {
@@ -525,7 +525,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetDispatchSizeThenExpec
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
@@ -542,7 +542,7 @@ HWTEST_F(DirectSubmissionTest,
size_t expectedSize = Dispatcher::getSizeStoreDwordCommand() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
@@ -557,7 +557,7 @@ HWTEST_F(DirectSubmissionTest,
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.workloadMode = 2;
size_t expectedSize = Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(expectedSize, actualSize);
@@ -570,7 +570,7 @@ HWTEST_F(DirectSubmissionTest,
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.disableCacheFlush = true;
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);

View File

@@ -269,7 +269,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
bool ret = directSubmission.allocateResources();
EXPECT_TRUE(ret);
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo);
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(disabledSizeDispatch, (regularSizeDispatch - tagUpdateSize));
@@ -2727,7 +2727,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenRelaxedOrderingSchedulerReq
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
MemoryConstants::cacheLineSize;
if (directSubmission.disableMonitorFence) {
expectedBaseEndSize += Dispatcher::getSizeMonitorFence(pDevice->getHardwareInfo());
expectedBaseEndSize += Dispatcher::getSizeMonitorFence(pDevice->getRootDeviceEnvironment());
}
EXPECT_EQ(expectedBaseEndSize + directSubmission.getSizeDispatchRelaxedOrderingQueueStall(), directSubmission.getSizeEnd(true));

View File

@@ -28,7 +28,7 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingPreemptionCmdThenDispa
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForMonitorFenceCmdSizeThenReturnExpectedNumberOfMiFlush) {
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EXPECT_EQ(expectedSize, BlitterDispatcher<FamilyType>::getSizeMonitorFence(pDevice->getHardwareInfo()));
EXPECT_EQ(expectedSize, BlitterDispatcher<FamilyType>::getSizeMonitorFence(pDevice->getRootDeviceEnvironment()));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDispatchMiFlushWithPostSync) {

View File

@@ -52,9 +52,9 @@ HWTEST_F(RenderDispatcherTest, givenRenderWhenAddingPreemptionCmdThenExpectPrope
}
HWTEST_F(RenderDispatcherTest, givenRenderWhenAskingForMonitorFenceCmdSizeThenReturnRequiredPipeControlCmdSize) {
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(hardwareInfo, false);
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(this->pDevice->getRootDeviceEnvironment(), false);
EXPECT_EQ(expectedSize, RenderDispatcher<FamilyType>::getSizeMonitorFence(hardwareInfo));
EXPECT_EQ(expectedSize, RenderDispatcher<FamilyType>::getSizeMonitorFence(this->pDevice->getRootDeviceEnvironment()));
}
HWTEST_F(RenderDispatcherTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPipeControlWithProperAddressAndValue) {

View File

@@ -523,7 +523,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenDisabledMonitorFenceWhenDispatchSwitchRin
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
EXPECT_NE(pipeControl, nullptr);
EXPECT_EQ(directSubmission.getSizeSwitchRingBufferSection(), Dispatcher::getSizeStartCommandBuffer() + Dispatcher::getSizeMonitorFence(device->getHardwareInfo()));
EXPECT_EQ(directSubmission.getSizeSwitchRingBufferSection(), Dispatcher::getSizeStartCommandBuffer() + Dispatcher::getSizeMonitorFence(device->getRootDeviceEnvironment()));
directSubmission.currentTagData.tagValue--;
}

View File

@@ -11,6 +11,8 @@
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/unit_test/fixtures/implicit_scaling_fixture.h"
HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests, GivenGetSizeWhenDispatchingCmdBufferThenConsumedSizeMatchEstimatedAndCmdBufferHasCorrectCmds) {
@@ -1010,14 +1012,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
false,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = false;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, false, false);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, false, false);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1063,14 +1065,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1119,14 +1121,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1153,12 +1155,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
givenPostSyncBarrierDispatchWhenApiNotRequiresSelfCleanupThenExpectPostSyncMinimalCommandBuffer) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
MockExecutionEnvironment mockExecutionEnvironment{};
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) +
sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) +
sizeof(MI_BATCH_BUFFER_START) +
sizeof(WalkerPartition::BarrierControlSection);
@@ -1166,7 +1171,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
false,
true);
EXPECT_EQ(expectedSize, estimatedSize);
@@ -1175,7 +1180,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
flushArgs.dcFlushEnable = false;
uint64_t postSyncAddress = 0xFF000A180F0;
uint64_t postSyncValue = 0xFF00FF;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, postSyncAddress, postSyncValue, false, false);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), postSyncAddress, postSyncValue, false, false);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1192,7 +1197,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
expectedSemaphores++;
}
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(this->pDevice->getRootDeviceEnvironment())) {
expectedPipeControls++;
if (semaphoreAsAdditionalSync) {
expectedSemaphores++;
@@ -1235,7 +1240,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
size_t expectedSize = sizeof(MI_STORE_DATA_IMM) +
MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) +
sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) +
sizeof(MI_BATCH_BUFFER_START) +
sizeof(WalkerPartition::BarrierControlSection) +
@@ -1246,7 +1251,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
true);
EXPECT_EQ(expectedSize, estimatedSize);
@@ -1255,7 +1260,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
flushArgs.dcFlushEnable = true;
uint64_t postSyncAddress = 0xFF000A180F0;
uint64_t postSyncValue = 0xFF00FF;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, postSyncAddress, postSyncValue, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), postSyncAddress, postSyncValue, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1274,7 +1279,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
if (semaphoreAsAdditionalSync) {
expectedSemaphores++;
}
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(this->pDevice->getRootDeviceEnvironment())) {
expectedPipeControls++;
if (semaphoreAsAdditionalSync) {
expectedSemaphores++;
@@ -1319,7 +1324,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
testHardwareInfo.featureTable.flags.ftrLocalMemory = true;
size_t expectedSize = sizeof(MI_ATOMIC) +
MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(pDevice->getRootDeviceEnvironment(), false) +
sizeof(MI_ATOMIC) + sizeof(MI_SEMAPHORE_WAIT) +
sizeof(MI_BATCH_BUFFER_START) +
sizeof(WalkerPartition::BarrierControlSection) +
@@ -1330,7 +1335,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
true);
EXPECT_EQ(expectedSize, estimatedSize);
@@ -1339,7 +1344,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
flushArgs.dcFlushEnable = true;
uint64_t postSyncAddress = 0xFF000A180F0;
uint64_t postSyncValue = 0xFF00FF;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, postSyncAddress, postSyncValue, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), postSyncAddress, postSyncValue, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1355,7 +1360,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
if (semaphoreAsAdditionalSync) {
expectedSemaphores++;
}
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(this->pDevice->getRootDeviceEnvironment())) {
expectedPipeControls++;
if (semaphoreAsAdditionalSync) {
expectedSemaphores++;
@@ -1407,14 +1412,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1464,14 +1469,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
false,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, false, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, false, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);
@@ -1523,14 +1528,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ImplicitScalingTests,
size_t estimatedSize = 0;
size_t totalBytesProgrammed = 0;
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(testHardwareInfo,
estimatedSize = ImplicitScalingDispatch<FamilyType>::getBarrierSize(this->pDevice->getRootDeviceEnvironment(),
true,
false);
EXPECT_EQ(expectedSize, estimatedSize);
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, testHardwareInfo, 0, 0, true, true);
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(commandStream, twoTile, flushArgs, this->pDevice->getRootDeviceEnvironment(), 0, 0, true, true);
totalBytesProgrammed = commandStream.getUsed();
EXPECT_EQ(expectedSize, totalBytesProgrammed);

View File

@@ -1413,15 +1413,18 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
auto expectedOffsetSectionSize = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto expectedOffsetSectionSize = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>) +
sizeof(WalkerPartition::BATCH_BUFFER_START<FamilyType>);
auto expectedCommandUsedSize = expectedOffsetSectionSize +
sizeof(BarrierControlSection);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = false;
@@ -1430,14 +1433,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);
size_t parsedOffset = 0;
size_t additionalSyncCmdSize = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(testHardwareInfo);
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment)) {
constexpr uint64_t zeroGpuAddress = 0;
constexpr uint64_t zeroImmediateValue = 0;
auto pipeControl = genCmdCast<WalkerPartition::PIPE_CONTROL<FamilyType> *>(ptrOffset(cmdBuffer, parsedOffset));
@@ -1500,8 +1503,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto expectedOffsetSectionSize = sizeof(WalkerPartition::MI_STORE_DATA_IMM<FamilyType>) +
NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>) +
sizeof(WalkerPartition::BATCH_BUFFER_START<FamilyType>);
@@ -1511,8 +1517,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
sizeof(WalkerPartition::MI_STORE_DATA_IMM<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
@@ -1521,7 +1527,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);
size_t parsedOffset = 0;
@@ -1537,7 +1543,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
size_t additionalSyncCmdSize = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(testHardwareInfo);
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment)) {
constexpr uint64_t zeroGpuAddress = 0;
constexpr uint64_t zeroImmediateValue = 0;
auto pipeControl = genCmdCast<WalkerPartition::PIPE_CONTROL<FamilyType> *>(ptrOffset(cmdBuffer, parsedOffset));
@@ -1640,9 +1646,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto expectedOffsetSectionSize = sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) +
NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(testHardwareInfo, false) +
NEO::MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>) +
sizeof(WalkerPartition::BATCH_BUFFER_START<FamilyType>);
@@ -1652,8 +1660,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
@@ -1662,7 +1670,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);
@@ -1684,7 +1692,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests,
size_t additionalSyncCmdSize = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(testHardwareInfo);
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(testHardwareInfo)) {
if (NEO::MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment)) {
constexpr uint64_t zeroGpuAddress = 0;
constexpr uint64_t zeroImmediateValue = 0;
auto pipeControl = genCmdCast<WalkerPartition::PIPE_CONTROL<FamilyType> *>(ptrOffset(cmdBuffer, parsedOffset));

View File

@@ -1375,6 +1375,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenDo
testArgs.tileCount = 4u;
testArgs.emitSelfCleanup = false;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
@@ -1385,8 +1387,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenDo
auto expectedCommandUsedSize = expectedOffsetSectionSize +
sizeof(BarrierControlSection);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = false;
@@ -1395,7 +1397,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenDo
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);
@@ -1442,7 +1444,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto expectedOffsetSectionSize = sizeof(WalkerPartition::MI_STORE_DATA_IMM<FamilyType>) +
sizeof(WalkerPartition::PIPE_CONTROL<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>) +
@@ -1454,8 +1457,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
sizeof(WalkerPartition::MI_STORE_DATA_IMM<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
@@ -1464,7 +1467,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);
@@ -1559,7 +1562,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
uint32_t totalBytesProgrammed = 0u;
uint64_t gpuVirtualAddress = 0xFF0000;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto expectedOffsetSectionSize = sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) +
sizeof(WalkerPartition::PIPE_CONTROL<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>) +
@@ -1571,8 +1575,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) +
sizeof(WalkerPartition::MI_ATOMIC<FamilyType>) + sizeof(WalkerPartition::MI_SEMAPHORE_WAIT<FamilyType>);
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, testHardwareInfo));
EXPECT_EQ(expectedOffsetSectionSize, computeBarrierControlSectionOffset<FamilyType>(testArgs, rootDeviceEnvironment));
EXPECT_EQ(expectedCommandUsedSize, estimateBarrierSpaceRequiredInCommandBuffer<FamilyType>(testArgs, rootDeviceEnvironment));
PipeControlArgs flushArgs;
flushArgs.dcFlushEnable = true;
@@ -1581,7 +1585,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenBarrierProgrammingWhenEm
totalBytesProgrammed,
testArgs,
flushArgs,
testHardwareInfo);
rootDeviceEnvironment);
EXPECT_EQ(expectedCommandUsedSize, totalBytesProgrammed);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/source/helpers/hw_helper.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/hw_test.h"
namespace NEO {
@@ -77,7 +78,9 @@ HWTEST_TEMPLATED_F(DerivedTemplatedFixtureTests, whenExecutingTemplatedTestThenC
struct TemplatedFixtureBaseTests : public ::testing::Test {
template <typename T>
void setUpT() {
capturedPipeControlWaRequiredInSetUp = MemorySynchronizationCommands<T>::isBarrierWaRequired(*defaultHwInfo);
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
capturedPipeControlWaRequiredInSetUp = MemorySynchronizationCommands<T>::isBarrierWaRequired(rootDeviceEnvironment);
}
template <typename T>
@@ -87,7 +90,9 @@ struct TemplatedFixtureBaseTests : public ::testing::Test {
};
HWTEST_TEMPLATED_F(TemplatedFixtureBaseTests, whenExecutingTemplatedSetupThenTemplateTargetsCorrectPlatform) {
bool capturedPipeControlWaRequiredInTestBody = MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(*defaultHwInfo);
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
bool capturedPipeControlWaRequiredInTestBody = MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment);
EXPECT_EQ(capturedPipeControlWaRequiredInTestBody, capturedPipeControlWaRequiredInSetUp);
}

View File

@@ -12,6 +12,7 @@
#include "shared/source/helpers/preamble.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
@@ -28,11 +29,14 @@ ADLPTEST_F(PreambleHelperTestsAdlp, givenSystolicPipelineSelectModeDisabledWhenP
char streamBuffer[bufferSize];
LinearStream stream(streamBuffer, bufferSize);
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
flags.pipelineSelectArgs.systolicPipelineSelectMode = false;
flags.pipelineSelectArgs.systolicPipelineSelectSupport = PreambleHelper<FamilyType>::isSystolicModeConfigurable(ADLP::hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&stream, flags.pipelineSelectArgs, ADLP::hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&stream, flags.pipelineSelectArgs, rootDeviceEnvironment);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(stream, 0);
@@ -59,12 +63,14 @@ ADLPTEST_F(PreambleHelperTestsAdlp, givenSystolicPipelineSelectModeEnabledWhenPr
char streamBuffer[bufferSize];
LinearStream stream(streamBuffer, bufferSize);
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
flags.pipelineSelectArgs.systolicPipelineSelectMode = true;
flags.pipelineSelectArgs.systolicPipelineSelectSupport = PreambleHelper<FamilyType>::isSystolicModeConfigurable(ADLP::hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&stream, flags.pipelineSelectArgs, ADLP::hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&stream, flags.pipelineSelectArgs, rootDeviceEnvironment);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(stream, 0);

View File

@@ -241,10 +241,8 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, givenCoherencyRequirementWithoutShar
EXPECT_EQ(expectToBeProgrammed, foundOne);
};
auto hwInfo = device->getHardwareInfo();
flushTask(false);
if (MemorySynchronizationCommands<FamilyType>::isBarrierlPriorToPipelineSelectWaRequired(hwInfo)) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierlPriorToPipelineSelectWaRequired(device->getRootDeviceEnvironment())) {
findCmd(true, false, true); // first time
} else {
findCmd(true, false, false); // first time

View File

@@ -35,7 +35,7 @@ GEN12LPTEST_F(Gen12LpCommandEncodeTest, WhenDefaultEngineIsRcsAnd3DPipelineSelec
const auto &productHelper = device.getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getRootDeviceEnvironment()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
} else {
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
}

View File

@@ -161,9 +161,8 @@ GEN12LPTEST_F(Gen12lpCommandEncodeTest, givenBcsCommandsHelperWhenMiArbCheckWaRe
GEN12LPTEST_F(CommandEncodeStatesTest, givenGen12LpPlatformWhenAdjustPipelineSelectIsCalledThenPipelineIsDispatched) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
auto &hwInfo = pDevice->getHardwareInfo();
size_t barrierSize = 0;
if (MemorySynchronizationCommands<FamilyType>::isBarrierlPriorToPipelineSelectWaRequired(hwInfo)) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierlPriorToPipelineSelectWaRequired(pDevice->getRootDeviceEnvironment())) {
barrierSize = MemorySynchronizationCommands<FamilyType>::getSizeForSingleBarrier(false);
}

View File

@@ -235,12 +235,15 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed
expectedPipeControl.setPostSyncOperation(PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP);
expectedPipeControl.setAddress(static_cast<uint32_t>(address & 0x0000FFFFFFFFULL));
expectedPipeControl.setAddressHigh(static_cast<uint32_t>(address >> 32));
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &hardwareInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
PipeControlArgs args;
MemorySynchronizationCommands<FamilyType>::addBarrierWithPostSyncOperation(
stream, PostSyncMode::Timestamp, address, immediateData, hardwareInfo, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(hardwareInfo, false) - sizeof(PIPE_CONTROL);
stream, PostSyncMode::Timestamp, address, immediateData, rootDeviceEnvironment, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) - sizeof(PIPE_CONTROL);
auto pipeControlLocationSize = additionalPcSize - MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(hardwareInfo);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(ptrOffset(stream.getCpuBase(), pipeControlLocationSize));
ASSERT_NE(nullptr, pipeControl);
@@ -285,12 +288,14 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIs
expectedPipeControl.setAddress(static_cast<uint32_t>(address & 0x0000FFFFFFFFULL));
expectedPipeControl.setAddressHigh(static_cast<uint32_t>(address >> 32));
expectedPipeControl.setImmediateData(immediateData);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &hardwareInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
PipeControlArgs args;
MemorySynchronizationCommands<FamilyType>::addBarrierWithPostSyncOperation(
stream, PostSyncMode::ImmediateData, address, immediateData, hardwareInfo, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(hardwareInfo, false) - sizeof(PIPE_CONTROL);
stream, PostSyncMode::ImmediateData, address, immediateData, rootDeviceEnvironment, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) - sizeof(PIPE_CONTROL);
auto pipeControlLocationSize = additionalPcSize - MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(hardwareInfo);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(ptrOffset(stream.getCpuBase(), pipeControlLocationSize));
ASSERT_NE(nullptr, pipeControl);
@@ -314,13 +319,15 @@ HWTEST_F(PipeControlHelperTests, givenNotifyEnableArgumentIsTrueWhenHelperIsUsed
expectedPipeControl.setAddressHigh(static_cast<uint32_t>(address >> 32));
expectedPipeControl.setImmediateData(immediateData);
expectedPipeControl.setNotifyEnable(true);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &hardwareInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
PipeControlArgs args;
args.notifyEnable = true;
MemorySynchronizationCommands<FamilyType>::addBarrierWithPostSyncOperation(
stream, PostSyncMode::ImmediateData, address, immediateData, hardwareInfo, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(hardwareInfo, false) - sizeof(PIPE_CONTROL);
stream, PostSyncMode::ImmediateData, address, immediateData, rootDeviceEnvironment, args);
auto additionalPcSize = MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) - sizeof(PIPE_CONTROL);
auto pipeControlLocationSize = additionalPcSize - MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(hardwareInfo);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(ptrOffset(stream.getCpuBase(), pipeControlLocationSize));
ASSERT_NE(nullptr, pipeControl);

View File

@@ -69,16 +69,19 @@ HWTEST2_F(PipeControlHelperTestsDg2AndLater, WhenAddingPipeControlWAThenCorrectC
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
uint8_t buffer[128];
uint64_t address = 0x1234567887654321;
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &hardwareInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
bool requiresMemorySynchronization = (MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(hardwareInfo) > 0) ? true : false;
for (auto ftrLocalMemory : ::testing::Bool()) {
LinearStream stream(buffer, 128);
hardwareInfo.featureTable.flags.ftrLocalMemory = ftrLocalMemory;
MemorySynchronizationCommands<FamilyType>::addBarrierWa(stream, address, hardwareInfo);
MemorySynchronizationCommands<FamilyType>::addBarrierWa(stream, address, rootDeviceEnvironment);
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(hardwareInfo) == false) {
if (MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment) == false) {
EXPECT_EQ(0u, stream.getUsed());
continue;
}

View File

@@ -71,7 +71,7 @@ PVCTEST_F(PreamblePipelineSelectState, givenRevisionBAndAboveWhenCallingProgramP
hwInfo->platform.usRevId = testInput.revId;
pipelineArgs.systolicPipelineSelectSupport = productHelper.isSystolicModeConfigurable(*hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&linearStream, pipelineArgs, *hwInfo);
PreambleHelper<FamilyType>::programPipelineSelect(&linearStream, pipelineArgs, pDevice->getRootDeviceEnvironment());
parseCommands<FamilyType>(linearStream);
auto itorCmd = find<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());

View File

@@ -17,6 +17,7 @@
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "hw_cmds_xe_hpg_core_base.h"
@@ -176,16 +177,17 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenDisablePipeControlFlagIsEnabl
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
DebugManagerStateRestore restore;
DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(1);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &hardwareInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
EXPECT_TRUE(MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(hardwareInfo));
EXPECT_TRUE(MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment));
constexpr size_t bufferSize = 128u;
uint8_t buffer[bufferSize];
LinearStream cmdStream(buffer, bufferSize);
MemorySynchronizationCommands<FamilyType>::addBarrierWa(cmdStream, 0x1000, hardwareInfo);
MemorySynchronizationCommands<FamilyType>::addBarrierWa(cmdStream, 0x1000, rootDeviceEnvironment);
EXPECT_EQ(sizeof(PIPE_CONTROL), cmdStream.getUsed());
}
@@ -193,15 +195,17 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenDisablePipeControlFlagIsEnabl
DebugManagerStateRestore restore;
DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(1);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &hardwareInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
EXPECT_FALSE(MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(hardwareInfo));
EXPECT_FALSE(MemorySynchronizationCommands<FamilyType>::isBarrierWaRequired(rootDeviceEnvironment));
constexpr size_t bufferSize = 128u;
uint8_t buffer[bufferSize];
LinearStream cmdStream(buffer, bufferSize);
MemorySynchronizationCommands<FamilyType>::addBarrierWa(cmdStream, 0x1000, hardwareInfo);
MemorySynchronizationCommands<FamilyType>::addBarrierWa(cmdStream, 0x1000, rootDeviceEnvironment);
EXPECT_EQ(0u, cmdStream.getUsed());
}
@@ -221,7 +225,9 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore,
uint8_t buffer[bufferSize];
LinearStream cmdStream(buffer, bufferSize);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &hardwareInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
PipeControlArgs args;
@@ -231,7 +237,7 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore,
PostSyncMode::ImmediateData,
gpuAddress,
immediateValue,
hardwareInfo,
rootDeviceEnvironment,
args);
EXPECT_EQ(sizeof(PIPE_CONTROL), cmdStream.getUsed());
@@ -258,7 +264,9 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore,
uint8_t buffer[bufferSize];
LinearStream cmdStream(buffer, bufferSize);
HardwareInfo hardwareInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &hardwareInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
PipeControlArgs args;
@@ -268,7 +276,7 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore,
PostSyncMode::ImmediateData,
gpuAddress,
immediateValue,
hardwareInfo,
rootDeviceEnvironment,
args);
EXPECT_EQ(sizeof(PIPE_CONTROL) * 2, cmdStream.getUsed());