Add more cmdlist tests

Related-To: NEO-4515

Change-Id: Idc0e0cdab97cb1a2437c212cbe8ae2bcf673125f
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2020-03-27 10:05:00 +01:00 committed by sys_ocldev
parent 000f8bdd65
commit 6dc5810c7f
3 changed files with 38 additions and 3 deletions

View File

@ -118,12 +118,12 @@ void CommandQueueImp::CommandBufferManager::initialize(Device *device, size_t si
false,
NEO::SubDevice::unspecifiedSubDeviceIndex};
buffers[BUFFER_ALLOCATION::FIRST] = device->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
buffers[BUFFER_ALLOCATION::FIRST] = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
UNRECOVERABLE_IF(nullptr == buffers[BUFFER_ALLOCATION::FIRST]);
memset(buffers[BUFFER_ALLOCATION::FIRST]->getUnderlyingBuffer(), 0, buffers[BUFFER_ALLOCATION::FIRST]->getUnderlyingBufferSize());
buffers[BUFFER_ALLOCATION::SECOND] = device->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
buffers[BUFFER_ALLOCATION::SECOND] = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
UNRECOVERABLE_IF(nullptr == buffers[BUFFER_ALLOCATION::SECOND]);
memset(buffers[BUFFER_ALLOCATION::SECOND]->getUnderlyingBuffer(), 0, buffers[BUFFER_ALLOCATION::SECOND]->getUnderlyingBufferSize());

View File

@ -43,7 +43,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::createFence(const ze_fence_desc_t *de
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandQueueHw<gfxCoreFamily>::destroy() {
delete commandStream;
buffers.destroy(this->getDevice()->getDriverHandle()->getMemoryManager());
buffers.destroy(this->getDevice()->getNEODevice()->getMemoryManager());
delete this;
return ZE_RESULT_SUCCESS;
}

View File

@ -62,5 +62,40 @@ TEST_F(CommandListCreate, givenRegularCommandListThenDefaultNumIddPerBlockIsUsed
const uint32_t defaultNumIdds = CommandList::defaultNumIddsPerBlock;
EXPECT_EQ(defaultNumIdds, commandList->commandContainer.getNumIddPerBlock());
}
TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device.get(), &desc, false));
ASSERT_NE(nullptr, commandList);
const uint32_t cmdListImmediateIdds = CommandList::commandListimmediateIddsPerBlock;
EXPECT_EQ(cmdListImmediateIdds, commandList->commandContainer.getNumIddPerBlock());
}
TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateCommandQueueCreated) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device.get(), &desc, false));
ASSERT_NE(nullptr, commandList);
EXPECT_EQ(device.get(), commandList->device);
EXPECT_EQ(1u, commandList->cmdListType);
EXPECT_NE(nullptr, commandList->cmdQImmediate);
}
TEST_F(CommandListCreate, givenInvalidProductFamilyThenReturnsNullPointer) {
std::unique_ptr<L0::CommandList> commandList(CommandList::create(IGFX_UNKNOWN, device.get()));
EXPECT_EQ(nullptr, commandList);
}
} // namespace ult
} // namespace L0