junrushao opened a new pull request, #15207:
URL: https://github.com/apache/tvm/pull/15207
This PR adds a pass LiftThreadBinding to TIR.
Previously, during GPU cross-thread reduction, a temporary local buffer will
be created in the RF buffer, as a concrete example:
```python
rf_local = T.alloc_buffer(..., scope="local")
// Step 1. Data parallel RF block
for tx in T.thread_binding(..., thread="threadIdx.x")
rf_local[tx, ...] =
// Step 2. Cross-thread reduction to accumuate rf_local
for ...:
for tx' in T.thread_binding(..., thread="threadIdx.x"):
... += rf_local[tx', ...]
```
In this case, the buffer `rf_local` will only be accessed by a single point
`tx` or `tx'`, but during the pass `CompactBuffeRegion`, the two variables as
thread bindings are treated as two separate variables, i.e. the information
that `tx` and `tx'` are always identical to each other is discarded, which
means the accessed region on `rf_local` are estimated as `Union({tx}, {tx'})`
as opposed to `{tx}`, leading over allocation of local registers.
This pass is introduced to address this issue by lifting thread bindings to
their LCAs.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]