Hzfengsy commented on a change in pull request #8803:
URL: https://github.com/apache/tvm/pull/8803#discussion_r692652425
##########
File path: src/tir/ir/specialize.cc
##########
@@ -157,12 +179,31 @@ class PrimFuncSpecializer : public StmtExprMutator {
}
}
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(AddNode, add);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(SubNode, sub);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(MulNode, mul);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(DivNode, div);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(ModNode, truncmod);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(FloorDivNode, floordiv);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(FloorModNode, floormod);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(MaxNode, max);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(MinNode, min);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(EQNode, equal);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(NENode, not_equal);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(LTNode, less);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(LENode, less_equal);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(GTNode, greater);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(GENode, greater_equal);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(AndNode, logical_and);
+ DEFINE_SPECIALIZER_BINARY_OP_MUTATE(OrNode, logical_or);
+ DEFINE_SPECIALIZER_UNARY_OP_MUTATE(NotNode, logical_not);
+
private:
- Buffer MutateBuffer(const Buffer& buffer) const {
+ Buffer MutateBuffer(const Buffer& buffer) {
Array<PrimExpr> shape =
- MutateArray(buffer->shape, [this](const PrimExpr& e) { return
Substitute(e, var_map_); });
+ MutateArray(buffer->shape, [this](const PrimExpr& e) { return
VisitExpr(e); });
Array<PrimExpr> strides =
- MutateArray(buffer->strides, [this](const PrimExpr& e) { return
Substitute(e, var_map_); });
+ MutateArray(buffer->strides, [this](const PrimExpr& e) { return
VisitExpr(e); });
PrimExpr elem_offset = Substitute(buffer->elem_offset, var_map_);
Review comment:
It would be great if we can also change this `Substitute` into
`VisitExpr`.
Please also check if there are other places where we use `Substitute`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]