@@ -885,5 +885,69 @@ HWTEST_F(CommandQueueExecuteCommandListsSimpleTest, GivenRegisterInstructionCach
885
885
commandQueue->destroy ();
886
886
}
887
887
888
+ using CommandQueueExecuteCommandListsMultiDeviceTest = Test<MultiDeviceFixture>;
889
+
890
+ HWTEST_F (CommandQueueExecuteCommandListsMultiDeviceTest, GivenDirtyFlagForContextInBindlessHelperWhenExecutingCmdListsThenStateCacheInvalidateIsSent) {
891
+ using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
892
+ ze_command_queue_desc_t queueDesc = {};
893
+ ze_result_t returnValue;
894
+ auto neoDevice = driverHandle->devices [numRootDevices - 1 ]->getNEODevice ();
895
+ auto device = driverHandle->devices [numRootDevices - 1 ];
896
+
897
+ auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices () > 1 );
898
+ MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get ();
899
+ neoDevice->getExecutionEnvironment ()->rootDeviceEnvironments [neoDevice->getRootDeviceIndex ()]->bindlessHeapsHelper .reset (bindlessHeapsHelper.release ());
900
+
901
+ queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
902
+ auto commandQueue = whiteboxCast (CommandQueue::create (productFamily, device, neoDevice->getDefaultEngine ().commandStreamReceiver , &queueDesc, false , false , false , returnValue));
903
+ ASSERT_NE (nullptr , commandQueue);
904
+
905
+ uint32_t contextId = commandQueue->getCsr ()->getOsContext ().getContextId ();
906
+ uint32_t contextIdFirst = neoDevice->getMemoryManager ()->getFirstContextIdForRootDevice (numRootDevices - 1 );
907
+ EXPECT_LE (contextIdFirst, contextId);
908
+
909
+ uint32_t firstDeviceFirstContextId = neoDevice->getMemoryManager ()->getFirstContextIdForRootDevice (0 );
910
+ EXPECT_EQ (0u , firstDeviceFirstContextId);
911
+
912
+ bindlessHeapsHelperPtr->stateCacheDirtyForContext .set ();
913
+
914
+ auto usedSpaceBefore = commandQueue->commandStream .getUsed ();
915
+
916
+ ze_command_list_handle_t commandLists[] = {
917
+ CommandList::create (productFamily, device, NEO::EngineGroupType::renderCompute, 0u , returnValue, false )->toHandle (),
918
+ CommandList::create (productFamily, device, NEO::EngineGroupType::renderCompute, 0u , returnValue, false )->toHandle ()};
919
+ uint32_t numCommandLists = sizeof (commandLists) / sizeof (commandLists[0 ]);
920
+ CommandList::fromHandle (commandLists[0 ])->close ();
921
+ CommandList::fromHandle (commandLists[1 ])->close ();
922
+ auto result = commandQueue->executeCommandLists (numCommandLists, commandLists, nullptr , true , nullptr );
923
+
924
+ ASSERT_EQ (ZE_RESULT_SUCCESS, result);
925
+
926
+ auto usedSpaceAfter = commandQueue->commandStream .getUsed ();
927
+ ASSERT_GT (usedSpaceAfter, usedSpaceBefore);
928
+
929
+ GenCmdList cmdList;
930
+ ASSERT_TRUE (FamilyType::Parse::parseCommandBuffer (
931
+ cmdList, ptrOffset (commandQueue->commandStream .getCpuBase (), 0 ), usedSpaceAfter));
932
+
933
+ auto pipeControls = findAll<PIPE_CONTROL *>(cmdList.begin (), cmdList.end ());
934
+ ASSERT_NE (0u , pipeControls.size ());
935
+
936
+ auto pipeControl = reinterpret_cast <PIPE_CONTROL *>(*pipeControls[0 ]);
937
+ EXPECT_TRUE (pipeControl->getCommandStreamerStallEnable ());
938
+ EXPECT_TRUE (pipeControl->getStateCacheInvalidationEnable ());
939
+ EXPECT_TRUE (pipeControl->getTextureCacheInvalidationEnable ());
940
+ EXPECT_TRUE (pipeControl->getRenderTargetCacheFlushEnable ());
941
+
942
+ EXPECT_FALSE (bindlessHeapsHelperPtr->getStateDirtyForContext (commandQueue->getCsr ()->getOsContext ().getContextId ()));
943
+
944
+ for (auto i = 0u ; i < numCommandLists; i++) {
945
+ auto commandList = CommandList::fromHandle (commandLists[i]);
946
+ commandList->destroy ();
947
+ }
948
+
949
+ commandQueue->destroy ();
950
+ }
951
+
888
952
} // namespace ult
889
953
} // namespace L0
0 commit comments