gemini-code-assist[bot] commented on code in PR #18389:
URL: https://github.com/apache/tvm/pull/18389#discussion_r2459094906
##########
src/tir/analysis/estimate_flops.cc:
##########
@@ -193,10 +193,20 @@ class FlopEstimator : private ExprFunctor<TResult(const
PrimExpr& n)>,
return cond;
}
+ TResult VisitStmt_(const AssertStmtNode* op) override {
+ TResult result = VisitExpr(op->condition);
+ if (op->message.defined()) {
+ result += VisitExpr(op->message);
+ }
+ result += VisitStmt(op->body);
+ return result;
+ }
Review Comment:

The cost of evaluating the assertion `message` should likely be excluded
from the FLOP count. The message is only evaluated on the exceptional path when
the assertion fails, whereas FLOP estimation is typically concerned with the
performance of the successful execution path. Including the message's FLOPs
could lead to an overestimation, especially if the message formatting involves
computations.
```c
TResult VisitStmt_(const AssertStmtNode* op) override {
TResult result = VisitExpr(op->condition);
result += VisitStmt(op->body);
return result;
}
```
--
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]