@@ -992,18 +992,25 @@ struct MockHeapHelper : public HeapHelper {
992
992
using HeapHelper::storageForReuse;
993
993
};
994
994
995
- TEST_F (CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsThenAllocListsNotEmpty ) {
995
+ TEST_F (CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsThenAllocListsNotEmptyAndMadeResident ) {
996
996
DebugManagerStateRestore dbgRestore;
997
997
DebugManager.flags .SetAmountOfReusableAllocations .set (1 );
998
998
auto cmdContainer = std::make_unique<CommandContainer>();
999
+ auto csr = pDevice->getDefaultEngine ().commandStreamReceiver ;
1000
+
999
1001
AllocationsList allocList;
1000
1002
cmdContainer->initialize (pDevice, &allocList, true );
1003
+ cmdContainer->setImmediateCmdListCsr (csr);
1004
+ auto heapHelper = reinterpret_cast <MockHeapHelper *>(cmdContainer->getHeapHelper ());
1001
1005
1002
1006
EXPECT_TRUE (allocList.peekIsEmpty ());
1003
- EXPECT_TRUE (reinterpret_cast <MockHeapHelper *>(cmdContainer->getHeapHelper ())->storageForReuse ->getAllocationsForReuse ().peekIsEmpty ());
1007
+ EXPECT_TRUE (heapHelper->storageForReuse ->getAllocationsForReuse ().peekIsEmpty ());
1008
+ auto actualResidencyContainerSize = cmdContainer->getResidencyContainer ().size ();
1004
1009
cmdContainer->fillReusableAllocationLists ();
1005
1010
EXPECT_FALSE (allocList.peekIsEmpty ());
1006
- EXPECT_FALSE (reinterpret_cast <MockHeapHelper *>(cmdContainer->getHeapHelper ())->storageForReuse ->getAllocationsForReuse ().peekIsEmpty ());
1011
+ EXPECT_FALSE (heapHelper->storageForReuse ->getAllocationsForReuse ().peekIsEmpty ());
1012
+ EXPECT_EQ (heapHelper->storageForReuse ->getAllocationsForReuse ().peekHead ()->getResidencyTaskCount (csr->getOsContext ().getContextId ()), 1u );
1013
+ EXPECT_EQ (cmdContainer->getResidencyContainer ().size (), actualResidencyContainerSize + 1 );
1007
1014
1008
1015
cmdContainer.reset ();
1009
1016
allocList.freeAllGraphicsAllocations (pDevice);
@@ -1013,9 +1020,12 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
1013
1020
DebugManagerStateRestore dbgRestore;
1014
1021
DebugManager.flags .SetAmountOfReusableAllocations .set (1 );
1015
1022
auto cmdContainer = std::make_unique<CommandContainer>();
1023
+ auto csr = pDevice->getDefaultEngine ().commandStreamReceiver ;
1024
+
1016
1025
AllocationsList allocList;
1017
1026
cmdContainer->enableHeapSharing ();
1018
1027
cmdContainer->initialize (pDevice, &allocList, true );
1028
+ cmdContainer->setImmediateCmdListCsr (csr);
1019
1029
1020
1030
auto &reusableHeapsList = reinterpret_cast <MockHeapHelper *>(cmdContainer->getHeapHelper ())->storageForReuse ->getAllocationsForReuse ();
1021
1031
@@ -1031,9 +1041,11 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
1031
1041
TEST_F (CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWithBindlessModeEnabledThenOnlyOneHeapFilled) {
1032
1042
DebugManagerStateRestore dbgRestore;
1033
1043
DebugManager.flags .SetAmountOfReusableAllocations .set (1 );
1044
+ auto csr = pDevice->getDefaultEngine ().commandStreamReceiver ;
1034
1045
auto cmdContainer = std::make_unique<CommandContainer>();
1035
1046
AllocationsList allocList;
1036
1047
cmdContainer->initialize (pDevice, &allocList, true );
1048
+ cmdContainer->setImmediateCmdListCsr (csr);
1037
1049
1038
1050
auto &reusableHeapsList = reinterpret_cast <MockHeapHelper *>(cmdContainer->getHeapHelper ())->storageForReuse ->getAllocationsForReuse ();
1039
1051
@@ -1067,8 +1079,10 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
1067
1079
DebugManagerStateRestore dbgRestore;
1068
1080
DebugManager.flags .SetAmountOfReusableAllocations .set (10 );
1069
1081
auto cmdContainer = std::make_unique<CommandContainer>();
1082
+ auto csr = pDevice->getDefaultEngine ().commandStreamReceiver ;
1070
1083
AllocationsList allocList;
1071
1084
cmdContainer->initialize (pDevice, &allocList, false );
1085
+ cmdContainer->setImmediateCmdListCsr (csr);
1072
1086
1073
1087
EXPECT_TRUE (allocList.peekIsEmpty ());
1074
1088
cmdContainer->fillReusableAllocationLists ();
@@ -1106,8 +1120,10 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsAnd
1106
1120
DebugManagerStateRestore dbgRestore;
1107
1121
DebugManager.flags .SetAmountOfReusableAllocations .set (0 );
1108
1122
auto cmdContainer = std::make_unique<CommandContainer>();
1123
+ auto csr = pDevice->getDefaultEngine ().commandStreamReceiver ;
1109
1124
AllocationsList allocList;
1110
1125
cmdContainer->initialize (pDevice, &allocList, false );
1126
+ cmdContainer->setImmediateCmdListCsr (csr);
1111
1127
1112
1128
EXPECT_TRUE (allocList.peekIsEmpty ());
1113
1129
cmdContainer->fillReusableAllocationLists ();
0 commit comments