L0 Debug - Fix imm cmdlist mode on windows

Single Address Space SBA programming was using incorrect BB
level and not loading GPR15

Related-to: NEO-7517
Signed-off-by: Yates, Brandon <brandon.yates@intel.com>
This commit is contained in:
Yates, Brandon
2022-11-22 20:07:45 +00:00
committed by Compute-Runtime-Automation
parent 5da472e84f
commit 4bd5765a06
19 changed files with 128 additions and 41 deletions

View File

@ -2569,7 +2569,7 @@ void CommandListCoreFamily<gfxCoreFamily>::programStateBaseAddress(NEO::CommandC
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled,
*this->device->getNEODevice(),
*container.getCommandStream(),
sba);
sba, this->isFlushTaskSubmissionEnabled);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@ -81,7 +81,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddressIntoCommandStream(stateBaseAddressHelperArgs, commandStream);
bool sbaTrackingEnabled = (NEO::Debugger::isDebugEnabled(this->internalUsage) && device->getL0Debugger());
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled, *neoDevice, commandStream, sbaCmd);
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled, *neoDevice, commandStream, sbaCmd, true);
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(commandStream, {}, false, hwInfo, isRcs);

View File

@ -73,7 +73,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled,
*neoDevice,
commandStream,
sbaCmd);
sbaCmd, true);
auto heap = neoDevice->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::GLOBAL_SSH);
NEO::StateBaseAddressHelper<GfxFamily>::programBindingTableBaseAddress(

View File

@ -96,6 +96,17 @@ struct L0DebuggerPerContextAddressSpaceFixture : public L0DebuggerHwFixture {
DebugManagerStateRestore restorer;
};
struct L0DebuggerSingleAddressSpaceFixture : public L0DebuggerHwFixture {
void setUp() {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(1);
L0DebuggerHwFixture::setUp();
}
void tearDown() {
L0DebuggerHwFixture::tearDown();
}
DebugManagerStateRestore restorer;
};
struct L0DebuggerHwParameterizedFixture : ::testing::TestWithParam<int>, public L0DebuggerHwFixture {
void SetUp() override {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(GetParam());

View File

@ -106,6 +106,51 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenDebuggerLogsDisabledWhenCommandListIsSy
}
using Gen12Plus = IsAtLeastGfxCore<IGFX_GEN12_CORE>;
using singleAddressSpaceModeTest = Test<L0DebuggerSingleAddressSpaceFixture>;
HWTEST2_F(singleAddressSpaceModeTest, givenImmediateCommandListWhenExecutingWithFlushTaskThenGPR15isProgrammed, Gen12Plus) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
Mock<::L0::Kernel> kernel;
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
ze_command_queue_desc_t queueDesc = {};
ze_result_t returnValue = ZE_RESULT_SUCCESS;
ze_group_count_t groupCount{1, 1, 1};
auto &csr = neoDevice->getUltCommandStreamReceiver<FamilyType>();
csr.storeMakeResidentAllocations = true;
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue);
EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled);
EXPECT_EQ(&csr, commandList->csr);
csr.lastFlushedCommandStream = nullptr;
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, csr.lastFlushedCommandStream);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, commandList->csr->getCS().getCpuBase(), commandList->csr->getCS().getUsed()));
bool gpr15Found = false;
auto miLoadImm = findAll<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
for (size_t i = 0; i < miLoadImm.size(); i++) {
MI_LOAD_REGISTER_IMM *miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[i]);
ASSERT_NE(nullptr, miLoad);
if (miLoad->getRegisterOffset() == CS_GPR_R15) {
gpr15Found = true;
break;
}
}
EXPECT_TRUE(gpr15Found);
commandList->destroy();
}
HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateCommandListWhenExecutingWithFlushTaskThenSipIsInstalledAndDebuggerAllocationsAreResident, Gen12Plus) {
using STATE_SIP = typename FamilyType::STATE_SIP;
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;