Commit 6c35f3f
[TIR][Schedule] Scoped CacheRead/Write producing compact region
This PR enhances CacheRead/Write so that when a cache operation is
performed under an inner block, the generated cache buffer will have
the shape as compact as possible, by region consumption analysis.
The motivation of this change comes from the needs of dynamic shape TIR
scheduling, in which case we may isolate a "static shape" internal block
using blockize, and do further scheduling inside the internal block. For
such cases, the current CacheRead/Write inside the static-shape block
will still produce dynamic-shape cache buffers, which is not ideal for
analysis and subsequent scheduling.
One thing that worths noting is that, to ensure the IR correctness after
inserting the cache block, we will only compact the cache buffer when
all the consumer blocks of the read buffer (for CacheRead) or the write
buffer (for CacheWrite) are children blocks of the cache block insertion
location. Otherwise we will insist allocating the full-size cache
buffer.
Co-authored-by: Bohan Hou <[email protected]>1 parent 516c56b commit 6c35f3f
File tree
3 files changed
+403
-73
lines changed- src/tir/schedule
- primitive
- tests/python/unittest
3 files changed
+403
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
0 commit comments