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 2021/09/22 01:17:23 UTC

[GitHub] [tvm] junrushao1994 commented on a change in pull request #9041: [TensorIR][M2a] Decompose-Reduction

junrushao1994 commented on a change in pull request #9041:
URL: https://github.com/apache/tvm/pull/9041#discussion_r713522208



##########
File path: src/tir/schedule/primitive/loop_transformation.cc
##########
@@ -482,7 +482,7 @@ StmtSRef Fuse(ScheduleState self, const Array<StmtSRef>& loop_srefs) {
   Array<PrimExpr> substitute_value;
   substitute_value.resize(loops.size());
   PrimExpr tot = fused_var;
-  for (int i = static_cast<int>(loops.size()) - 1; i >= 0; i--) {
+  for (int i = loops.size() - 1; i >= 0; i--) {

Review comment:
       No we should keep with `static_cast` instead. As a principle, `size_t` is all evil and should be avoided unless we have good reasons. In our particular case, if `loops.size()` is 0, underflow of `size_t` it may cause tremendous trouble. Even if by reading around we might have the assumption that `loops.size() > 0`, it is still not as convenient as just casting to signed integers.




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