Conversation
|
Hi @ShangkunLi,
|
| let summary = "Bitwise OR operation"; | ||
| let arguments = (ins AnySignlessInteger:$lhs, AnySignlessInteger:$rhs, Optional<AnyType>:$predicate); | ||
| let results = (outs AnySignlessInteger:$result); | ||
| let arguments = (ins AnyType:$lhs, AnyType:$rhs, Optional<AnyType>:$predicate); |
There was a problem hiding this comment.
I mentioned in another PR, i.e., do you think we still need this Optional<AnyType>:$predicate? our data now has the predicate bit.
There was a problem hiding this comment.
I think we don't need such Optional<AnyType>:$predicate anymore, we can clean them up together with the predicate attribute in neura.constant.
There was a problem hiding this comment.
Right, we may only need grant_predicate has a predicate as operand, which is not optional there. Please file an issue for this cleanup, thanks~!
Sorry, there is a bug in the current |
Shouldn't we fix |
Okay, I will split this pr as two prs. Fix the canonicalize-live-in and then enable this more robust transform. |
|
Where is the udpated IR? |
Sorry, typo. Haven't updated. |
In the existing implementation, we can't ensure the correctness of the value in blocks that are behind the nested loop control/branch control.
There are two examples here:
Example 1 (nested loop)
The predicate bit of the upper bound (
%10) of the second loop compare%11 = "neura.icmp"(%9, %10) <{cmpType = "slt"}> : (i64, i64) -> i1should be determined by the outer loop. If the outer loop is not valid,%10should be invalid. But current implementation simply uses the%3without considering%7 = "neura.icmp"(%5, %6) <{cmpType = "slt"}> : (i64, i64) -> i1.Example 2 (for + if):
Current implementation cannot
grant_predicatelive-in values inbb6because the execution condition ofbb6is the same asbb5. Andbb5has two predecessor blocks; these two predecessors have different execution conditions (e.g.,bb3->%12 AND %13,bb4->%12 AND !%13).In this pr:
calculateBlockExecuteConditions()function to calculate each blocks execution conditiongrant_predicateall the live-ins (except live-ins operands incond_br, because they are guranteed by the condition incond_br) in each block based on the execution condition