Lunderberg commented on code in PR #14532:
URL: https://github.com/apache/tvm/pull/14532#discussion_r1168707819


##########
src/arith/rewrite_simplify.h:
##########
@@ -87,9 +125,29 @@ class RewriteSimplifier::Impl : public 
IRMutatorWithAnalyzer {
   /*! \brief Return the currently enabled extensions */
   Extension GetEnabledExtensions() const;
 
+  RewriteSimplifierStats GetStatsCounters() const { return 
RewriteSimplifierStats(stats_); }
+
+  void ResetStatsCounters() { stats_ = {}; }
+
+  void SetMaximumRewriteSteps(int64_t maximum) { maximum_rewrite_steps_ = 
maximum; }
+
  protected:
+  int64_t maximum_rewrite_steps_{0};
+  RewriteSimplifierStatsNode stats_;
+
+  void RecordAttemptedRewrite() { stats_.rewrites_attempted++; }
+  void RecordRewrite() {
+    stats_.rewrites_performed++;
+
+    ICHECK(maximum_rewrite_steps_ <= 0 || stats_.rewrites_performed <= 
maximum_rewrite_steps_)
+        << "RewriteSimplifier exceeded maximum number of rewrites allowed ("
+        << maximum_rewrite_steps_ << ")";
+  }
+
+  bool is_currently_visiting_{false};

Review Comment:
   Thank you, and removed.  This was part of an additional counter that I ended 
up not implementing, but failed to strip out of the final PR.



##########
src/arith/rewrite_simplify.h:
##########
@@ -39,6 +40,41 @@ namespace arith {
 
 using namespace tir;
 
+/* Record of

Review Comment:
   Thank you, and added.



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