@@ -473,10 +473,36 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommand
473473using CommandQueueDestroySupport = IsAtLeastProduct<IGFX_SKYLAKE>;
474474using CommandQueueDestroy = Test<DeviceFixture>;
475475
476- using CommandQueueCommands = Test<DeviceFixture>;
477- HWTEST_F (CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
476+ template <bool multiTile>
477+ struct CommandQueueCommands : DeviceFixture, ::testing::Test {
478+ void SetUp () override {
479+ DebugManager.flags .ForcePreemptionMode .set (static_cast <int >(NEO::PreemptionMode::Disabled));
480+ DebugManager.flags .CreateMultipleSubDevices .set (multiTile ? 2 : 1 );
481+ DeviceFixture::SetUp ();
482+ }
483+
484+ void TearDown () override {
485+ DeviceFixture::TearDown ();
486+ }
487+
488+ template <typename FamilyType>
489+ bool isAllocationInResidencyContainer (MockCsrHw2<FamilyType> &csr, NEO::GraphicsAllocation *graphicsAllocation) {
490+ for (auto alloc : csr.copyOfAllocations ) {
491+ if (alloc == graphicsAllocation) {
492+ return true ;
493+ }
494+ }
495+ return false ;
496+ }
497+
478498 const ze_command_queue_desc_t desc = {};
499+ DebugManagerStateRestore restore{};
500+ VariableBackup<bool > mockDeviceFlagBackup{&NEO::MockDevice::createSingleDevice, false };
501+ };
502+ using CommandQueueCommandsSingleTile = CommandQueueCommands<false >;
503+ using CommandQueueCommandsMultiTile = CommandQueueCommands<true >;
479504
505+ HWTEST_F (CommandQueueCommandsSingleTile, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
480506 MockCsrHw2<FamilyType> csr (*neoDevice->getExecutionEnvironment (), 0 , neoDevice->getDeviceBitfield ());
481507 csr.initializeTagAllocation ();
482508 csr.setupContext (*neoDevice->getDefaultEngine ().osContext );
@@ -497,20 +523,41 @@ HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHar
497523
498524 auto globalFence = csr.getGlobalFenceAllocation ();
499525 if (globalFence) {
500- bool found = false ;
501- for (auto alloc : csr.copyOfAllocations ) {
502- if (alloc == globalFence) {
503- found = true ;
504- break ;
505- }
506- }
507- EXPECT_TRUE (found);
526+ EXPECT_TRUE (isAllocationInResidencyContainer (csr, globalFence));
508527 }
509528 EXPECT_EQ (status, ZE_RESULT_SUCCESS);
510529 EXPECT_TRUE (csr.programHardwareContextCalled );
511530 commandQueue->destroy ();
512531}
513532
533+ HWTEST_F (CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenExecutingCommandListsThenWorkPartitionAllocationIsMadeResident) {
534+ MockCsrHw2<FamilyType> csr (*neoDevice->getExecutionEnvironment (), 0 , neoDevice->getDeviceBitfield ());
535+ csr.initializeTagAllocation ();
536+ csr.createWorkPartitionAllocation (*neoDevice);
537+ csr.setupContext (*neoDevice->getDefaultEngine ().osContext );
538+
539+ ze_result_t returnValue;
540+ L0::CommandQueue *commandQueue = CommandQueue::create (productFamily,
541+ device,
542+ &csr,
543+ &desc,
544+ false ,
545+ false ,
546+ returnValue);
547+ ASSERT_NE (nullptr , commandQueue);
548+
549+ std::unique_ptr<L0::CommandList> commandList (CommandList::create (productFamily, device, NEO::EngineGroupType::Compute, returnValue));
550+ auto commandListHandle = commandList->toHandle ();
551+ auto status = commandQueue->executeCommandLists (1 , &commandListHandle, nullptr , false );
552+ EXPECT_EQ (status, ZE_RESULT_SUCCESS);
553+
554+ auto workPartitionAllocation = csr.getWorkPartitionAllocation ();
555+ ASSERT_NE (nullptr , workPartitionAllocation);
556+ EXPECT_TRUE (isAllocationInResidencyContainer (csr, workPartitionAllocation));
557+
558+ commandQueue->destroy ();
559+ }
560+
514561using CommandQueueIndirectAllocations = Test<ModuleFixture>;
515562HWTEST_F (CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
516563 const ze_command_queue_desc_t desc = {};
0 commit comments