MasterJH5574 opened a new pull request #8875:
URL: https://github.com/apache/tvm/pull/8875


   This PR adds a new analysis function named `GetBlockReadWriteRegion` for 
TIR, which collects all buffer regions that a given block reads from and writes 
to.
   
   Before this PR, there was an existed function named `GetBlockAccessRegion` 
which collects three kinds of accesses: read accesses, write accesses, and 
opaque accesses. This function is only responsible for _reflecting the true 
access patterns of the given block_. That is, for example, suppose that `A` is 
a buffer of shape `[128]`, and there's an external function call 
`tir.call_extern("test", A.data, A[vi])` in the input block. The result of 
`GetBlockAccessRegion` says "the input block has a read access to `A[vi:vi + 
1]` and an opaque access to `A[0:128]`".
   
   To create a block's `read`/`write` fields, we need to merge the read/write 
accesses with the opaque accesses of the block respectively. Continue the 
example above. Merging accesses means telling that "the block reads from 
`A[0:128]` and writes to `A[0:128]`". We leave out the read access `A[vi:vi + 
1]` in the merging as it's covered by the opaque access. The "merging" is 
exactly what `GetBlockReadWriteRegion` does.
   
   After introducing `GetBlockReadWriteRegion`, whenever people want to 
generate the `read`/`write` fields of a block, or want to collect the 
read/write regions regarding opaque accesses as both read and write accesses, 
they can just invoke `GetBlockReadWriteRegion` - no need to call 
`GetBlockAccessRegion` and then merge the accesses.
   
   ----------------------
   
   cc @Hzfengsy @junrushao1994 @tqchen 


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


Reply via email to