From commits-return-17893-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Thu Jul 16 05:15:22 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4D5111804BB for ; Thu, 16 Jul 2020 07:15:22 +0200 (CEST) Received: (qmail 41579 invoked by uid 500); 16 Jul 2020 05:15:21 -0000 Mailing-List: contact commits-help@tvm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tvm.apache.org Delivered-To: mailing list commits@tvm.apache.org Received: (qmail 41570 invoked by uid 99); 16 Jul 2020 05:15:21 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2020 05:15:21 +0000 From: =?utf-8?q?GitBox?= To: commits@tvm.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bincubator-tvm=5D_hzfan_commented_on_a_change_in_pu?= =?utf-8?q?ll_request_=235235=3A_=5BRELAY=5D=5BFix=5D_i64_indices?= Message-ID: <159487652100.29655.3089638434567512001.asfpy@gitbox.apache.org> Date: Thu, 16 Jul 2020 05:15:21 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: 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 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