MasterJH5574 opened a new pull request #10789:
URL: https://github.com/apache/tvm/pull/10789


   ## Context
   
   When dealing with end-to-end models, we note that some tensors may have 
large shapes. Thus, when designing graph-level IR, we sometimes use `int64` 
instead of `int32` for the shape. Below is an dense GeMM example which has 
`int64` input tensor shape:
   ```python
   @tvm.script.ir_module
   class Module:
       @T.prim_func
       def main(rxplaceholder: T.Buffer[(1, 512), "float32"], rxplaceholder_1: 
T.Buffer[(T.int64(1000), T.int64(512)), "float32"], T_matmul_NT: T.Buffer[(1, 
T.int64(1000)), "float32"]) -> None:
           # function attr dict
           T.func_attr({"global_symbol": "dense", "tir.noalias": True, 
"op_pattern": 3})
           # body
           # with T.block("root")
           for i0_0, i1_0, i0_1, i1_1, i2_0, i0_2, i1_2, i2_1, i0_3, i1_3 in 
T.grid(1, 4, 1, 25, 8, 1, 10, 64, 1, 1):
               with T.block("T_matmul_NT"):
                   i = T.axis.spatial(1, 0)
                   j = T.axis.spatial(T.int64(1000), i1_0 * T.int64(250) + i1_1 
* T.int64(10) + i1_2)
                   k = T.axis.reduce(512, i2_0 * 64 + i2_1)
                   T.reads(T_matmul_NT[i, j], rxplaceholder[i, k], 
rxplaceholder_1[j, k])
                   T.writes(T_matmul_NT[i, j])
                   T.block_attr({"layout_free_placeholders":[rxplaceholder_1], 
"meta_schedule.tiling_structure":"SSRSRS"})
                   with T.init():
                       T_matmul_NT[i, j] = T.float32(0)
                   T_matmul_NT[i, j] = T_matmul_NT[i, j] + rxplaceholder[i, k] 
* rxplaceholder_1[j, k]
   ```
   
   ## Problem
   
   Though our TVMScript printer can easily print `int64` constants, the parser 
had poor support for `int64`. So this PR introduces some parser support for 
`int64`, basically about the data type of loop variables, block iterators and 
block read/write regions.
   
   Besides the parser, most of the TIR schedule primitives didn't take `int64` 
into account in their implementations. These schedule primitives will be fixed 
and updated in recent future, in followup PRs.
   
   -----
   
   cc @tqchen @spectrometerHBH @junrushao1994 @jinhongyii @Hzfengsy 


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