fix(debugger): pass correct sipAllocation to makeResident

- sipAllocation for context must be resident in Offline mode

Related-To: NEO-7630

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2023-07-28 13:22:38 +00:00
committed by Compute-Runtime-Automation
parent 8516f7f6ef
commit 997b599168
25 changed files with 141 additions and 70 deletions

View File

@@ -965,8 +965,9 @@ template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::makeSipIsaResidentIfSipKernelUsed(CommandListExecutionContext &ctx) {
NEO::Device *neoDevice = this->device->getNEODevice();
if (ctx.isDevicePreemptionModeMidThread || ctx.isNEODebuggerActive(this->device)) {
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
this->csr->makeResident(*sipIsa);
NEO::GraphicsAllocation *sipAllocation = NEO::SipKernel::getSipKernel(*neoDevice, &this->csr->getOsContext()).getSipAllocation();
this->csr->makeResident(*sipAllocation);
}
}

View File

@@ -1195,8 +1195,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
bool ret = NEO::SipKernel::initSipKernel(NEO::SipKernel::getSipKernelType(*neoDevice), *neoDevice);
UNRECOVERABLE_IF(!ret);
stateSaveAreaHeader = NEO::SipKernel::getSipKernel(*neoDevice).getStateSaveAreaHeader();
debugSurfaceSize = NEO::SipKernel::getSipKernel(*neoDevice).getStateSaveAreaSize(neoDevice);
stateSaveAreaHeader = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getStateSaveAreaHeader();
debugSurfaceSize = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getStateSaveAreaSize(neoDevice);
} else {
*returnValue = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}

View File

@@ -467,7 +467,7 @@ HWTEST_F(CommandQueueExecuteCommandLists, givenMidThreadPreemptionWhenCommandsAr
if (preemptionMode == NEO::PreemptionMode::MidThread) {
EXPECT_NE(cmdList.end(), itorSip);
auto sipAllocation = SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipAllocation = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
STATE_SIP *stateSipCmd = reinterpret_cast<STATE_SIP *>(*itorSip);
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
} else {
@@ -525,7 +525,7 @@ HWTEST2_F(CommandQueueExecuteCommandLists, givenMidThreadPreemptionWhenCommandsA
if (preemptionMode == NEO::PreemptionMode::MidThread) {
EXPECT_NE(cmdList.end(), itorSip);
auto sipAllocation = SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipAllocation = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
STATE_SIP *stateSipCmd = reinterpret_cast<STATE_SIP *>(*itorSip);
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
} else {

View File

@@ -45,7 +45,7 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingL0DebuggerThenValidDebuggerInst
}
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSipAllocationThenValidSipTypeIsReturned) {
auto systemRoutine = SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto systemRoutine = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
ASSERT_NE(nullptr, systemRoutine);
auto sipType = SipKernel::getSipKernelType(*neoDevice);
@@ -65,7 +65,7 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSipTypeThenDebugBindlessIsRetur
}
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) {
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*neoDevice).getStateSaveAreaHeader();
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*neoDevice, nullptr).getStateSaveAreaHeader();
auto sipType = SipKernel::getSipKernelType(*neoDevice);
auto &expectedStateSaveAreaHeader = neoDevice->getBuiltIns()->getSipKernel(sipType, *neoDevice).getStateSaveAreaHeader();
@@ -143,7 +143,7 @@ HWTEST_F(L0DebuggerPerContextAddressSpaceTest, givenDebuggingEnabledWhenCommandL
STATE_SIP *stateSip = genCmdCast<STATE_SIP *>(*stateSipCmds[0]);
auto systemRoutine = SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto systemRoutine = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
ASSERT_NE(nullptr, systemRoutine);
EXPECT_EQ(systemRoutine->getGpuAddressToPatch(), stateSip->getSystemInstructionPointer());
}

View File

@@ -185,7 +185,7 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateCommandListWhenExecutingWithF
EXPECT_NE(nullptr, csr.lastFlushedCommandStream);
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(commandList->csr->getOsContext().getContextId());
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
auto debugSurface = device->getDebugSurface();
EXPECT_TRUE(csr.isMadeResident(sbaBuffer));
@@ -247,7 +247,7 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateFlushTaskWhenExecutingKernelT
EXPECT_NE(nullptr, csr.lastFlushedCommandStream);
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(commandList->csr->getOsContext().getContextId());
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
auto debugSurface = device->getDebugSurface();
EXPECT_TRUE(csr.isMadeResident(sbaBuffer));
@@ -304,7 +304,7 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenInternalUsageImmediateCommandListWhenEx
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(commandList->csr->getOsContext().getContextId());
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
auto debugSurface = device->getDebugSurface();
EXPECT_FALSE(csr.isMadeResident(sbaBuffer));
@@ -513,7 +513,7 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenInternalCmdQIsUsed
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().getContextId());
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation();
auto debugSurface = device->getDebugSurface();
bool sbaFound = false;
bool sipFound = false;

View File

@@ -220,7 +220,7 @@ HWTEST2_F(SLDebuggerInternalUsageTest, givenDebuggingEnabledWhenInternalCmdQIsUs
EXPECT_EQ(0u, stateSip.size());
}
auto sipIsa = NEO::SipKernel::getSipKernel(*device).getSipAllocation();
auto sipIsa = NEO::SipKernel::getSipKernel(*device, nullptr).getSipAllocation();
auto debugSurface = deviceL0->getDebugSurface();
bool sipFound = false;
bool debugSurfaceFound = false;
@@ -281,7 +281,7 @@ TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreC
EXPECT_NE(nullptr, debugSurface);
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*deviceL0->getNEODevice()).getStateSaveAreaHeader();
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*deviceL0->getNEODevice(), nullptr).getStateSaveAreaHeader();
for (auto i = 0u; i < debugSurface->storageInfo.getNumBanks(); ++i) {
EXPECT_EQ(0, memcmp(static_cast<uint8_t *>(debugSurface->getUnderlyingBuffer()) + i * debugSurface->getUnderlyingBufferSize(),
stateSaveAreaHeader.data(), stateSaveAreaHeader.size()));