Commit 384452b0 authored by Scott Pillow's avatar Scott Pillow Committed by gbsbuild

Added initial waveMultiPrefix implementation

Change-Id: Ib5711f1c6d86c8c917dfbf06abac8cd8cfe2f288
parent fd002fde
......@@ -773,6 +773,11 @@ public:
llvm::Value* src, llvm::Value* type, bool inclusive,
llvm::Value *Mask = nullptr);
llvm::Value* create_waveMatch(llvm::Instruction *inst, llvm::Value *src);
llvm::Value* create_waveMultiPrefix(
llvm::Instruction *I,
llvm::Value *Val,
llvm::Value *Mask,
IGC::WaveOps OpKind);
llvm::Value* create_quadPrefix(llvm::Value* src, llvm::Value* type, bool inclusive = false);
llvm::Value* get32BitLaneID();
llvm::Value* getSimdSize();
......
......@@ -4436,6 +4436,8 @@ inline llvm::Value* LLVM3DBuilder<preserveNames, T, Inserter>::create_waveMatch(
auto *EndBlock = BodyBlock->splitBasicBlock(
inst->getNextNode(), "wavematch-end");
// Make sure that we set the insert point again as we've just invalidated
// it with the splitBasicBlock() calls above.
this->SetInsertPoint(inst);
// Now generate the code for a single iteration of the code
......@@ -4461,6 +4463,44 @@ inline llvm::Value* LLVM3DBuilder<preserveNames, T, Inserter>::create_waveMatch(
return Mask;
}
template<bool preserveNames, typename T, typename Inserter>
inline llvm::Value*
LLVM3DBuilder<preserveNames, T, Inserter>::create_waveMultiPrefix(
llvm::Instruction *I,
llvm::Value *Val,
llvm::Value *Mask,
IGC::WaveOps OpKind)
{
// This implementation is similar create_waveMatch() in that we loop
// until all subsets of lanes are processed.
auto *PreHeader = I->getParent();
auto *BodyBlock = PreHeader->splitBasicBlock(I, "multiprefix-body");
auto *EndBlock = BodyBlock->splitBasicBlock(
I->getNextNode(), "multiprefix-end");
// Make sure that we set the insert point again as we've just invalidated
// it with the splitBasicBlock() calls above.
this->SetInsertPoint(I);
// Now generate the code for a single iteration of the code
auto *FirstValue = this->readFirstLane(Mask);
auto *ParticipatingLanes = this->create_waveInverseBallot(FirstValue);
auto *WavePrefix = this->create_wavePrefix(
Val, this->getInt8((uint8_t)OpKind), false, ParticipatingLanes);
// Replace the current terminator to either exit the loop
// or branch back for another iteration.
auto *Br = BodyBlock->getTerminator();
this->SetInsertPoint(Br);
this->CreateCondBr(ParticipatingLanes, EndBlock, BodyBlock);
Br->eraseFromParent();
this->SetInsertPoint(&*EndBlock->getFirstInsertionPt());
return WavePrefix;
}
template<bool preserveNames, typename T, typename Inserter>
inline llvm::Value* LLVM3DBuilder<preserveNames, T, Inserter>::create_quadPrefix(llvm::Value* src, llvm::Value* type, bool inclusive)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment