Hzfengsy commented on code in PR #13906: URL: https://github.com/apache/tvm/pull/13906#discussion_r1094699143
########## 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: It would be great to make the test "unit" enough, i.e., only test the related pass instead of a whole build workflow. One of the common practices is to test the IRModule before and after the pass. Please see the test case `test_1D_cascade_op_rolling_buffer()` in the same file. -- 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