cyx-6 opened a new pull request, #13900:
URL: https://github.com/apache/tvm/pull/13900

   This PR is the bug fix reported in #13892. Initially, we mix the logic of 
`LetStmt` docsifying method with and without concise scoping. For example, in
   ```python
   x = T.var("int32")
   with T.let(x, 0):
   ```
   `x` in the `LetStmt` works as a right value, while in
   ```python
   x: T.int32 = 0
   ```
   `x` in the `LetStmt` works as a left value as result.
   Our old logic mixed them together to generate the wrong code for the first 
case.
   Meanwhile, during the fix, we found another bug in concise scoping check. 
For example, we have
   ```python
   x = T.var("int32")
   y = T.var("int32")
   with T.let(x, y):
     with T.let(y, 0):
   ```
   here we should not output
   ```python
   x = T.var("int32")
   y = T.var("int32")
   with T.let(x, y):
     y: int32 = 0
   ```
   becase this will define a new `y_1: int32 = 0` indeed, due the the variable 
shadowing logic of the parser, which is different from the `y` we define and 
refer to.
   Our concise scoping `v: ... = ...` should launch if and only if the `v` is 
never defined before.
   Otherwise, we use `with T.let(v, ...):` instead.


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