Skip to content

Commit 9df1932

Browse files
pguo-igcpaigeale
authored andcommitted
Favor SIMD32 if CS has barriers.
Change-Id: I31711f65eae89300126e3646269c88522ce5bb1f
1 parent 938f47b commit 9df1932

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

IGC/Compiler/CISACodeGen/CheckInstrTypes.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ CheckInstrTypes::CheckInstrTypes(IGC::SInstrTypes* instrList) : FunctionPass(ID)
7676
instrList->psHasSideEffect = false;
7777
instrList->hasDebugInfo = false;
7878
instrList->hasAtomics = false;
79+
instrList->hasBarrier = false;
7980
instrList->hasDiscard = false;
8081
instrList->mayHaveIndirectOperands = false;
8182
instrList->numSample = 0;
@@ -188,6 +189,9 @@ void CheckInstrTypes::visitCallInst(CallInst &C)
188189
case GenISAIntrinsic::GenISA_WaveShuffleIndex:
189190
g_InstrTypes->mayHaveIndirectOperands = true;
190191
break;
192+
case GenISAIntrinsic::GenISA_threadgroupbarrier:
193+
g_InstrTypes->hasBarrier = true;
194+
break;
191195
default:
192196
break;
193197
}

IGC/Compiler/CISACodeGen/ComputeShaderCodeGen.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ bool CComputeShader::CompileSIMDSize(SIMDMode simdMode, EmitPass &EP, llvm::Func
610610

611611
float occu16 = ctx->GetThreadOccupancy(SIMDMode::SIMD16);
612612
float occu32 = ctx->GetThreadOccupancy(SIMDMode::SIMD32);
613-
if (occu32 > occu16 && !ctx->isSecondCompile)
613+
if (!ctx->isSecondCompile &&
614+
(occu32 > occu16 ||
615+
(occu32 == occu16 && ctx->m_instrTypes.hasBarrier)))
614616
{
615617
return true;
616618
}

IGC/Compiler/CodeGenPublic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ namespace IGC
142142
bool hasGenericAddressSpacePointers;
143143
bool hasDebugInfo; //<! true only if module contains debug info !llvm.dbg.cu
144144
bool hasAtomics;
145+
bool hasBarrier; //<! true if module has thread group barrier
145146
bool hasDiscard;
146147
bool mayHaveIndirectOperands; //<! true if code may have indirect operands like r5[a0].
147148
unsigned int numSample;

0 commit comments

Comments
 (0)