11/*
2- * Copyright (C) 2020-2024 Intel Corporation
2+ * Copyright (C) 2020-2025 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
@@ -927,7 +927,7 @@ HWTEST2_F(CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListWhenC
927927 auto immediateCmdList = static_cast <CommandListCoreFamilyImmediate<gfxCoreFamily> *>(commandList.get ());
928928 auto secondaryCmdStream = reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get ();
929929
930- immediateCmdList->checkAvailableSpace (0u , false , commonImmediateCommandSize, false );
930+ immediateCmdList->checkAvailableSpace (0u , false , commonImmediateCommandSize);
931931
932932 EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
933933 EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ()->getMemoryPool ()));
@@ -938,144 +938,6 @@ HWTEST2_F(CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListWhenC
938938 EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList ->getGraphicsAllocation ()->getMemoryPool ()));
939939}
940940
941- HWTEST2_F (CommandListCreate, givenSecondaryCommandStreamInHostMemForImmediateCmdListWhenCheckAvailableSpaceForRelaxedOrderingThenSwapCommandStreams, MatchAny) {
942- auto &gfxCoreHelper = device->getGfxCoreHelper ();
943- auto &productHelper = device->getProductHelper ();
944- if (!gfxCoreHelper.isPlatformFlushTaskEnabled (productHelper)) {
945- GTEST_SKIP ();
946- }
947- DebugManagerStateRestore restorer;
948- debugManager.flags .DirectSubmissionFlatRingBuffer .set (-1 );
949-
950- static_cast <MockMemoryManager *>(device->getNEODevice ()->getMemoryManager ())->localMemorySupported [0 ] = true ;
951- ze_command_queue_desc_t desc = {};
952- desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
953- ze_result_t returnValue;
954- CommandStreamReceiver *csr = nullptr ;
955- device->getCsrForOrdinalAndIndex (&csr, desc.ordinal , desc.index , ZE_COMMAND_QUEUE_PRIORITY_NORMAL, false );
956- reinterpret_cast <UltCommandStreamReceiver<FamilyType> *>(csr)->directSubmissionAvailable = true ;
957- std::unique_ptr<L0::CommandList> commandList (CommandList::createImmediate (productFamily, device, &desc, false , NEO::EngineGroupType::copy, returnValue));
958- ASSERT_NE (nullptr , commandList);
959- EXPECT_NE (reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get (), nullptr );
960- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList ->getGraphicsAllocation ()->getMemoryPool ()));
961-
962- auto immediateCmdList = static_cast <CommandListCoreFamilyImmediate<gfxCoreFamily> *>(commandList.get ());
963-
964- auto secondaryCmdStream = reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get ();
965-
966- immediateCmdList->getCmdContainer ().swapStreams ();
967- EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
968- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ()->getMemoryPool ()));
969-
970- immediateCmdList->checkAvailableSpace (0u , true , commonImmediateCommandSize, false );
971-
972- EXPECT_NE (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
973- }
974-
975- struct CmdContainerMockLocalAllocTests : public CommandContainer {
976- using CommandContainer::secondaryCommandStreamForImmediateCmdList;
977- };
978-
979- HWTEST2_F (CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListButNotYetUsingHostAllocWhenCallingAppendCmdlistsThenDoNotSwapCommandStreams, IsPVC) {
980- DebugManagerStateRestore restorer;
981- debugManager.flags .DirectSubmissionFlatRingBuffer .set (-1 );
982-
983- static_cast <MockMemoryManager *>(device->getNEODevice ()->getMemoryManager ())->localMemorySupported [0 ] = true ;
984- ze_command_queue_desc_t desc = {};
985- desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
986- ze_result_t returnValue;
987- CommandStreamReceiver *csr = nullptr ;
988- device->getCsrForOrdinalAndIndex (&csr, desc.ordinal , desc.index , ZE_COMMAND_QUEUE_PRIORITY_NORMAL, false );
989- reinterpret_cast <UltCommandStreamReceiver<FamilyType> *>(csr)->directSubmissionAvailable = true ;
990- std::unique_ptr<L0::CommandList> commandList (CommandList::createImmediate (productFamily, device, &desc, false , NEO::EngineGroupType::copy, returnValue));
991- ASSERT_NE (nullptr , commandList);
992- EXPECT_NE (reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get (), nullptr );
993- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList ->getGraphicsAllocation ()->getMemoryPool ()));
994-
995- auto secondaryCmdStream = reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get ();
996-
997- std::unique_ptr<L0::CommandList> commandListRegular (CommandList::create (productFamily, device, NEO::EngineGroupType::copy, 0u , returnValue, false ));
998- commandListRegular->close ();
999- auto commandListHandle = commandListRegular->toHandle ();
1000-
1001- ze_result_t result = ZE_RESULT_SUCCESS;
1002- result = commandList->appendCommandLists (1u , &commandListHandle, nullptr , 0u , nullptr );
1003- EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1004-
1005- EXPECT_NE (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
1006- EXPECT_FALSE (MemoryPoolHelper::isSystemMemoryPool (commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ()->getMemoryPool ()));
1007- }
1008-
1009- HWTEST2_F (CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListButAndUsingHostAllocWhenCallingAppendCmdlistsThenSwapCommandStreamsAndAppendSucceeds, IsAtLeastXeHpcCore) {
1010- DebugManagerStateRestore restorer;
1011- debugManager.flags .DirectSubmissionFlatRingBuffer .set (-1 );
1012-
1013- static_cast <MockMemoryManager *>(device->getNEODevice ()->getMemoryManager ())->localMemorySupported [0 ] = true ;
1014- ze_command_queue_desc_t desc = {};
1015- desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
1016- ze_result_t returnValue;
1017- CommandStreamReceiver *csr = nullptr ;
1018- device->getCsrForOrdinalAndIndex (&csr, desc.ordinal , desc.index , ZE_COMMAND_QUEUE_PRIORITY_NORMAL, false );
1019- reinterpret_cast <UltCommandStreamReceiver<FamilyType> *>(csr)->directSubmissionAvailable = true ;
1020- std::unique_ptr<L0::CommandList> commandList (CommandList::createImmediate (productFamily, device, &desc, false , NEO::EngineGroupType::copy, returnValue));
1021- ASSERT_NE (nullptr , commandList);
1022- EXPECT_NE (reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get (), nullptr );
1023- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList ->getGraphicsAllocation ()->getMemoryPool ()));
1024-
1025- auto secondaryCmdStream = reinterpret_cast <CmdContainerMockLocalAllocTests *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get ();
1026-
1027- std::unique_ptr<L0::CommandList> commandListRegular (CommandList::create (productFamily, device, NEO::EngineGroupType::compute, 0u , returnValue, false ));
1028- commandListRegular->close ();
1029- auto commandListHandle = commandListRegular->toHandle ();
1030-
1031- commandList->getCmdContainer ().swapStreams ();
1032- EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
1033-
1034- ze_result_t result = ZE_RESULT_SUCCESS;
1035- result = commandList->appendCommandLists (1u , &commandListHandle, nullptr , 0u , nullptr );
1036- EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1037-
1038- EXPECT_NE (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
1039- }
1040-
1041- HWTEST2_F (CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListAndAlreadyUsingHostAllocThenAppendingRegularCommandlistsIntoImmediateUsesLocalAndRestoresHostAlloc, MatchAny) {
1042- if (!device->getHwInfo ().featureTable .flags .ftrLocalMemory ) {
1043- GTEST_SKIP ();
1044- }
1045- DebugManagerStateRestore restorer;
1046- debugManager.flags .DirectSubmissionFlatRingBuffer .set (-1 );
1047-
1048- static_cast <MockMemoryManager *>(device->getNEODevice ()->getMemoryManager ())->localMemorySupported [0 ] = true ;
1049- ze_command_queue_desc_t desc = {};
1050- desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
1051- ze_result_t returnValue;
1052- CommandStreamReceiver *csr = nullptr ;
1053- device->getCsrForOrdinalAndIndex (&csr, desc.ordinal , desc.index , ZE_COMMAND_QUEUE_PRIORITY_NORMAL, false );
1054- reinterpret_cast <UltCommandStreamReceiver<FamilyType> *>(csr)->directSubmissionAvailable = true ;
1055- std::unique_ptr<L0::CommandList> commandList (CommandList::createImmediate (productFamily, device, &desc, false , NEO::EngineGroupType::copy, returnValue));
1056- ASSERT_NE (nullptr , commandList);
1057- EXPECT_NE (reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get (), nullptr );
1058- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList ->getGraphicsAllocation ()->getMemoryPool ()));
1059-
1060- auto immediateCmdList = static_cast <CommandListCoreFamilyImmediate<gfxCoreFamily> *>(commandList.get ());
1061- auto secondaryCmdStream = reinterpret_cast <CmdContainerMock *>(&commandList->getCmdContainer ())->secondaryCommandStreamForImmediateCmdList .get ();
1062-
1063- immediateCmdList->checkAvailableSpace (0u , false , commonImmediateCommandSize, false );
1064-
1065- EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
1066- EXPECT_TRUE (MemoryPoolHelper::isSystemMemoryPool (commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ()->getMemoryPool ()));
1067-
1068- std::unique_ptr<L0::CommandList> commandListRegular (CommandList::create (productFamily, device, NEO::EngineGroupType::copy, 0u , returnValue, false ));
1069- commandListRegular->close ();
1070- auto commandListHandle = commandListRegular->toHandle ();
1071-
1072- ze_result_t result = ZE_RESULT_SUCCESS;
1073- result = commandList->appendCommandLists (1u , &commandListHandle, nullptr , 0u , nullptr );
1074- EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1075- EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), secondaryCmdStream);
1076- EXPECT_TRUE (commandList->getCmdContainer ().usingSecondaryCmdbufInHostMem ());
1077- }
1078-
1079941HWTEST2_F (CommandListCreate, givenNoSecondaryCommandStreamForImmediateCmdListWhenCheckAvailableSpaceThenNotSwapCommandStreams, MatchAny) {
1080942 if (!device->getHwInfo ().featureTable .flags .ftrLocalMemory ) {
1081943 GTEST_SKIP ();
@@ -1094,7 +956,7 @@ HWTEST2_F(CommandListCreate, givenNoSecondaryCommandStreamForImmediateCmdListWhe
1094956 auto immediateCmdList = static_cast <CommandListCoreFamilyImmediate<gfxCoreFamily> *>(commandList.get ());
1095957 auto cmdStream = commandList->getCmdContainer ().getCommandStream ();
1096958
1097- immediateCmdList->checkAvailableSpace (0u , false , commonImmediateCommandSize, false );
959+ immediateCmdList->checkAvailableSpace (0u , false , commonImmediateCommandSize);
1098960
1099961 EXPECT_EQ (commandList->getCmdContainer ().getCommandStream (), cmdStream);
1100962 EXPECT_FALSE (MemoryPoolHelper::isSystemMemoryPool (commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ()->getMemoryPool ()));
0 commit comments