gemini-code-assist[bot] commented on code in PR #18873:
URL: https://github.com/apache/tvm/pull/18873#discussion_r2885186749


##########
include/tvm/tir/stmt_functor.h:
##########
@@ -144,6 +144,19 @@ class TVM_DLL StmtVisitor : protected 
StmtFunctor<void(const Stmt&)> {
    *       and redirect Visit to ExprMutator::VisitExpr(Expr)
    */
   virtual void VisitExpr(const PrimExpr& e) {}
+  /*!
+   * \brief Visit buffer at definition site (AllocBuffer, DeclBuffer, SBlock 
alloc_buffers).
+   *  Visits buffer shape, strides, elem_offset via VisitExpr.
+   * \param buffer The buffer being defined.
+   * \param alloc_data If true, the buffer's data pointer is a new allocation 
(AllocBuffer);
+   *              if false, data references an existing variable (DeclBuffer).
+   */
+  virtual void VisitBufferDef(const Buffer& buffer, bool alloc_data);
+  /*!
+   * \brief Visit buffer at use site (BufferStore, BufferLoad, SBlock 
reads/writes).
+   *  By default visits buffer shape, strides, elem_offset via VisitExpr.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The comment for `VisitBufferUse` states that it visits buffer fields by 
default. However, the implementation in `stmt_functor.cc` is an empty function, 
with a comment explaining that buffer fields are visited at definition sites, 
not use sites, to avoid issues with variable scoping. This comment should be 
updated to reflect the implementation.
   
   ```c
      *  By default, this is a no-op, as buffer fields (shape, strides, 
elem_offset) are visited at their definition site.
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to