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 2022/03/10 19:32:32 UTC

[GitHub] [tvm] tkonolige opened a new pull request #10571: [TE] Promote substituted variable to iter_var's dtype

tkonolige opened a new pull request #10571:
URL: https://github.com/apache/tvm/pull/10571


   This fixes a bug where an iteration variable and its associated loop variable have a mismatched dtype.
   
   @mbrookhart @junrushao1994 


-- 
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] masahi commented on pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #10571:
URL: https://github.com/apache/tvm/pull/10571#issuecomment-1064677981


   Interesting, does this change remove a need for fixes in
   
   https://github.com/apache/tvm/pull/10519
   https://github.com/apache/tvm/pull/9582
   https://github.com/apache/tvm/pull/10172
   
   ?
   
   I've been trying to compile the QAT BERT from mlperf via various ways but I consistently get the int32 vs int64 dtype mismatch like:
   
   ```
     2: tvm::arith::SolveInequalitiesToRange(tvm::arith::IntConstraints const&)
     1: tvm::arith::AsConditions(tvm::runtime::Array<tvm::tir::Var, void> const&, tvm::runtime::Map<tvm::tir::Var, tvm::arith::IntGroupBounds, void, void> const&, tvm::runtime::Array<tvm::PrimExpr, void> const&)
     0: tvm::tir::LE::LE(tvm::PrimExpr, tvm::PrimExpr, tvm::Span)
     File "/home/masa/projects/dev/tvm/src/tir/ir/expr.cc", line 447
   TypeError: Check failed: (a.dtype() == b.dtype()) is false: mismatched types. int32 vs. int64
   ```
   
   ```
     1: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::FloorDivNode const*)
     0: tvm::tir::FloorDiv::FloorDiv(tvm::PrimExpr, tvm::PrimExpr, tvm::Span)
     File "/home/masa/projects/dev/tvm/src/tir/ir/expr.cc", line 322
   TypeError: Check failed: (a.dtype() == b.dtype()) is false: mismatched types. int64 vs. int32
   ```
   
   ```
     1: tvm::tir::ArgBinder::BindBuffer(tvm::tir::Buffer const&, tvm::tir::Buffer const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
     0: tvm::tir::ArgBinder::Bind_(tvm::PrimExpr const&, tvm::PrimExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
     File "/home/masa/projects/dev/tvm/src/tir/transforms/arg_binder.cc", line 52
   TVMError:
   ---------------------------------------------------------------
   An error occurred during the execution of TVM.
   For more information, please see: https://tvm.apache.org/docs/errors.html
   ---------------------------------------------------------------
   
     Check failed: arg.dtype() == value.dtype() (int32 vs. int64) :
   ```  


-- 
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] tkonolige commented on pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
tkonolige commented on pull request #10571:
URL: https://github.com/apache/tvm/pull/10571#issuecomment-1064671346


   This problem is a lot more complicated than I initially thought. It is actually two problems: 1. `IterVar` has an invariant that the dtype of its `var` and the dtype of its domain's extent (`dom->extent`) match. I fixed all violations of this invariant and added a check for it in the constructor of `IterVar`. 2. The `IterVar` of thread/block and the `IterVar` it binds to need to have the same dtype when computing loop nesting. However, there is no way to know what datatype is needed when constructing the thread/block `IterVar`, so it defaults to int32. I've added an automatic promotion from thread/block `IterVar` dtype to the bound `IterVar`'s dtype when computing loop nests, but this is a hack and will cause integer overflow if the bound `IterVar` exceeds int32::max (should not happen unless we get a GPU/CPU with more than int32::max threads).


-- 
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] masahi edited a comment on pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
masahi edited a comment on pull request #10571:
URL: https://github.com/apache/tvm/pull/10571#issuecomment-1064677981


   Interesting, does this change remove the need for fixes in the following PRs?
   
   https://github.com/apache/tvm/pull/10519
   https://github.com/apache/tvm/pull/9582
   https://github.com/apache/tvm/pull/10172
   
   I've been trying to compile the QAT BERT from mlperf via various ways but I consistently get the int32 vs int64 dtype mismatch like:
   
   ```
     2: tvm::arith::SolveInequalitiesToRange(tvm::arith::IntConstraints const&)
     1: tvm::arith::AsConditions(tvm::runtime::Array<tvm::tir::Var, void> const&, tvm::runtime::Map<tvm::tir::Var, tvm::arith::IntGroupBounds, void, void> const&, tvm::runtime::Array<tvm::PrimExpr, void> const&)
     0: tvm::tir::LE::LE(tvm::PrimExpr, tvm::PrimExpr, tvm::Span)
     File "/home/masa/projects/dev/tvm/src/tir/ir/expr.cc", line 447
   TypeError: Check failed: (a.dtype() == b.dtype()) is false: mismatched types. int32 vs. int64
   ```
   
   ```
     1: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::FloorDivNode const*)
     0: tvm::tir::FloorDiv::FloorDiv(tvm::PrimExpr, tvm::PrimExpr, tvm::Span)
     File "/home/masa/projects/dev/tvm/src/tir/ir/expr.cc", line 322
   TypeError: Check failed: (a.dtype() == b.dtype()) is false: mismatched types. int64 vs. int32
   ```
   
   ```
     1: tvm::tir::ArgBinder::BindBuffer(tvm::tir::Buffer const&, tvm::tir::Buffer const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
     0: tvm::tir::ArgBinder::Bind_(tvm::PrimExpr const&, tvm::PrimExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
     File "/home/masa/projects/dev/tvm/src/tir/transforms/arg_binder.cc", line 52
   TVMError:
   ---------------------------------------------------------------
   An error occurred during the execution of TVM.
   For more information, please see: https://tvm.apache.org/docs/errors.html
   ---------------------------------------------------------------
   
     Check failed: arg.dtype() == value.dtype() (int32 vs. int64) :
   ```  


-- 
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] masahi commented on pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #10571:
URL: https://github.com/apache/tvm/pull/10571#issuecomment-1065437706


   just sent a PR fixing a related problem (one of my errors above)
   
   https://github.com/apache/tvm/pull/10584


-- 
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] masahi merged pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #10571:
URL: https://github.com/apache/tvm/pull/10571


   


-- 
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] tkonolige commented on pull request #10571: [TE] Promote substituted variable to iter_var's dtype

Posted by GitBox <gi...@apache.org>.
tkonolige commented on pull request #10571:
URL: https://github.com/apache/tvm/pull/10571#issuecomment-1065294335


   I think it may fix the middle and top issues, but I'm not positive.
   
   Also, we should think about checking that every `For` also has matching dtypes between its var and extent.


-- 
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