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


##########
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’m curious about the plan of the heuristics here. As this check is 
standalone, it seems to me that we can introduce this function together with 
followup PRs.



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