wrongtest-intellif opened a new pull request, #13622:
URL: https://github.com/apache/tvm/pull/13622

   Fix the following script with multiple kernel launch (each take standalone 
thread binding) which is not round-trip-able.
   ```python
   import tvm
   from tvm.script import tir as T
   
   @T.prim_func
   def main(A: T.Buffer[128, "float32"], C: T.Buffer[128, "float32"]):
       B = T.alloc_buffer([128], "float32")
       for i in range(128):
           with T.block("B1"):
               vi = T.axis.remap("S", [i])
               B[vi] = A[vi] + 1.0
       for i in range(128):
           with T.block("B2"):
               vi = T.axis.remap("S", [i])
               C[vi] = B[vi] + 2.0
   
   s = tvm.tir.schedule.Schedule(main)
   b1 = s.get_block("B1")
   b2 = s.get_block("B2")
   i = s.get_loops(b1)[0]
   s.bind(i, "threadIdx.x")
   i = s.get_loops(b2)[0]
   s.bind(i, "threadIdx.x")
   f = tvm.lower(s.mod["main"])
   print(f.script())
   tvm.ir.assert_structural_equal(f, tvm.script.from_source(f.script()))
   ```
   
   Since the env thread is always printed on the function head, `TryDeallocVar` 
which decrease the name uniqueness counting may not be invoked for thread 
binding code path.


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