[14/n] Internal 4GB allocator

- call make resident on sip kernel allocation.

Change-Id: I9c9af5ed4cec3e8b05decac7228658358ef1562b
This commit is contained in:
Mrozek, Michal
2018-03-12 17:18:00 +01:00
committed by sys_ocldev
parent 5eb96ade7a
commit 00ae077913
2 changed files with 66 additions and 0 deletions

View File

@@ -306,6 +306,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
if (preemptionCsrAllocation)
makeResident(*preemptionCsrAllocation);
if (dispatchFlags.preemptionMode == PreemptionMode::MidThread) {
makeResident(*BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *device).getSipAllocation());
}
// If the CSR has work in its CS, flush it before the task
bool submitTask = commandStreamStartTask != commandStreamTask.getUsed();
bool submitCSR = commandStreamStartCSR != commandStreamCSR.getUsed();

View File

@@ -330,6 +330,68 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu
EXPECT_EQ(expectedUsedSize, commandStream.getUsed());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(mockCsr);
mockCsr->overrideDispatchPolicy(CommandStreamReceiver::DispatchMode::BatchedDispatch);
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
DispatchFlags dispatchFlags;
dispatchFlags.preemptionMode = PreemptionMode::MidThread;
mockCsr->flushTask(commandStream,
0,
dsh,
ih,
ioh,
ssh,
taskLevel,
dispatchFlags);
auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
auto sipAllocation = BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *pDevice).getSipAllocation();
bool found = false;
for (auto allocation : cmdBuffer->surfaces) {
if (allocation == sipAllocation) {
found = true;
break;
}
}
EXPECT_TRUE(found);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
pDevice->resetCommandStreamReceiver(mockCsr);
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
DispatchFlags dispatchFlags;
dispatchFlags.preemptionMode = PreemptionMode::MidThread;
mockCsr->flushTask(commandStream,
0,
dsh,
ih,
ioh,
ssh,
taskLevel,
dispatchFlags);
auto sipAllocation = BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *pDevice).getSipAllocation();
bool found = false;
for (auto allocation : mockCsr->copyOfAllocations) {
if (allocation == sipAllocation) {
found = true;
break;
}
}
EXPECT_TRUE(found);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, sameTaskLevelShouldntSendAPipeControl) {
WhitelistedRegisters forceRegs = {0};
pDevice->setForceWhitelistedRegs(true, &forceRegs);