You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "cconvey (via GitHub)" <gi...@apache.org> on 2023/02/02 15:12:56 UTC
[GitHub] [tvm] cconvey opened a new pull request, #13906: [tir] fix buffer_decl buffer allocation
cconvey opened a new pull request, #13906:
URL: https://github.com/apache/tvm/pull/13906
- Fix a bug where `buffer_decl`, combined with certain usage patterns of the resulting buffer, cause an TVM-internal assert failure during TIR-compilation.
--
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
[GitHub] [tvm] tvm-bot commented on pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #13906:
URL: https://github.com/apache/tvm/pull/13906#issuecomment-1413902851
<!---bot-comment-->
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<!--bot-comment-ccs-start-->
* cc @Hzfengsy, @junrushao, @quic-sanirudh, @shingjan <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
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
[GitHub] [tvm] Hzfengsy merged pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy merged PR #13906:
URL: https://github.com/apache/tvm/pull/13906
--
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
[GitHub] [tvm] Hzfengsy commented on a diff in pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
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-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Hzfengsy commented on a diff in pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on code in PR #13906:
URL: https://github.com/apache/tvm/pull/13906#discussion_r1094665278
##########
src/tir/transforms/plan_update_buffer_allocation_location.cc:
##########
@@ -111,6 +112,12 @@ class BufferAllocationLocator : public StmtExprMutator {
collector(func->body);
unmanaged_allocations_ = collector.unmanaged_allocations;
+ for (Var param : func->params) {
Review Comment:
```suggestion
for (const Var& param : func->params) {
```
##########
tests/python/unittest/test_buffer_decl.py:
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import tvm
Review Comment:
Could you please add a testcase in `tests/python/unittest/test_tir_transform_plan_update_buffer_allocation_location.py` as the code changes are in the related 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-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] cconvey commented on a diff in pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "cconvey (via GitHub)" <gi...@apache.org>.
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-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Hzfengsy commented on pull request #13906: [tir] fix buffer_decl buffer allocation
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on PR #13906:
URL: https://github.com/apache/tvm/pull/13906#issuecomment-1414892052
Thanks @cconvey for the fixing and continuous improving
--
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