fix: noop close call on immediate command lists

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-08-10 16:51:18 +00:00
committed by Compute-Runtime-Automation
parent 79ea10ec98
commit 2f43ff28c3
5 changed files with 34 additions and 9 deletions

View File

@ -261,7 +261,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::executeCommandListImmediate(bo
template <GFXCORE_FAMILY gfxCoreFamily>
inline ze_result_t CommandListCoreFamily<gfxCoreFamily>::executeCommandListImmediateImpl(bool performMigration, L0::CommandQueue *cmdQImmediate) {
this->close();
CommandListCoreFamily<gfxCoreFamily>::close();
ze_command_list_handle_t immediateHandle = this->toHandle();
this->commandContainer.removeDuplicatesFromResidencyContainer();

View File

@ -151,6 +151,10 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
ze_result_t hostSynchronize(uint64_t timeout) override;
ze_result_t close() override {
return ZE_RESULT_SUCCESS;
}
MOCKABLE_VIRTUAL ze_result_t executeCommandListImmediateWithFlushTask(bool performMigration, bool hasStallingCmds, bool hasRelaxedOrderingDependencies, bool kernelOperation);
ze_result_t executeCommandListImmediateWithFlushTaskImpl(bool performMigration, bool hasStallingCmds, bool hasRelaxedOrderingDependencies, bool kernelOperation, CommandQueue *cmdQ);

View File

@ -196,6 +196,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
struct MockCommandListImmediate : public CommandListCoreFamilyImmediate<gfxCoreFamily> {
using BaseClass = CommandListCoreFamilyImmediate<gfxCoreFamily>;
using BaseClass::checkAssert;
using BaseClass::cmdListCurrentStartOffset;
using BaseClass::cmdQImmediate;
using BaseClass::commandContainer;
using BaseClass::compactL3FlushEventPacket;

View File

@ -1432,5 +1432,22 @@ HWTEST2_F(ImmediateCmdListSharedHeapsImmediateFlushTaskTest,
EXPECT_TRUE(sbaCmd->getGeneralStateBaseAddressModifyEnable());
}
using ImmediateCommandListTest = Test<ModuleMutableCommandListFixture>;
HWTEST2_F(ImmediateCommandListTest, givenImmediateCommandListWhenClosingCommandListThenExpectNoEndingCmdDispatched, IsAtLeastSkl) {
std::unique_ptr<L0::CommandList> commandList;
const ze_command_queue_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
ze_result_t returnValue;
commandList.reset(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Compute, returnValue));
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
auto &commandListImmediate = static_cast<MockCommandListImmediate<gfxCoreFamily> &>(*commandList);
returnValue = commandListImmediate.close();
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
auto &commandContainer = commandListImmediate.commandContainer;
EXPECT_EQ(0u, commandContainer.getCommandStream()->getUsed());
}
} // namespace ult
} // namespace L0

View File

@ -549,7 +549,6 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
}
HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigratedSharedAllocationsSetWhenPrefetchApiIsCalledForUnifiedSharedMemoryOnCmdListCopyOnlyThenCallMigrateAllocationsToGpu, IsXeHpcCore) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using POSTSYNC_DATA = typename FamilyType::POSTSYNC_DATA;
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
@ -563,17 +562,18 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
createKernel();
ze_result_t returnValue;
ze_command_queue_desc_t queueDesc = {};
ze_command_queue_desc_t queueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
ze_command_list_flags_t cmdListFlags = {};
ze_command_list_handle_t commandListHandle = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)->toHandle();
auto commandList = CommandList::fromHandle(commandListHandle);
auto commandList = CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, cmdListFlags, returnValue);
auto commandListHandle = commandList->toHandle();
auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, true, returnValue);
ze_event_pool_desc_t eventPoolDesc = {};
ze_event_pool_desc_t eventPoolDesc = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
ze_event_desc_t eventDesc = {ZE_STRUCTURE_TYPE_EVENT_DESC};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, returnValue));
@ -585,8 +585,8 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
void *srcPtr = nullptr;
void *dstPtr = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
ze_host_mem_alloc_desc_t hostDesc = {};
ze_device_mem_alloc_desc_t deviceDesc = {ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC};
ze_host_mem_alloc_desc_t hostDesc = {ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC};
auto result = context->allocSharedMem(device->toHandle(), &deviceDesc, &hostDesc, size, alignment, &srcPtr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@ -608,6 +608,9 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
result = commandList->appendMemoryCopy(dstPtr, srcPtr, size, event->toHandle(), 0, nullptr, false, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList->close();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, true);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);