masahi edited a comment on pull request #8571: URL: https://github.com/apache/tvm/pull/8571#issuecomment-888836469
> Can we reuse buffers that are out of the lifetime in the new pass? To be specific, please see the following example: > > ``` > A_shared[i] = A[i] > A_local[i] = A_shared[i] > C_local[i] = A_local[i] + 1 > C_shared[i] = C_local[i] > ``` > > Since `A_shared[i]` is never used when we store to `C_shared`. We can directly store the data into `A_shared[i]` to reduce memory usage. It is supported in `storage_rewrite` Thanks, I didn't think about reuse support. To support this, I think it is better to drop the new pass in this PR and merge the new functionality to `storage_rewrite` pass. I'll consider both possibilities and try to find the simplest solution. One difficulty I can imagine is that, dynamic shared memory in general has unknown alloc size. So for the general cases I don't think reuse analysis would work just like it does in `storage_rewrite`. For special cases where dynamic shared memory happens to have a constant size, it is probably worth supporting reuse. What do you think? @Hzfengsy @vinx13 -- 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-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org