You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "MasterJH5574 (via GitHub)" <gi...@apache.org> on 2023/04/05 16:22:44 UTC
[GitHub] [tvm] MasterJH5574 opened a new pull request, #14511: [Unity] Memory planning with TIR var upper bound
MasterJH5574 opened a new pull request, #14511:
URL: https://github.com/apache/tvm/pull/14511
This PR enhances the memory planning pass with TIR var upper bound
annotation, so that it supports dynamic shape cases when we have
an estimate for the maximum values of the dynamic vars.
--
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] spectrometerHBH merged pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "spectrometerHBH (via GitHub)" <gi...@apache.org>.
spectrometerHBH merged PR #14511:
URL: https://github.com/apache/tvm/pull/14511
--
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 #14511: [Unity] Memory planning with TIR var upper bound
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14511:
URL: https://github.com/apache/tvm/pull/14511#issuecomment-1497777703
<!---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 @quic-sanirudh <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] yzh119 commented on pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "yzh119 (via GitHub)" <gi...@apache.org>.
yzh119 commented on PR #14511:
URL: https://github.com/apache/tvm/pull/14511#issuecomment-1498185474
In SparseTIR we have statements like `T.assume_bound`, and we might unify them in the future :)
--
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] MasterJH5574 commented on pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on PR #14511:
URL: https://github.com/apache/tvm/pull/14511#issuecomment-1497777992
Depends on #14509.
--
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] tqchen commented on a diff in pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #14511:
URL: https://github.com/apache/tvm/pull/14511#discussion_r1158828890
##########
src/relax/transform/static_plan_block_memory.cc:
##########
@@ -476,11 +521,15 @@ class StorageAllocatorInit : public StorageAllocatorBaseVisitor {
token2block_.erase(token_to_discard.get());
}
+ /*! \brief The arithmetic analyzer. */
+ arith::Analyzer ana;
Review Comment:
ana_
--
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] tqchen commented on a diff in pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #14511:
URL: https://github.com/apache/tvm/pull/14511#discussion_r1158840469
##########
src/relax/transform/static_plan_block_memory.cc:
##########
@@ -401,8 +431,23 @@ class StorageAllocatorInit : public StorageAllocatorBaseVisitor {
ICHECK(sinfo->dtype == Downcast<DataTypeImm>(call->args[1])->value);
ICHECK(!token_map_.count(call));
- // No support for symbolic shape at this moment.
+ // Use the upper bounds of TIR vars as their values.
+ Array<PrimExpr> upper_bounded_shape;
+ upper_bounded_shape.reserve(shape->values.size());
for (const PrimExpr& dim_len : shape->values) {
+ upper_bounded_shape.push_back(
+ ana_.Simplify(tir::Substitute(dim_len, [this](const tir::Var& v) -> tvm::PrimExpr {
Review Comment:
Do not use substitute, instead use ConstIntBound. see https://github.com/apache/tvm/blob/main/include/tvm/arith/analyzer.h#L131, this helps to avoid cases where expression is not monotonically increasing with the var
--
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 #14511: [Unity] Memory planning with TIR var upper bound
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14511:
URL: https://github.com/apache/tvm/pull/14511#issuecomment-1497777682
<!---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 @quic-sanirudh <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] MasterJH5574 commented on a diff in pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on code in PR #14511:
URL: https://github.com/apache/tvm/pull/14511#discussion_r1158905032
##########
src/relax/transform/static_plan_block_memory.cc:
##########
@@ -401,8 +431,23 @@ class StorageAllocatorInit : public StorageAllocatorBaseVisitor {
ICHECK(sinfo->dtype == Downcast<DataTypeImm>(call->args[1])->value);
ICHECK(!token_map_.count(call));
- // No support for symbolic shape at this moment.
+ // Use the upper bounds of TIR vars as their values.
+ Array<PrimExpr> upper_bounded_shape;
+ upper_bounded_shape.reserve(shape->values.size());
for (const PrimExpr& dim_len : shape->values) {
+ upper_bounded_shape.push_back(
+ ana_.Simplify(tir::Substitute(dim_len, [this](const tir::Var& v) -> tvm::PrimExpr {
Review Comment:
Thanks for bringing it up! Fixed.
--
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] tqchen commented on a diff in pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #14511:
URL: https://github.com/apache/tvm/pull/14511#discussion_r1158829644
##########
src/relax/transform/static_plan_block_memory.cc:
##########
@@ -476,11 +521,15 @@ class StorageAllocatorInit : public StorageAllocatorBaseVisitor {
token2block_.erase(token_to_discard.get());
}
+ /*! \brief The arithmetic analyzer. */
+ arith::Analyzer ana;
/*!
* \brief The context IRModule, used for checking if a callee function is
* a PrimFunc inside the IRModule.
*/
const IRModule& ctx_mod_;
+ /*! \brief The mapping from TIR variables to their respective upper bound values. */
+ std::unordered_map<const tir::VarNode*, IntImm> var_upper_bound_;
Review Comment:
prefer `unordered_map<tir::Var, IntImm, ObjectPtrHash, ObjectPtrEqual>`, mainly to avoid var get de-allocated and re-allocated, does not matter in here
--
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] MasterJH5574 commented on a diff in pull request #14511: [Unity] Memory planning with TIR var upper bound
Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on code in PR #14511:
URL: https://github.com/apache/tvm/pull/14511#discussion_r1158830164
##########
src/relax/transform/static_plan_block_memory.cc:
##########
@@ -476,11 +521,15 @@ class StorageAllocatorInit : public StorageAllocatorBaseVisitor {
token2block_.erase(token_to_discard.get());
}
+ /*! \brief The arithmetic analyzer. */
+ arith::Analyzer ana;
Review Comment:
Ah thanks my bad. It was added in the last minute so missed this point.
--
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