Reserve SSH space for bindless mode

Related-To: NEO-4767

Change-Id: Id7876ea5a5a4fc12ab0b3192548b006fc1eea75c
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-07-15 09:10:22 +02:00
committed by sys_ocldev
parent b3813d9a63
commit ca39301ed8
12 changed files with 148 additions and 42 deletions

View File

@@ -282,6 +282,25 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu
}
}
HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelAndNotUsedSSHWhenEnqueuedThenSSHIsNotReallocated) {
if (std::string(pPlatform->getClDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.") != std::string::npos) {
const size_t globalOffsets[3] = {0, 0, 0};
const size_t workItems[3] = {1, 1, 1};
pKernel->createReflectionSurface();
MockMultiDispatchInfo multiDispatchInfo(pKernel);
auto ssh = &getIndirectHeap<FamilyType, IndirectHeap::SURFACE_STATE>(*pCmdQ, multiDispatchInfo);
ssh->replaceBuffer(ssh->getCpuBase(), ssh->getMaxAvailableSpace());
pCmdQ->enqueueKernel(pKernel, 1, globalOffsets, workItems, workItems, 0, nullptr, nullptr);
auto ssh2 = &getIndirectHeap<FamilyType, IndirectHeap::SURFACE_STATE>(*pCmdQ, multiDispatchInfo);
EXPECT_EQ(ssh, ssh2);
EXPECT_EQ(ssh->getGraphicsAllocation(), ssh2->getGraphicsAllocation());
}
}
HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueuedThenBlocksSurfaceStatesAreCopied) {
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
@@ -307,10 +326,10 @@ HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelEnqueueTest, givenParentKernelWhenEnqueu
// will be coies
ssh->align(BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
// mark the assumed place for surface states
size_t parentSshOffset = ssh->getUsed();
pCmdQ->enqueueKernel(pKernel, 1, globalOffsets, workItems, workItems, 0, nullptr, nullptr);
// mark the assumed place for surface states
size_t parentSshOffset = 0;
ssh = &getIndirectHeap<FamilyType, IndirectHeap::SURFACE_STATE>(*pCmdQ, multiDispatchInfo);
void *blockSSH = ptrOffset(ssh->getCpuBase(), parentSshOffset + parentKernelSSHSize); // note : unaligned at this point

View File

@@ -371,7 +371,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MockParentKernelDispatch, GivenUsedSSHHeapWhenParent
nullptr,
CL_COMMAND_NDRANGE_KERNEL);
EXPECT_EQ(UnitTestHelper<FamilyType>::getDefaultSshUsage(), ssh.getUsed());
EXPECT_EQ(0u, ssh.getUsed());
delete mockParentKernel;
}

View File

@@ -297,7 +297,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenParentKernelWh
delete parentKernel;
}
HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQueueHeapshenParentKernelIsSubmittedThenQueueHeapsAreNotUsed) {
HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQueueHeapsWhenParentKernelIsSubmittedThenQueueHeapsAreNotUsed) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
cl_queue_properties properties[3] = {0};
@@ -330,6 +330,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQue
queueDsh.getSpace(usedSize);
queueIoh.getSpace(usedSize);
auto intialSshUsed = queueSsh.getUsed();
auto cmdStreamAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), 4096, GraphicsAllocation::AllocationType::COMMAND_BUFFER, device->getDeviceBitfield()});
auto blockedCommandData = std::make_unique<KernelOperation>(new LinearStream(cmdStreamAllocation),
*pCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
@@ -345,7 +347,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQue
EXPECT_FALSE(cmdQ.releaseIndirectHeapCalled);
EXPECT_EQ(usedSize, queueDsh.getUsed());
EXPECT_EQ(usedSize, queueIoh.getUsed());
EXPECT_EQ(usedSize, queueSsh.getUsed());
EXPECT_EQ(intialSshUsed, queueSsh.getUsed());
delete cmdComputeKernel;
delete parentKernel;
@@ -372,8 +374,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenNotUsedSSHWhen
pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, sshSize, ssh);
dsh->getSpace(mockDevQueue.getDshOffset());
EXPECT_EQ(0u, ssh->getUsed());
pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, sshSize);
void *sshBuffer = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u).getCpuBase();