Refactor around binding table programming

Change-Id: I4cad63b11937531e36ea9d92cee606ea8941c9ef
This commit is contained in:
Chodor, Jaroslaw
2018-08-29 13:39:27 +02:00
committed by sys_ocldev
parent da0f9381dc
commit ad9710bec2
13 changed files with 60 additions and 21 deletions

View File

@@ -437,7 +437,7 @@ TEST_P(CommandQueueIndirectHeapTest, IndirectHeapContainsAtLeast64KB) {
auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), sizeof(uint32_t));
if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
EXPECT_EQ(64 * KB - MemoryConstants::pageSize, indirectHeap.getAvailableSpace());
EXPECT_EQ(pDevice->getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize, indirectHeap.getAvailableSpace());
} else {
EXPECT_EQ(64 * KB, indirectHeap.getAvailableSpace());
}
@@ -464,9 +464,10 @@ TEST_P(CommandQueueIndirectHeapTest, getIndirectHeapCanRecycle) {
ASSERT_NE(nullptr, &indirectHeap);
if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
//no matter what SSH is always capped
EXPECT_EQ(indirectHeap.getMaxAvailableSpace(), maxSshSize);
EXPECT_EQ(cmdQ.getDevice().getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize,
indirectHeap.getMaxAvailableSpace());
} else {
EXPECT_GE(indirectHeap.getMaxAvailableSpace(), requiredSize);
EXPECT_LE(requiredSize, indirectHeap.getMaxAvailableSpace());
}
}
@@ -492,6 +493,7 @@ TEST_P(CommandQueueIndirectHeapTest, MemoryManagerWithReusableAllocationsWhenAsk
CommandQueue cmdQ(context.get(), pDevice, props);
auto memoryManager = pDevice->getMemoryManager();
auto allocationSize = defaultHeapSize * 2;
GraphicsAllocation *allocation = nullptr;
@@ -501,6 +503,9 @@ TEST_P(CommandQueueIndirectHeapTest, MemoryManagerWithReusableAllocationsWhenAsk
} else {
allocation = memoryManager->allocateGraphicsMemory(allocationSize);
}
if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
allocation->setSize(cmdQ.getDevice().getCommandStreamReceiver().defaultSshSize * 2);
}
memoryManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
@@ -511,12 +516,13 @@ TEST_P(CommandQueueIndirectHeapTest, MemoryManagerWithReusableAllocationsWhenAsk
EXPECT_EQ(indirectHeap.getGraphicsAllocation(), allocation);
//if we obtain heap from reusable pool, we need to keep the size of allocation
//surface state heap is an exception, it is capped at ~60KB
// if we obtain heap from reusable pool, we need to keep the size of allocation
// surface state heap is an exception, it is capped at (max_ssh_size_for_HW - page_size)
if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
EXPECT_EQ(indirectHeap.getMaxAvailableSpace(), 64 * KB - MemoryConstants::pageSize);
EXPECT_EQ(cmdQ.getDevice().getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize,
indirectHeap.getMaxAvailableSpace());
} else {
EXPECT_EQ(indirectHeap.getMaxAvailableSpace(), allocationSize);
EXPECT_EQ(allocationSize, indirectHeap.getMaxAvailableSpace());
}
EXPECT_TRUE(memoryManager->allocationsForReuse.peekIsEmpty());

View File

@@ -820,7 +820,7 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSi
EXPECT_GE(commandStream.getAvailableSpace(), sizeRequested);
commandStream.getSpace(sizeRequested - sizeCQReserves);
GraphicsAllocation allocation((void *)0x1234, 1);
GraphicsAllocation allocation((void *)MemoryConstants::pageSize, 1);
IndirectHeap linear(&allocation);
auto blocking = true;

View File

@@ -152,3 +152,8 @@ HWTEST_F(CommandStreamReceiverHwTest, givenCsrHwWhenTypeIsCheckedThenCsrHwIsRetu
EXPECT_EQ(CommandStreamReceiverType::CSR_HW, csr->getType());
}
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverHwTest, WhenCommandStreamReceiverHwIsCreatedThenDefaultSshSizeIs64KB) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver();
EXPECT_EQ(64 * KB, commandStreamReceiver.defaultSshSize);
}

View File

@@ -39,9 +39,7 @@ class MemoryManagerWithCsrFixture {
uint32_t taskCount = 0;
uint32_t currentGpuTag = initialHardwareTag;
MemoryManagerWithCsrFixture() {
csr = std::make_unique<MockCommandStreamReceiver>(this->executionEnvironment);
}
MemoryManagerWithCsrFixture() { csr = std::make_unique<MockCommandStreamReceiver>(this->executionEnvironment, defaultHeapSize); }
~MemoryManagerWithCsrFixture() = default;

View File

@@ -422,7 +422,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
typedef CommandStreamReceiver BaseClass;
public:
CommandStreamReceiverMock() : BaseClass(*(new ExecutionEnvironment)) {
CommandStreamReceiverMock() : BaseClass(*(new ExecutionEnvironment), defaultHeapSize) {
this->mockExecutionEnvironment.reset(&this->executionEnvironment);
}

View File

@@ -230,7 +230,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
std::unique_ptr<ExecutionEnvironment> mockExecutionEnvironment;
MockCommandStreamReceiver() : CommandStreamReceiver(*(new ExecutionEnvironment)) {
MockCommandStreamReceiver() : CommandStreamReceiver(*(new ExecutionEnvironment), defaultHeapSize) {
mockExecutionEnvironment.reset(&this->executionEnvironment);
}