hzfan opened a new pull request #5092: [PASS] dtype rewrite for indexing variables URL: https://github.com/apache/incubator-tvm/pull/5092 Changes: - enable indexing with i64 vars, so that large tensors with more than 2^32 elements can be properly indexed. - narrow i64 index which trivially fits into i32 to i32. Some background: https://discuss.tvm.ai/t/rfc-support-for-large-tensors/5643 Take the following as an example: ``` A = te.placeholder((m, n), name='A') B = te.placeholder((m, n), name='B') C = te.compute((m, n), lambda *idx: A[idx] + B[idx]) ``` `m, n = te.var(’m’, dtype=‘int64’), te.var(’n’, dtype=‘int64’)` yields ``` produce compute { for (i0.int64, (int64)0, m.int64) { for (i1.int64, (int64)0, n.int64) { compute[((i0.int64*stride.int64) + (i1.int64*stride.int64))] = (A[((i0.int64*stride.int64) + (i1.int64*stride.int64))] + B[((i0.int64*stride.int64) + (i1.int64*stride.int64))]) } } } ``` `m, n = tvm.tir.const(2, dtype="int64"), tvm.tir.const(2, dtype="int64")` yields ``` produce compute { for (i0.int32, 0, 2) { for (i1.int32, 0, 2) { compute[((i0.int32*2) + i1.int32)] = (A[((i0.int32*2) + i1.int32)] + B[((i0.int32*2) + i1.int32)]) } } } ``` @yzhliu Could you review?
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
