[17/n] Internal 4GB allocator.

- Make sure that blocks ISA is made resident
- both blocked & non blocked path
- fix a bug where private surface was not made resident in blocked path.

Change-Id: Ie564595b176b94ecc7c79d7efeae20598c5874fb
This commit is contained in:
Mrozek, Michal
2018-03-27 09:24:26 +02:00
committed by sys_ocldev
parent 51fdd2a18f
commit 09923fcb39
6 changed files with 107 additions and 9 deletions

View File

@ -125,7 +125,6 @@ HWTEST_P(ParentKernelEnqueueTest, givenParentKernelWhenEnqueuedThenDeviceQueueDS
}
HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithPrivateSurfaceWhenEnqueueKernelCalledThenResidencyCountIncreased) {
if (pDevice->getSupportedClVersion() >= 20) {
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
@ -141,6 +140,89 @@ HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithPrivateSurfaceWhenEnqueue
}
}
HWTEST_P(ParentKernelEnqueueTest, GivenBlocksWithPrivateMemoryWhenEnqueueKernelThatIsBlockedByUserEventIsCalledThenPrivateAllocationIsMadeResidentWhenEventUnblocks) {
if (pDevice->getSupportedClVersion() >= 20) {
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
auto blockKernelManager = pKernel->getProgram()->getBlockKernelManager();
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.storeMakeResidentAllocations = true;
auto privateAllocation = csr.getMemoryManager()->allocateGraphicsMemory(10);
blockKernelManager->pushPrivateSurface(privateAllocation, 0);
UserEvent uEvent(pContext);
auto clEvent = static_cast<cl_event>(&uEvent);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, gws, 1, &clEvent, nullptr);
EXPECT_FALSE(csr.isMadeResident(privateAllocation));
uEvent.setStatus(CL_COMPLETE);
EXPECT_TRUE(csr.isMadeResident(privateAllocation));
}
}
HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithBlocksWhenEnqueueKernelIsCalledThenBlockKernelIsaAllocationIsMadeResident) {
if (pDevice->getSupportedClVersion() >= 20) {
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
auto blockKernelManager = pKernel->getProgram()->getBlockKernelManager();
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.storeMakeResidentAllocations = true;
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, gws, 0, nullptr, nullptr);
auto blockCount = blockKernelManager->getCount();
for (auto blockId = 0u; blockId < blockCount; blockId++) {
EXPECT_TRUE(csr.isMadeResident(blockKernelManager->getBlockKernelInfo(blockId)->getGraphicsAllocation()));
}
}
}
HWTEST_P(ParentKernelEnqueueTest, GivenBlockKernelManagerFilledWithBlocksWhenMakeInternalAllocationsResidentIsCalledThenAllSurfacesAreMadeResident) {
if (pDevice->getSupportedClVersion() >= 20) {
auto blockKernelManager = pKernel->getProgram()->getBlockKernelManager();
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.storeMakeResidentAllocations = true;
blockKernelManager->makeInternalAllocationsResident(csr);
auto blockCount = blockKernelManager->getCount();
for (auto blockId = 0u; blockId < blockCount; blockId++) {
EXPECT_TRUE(csr.isMadeResident(blockKernelManager->getBlockKernelInfo(blockId)->getGraphicsAllocation()));
}
}
}
HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithBlocksWhenEnqueueKernelThatIsBlockedByUserEventIsCalledThenBlockKernelIsaAllocationIsMadeResidentWhenEventUnblocks) {
if (pDevice->getSupportedClVersion() >= 20) {
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
auto blockKernelManager = pKernel->getProgram()->getBlockKernelManager();
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.storeMakeResidentAllocations = true;
UserEvent uEvent(pContext);
auto clEvent = static_cast<cl_event>(&uEvent);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, gws, 1, &clEvent, nullptr);
auto blockCount = blockKernelManager->getCount();
for (auto blockId = 0u; blockId < blockCount; blockId++) {
EXPECT_FALSE(csr.isMadeResident(blockKernelManager->getBlockKernelInfo(blockId)->getGraphicsAllocation()));
}
uEvent.setStatus(CL_COMPLETE);
for (auto blockId = 0u; blockId < blockCount; blockId++) {
EXPECT_TRUE(csr.isMadeResident(blockKernelManager->getBlockKernelInfo(blockId)->getGraphicsAllocation()));
}
}
}
HWTEST_P(ParentKernelEnqueueTest, givenParentKernelWhenEnqueuedSecondTimeThenDeviceQueueDSHIsResetToInitialOffset) {
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;