altanh commented on issue #10831:
URL: https://github.com/apache/tvm/issues/10831#issuecomment-1083748600


   > Thanks @altanh for reporting this. Unfortunately, defining local variables 
in tvm script is not supported now
   
   Is something happening when I remove the upper loop in that case? Since the 
PrimFunc definitely includes local let bindings when I print it:
   ```
   // this doesn't work
   primfn(a: handle) -> ()
     buffers = {A: Buffer(A_1: Pointer(global float32), float32, [1], [])}
     buffer_map = {a: A} {
     block([], "root") {
       tir.reads([])
       tir.writes([])
       A_pack = alloc_buffer(float32[64, 8])
       B_pack = alloc_buffer(float32[64, 8])
       C_reg = alloc_buffer(float32[8, 8])
       for (loop: int32, 0, 100000) {
         for (rk: int32, 0, 64) {
           for (rii: int32, 0, 8) {
             for (rjj: int32, 0, 8) {
               C_reg[rii, rjj] = 0f32
             }
           }
           for (riijj: int32, 0, (8*8)) "vectorized" {
             let x: int32 = floordiv(riijj, 8)
             let y: int32 = floormod(riijj, 8)
             C_reg[x, y] = (C_reg[x, y] + (A_pack[rk, x]*B_pack[rk, y]))
           }
         }
       }
   }
   
   // this does work
   primfn(a: handle) -> ()
     buffers = {A: Buffer(A_1: Pointer(global float32), float32, [1], [])}
     buffer_map = {a: A} {
     block([], "root") {
       tir.reads([])
       tir.writes([])
       A_pack = alloc_buffer(float32[64, 8])
       B_pack = alloc_buffer(float32[64, 8])
       C_reg = alloc_buffer(float32[8, 8])
       for (loop: int32, 0, 100000) {
         for (rk: int32, 0, 64) {
           for (riijj: int32, 0, (8*8)) "vectorized" {
             let x: int32 = floordiv(riijj, 8)
             let y: int32 = floormod(riijj, 8)
             C_reg[x, y] = (C_reg[x, y] + (A_pack[rk, x]*B_pack[rk, y]))
           }
         }
       }
   }
   
   ```


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