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


##########
src/tir/schedule/primitive/compute_inline.cc:
##########
@@ -295,7 +295,8 @@ class BaseInliner : public StmtExprMutator {
    * \param stmt The statement in which to count undefined variables
    */
   static int GetNumUndefinedNonpointerVars(const Stmt& stmt) {
-    auto undefined_vars = UndefinedVars(stmt, {});
+    // Do not visit buffer shape/strides.
+    auto undefined_vars = UndefinedVars(/*stmt=*/stmt, /*defs=*/{}, 
/*visit_buffer=*/false);

Review Comment:
   If I'm reading it correctly, it looks like this would also ignore variables 
that are used in the shape/stride of buffers that are declared internal to 
`stmt`, but the suppression of the undefined variable failures should only 
apply to buffers that are declared externally to `stmt`.
   
   Instead of defining contexts in which variables should not be considered, 
could we instead define variables should be ignored by `UndefinedVars`?  If a 
variable's definition occurs outside the LCA of the producer/consumer, then it 
would be legal to use in the inlined statement.  The dynamic buffer shapes 
would then need to follow this more general condition, rather than being 
ignored entirely.



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