cconvey commented on code in PR #13906:
URL: https://github.com/apache/tvm/pull/13906#discussion_r1094866037


##########
tests/python/unittest/test_tir_transform_plan_update_buffer_allocation_location.py:
##########
@@ -416,5 +416,26 @@ def test_allocate_const_after_tensorize():
     _ = seq(sch.mod)
 
 
+def test_buffer_decl_allocation():
+    """
+    Confirm a fix to
+    `src/tir/transforms/plan_update_buffer_allocation_location.cc`
+    in which a declared buffer was erroneously duplicated, resulting in a
+    TIR-compilation failure.
+    """
+
+    @tvm.script.ir_module
+    class IRMod:
+        @T.prim_func
+        def func(a: T.Ptr[T.float32]):
+            T.func_attr({"global_symbol": "main", "tir.noalias": True})
+            A = T.buffer_decl(1, "float32", data=a)
+            for i in range(1):
+                A[i] = 0
+
+    ir_mod = IRMod
+    built_mod = tvm.build(ir_mod)

Review Comment:
   Thanks, that's an excellent suggestion.  Fixed (IMHO) in the newest version 
of the PR.



-- 
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-unsubscr...@tvm.apache.org

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

Reply via email to