masahi commented on a change in pull request #7391:
URL: https://github.com/apache/tvm/pull/7391#discussion_r572384767
##########
File path: python/tvm/topi/cumsum.py
##########
@@ -90,6 +105,10 @@ def gen_ir(data_buf, out_buf):
cur_idx = base_idx + k * axis_mul_after
prev_idx = base_idx + (k - 1) * axis_mul_after
out_buf[cur_idx] = out_buf[prev_idx] +
maybe_cast(data_buf[cur_idx])
+ if exclusive != 0:
+ with ib.for_range(0, cumsum_axis_len, "_k") as k:
+ cur_idx = base_idx + k * axis_mul_after
+ out_buf[cur_idx] = out_buf[cur_idx] -
maybe_cast(data_buf[cur_idx])
Review comment:
instead of this, we can just do exclusive sum here by initializing
`out_buf[base_idx]` to 0 if `exclusive != 0` at
https://github.com/apache/tvm/blob/1e0d3569b94f650243f4d0ac204d196e3be8b0aa/python/tvm/topi/cumsum.py#L87
and making some index adjustment in the inner loop.
----------------------------------------------------------------
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]