psrivas2 commented on code in PR #14146:
URL: https://github.com/apache/tvm/pull/14146#discussion_r1120694607


##########
src/relax/transform/fold_constant.cc:
##########
@@ -127,6 +129,19 @@ class ConstantFolder : public ExprMutator {
     return build_func;
   }
 
+  /*!
+   * \brief Checks if it is useful to fold \p expr.
+   * \details Folding an expr is a trade-off - we are materializing a constant 
in the IRModule and
+   * paying compile time cost to avoid the cost of executing this expr at 
runtime. For example,
+   * folding iota ops could result in large constants being materialized, thus 
increasing the size
+   * of the program.
+   */
+  bool ShouldBeFolded(Expr expr) {
+    // TODO(prakalp): Implement a heuristic to check if folding this op is 
actually useful or

Review Comment:
   I introduced it here so we don't forget about it. Indeed there are other 
ways to achieve the same, perhaps a github issue. Is that preferred?



-- 
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]

Reply via email to