Skip to content

Commit 5f4cfaa

Browse files
traoux1gfxbot
traoux1
authored andcommitted
Disable pattern match generating .any/.all as they don't work as
expected. They consider innactive lane which can have any value. We will try to find another solution based on the performance impact Change-Id: Ic0bbecd7f127bab04dfdf5199f8621c1f6345816
1 parent 7439d42 commit 5f4cfaa

File tree

1 file changed

+2
-72
lines changed

1 file changed

+2
-72
lines changed

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,52 +2459,12 @@ bool CodeGenPatternMatch::MatchBranch(llvm::BranchInst& I)
24592459
if(!I.isUnconditional())
24602460
{
24612461
Value* cond = I.getCondition();
2462-
ICmpInst* icmp = dyn_cast<ICmpInst>(cond);
2463-
bool predMatched = false;
2464-
24652462
if(GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(cond,
24662463
GenISAIntrinsic::GenISA_UpdateDiscardMask))
24672464
{
24682465
pattern->isDiscardBranch = true;
24692466
}
2470-
else if(icmp)
2471-
{
2472-
GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(
2473-
icmp->getOperand(0), GenISAIntrinsic::GenISA_WaveBallot);
2474-
ConstantInt* constCmp = dyn_cast<ConstantInt>(icmp->getOperand(1));
2475-
2476-
if(intrin && constCmp)
2477-
{
2478-
if(icmp->getPredicate() == ICmpInst::ICMP_NE || icmp->getPredicate() == ICmpInst::ICMP_EQ)
2479-
{
2480-
if(constCmp->isZero())
2481-
{
2482-
pattern->predMode = EPRED_ANY;
2483-
pattern->cond = GetSource(intrin->getArgOperand(0), false, false);
2484-
if(icmp->getPredicate() == ICmpInst::ICMP_EQ)
2485-
{
2486-
pattern->cond.mod = EMOD_NOT;
2487-
}
2488-
predMatched = true;
2489-
}
2490-
else if(constCmp->isMinusOne())
2491-
{
2492-
pattern->predMode = EPRED_ALL;
2493-
pattern->cond = GetSource(intrin->getArgOperand(0), false, false);
2494-
if(icmp->getPredicate() == ICmpInst::ICMP_NE)
2495-
{
2496-
pattern->cond.mod = EMOD_NOT;
2497-
}
2498-
predMatched = true;
2499-
}
2500-
}
2501-
}
2502-
}
2503-
2504-
if(!predMatched)
2505-
{
2506-
pattern->cond = GetSource(I.getCondition(), false, false);
2507-
}
2467+
pattern->cond = GetSource(I.getCondition(), false, false);
25082468
}
25092469
AddPattern(pattern);
25102470
return true;
@@ -2633,37 +2593,7 @@ bool CodeGenPatternMatch::MatchSelectModifier(llvm::SelectInst& I)
26332593
SelectPattern *pattern = new (m_allocator) SelectPattern();
26342594
pattern->predMode = EPRED_NORMAL;
26352595

2636-
/**
2637-
* Match the IR for blend to fill
2638-
* %1 = WaveBallot(i1 %cond) ; return uniform i32
2639-
* %2 = icmp ne i31 %1, i32 0
2640-
* %3 = select i1 %2, i32 %x, i32 %y
2641-
* ->
2642-
* cmp f0.0 ...
2643-
* ifany_f0.0 select ...
2644-
*/
2645-
Value* cond = I.getCondition();
2646-
ICmpInst* icmp = dyn_cast<ICmpInst>(cond);
2647-
bool predMatched = false;
2648-
if (icmp != nullptr && cond->hasOneUse() &&
2649-
m_WI->whichDepend(cond) == WIAnalysis::UNIFORM &&
2650-
icmp->getPredicate() == ICmpInst::ICMP_NE)
2651-
{
2652-
GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(
2653-
icmp->getOperand(0), GenISAIntrinsic::GenISA_WaveBallot);
2654-
ConstantInt* const0 = dyn_cast<ConstantInt>(icmp->getOperand(1));
2655-
if (intrin && const0 && const0->getZExtValue() == 0)
2656-
{
2657-
pattern->sources[0] = GetSource(intrin->getArgOperand(0), false, false);
2658-
pattern->predMode = EPRED_ANY;
2659-
predMatched = true;
2660-
}
2661-
}
2662-
2663-
if (!predMatched)
2664-
{
2665-
pattern->sources[0] = GetSource(I.getCondition(), false, false);
2666-
}
2596+
pattern->sources[0] = GetSource(I.getCondition(), false, false);
26672597
pattern->sources[1] = GetSource(I.getTrueValue(), true, false);
26682598
pattern->sources[2] = GetSource(I.getFalseValue(), true, false);
26692599
AddPattern(pattern);

0 commit comments

Comments
 (0)