Skip to content

Commit 4bc61a1

Browse files
authored
[Relax][Transform] Add SelectNode handling in SymbolicMatcher (#17368)
This PR added support for handling SelectNode in the SymbolicMatcher class by modifying the VisitExpr_ function to match the true_value and false_value expressions between the current SelectNode and the other expression. If the other expression is not a SelectNode, the matching condition is updated to ensure the current SelectNode expression is equivalent to the other expression.
1 parent e0105e4 commit 4bc61a1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/relax/transform/fuse_tir.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ class SymbolicMatcher : ExprFunctor<void(const PrimExpr& n, const PrimExpr& othe
139139
}
140140
}
141141

142+
void VisitExpr_(const SelectNode* op, const PrimExpr& other) {
143+
const auto* rhs = other.as<SelectNode>();
144+
if (rhs) {
145+
VisitExpr(op->true_value, rhs->true_value);
146+
VisitExpr(op->false_value, rhs->false_value);
147+
} else {
148+
must_prove_ = must_prove_ && (GetRef<PrimExpr>(op) == other);
149+
}
150+
}
151+
142152
arith::Analyzer* analyzer_;
143153
Map<tir::Var, PrimExpr>* var_remap_;
144154
PrimExpr must_prove_ = Bool(true);

0 commit comments

Comments
 (0)