Add debug flag to disable cache flush

Related-To: NEO-5144

Change-Id: I29590d840a641dfcf3fc4d099ca84f196c8fdc1f
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2020-09-30 15:06:42 +02:00
committed by sys_ocldev
parent 78feb47d6c
commit 5af3a46662
10 changed files with 129 additions and 19 deletions

View File

@@ -11,6 +11,8 @@
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/source/kernel/kernel.h"
#include "pipe_control_args.h"
namespace NEO {
template <typename GfxFamily>
@@ -153,12 +155,8 @@ void HardwareCommandsHelper<GfxFamily>::setInterfaceDescriptorOffset(
template <typename GfxFamily>
void HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(LinearStream *commandStream, const CommandQueue &commandQueue, const Kernel *kernel, uint64_t postSyncAddress) {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
auto pipeControl = commandStream->getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
cmd.setDcFlushEnable(true);
*pipeControl = cmd;
PipeControlArgs args(true);
MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandStream, args);
}
} // namespace NEO

View File

@@ -894,6 +894,46 @@ HWTEST_F(UltCommandStreamReceiverTest, addPipeControlWithFlushAllCaches) {
EXPECT_TRUE(pipeControl->getStateCacheInvalidationEnable());
}
HWTEST_F(UltCommandStreamReceiverTest, givenDebugDisablingCacheFlushWhenAddingPipeControlWithCacheFlushThenOverrideRequestAndDisableCacheFlushFlags) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DoNotFlushCaches.set(true);
char buff[sizeof(PIPE_CONTROL) * 3];
LinearStream stream(buff, sizeof(PIPE_CONTROL) * 3);
PipeControlArgs args(true);
args.constantCacheInvalidationEnable = true;
args.instructionCacheInvalidateEnable = true;
args.pipeControlFlushEnable = true;
args.renderTargetCacheFlushEnable = true;
args.stateCacheInvalidationEnable = true;
args.textureCacheInvalidationEnable = true;
args.vfCacheInvalidationEnable = true;
MemorySynchronizationCommands<FamilyType>::addPipeControl(stream, args);
parseCommands<FamilyType>(stream, 0);
PIPE_CONTROL *pipeControl = getCommand<PIPE_CONTROL>();
ASSERT_NE(nullptr, pipeControl);
// WA pipeControl added
if (cmdList.size() == 2) {
pipeControl++;
}
EXPECT_FALSE(pipeControl->getDcFlushEnable());
EXPECT_FALSE(pipeControl->getRenderTargetCacheFlushEnable());
EXPECT_FALSE(pipeControl->getInstructionCacheInvalidateEnable());
EXPECT_FALSE(pipeControl->getTextureCacheInvalidationEnable());
EXPECT_FALSE(pipeControl->getPipeControlFlushEnable());
EXPECT_FALSE(pipeControl->getVfCacheInvalidationEnable());
EXPECT_FALSE(pipeControl->getConstantCacheInvalidationEnable());
EXPECT_FALSE(pipeControl->getStateCacheInvalidationEnable());
}
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenEnabledPreemptionWhenFlushTaskCalledThenDontProgramMediaVfeStateAgain) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();

View File

@@ -72,3 +72,56 @@ GEN12LPTEST_F(UltCommandStreamReceiverTest, givenStateBaseAddressWhenItIsRequire
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable());
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
}
using UltCommandStreamReceiverTestGen12Lp = UltCommandStreamReceiverTest;
GEN12LPTEST_F(UltCommandStreamReceiverTestGen12Lp, givenDebugEnablingCacheFlushWhenAddingPipeControlWithoutCacheFlushThenOverrideRequestAndEnableCacheFlushFlags) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.FlushAllCaches.set(true);
char buff[sizeof(PIPE_CONTROL) * 3];
LinearStream stream(buff, sizeof(PIPE_CONTROL) * 3);
PipeControlArgs args;
MemorySynchronizationCommands<FamilyType>::addPipeControl(stream, args);
parseCommands<FamilyType>(stream, 0);
PIPE_CONTROL *pipeControl = getCommand<PIPE_CONTROL>();
ASSERT_NE(nullptr, pipeControl);
// WA pipeControl added
if (cmdList.size() == 2) {
pipeControl++;
}
EXPECT_TRUE(pipeControl->getHdcPipelineFlush());
}
GEN12LPTEST_F(UltCommandStreamReceiverTestGen12Lp, givenDebugDisablingCacheFlushWhenAddingPipeControlWithCacheFlushThenOverrideRequestAndDisableCacheFlushFlags) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DoNotFlushCaches.set(true);
char buff[sizeof(PIPE_CONTROL) * 3];
LinearStream stream(buff, sizeof(PIPE_CONTROL) * 3);
PipeControlArgs args(true);
args.hdcPipelineFlush = true;
MemorySynchronizationCommands<FamilyType>::addPipeControl(stream, args);
parseCommands<FamilyType>(stream, 0);
PIPE_CONTROL *pipeControl = getCommand<PIPE_CONTROL>();
ASSERT_NE(nullptr, pipeControl);
// WA pipeControl added
if (cmdList.size() == 2) {
pipeControl++;
}
EXPECT_FALSE(pipeControl->getHdcPipelineFlush());
}

View File

@@ -338,12 +338,12 @@ GEN12LPTEST_F(LriHelperTestsGen12Lp, whenProgrammingLriCommandThenExpectMmioRema
using MemorySynchronizatiopCommandsTests = ::testing::Test;
GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFieldsThenExpectHdcFlushSet) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
PIPE_CONTROL pipeControl = FamilyType::cmdInitPipeControl;
pipeControl.setConstantCacheInvalidationEnable(true);
MemorySynchronizationCommands<FamilyType>::setCacheFlushExtraProperties(pipeControl);
EXPECT_TRUE(pipeControl.getHdcPipelineFlush());
EXPECT_FALSE(pipeControl.getConstantCacheInvalidationEnable());
PipeControlArgs args;
args.constantCacheInvalidationEnable = true;
MemorySynchronizationCommands<FamilyType>::setCacheFlushExtraProperties(args);
EXPECT_TRUE(args.hdcPipelineFlush);
EXPECT_FALSE(args.constantCacheInvalidationEnable);
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenUnknownProductFamilyWhenGettingIsWorkaroundRequiredThenFalseIsReturned) {

View File

@@ -196,4 +196,5 @@ PerformImplicitFlushForNewResource = -1
PerformImplicitFlushForIdleGpu = -1
ProvideVerboseImplicitFlush = false
PauseOnGpuMode = -1
PrintTagAllocationAddress = 0
PrintTagAllocationAddress = 0
DoNotFlushCaches = false