feature: program debug surface address

Related-To: NEO-7986
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2024-07-01 19:50:09 +00:00
committed by Compute-Runtime-Automation
parent 213ee414d7
commit 51fc9059c2
20 changed files with 229 additions and 47 deletions

View File

@@ -4505,7 +4505,7 @@ HWTEST2_F(CommandStreamReceiverHwTest,
HardwareParse hwParserCsr;
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
auto itCsrCommand = NEO::UnitTestHelper<FamilyType>::findMidThreadPreemptionAllocationCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
auto itCsrCommand = NEO::UnitTestHelper<FamilyType>::findCsrBaseAddressCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
if (csrSurfaceProgramming) {
EXPECT_NE(hwParserCsr.cmdList.end(), itCsrCommand);
} else {
@@ -4522,12 +4522,63 @@ HWTEST2_F(CommandStreamReceiverHwTest,
hwParserCsr.tearDown();
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, usedSize);
itCsrCommand = NEO::UnitTestHelper<FamilyType>::findMidThreadPreemptionAllocationCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
itCsrCommand = NEO::UnitTestHelper<FamilyType>::findCsrBaseAddressCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
EXPECT_EQ(hwParserCsr.cmdList.end(), itCsrCommand);
EXPECT_TRUE(commandStreamReceiver.isMadeResident(commandStreamReceiver.getPreemptionAllocation()));
}
HWTEST2_F(CommandStreamReceiverHwTest,
givenImmediateFlushTaskWhenDebugSurfaceProgrammingNeededThenOnlyOneTimeCsrProgrammed,
IsAtLeastXeHpCore) {
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->initDebuggerL0(pDevice);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.storeMakeResidentAllocations = true;
EXPECT_FALSE(commandStreamReceiver.csrSurfaceProgrammed());
commandStreamReceiver.setCsrSurfaceProgrammed(true);
EXPECT_TRUE(commandStreamReceiver.csrSurfaceProgrammed());
commandStreamReceiver.setCsrSurfaceProgrammed(false);
EXPECT_FALSE(commandStreamReceiver.csrSurfaceProgrammed());
const auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
auto debugSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(*defaultHwInfo);
NEO::GraphicsAllocation *debugSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{pDevice->getRootDeviceIndex(), true,
debugSurfaceSize,
NEO::AllocationType::debugContextSaveArea,
false,
false,
pDevice->getDeviceBitfield()});
pDevice->setDebugSurface(debugSurface);
bool csrSurfaceProgramming = NEO::PreemptionHelper::getRequiredPreambleSize<FamilyType>(*pDevice) > 0;
commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice);
EXPECT_TRUE(commandStreamReceiver.csrSurfaceProgrammed());
HardwareParse hwParserCsr;
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
auto itCsrCommand = NEO::UnitTestHelper<FamilyType>::findCsrBaseAddressCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
if (csrSurfaceProgramming) {
EXPECT_NE(hwParserCsr.cmdList.end(), itCsrCommand);
} else {
EXPECT_EQ(hwParserCsr.cmdList.end(), itCsrCommand);
}
size_t usedSize = commandStreamReceiver.commandStream.getUsed();
commandStreamReceiver.flushImmediateTask(commandStream,
commandStream.getUsed(),
immediateFlushTaskFlags,
*pDevice);
hwParserCsr.tearDown();
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, usedSize);
itCsrCommand = NEO::UnitTestHelper<FamilyType>::findCsrBaseAddressCommand(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
EXPECT_EQ(hwParserCsr.cmdList.end(), itCsrCommand);
}
HWTEST2_F(CommandStreamReceiverHwTest,
givenImmediateFlushTaskWhenSipProgrammingNeededThenOneTimeSipStateDispatched,
IsAtLeastXeHpCore) {
@@ -4543,6 +4594,16 @@ HWTEST2_F(CommandStreamReceiverHwTest,
EXPECT_TRUE(commandStreamReceiver.getSipSentFlag());
commandStreamReceiver.setSipSentFlag(false);
EXPECT_FALSE(commandStreamReceiver.getSipSentFlag());
const auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
auto debugSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(*defaultHwInfo);
NEO::GraphicsAllocation *debugSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{pDevice->getRootDeviceIndex(), true,
debugSurfaceSize,
NEO::AllocationType::debugContextSaveArea,
false,
false,
pDevice->getDeviceBitfield()});
pDevice->setDebugSurface(debugSurface);
commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice);
@@ -4589,6 +4650,16 @@ HWTEST2_F(CommandStreamReceiverHwTest,
EXPECT_TRUE(commandStreamReceiver.getSipSentFlag());
commandStreamReceiver.setSipSentFlag(false);
EXPECT_FALSE(commandStreamReceiver.getSipSentFlag());
const auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
auto debugSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(*defaultHwInfo);
NEO::GraphicsAllocation *debugSurface = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{pDevice->getRootDeviceIndex(), true,
debugSurfaceSize,
NEO::AllocationType::debugContextSaveArea,
false,
false,
pDevice->getDeviceBitfield()});
pDevice->setDebugSurface(debugSurface);
commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,5 +46,5 @@ GEN11TEST_F(PreambleTestGen11, givenDisabledPreemptionAndDisabledDebuggingWhenPr
}
GEN11TEST_F(PreambleTestGen11, givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAndStateSipAreInlcuded) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAreInlcudedTest();
SourceLevelDebuggerPreambleTest<FamilyType>::givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThenCorrectSizeIsInlcudedTest();
}

View File

@@ -48,7 +48,7 @@ GEN9TEST_F(PreambleTestGen9, givenDisabledPreemptionAndDisabledDebuggingWhenPrea
}
GEN9TEST_F(PreambleTestGen9, givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAreInlcuded) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAreInlcudedTest();
SourceLevelDebuggerPreambleTest<FamilyType>::givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThenCorrectSizeIsInlcudedTest();
}
using ThreadArbitrationGen9 = PreambleFixture;