You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/12 19:31:27 UTC

[GitHub] [tvm] shingjan commented on a change in pull request #9224: [WIP][TIR] Add support for 0-dim buffer

shingjan commented on a change in pull request #9224:
URL: https://github.com/apache/tvm/pull/9224#discussion_r727431386



##########
File path: tests/python/unittest/test_tvmscript_complete.py
##########
@@ -272,10 +272,30 @@ def test_complete_match_buffer():
     tvm.ir.assert_structural_equal(match_buffer_func, expected_match_buffer_func)
 
 
+@T.prim_func
+def alloc_buffer_func(a: T.handle, b: T.handle) -> None:
+    A = T.match_buffer(a, [2, 2], dtype="float32")
+    B = T.match_buffer(b, [2, 2], dtype="float32")
+    # body
+    # tir.with block("root")
+    C = T.alloc_buffer([2, 2], dtype="float32")
+    A[(0, 0)] = T.float32(2)
+    C[(0, 0)] = A[(0, 0)] + B[(0, 0)]
+    B[(0, 0)] = C[(0, 0)]
+
+
+def test_complete_alloc_buffer():
+    func = alloc_buffer_func
+    rt_func = tvm.script.from_source(func.script(show_meta=True))
+    rt_mod = tvm.build(rt_func, "llvm")
+    tvm.ir.assert_structural_equal(func, rt_func)

Review comment:
       done




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org