@@ -346,22 +346,31 @@ namespace IGC
346
346
/* Instance Count
347
347
** This field determines the number of threads(minus one) spawned per input patch.
348
348
349
- ** If the HS kernel uses a barrier function, software must restrict the Instance Count
350
- ** to the number of threads that can be simultaneously active within a subslice.Factors
351
- ** which must be considered includes scratch memory availability.
349
+ ** If the HS kernel uses a barrier function, software must restrict the Instance Count
350
+ ** to the number of threads that can be simultaneously active within a subslice.
351
+ ** Factors which must be considered includes scratch memory availability.
352
352
** Value Description
353
353
** [0, 15] representing[1, 16] instances */
354
354
355
- llvm::GlobalVariable* pGlobal = GetModule ()->getGlobalVariable (" TessInputControlPointCount" );
356
- unsigned int inputControlPointCount = int_cast<unsigned int >(llvm::cast<llvm::ConstantInt>(pGlobal->getInitializer ())->getZExtValue ());
355
+ // Use HS single patch if WA exists and input control points >= 29 as there are not enough registers for push constants
356
+ bool useSinglePatch = false ;
357
+ if (pCodeGenContext->platform .WaDispatchGRFHWIssueInGSAndHSUnit ())
358
+ {
359
+ llvm::GlobalVariable* pGlobal = GetModule ()->getGlobalVariable (" TessInputControlPointCount" );
360
+ if (pGlobal && pGlobal->hasInitializer ())
361
+ {
362
+ unsigned int inputControlPointCount = int_cast<unsigned int >(llvm::cast<llvm::ConstantInt>(pGlobal->getInitializer ())->getZExtValue ());
363
+ if (inputControlPointCount >= 29 )
364
+ {
365
+ useSinglePatch = true ;
366
+ }
367
+ }
368
+ }
357
369
358
- // Use HS single patch if WA exists and input control points >= 29 as not enough registers for push constants
359
- bool useSinglePatch = !(pCodeGenContext->platform .WaDispatchGRFHWIssueInGSAndHSUnit () && inputControlPointCount >= 29 );
360
-
361
370
if (pCodeGenContext->platform .useOnlyEightPatchDispatchHS () ||
362
371
(pCodeGenContext->platform .supportHSEightPatchDispatch () &&
363
372
!(m_useMultipleHardwareThread && mOutputControlPointCount >= 16 ) &&
364
- useSinglePatch &&
373
+ ! useSinglePatch &&
365
374
IGC_IS_FLAG_DISABLED (EnableHSSinglePatchDispatch)))
366
375
{
367
376
Constant* cval = llvm::ConstantInt::get (
0 commit comments