Dont program dcFlush when not allowed

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-03-31 13:46:34 +00:00
committed by Compute-Runtime-Automation
parent 9dc25818cb
commit b6e3817f31
15 changed files with 78 additions and 45 deletions

View File

@@ -12,6 +12,7 @@
#include "shared/source/command_stream/linear_stream.h" #include "shared/source/command_stream/linear_stream.h"
#include "shared/source/device/device.h" #include "shared/source/device/device.h"
#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/interlocked_max.h" #include "shared/source/helpers/interlocked_max.h"
#include "shared/source/helpers/preamble.h" #include "shared/source/helpers/preamble.h"
@@ -32,16 +33,12 @@ template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream) { void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily; using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS; using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
PIPE_CONTROL *pcCmd = commandStream.getSpaceForCmd<PIPE_CONTROL>(); NEO::PipeControlArgs pcArgs;
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl; pcArgs.dcFlushEnable = true;
pcArgs.textureCacheInvalidationEnable = true;
cmd.setTextureCacheInvalidationEnable(true); NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(commandStream, pcArgs);
cmd.setDcFlushEnable(true);
cmd.setCommandStreamerStallEnable(true);
*pcCmd = cmd;
NEO::Device *neoDevice = device->getNEODevice(); NEO::Device *neoDevice = device->getNEODevice();
auto &hwInfo = neoDevice->getHardwareInfo(); auto &hwInfo = neoDevice->getHardwareInfo();

View File

@@ -403,7 +403,7 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyRegionC
cmd = genCmdCast<PIPE_CONTROL *>(*itor); cmd = genCmdCast<PIPE_CONTROL *>(*itor);
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end()); itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
} }
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
} }
HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyCalledThenPipeControlWithDcFlushAdded, Platforms) { HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyCalledThenPipeControlWithDcFlushAdded, Platforms) {
@@ -426,7 +426,7 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyCalledT
cmd = genCmdCast<PIPE_CONTROL *>(*itor); cmd = genCmdCast<PIPE_CONTROL *>(*itor);
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end()); itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
} }
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
} }
HWTEST2_F(CommandListCreate, givenCommandListAnd2DWhbufferenMemoryCopyRegionCalledThenCopyKernel2DCalled, Platforms) { HWTEST2_F(CommandListCreate, givenCommandListAnd2DWhbufferenMemoryCopyRegionCalledThenCopyKernel2DCalled, Platforms) {
@@ -596,7 +596,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyWithSignalEventScopeS
auto it = *(iterator.end() - 1); auto it = *(iterator.end() - 1);
auto cmd1 = genCmdCast<PIPE_CONTROL *>(*it); auto cmd1 = genCmdCast<PIPE_CONTROL *>(*it);
EXPECT_TRUE(cmd1->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd1->getDcFlushEnable());
} }
using ImageSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>; using ImageSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
@@ -1234,7 +1234,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenTimestampPassedToMemoryCopyThen
EXPECT_NE(cmdList.end(), itor); EXPECT_NE(cmdList.end(), itor);
{ {
auto cmd = genCmdCast<PIPE_CONTROL *>(*itor); auto cmd = genCmdCast<PIPE_CONTROL *>(*itor);
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
} }
} }
} // namespace ult } // namespace ult

View File

@@ -196,7 +196,7 @@ HWTEST2_F(CommandListAppendEventReset, givenEventWithHostScopeUsedInResetThenPip
EXPECT_TRUE(cmd->getCommandStreamerStallEnable()); EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
EXPECT_EQ(cmd->getAddressHigh(), gpuAddress >> 32u); EXPECT_EQ(cmd->getAddressHigh(), gpuAddress >> 32u);
EXPECT_EQ(cmd->getAddress(), uint32_t(gpuAddress)); EXPECT_EQ(cmd->getAddress(), uint32_t(gpuAddress));
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
postSyncFound = true; postSyncFound = true;
} }
} }

View File

@@ -132,7 +132,7 @@ HWTEST_F(CommandListAppendSignalEvent, givenEventWithScopeFlagDeviceWhenAppendin
if (cmd->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) { if (cmd->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
EXPECT_EQ(cmd->getImmediateData(), Event::STATE_SIGNALED); EXPECT_EQ(cmd->getImmediateData(), Event::STATE_SIGNALED);
EXPECT_TRUE(cmd->getCommandStreamerStallEnable()); EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
postSyncFound = true; postSyncFound = true;
} }
} }

View File

@@ -132,7 +132,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe
ASSERT_NE(cmd, nullptr); ASSERT_NE(cmd, nullptr);
EXPECT_TRUE(cmd->getCommandStreamerStallEnable()); EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
EXPECT_TRUE(cmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmd->getDcFlushEnable());
} }
} }
@@ -188,4 +188,4 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenCommandListWhenAppendWriteGlobalTim
} }
} // namespace ult } // namespace ult
} // namespace L0 } // namespace L0

View File

@@ -1369,7 +1369,7 @@ HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenAuxToNonAuxWhenTran
ASSERT_EQ(2u, pipeControls.size()); ASSERT_EQ(2u, pipeControls.size());
auto beginPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[0])); auto beginPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[0]));
EXPECT_TRUE(beginPipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), beginPipeControl->getDcFlushEnable());
EXPECT_TRUE(beginPipeControl->getCommandStreamerStallEnable()); EXPECT_TRUE(beginPipeControl->getCommandStreamerStallEnable());
auto endPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[1])); auto endPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[1]));
@@ -1425,7 +1425,7 @@ HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenNonAuxToAuxWhenTran
bool dcFlushRequired = (pClDevice->getHardwareInfo().platform.eRenderCoreFamily == IGFX_GEN8_CORE); bool dcFlushRequired = (pClDevice->getHardwareInfo().platform.eRenderCoreFamily == IGFX_GEN8_CORE);
auto beginPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[0])); auto beginPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[0]));
EXPECT_TRUE(beginPipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), beginPipeControl->getDcFlushEnable());
EXPECT_TRUE(beginPipeControl->getCommandStreamerStallEnable()); EXPECT_TRUE(beginPipeControl->getCommandStreamerStallEnable());
auto endPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[1])); auto endPipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*(pipeControls[1]));

View File

@@ -1415,8 +1415,10 @@ struct PauseOnGpuTests : public EnqueueKernelTest {
return false; return false;
} }
template <typename PIPE_CONTROL> template <typename FamilyType>
bool verifyPipeControl(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) { bool verifyPipeControl(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*iterator); auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*iterator);
if ((static_cast<uint32_t>(requiredDebugPauseState) == pipeControlCmd->getImmediateData()) && if ((static_cast<uint32_t>(requiredDebugPauseState) == pipeControlCmd->getImmediateData()) &&
@@ -1424,7 +1426,8 @@ struct PauseOnGpuTests : public EnqueueKernelTest {
(static_cast<uint32_t>(debugPauseStateAddress >> 32) == pipeControlCmd->getAddressHigh())) { (static_cast<uint32_t>(debugPauseStateAddress >> 32) == pipeControlCmd->getAddressHigh())) {
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable()); EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable());
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControlCmd->getDcFlushEnable());
EXPECT_EQ(PIPE_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, pipeControlCmd->getPostSyncOperation()); EXPECT_EQ(PIPE_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, pipeControlCmd->getPostSyncOperation());
@@ -1466,16 +1469,17 @@ struct PauseOnGpuTests : public EnqueueKernelTest {
} }
} }
template <typename PIPE_CONTROL> template <typename FamilyType>
void findPipeControls(GenCmdList &cmdList) { void findPipeControls(GenCmdList &cmdList) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto pipeControl = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end()); auto pipeControl = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
while (pipeControl != cmdList.end()) { while (pipeControl != cmdList.end()) {
if (verifyPipeControl<PIPE_CONTROL>(pipeControl, debugPauseStateAddress, DebugPauseState::waitingForUserStartConfirmation)) { if (verifyPipeControl<FamilyType>(pipeControl, debugPauseStateAddress, DebugPauseState::waitingForUserStartConfirmation)) {
pipeControlBeforeWalkerFound++; pipeControlBeforeWalkerFound++;
} }
if (verifyPipeControl<PIPE_CONTROL>(pipeControl, debugPauseStateAddress, DebugPauseState::waitingForUserEndConfirmation)) { if (verifyPipeControl<FamilyType>(pipeControl, debugPauseStateAddress, DebugPauseState::waitingForUserEndConfirmation)) {
pipeControlAfterWalkerFound++; pipeControlAfterWalkerFound++;
} }
@@ -1530,7 +1534,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenInser
EXPECT_EQ(1u, semaphoreBeforeWalkerFound); EXPECT_EQ(1u, semaphoreBeforeWalkerFound);
EXPECT_EQ(1u, semaphoreAfterWalkerFound); EXPECT_EQ(1u, semaphoreAfterWalkerFound);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, pipeControlBeforeWalkerFound); EXPECT_EQ(1u, pipeControlBeforeWalkerFound);
EXPECT_EQ(1u, pipeControlAfterWalkerFound); EXPECT_EQ(1u, pipeControlAfterWalkerFound);
@@ -1552,7 +1556,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetToMinusTwoWhenDispatchWalker
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList); findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(2u, semaphoreBeforeWalkerFound); EXPECT_EQ(2u, semaphoreBeforeWalkerFound);
EXPECT_EQ(2u, semaphoreAfterWalkerFound); EXPECT_EQ(2u, semaphoreAfterWalkerFound);
@@ -1576,7 +1580,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeOnlyWhenDispatchingThenInsert
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList); findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeWalkerFound); EXPECT_EQ(1u, semaphoreBeforeWalkerFound);
EXPECT_EQ(0u, semaphoreAfterWalkerFound); EXPECT_EQ(0u, semaphoreAfterWalkerFound);
@@ -1600,7 +1604,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList); findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(0u, semaphoreBeforeWalkerFound); EXPECT_EQ(0u, semaphoreBeforeWalkerFound);
EXPECT_EQ(1u, semaphoreAfterWalkerFound); EXPECT_EQ(1u, semaphoreAfterWalkerFound);
@@ -1624,7 +1628,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList); findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeWalkerFound); EXPECT_EQ(1u, semaphoreBeforeWalkerFound);
EXPECT_EQ(1u, semaphoreAfterWalkerFound); EXPECT_EQ(1u, semaphoreAfterWalkerFound);
@@ -1649,7 +1653,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenDontI
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList); findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findPipeControls<PIPE_CONTROL>(hwParser.cmdList); findPipeControls<FamilyType>(hwParser.cmdList);
EXPECT_EQ(0u, semaphoreBeforeWalkerFound); EXPECT_EQ(0u, semaphoreBeforeWalkerFound);
EXPECT_EQ(0u, semaphoreAfterWalkerFound); EXPECT_EQ(0u, semaphoreAfterWalkerFound);

View File

@@ -545,7 +545,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenStateBaseAddressWhenItIsRequi
EXPECT_NE(stateBaseAddressItor, pipeControlItor); EXPECT_NE(stateBaseAddressItor, pipeControlItor);
auto pipeControlCmd = (typename FamilyType::PIPE_CONTROL *)*pipeControlItor; auto pipeControlCmd = (typename FamilyType::PIPE_CONTROL *)*pipeControlItor;
EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable()); EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable());
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControlCmd->getDcFlushEnable());
} }
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNotApplicableL3ConfigWhenFlushingTaskThenDontReloadSba) { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNotApplicableL3ConfigWhenFlushingTaskThenDontReloadSba) {
@@ -1185,11 +1185,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, GivenBlockingWh
// Verify that the dcFlushEnabled bit is not set in PC // Verify that the dcFlushEnabled bit is not set in PC
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(pipeControlTask); auto pCmd = reinterpret_cast<PIPE_CONTROL *>(pipeControlTask);
EXPECT_TRUE(pCmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pCmd->getDcFlushEnable());
} }
} else { } else {
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(*itorPC); auto pCmd = reinterpret_cast<PIPE_CONTROL *>(*itorPC);
EXPECT_TRUE(pCmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pCmd->getDcFlushEnable());
} }
} }
@@ -1233,7 +1233,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelRequiringDCFlush
// Verify that the dcFlushEnabled bit is set in PC // Verify that the dcFlushEnabled bit is set in PC
auto pCmdWA = reinterpret_cast<PIPE_CONTROL *>(*itorPC); auto pCmdWA = reinterpret_cast<PIPE_CONTROL *>(*itorPC);
EXPECT_TRUE(pCmdWA->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pCmdWA->getDcFlushEnable());
buffer->release(); buffer->release();
} }

View File

@@ -74,7 +74,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFl
// Verify that the dcFlushEnabled bit is set in PC // Verify that the dcFlushEnabled bit is set in PC
auto pCmdWA = reinterpret_cast<PIPE_CONTROL *>(*itorPC); auto pCmdWA = reinterpret_cast<PIPE_CONTROL *>(*itorPC);
EXPECT_TRUE(pCmdWA->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pCmdWA->getDcFlushEnable());
buffer->release(); buffer->release();
} }
@@ -347,10 +347,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests,
EXPECT_NE(cmdList.end(), itorCmdP); EXPECT_NE(cmdList.end(), itorCmdP);
auto itorCmd2 = find<PIPE_CONTROL *>(itorCmdP, cmdList.end()); auto itorCmd2 = find<PIPE_CONTROL *>(itorCmdP, cmdList.end());
cmdPC = (PIPE_CONTROL *)*itorCmd2; cmdPC = (PIPE_CONTROL *)*itorCmd2;
EXPECT_TRUE(cmdPC->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmdPC->getDcFlushEnable());
} else { } else {
// single PIPE_CONTROL following GPGPU_WALKER has DcFlush and Write HwTag // single PIPE_CONTROL following GPGPU_WALKER has DcFlush and Write HwTag
EXPECT_TRUE(cmdPC->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), cmdPC->getDcFlushEnable());
} }
retVal = clReleaseEvent(event); retVal = clReleaseEvent(event);

View File

@@ -952,7 +952,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenCommandA
auto pipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*itorPipeControl); auto pipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*itorPipeControl);
mockCsr->flushBatchedSubmissions(); mockCsr->flushBatchedSubmissions();
EXPECT_TRUE(pipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
} }
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrderModeFisabledWhenCommandAreSubmittedThenDcFlushIsAdded) { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrderModeFisabledWhenCommandAreSubmittedThenDcFlushIsAdded) {
@@ -984,7 +984,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrd
auto pipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*itorPipeControl); auto pipeControl = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*itorPipeControl);
mockCsr->flushBatchedSubmissions(); mockCsr->flushBatchedSubmissions();
EXPECT_TRUE(pipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
} }
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenUpdateTaskCountFromWaitSetWhenFlushTaskThenThereIsNoPipeControlForUpdateTaskCount) { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenUpdateTaskCountFromWaitSetWhenFlushTaskThenThereIsNoPipeControlForUpdateTaskCount) {
@@ -1136,7 +1136,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlThenDcFlus
auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation); auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation);
ASSERT_NE(nullptr, pipeControl); ASSERT_NE(nullptr, pipeControl);
mockCsr->flushBatchedSubmissions(); mockCsr->flushBatchedSubmissions();
EXPECT_TRUE(pipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
} }
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlushDisabledByDebugFlagThenDcFlushIsDisabled) { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlushDisabledByDebugFlagThenDcFlushIsDisabled) {
@@ -1742,7 +1742,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsTrueWhenCall
PIPE_CONTROL *pipeControl = genCmdCast<PIPE_CONTROL *>(buffer.get()); PIPE_CONTROL *pipeControl = genCmdCast<PIPE_CONTROL *>(buffer.get());
ASSERT_NE(nullptr, pipeControl); ASSERT_NE(nullptr, pipeControl);
EXPECT_TRUE(pipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable()); EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable());
} }

View File

@@ -279,6 +279,27 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed
EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0); EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0);
} }
HWTEST_F(PipeControlHelperTests, givenHwHelperwhenAskingForDcFlushThenReturnTrue) {
EXPECT_TRUE(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed());
}
HWTEST_F(PipeControlHelperTests, givenDcFlushNotAllowedWhenProgrammingPipeControlThenDontSetDcFlush) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
LinearStream stream(buffer.get(), 128);
PipeControlArgs args;
args.dcFlushEnable = true;
MemorySynchronizationCommands<FamilyType>::addPipeControl(stream, args);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(stream.getCpuBase());
ASSERT_NE(nullptr, pipeControl);
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
}
HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIsUsedThenProperFieldsAreProgrammed) { HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIsUsedThenProperFieldsAreProgrammed) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
std::unique_ptr<uint8_t> buffer(new uint8_t[128]); std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
@@ -1007,7 +1028,7 @@ HWTEST_F(PipeControlHelperTests, WhenProgrammingCacheFlushThenExpectBasicFieldsS
ASSERT_NE(nullptr, pipeControl); ASSERT_NE(nullptr, pipeControl);
EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable()); EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable());
EXPECT_TRUE(pipeControl->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControl->getDcFlushEnable());
EXPECT_TRUE(pipeControl->getRenderTargetCacheFlushEnable()); EXPECT_TRUE(pipeControl->getRenderTargetCacheFlushEnable());
EXPECT_TRUE(pipeControl->getInstructionCacheInvalidateEnable()); EXPECT_TRUE(pipeControl->getInstructionCacheInvalidateEnable());

View File

@@ -612,7 +612,7 @@ void BcsBufferTests::waitForCacheFlushFromBcsTest(MockCommandQueueHw<FamilyType>
uint64_t addressLow = pipeControlCmd->getAddress(); uint64_t addressLow = pipeControlCmd->getAddress();
cacheFlushWriteAddress = addressHigh | addressLow; cacheFlushWriteAddress = addressHigh | addressLow;
if (cacheFlushWriteAddress != 0) { if (cacheFlushWriteAddress != 0) {
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControlCmd->getDcFlushEnable());
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable()); EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
EXPECT_EQ(isCacheFlushForBcsRequired, 0u == pipeControlCmd->getImmediateData()); EXPECT_EQ(isCacheFlushForBcsRequired, 0u == pipeControlCmd->getImmediateData());
break; break;
@@ -728,7 +728,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBarrierWhenReleasingMultipleBlockedEnque
stallingPipeControlFound = true; stallingPipeControlFound = true;
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable()); EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable()); EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControlCmd->getDcFlushEnable());
break; break;
} }
} }

View File

@@ -739,7 +739,8 @@ inline bool CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
//make sure we flush DC if needed //make sure we flush DC if needed
if (epiloguePipeControlLocation) { if (epiloguePipeControlLocation) {
bool flushDcInEpilogue = true; bool flushDcInEpilogue = MemorySynchronizationCommands<GfxFamily>::isDcFlushAllowed();
if (DebugManager.flags.DisableDcFlushInEpilogue.get()) { if (DebugManager.flags.DisableDcFlushInEpilogue.get()) {
flushDcInEpilogue = false; flushDcInEpilogue = false;
} }

View File

@@ -401,6 +401,8 @@ struct MemorySynchronizationCommands {
static void addPipeControl(LinearStream &commandStream, PipeControlArgs &args); static void addPipeControl(LinearStream &commandStream, PipeControlArgs &args);
static void addPipeControlWithCSStallOnly(LinearStream &commandStream, PipeControlArgs &args); static void addPipeControlWithCSStallOnly(LinearStream &commandStream, PipeControlArgs &args);
static bool isDcFlushAllowed();
static void addFullCacheFlush(LinearStream &commandStream); static void addFullCacheFlush(LinearStream &commandStream);
static void setCacheFlushExtraProperties(PipeControlArgs &args); static void setCacheFlushExtraProperties(PipeControlArgs &args);

View File

@@ -234,7 +234,6 @@ void MemorySynchronizationCommands<GfxFamily>::addPipeControlWithPostSync(
template <typename GfxFamily> template <typename GfxFamily>
void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily::PIPE_CONTROL &pipeControl, PipeControlArgs &args) { void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily::PIPE_CONTROL &pipeControl, PipeControlArgs &args) {
pipeControl.setCommandStreamerStallEnable(true); pipeControl.setCommandStreamerStallEnable(true);
pipeControl.setDcFlushEnable(args.dcFlushEnable);
pipeControl.setConstantCacheInvalidationEnable(args.constantCacheInvalidationEnable); pipeControl.setConstantCacheInvalidationEnable(args.constantCacheInvalidationEnable);
pipeControl.setInstructionCacheInvalidateEnable(args.instructionCacheInvalidateEnable); pipeControl.setInstructionCacheInvalidateEnable(args.instructionCacheInvalidateEnable);
pipeControl.setPipeControlFlushEnable(args.pipeControlFlushEnable); pipeControl.setPipeControlFlushEnable(args.pipeControlFlushEnable);
@@ -245,6 +244,10 @@ void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily
pipeControl.setGenericMediaStateClear(args.genericMediaStateClear); pipeControl.setGenericMediaStateClear(args.genericMediaStateClear);
pipeControl.setTlbInvalidate(args.tlbInvalidation); pipeControl.setTlbInvalidate(args.tlbInvalidation);
if (isDcFlushAllowed()) {
pipeControl.setDcFlushEnable(args.dcFlushEnable);
}
setPipeControlExtraProperties(pipeControl, args); setPipeControlExtraProperties(pipeControl, args);
if (DebugManager.flags.FlushAllCaches.get()) { if (DebugManager.flags.FlushAllCaches.get()) {
@@ -270,6 +273,11 @@ void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily
} }
} }
template <typename GfxFamily>
bool MemorySynchronizationCommands<GfxFamily>::isDcFlushAllowed() {
return true;
}
template <typename GfxFamily> template <typename GfxFamily>
void MemorySynchronizationCommands<GfxFamily>::addPipeControl(LinearStream &commandStream, PipeControlArgs &args) { void MemorySynchronizationCommands<GfxFamily>::addPipeControl(LinearStream &commandStream, PipeControlArgs &args) {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL; using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;