Skip to content

Commit 76c7312

Browse files
bgajdaINTCigcbot
authored andcommitted
Extend capability of wavePrefix.
Extend capability of wavePrefix.
1 parent 8cf46f9 commit 76c7312

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21755,7 +21755,10 @@ static void GetReductionOp(WaveOps op, Type* opndTy, uint64_t& identity, e_opcod
2175521755

2175621756
void EmitPass::emitWavePrefix(WavePrefixIntrinsic* I)
2175721757
{
21758-
bool disableHelperLanes = int_cast<int>(cast<ConstantInt>(I->getArgOperand(4))->getSExtValue()) == 2;
21758+
auto helperLanes = int_cast<int>( cast<ConstantInt>( I->getArgOperand( 4 ) )->getSExtValue() );
21759+
bool disableHelperLanes = (helperLanes == 2);
21760+
bool getFullPrefix = ( helperLanes == 4 );
21761+
2175921762
if (disableHelperLanes)
2176021763
{
2176121764
ForceDMask();
@@ -21771,7 +21774,7 @@ void EmitPass::emitWavePrefix(WavePrefixIntrinsic* I)
2177121774
}
2177221775
m_encoder->SetSubSpanDestination(false);
2177321776
emitScan(
21774-
I->getSrc(), I->getOpKind(), I->isInclusiveScan(), Mask, false);
21777+
I->getSrc(), I->getOpKind(), I->isInclusiveScan(), Mask, false, getFullPrefix );
2177521778
if (disableHelperLanes)
2177621779
{
2177721780
ResetVMask();
@@ -21786,7 +21789,7 @@ void EmitPass::emitQuadPrefix(QuadPrefixIntrinsic* I)
2178621789

2178721790
void EmitPass::emitScan(
2178821791
Value* Src, IGC::WaveOps Op,
21789-
bool isInclusiveScan, Value* Mask, bool isQuad)
21792+
bool isInclusiveScan, Value* Mask, bool isQuad, bool noMask)
2179021793
{
2179121794
VISA_Type type;
2179221795
e_opcode opCode;
@@ -21801,11 +21804,19 @@ void EmitPass::emitScan(
2180121804
false, src, dst, Flag,
2180221805
!isInclusiveScan, isQuad);
2180321806

21804-
// Now that we've computed the result in temporary registers,
21805-
// make sure we only write the results to lanes participating in the
21806-
// scan as specified by 'mask'.
21807-
if (Flag)
21808-
m_encoder->SetPredicate(Flag);
21807+
if(noMask)
21808+
{
21809+
m_encoder->SetNoMask();
21810+
}
21811+
else
21812+
{
21813+
// Now that we've computed the result in temporary registers,
21814+
// make sure we only write the results to lanes participating in the
21815+
// scan as specified by 'mask'.
21816+
if (Flag)
21817+
m_encoder->SetPredicate(Flag);
21818+
}
21819+
2180921820
m_encoder->Copy(m_destination, dst[0]);
2181021821
if (m_currShader->m_numberInstance == 2)
2181121822
{

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ class EmitPass : public llvm::FunctionPass
10691069
void emitSetMessagePhaseType_legacy(llvm::GenIntrinsicInst* inst, VISA_Type type);
10701070

10711071
void emitScan(llvm::Value* Src, IGC::WaveOps Op,
1072-
bool isInclusiveScan, llvm::Value* Mask, bool isQuad);
1072+
bool isInclusiveScan, llvm::Value* Mask, bool isQuad, bool noMask = false);
10731073

10741074
// Cached per lane offset variables. This is a per basic block data
10751075
// structure. For each entry, the first item is the scalar type size in

0 commit comments

Comments
 (0)