jikechao opened a new pull request, #17957:
URL: https://github.com/apache/tvm/pull/17957

   Fix https://github.com/apache/tvm/issues/17956.
   
   Fixes `te.create_prim_func` to properly handle nested tensor lists (e.g., 
[input, [output1, output2]]), enabling correct IR generation for multi-output 
ops like topk.
   
   
   After the `te.create_prim_func` can generate correct IR for the test in 
https://github.com/apache/tvm/issues/17956.
   ```
   @I.ir_module
   class Module:
       @T.prim_func
       def main(var_data: T.handle, var_topk_cpu_v0: T.handle, var_topk_cpu_v1: 
T.handle):
           T.func_attr({"tir.noalias": True})
           data_buf = T.match_buffer(var_data, (128, 64), align=8)
           value_buf = T.match_buffer(var_topk_cpu_v0, (128, 10), align=8)
           indices_buf = T.match_buffer(var_topk_cpu_v1, (128, 10), "int64", 
align=8)
           with T.block("topk_cpu"):
               T.reads()
               T.writes()
               T.call_packed("tvm.contrib.sort.topk", 
T.tvm_stack_make_array(data_buf.data, T.tvm_stack_make_shape(128, 64), 0, 2, 
T.float32(0.0), 0), T.tvm_stack_make_array(value_buf.data, 
T.tvm_stack_make_shape(128, 10), 0, 2, T.float32(0.0), 0), 
T.tvm_stack_make_array(indices_buf.data, T.tvm_stack_make_shape(128, 10), 0, 2, 
T.int64(0), 0), 10, 1, "both", T.bool(False))
   
   ```


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