tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] hzfan commented on a change in pull request #5235: [RELAY][Fix] i64 indices
Date Thu, 16 Jul 2020 05:15:21 GMT

hzfan commented on a change in pull request #5235:
URL: https://github.com/apache/incubator-tvm/pull/5235#discussion_r455514589



##########
File path: src/te/schedule/operation_inline.cc
##########
@@ -63,7 +63,9 @@ class OperationInliner final : public StmtExprMutator {
       } else {
         Map<Var, PrimExpr> vmap;
         for (size_t i = 0; i < args_.size(); ++i) {
-          vmap.Set(args_[i], op->indices[i]);
+          // indices into `operation_` must be in the range of its output shape,
+          // so we can safely cast the indices without worrying about overflow

Review comment:
       Sure. An example is
   ```
   a_i32 = tvm.tir.const(2, “int32”)
   b_i64 = tvm.tir.const(2 ** 32, “int64”)
   a0 = te.placeholder((a_i32,), “a0”)
   a = te.compute((a_i32,), lambda i: a0[i])
   b = te.compute((b_i64,), lambda i: a[i % 2])
   ```
   When we fuse `a` (denoted by `operation_` in the comment) into `b`, the variable `i` (which
is i32) in the computation of `a` is replaced by `i % 2` (which is i64) in `b`. Since the
original indexing variable in `a` is i32, we need to cast `i % 2` from i64 to i32.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message