Skip to content

Commit

Permalink
Extend capability of wavePrefix.
Browse files Browse the repository at this point in the history
Extend capability of wavePrefix.
  • Loading branch information
bgajdaINTC authored and igcbot committed Nov 20, 2024
1 parent 8cf46f9 commit 76c7312
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21755,7 +21755,10 @@ static void GetReductionOp(WaveOps op, Type* opndTy, uint64_t& identity, e_opcod

void EmitPass::emitWavePrefix(WavePrefixIntrinsic* I)
{
bool disableHelperLanes = int_cast<int>(cast<ConstantInt>(I->getArgOperand(4))->getSExtValue()) == 2;
auto helperLanes = int_cast<int>( cast<ConstantInt>( I->getArgOperand( 4 ) )->getSExtValue() );
bool disableHelperLanes = (helperLanes == 2);
bool getFullPrefix = ( helperLanes == 4 );

if (disableHelperLanes)
{
ForceDMask();
Expand All @@ -21771,7 +21774,7 @@ void EmitPass::emitWavePrefix(WavePrefixIntrinsic* I)
}
m_encoder->SetSubSpanDestination(false);
emitScan(
I->getSrc(), I->getOpKind(), I->isInclusiveScan(), Mask, false);
I->getSrc(), I->getOpKind(), I->isInclusiveScan(), Mask, false, getFullPrefix );
if (disableHelperLanes)
{
ResetVMask();
Expand All @@ -21786,7 +21789,7 @@ void EmitPass::emitQuadPrefix(QuadPrefixIntrinsic* I)

void EmitPass::emitScan(
Value* Src, IGC::WaveOps Op,
bool isInclusiveScan, Value* Mask, bool isQuad)
bool isInclusiveScan, Value* Mask, bool isQuad, bool noMask)
{
VISA_Type type;
e_opcode opCode;
Expand All @@ -21801,11 +21804,19 @@ void EmitPass::emitScan(
false, src, dst, Flag,
!isInclusiveScan, isQuad);

// Now that we've computed the result in temporary registers,
// make sure we only write the results to lanes participating in the
// scan as specified by 'mask'.
if (Flag)
m_encoder->SetPredicate(Flag);
if(noMask)
{
m_encoder->SetNoMask();
}
else
{
// Now that we've computed the result in temporary registers,
// make sure we only write the results to lanes participating in the
// scan as specified by 'mask'.
if (Flag)
m_encoder->SetPredicate(Flag);
}

m_encoder->Copy(m_destination, dst[0]);
if (m_currShader->m_numberInstance == 2)
{
Expand Down
2 changes: 1 addition & 1 deletion IGC/Compiler/CISACodeGen/EmitVISAPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ class EmitPass : public llvm::FunctionPass
void emitSetMessagePhaseType_legacy(llvm::GenIntrinsicInst* inst, VISA_Type type);

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

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

0 comments on commit 76c7312

Please sign in to comment.