5
5
*
6
6
*/
7
7
8
+ #include " shared/source/command_container/implicit_scaling.h"
8
9
#include " shared/source/command_container/walker_partition_xehp_and_later.h"
9
10
#include " shared/source/command_stream/linear_stream.h"
10
11
#include " shared/source/gmm_helper/gmm_helper.h"
@@ -1066,8 +1067,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
1066
1067
memoryManager->freeGraphicsMemory (kernel->kernelInfo .kernelAllocation );
1067
1068
}
1068
1069
1069
- HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenWalkerPartitionIsOnThenSizeIsProperlyEstimated ) {
1070
+ HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeControlIsRequiredWhenWalkerPartitionIsOnThenSizeIsProperlyEstimated ) {
1070
1071
DebugManager.flags .EnableWalkerPartition .set (1u );
1072
+ VariableBackup<bool > pipeControlConfigBackup (&ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired (), true );
1071
1073
UltClDeviceFactory deviceFactory{1 , 2 };
1072
1074
MockClDevice *device = deviceFactory.rootDevices [0 ];
1073
1075
MockContext context{device};
@@ -1122,6 +1124,63 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenWalkerPart
1122
1124
EXPECT_EQ (returnedSize, partitionSize + baseSize);
1123
1125
}
1124
1126
1127
+ HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeControlIsNotRequiredWhenWalkerPartitionIsOnThenSizeIsProperlyEstimated) {
1128
+ DebugManager.flags .EnableWalkerPartition .set (1u );
1129
+ VariableBackup<bool > pipeControlConfigBackup (&ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired (), false );
1130
+ UltClDeviceFactory deviceFactory{1 , 2 };
1131
+ MockClDevice *device = deviceFactory.rootDevices [0 ];
1132
+ MockContext context{device};
1133
+
1134
+ auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(&context, device, nullptr );
1135
+ auto &csr = cmdQ->getUltCommandStreamReceiver ();
1136
+
1137
+ size_t numPipeControls = MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired (device->getHardwareInfo ()) ? 2 : 1 ;
1138
+
1139
+ auto baseSize = sizeof (typename FamilyType::COMPUTE_WALKER) +
1140
+ (sizeof (typename FamilyType::PIPE_CONTROL) * numPipeControls) +
1141
+ HardwareCommandsHelper<FamilyType>::getSizeRequiredCS () +
1142
+ EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch (kernel->kernelInfo .heapInfo .KernelHeapSize );
1143
+
1144
+ DispatchInfo dispatchInfo{};
1145
+ dispatchInfo.setNumberOfWorkgroups ({32 , 1 , 1 });
1146
+
1147
+ WalkerPartition::WalkerPartitionArgs testArgs = {};
1148
+ testArgs.initializeWparidRegister = true ;
1149
+ testArgs.crossTileAtomicSynchronization = false ;
1150
+ testArgs.emitPipeControlStall = false ;
1151
+ testArgs.partitionCount = 2u ;
1152
+ testArgs.tileCount = static_cast <uint32_t >(device->getDeviceBitfield ().count ());
1153
+
1154
+ DebugManager.flags .SynchronizeWalkerInWparidMode .set (0 );
1155
+ testArgs.staticPartitioning = false ;
1156
+ testArgs.synchronizeBeforeExecution = false ;
1157
+ csr.staticWorkPartitioningEnabled = false ;
1158
+ auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType>(testArgs);
1159
+ auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS (CL_COMMAND_NDRANGE_KERNEL, false , false , *cmdQ.get (), kernel->mockKernel , dispatchInfo);
1160
+ EXPECT_EQ (returnedSize, partitionSize + baseSize);
1161
+
1162
+ testArgs.staticPartitioning = true ;
1163
+ csr.staticWorkPartitioningEnabled = true ;
1164
+ partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType>(testArgs);
1165
+ returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS (CL_COMMAND_NDRANGE_KERNEL, false , false , *cmdQ.get (), kernel->mockKernel , dispatchInfo);
1166
+ EXPECT_EQ (returnedSize, partitionSize + baseSize);
1167
+
1168
+ DebugManager.flags .SynchronizeWalkerInWparidMode .set (1 );
1169
+ testArgs.synchronizeBeforeExecution = true ;
1170
+ testArgs.staticPartitioning = false ;
1171
+ csr.staticWorkPartitioningEnabled = false ;
1172
+ partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType>(testArgs);
1173
+ returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS (CL_COMMAND_NDRANGE_KERNEL, false , false , *cmdQ.get (), kernel->mockKernel , dispatchInfo);
1174
+ EXPECT_EQ (returnedSize, partitionSize + baseSize);
1175
+
1176
+ testArgs.synchronizeBeforeExecution = true ;
1177
+ testArgs.staticPartitioning = true ;
1178
+ csr.staticWorkPartitioningEnabled = true ;
1179
+ partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType>(testArgs);
1180
+ returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS (CL_COMMAND_NDRANGE_KERNEL, false , false , *cmdQ.get (), kernel->mockKernel , dispatchInfo);
1181
+ EXPECT_EQ (returnedSize, partitionSize + baseSize);
1182
+ }
1183
+
1125
1184
HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenWalkerPartitionIsDisabledThenSizeIsProperlyEstimated) {
1126
1185
DebugManager.flags .EnableWalkerPartition .set (0u );
1127
1186
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get (), device.get (), nullptr );
@@ -1157,8 +1216,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenPipeContro
1157
1216
EXPECT_EQ (returnedSize, baseSize);
1158
1217
}
1159
1218
1160
- HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenQueueIsMultiEngineCapableThenWalkerPartitionsAreEstimated ) {
1219
+ HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeControlIsRequiredWhenQueueIsMultiEngineCapableThenWalkerPartitionsAreEstimated ) {
1161
1220
DebugManager.flags .EnableWalkerPartition .set (1u );
1221
+ VariableBackup<bool > pipeControlConfigBackup (&ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired (), true );
1162
1222
1163
1223
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get (), device.get (), nullptr );
1164
1224
@@ -1185,6 +1245,35 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenQueueIsMul
1185
1245
EXPECT_EQ (returnedSize, partitionSize + baseSize);
1186
1246
}
1187
1247
1248
+ HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeControlIsNotRequiredWhenQueueIsMultiEngineCapableThenWalkerPartitionsAreEstimated) {
1249
+ DebugManager.flags .EnableWalkerPartition .set (1u );
1250
+ VariableBackup<bool > pipeControlConfigBackup (&ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired (), false );
1251
+
1252
+ auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get (), device.get (), nullptr );
1253
+
1254
+ size_t numPipeControls = MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired (device->getHardwareInfo ()) ? 2 : 1 ;
1255
+
1256
+ auto baseSize = sizeof (typename FamilyType::COMPUTE_WALKER) +
1257
+ (sizeof (typename FamilyType::PIPE_CONTROL) * numPipeControls) +
1258
+ HardwareCommandsHelper<FamilyType>::getSizeRequiredCS () +
1259
+ EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch (kernel->kernelInfo .heapInfo .KernelHeapSize );
1260
+
1261
+ WalkerPartition::WalkerPartitionArgs testArgs = {};
1262
+ testArgs.initializeWparidRegister = true ;
1263
+ testArgs.emitPipeControlStall = false ;
1264
+ testArgs.crossTileAtomicSynchronization = false ;
1265
+ testArgs.partitionCount = 16u ;
1266
+ testArgs.tileCount = static_cast <uint32_t >(device->getDeviceBitfield ().count ());
1267
+
1268
+ auto partitionSize = WalkerPartition::estimateSpaceRequiredInCommandBuffer<FamilyType>(testArgs);
1269
+
1270
+ DispatchInfo dispatchInfo{};
1271
+ dispatchInfo.setNumberOfWorkgroups ({32 , 1 , 1 });
1272
+
1273
+ auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS (CL_COMMAND_NDRANGE_KERNEL, false , false , *cmdQ.get (), kernel->mockKernel , dispatchInfo);
1274
+ EXPECT_EQ (returnedSize, partitionSize + baseSize);
1275
+ }
1276
+
1188
1277
HWCMDTEST_F (IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenProgramWalkerIsCalledThenWalkerPartitionLogicIsExecuted) {
1189
1278
if (!OSInterface::osEnableLocalMemory) {
1190
1279
GTEST_SKIP ();
0 commit comments