Biubiubiu12 commented on code in PR #15274:
URL: https://github.com/apache/tvm/pull/15274#discussion_r1271686149
##########
src/tir/schedule/primitive/blockize_tensorize.cc:
##########
@@ -441,25 +441,29 @@ Array<BufferRegion> EvalSetRegions(const
Array<BufferRegion>& regions,
* \return The union regions
*/
Array<BufferRegion> UnionRegions(const Array<BufferRegion>& regions) {
+ arith::Analyzer analyzer;
typedef std::vector<Array<arith::IntSet>> ranges_t;
std::unordered_map<Buffer, ranges_t, ObjectPtrHash, ObjectPtrEqual>
intset_map;
+ Array<Buffer> buffer_order;
for (const BufferRegion& buffer_region : regions) {
const Buffer& buffer = buffer_region->buffer;
if (intset_map.find(buffer) == intset_map.end()) {
intset_map[buffer] = {buffer->shape.size(), Array<arith::IntSet>()};
+ buffer_order.push_back(buffer);
}
std::vector<Array<arith::IntSet>> dim_range(buffer->shape.size(),
Array<arith::IntSet>());
for (size_t dim = 0; dim < buffer->shape.size(); ++dim) {
intset_map[buffer][dim].push_back(arith::IntSet::FromRange(buffer_region->region[dim]));
}
}
Array<BufferRegion> results;
- for (const auto& it : intset_map) {
- const Buffer& buffer = it.first;
+ for (size_t i = 0; i < buffer_order.size(); ++i) {
+ auto it = intset_map.find(buffer_order[i]);
Review Comment:
buffer_order is to ensure the order of traversing the `intset_map`
dictionary, and there may be duplicate values in `regions[i]->buffer`
--
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]