uwsampl / SparseTIR

SparseTIR: Sparse Tensor Compiler for Deep Learning
https://sampl.cs.washington.edu/SparseTIR/
Apache License 2.0
131 stars 13 forks source link

[Feature] Add `block_filter` attribute in ScheduleState to enable scheduling a subset of blocks. #58

Closed yzh119 closed 1 year ago

yzh119 commented 1 year ago

Composable format would create many blocks that might read the same buffer, and currently the cache_read/cache_write schedule primitives will rewrite buffers in all blocks.

However, the schedules applied to blocks generated by different formats should be treated independently, to enable this behavior, we create a block_filter attribute in ScheduleState class.

Whenever we only want to schedule a subset of blocks, we can annotate them with keywords, and set block filters in schedule:

sch.annotate(block, "group_1", 1)
sch.set_block_filter("group_1")
# START OF SUBSET SCHEDULES
# ...
# END OF SUBSET SCHEDULES
sch.unset_block_filter()