Hzfengsy commented on code in PR #12797:
URL: https://github.com/apache/tvm/pull/12797#discussion_r972550576
##########
src/tir/schedule/analysis/layout.cc:
##########
@@ -167,20 +167,25 @@ Optional<IndexMap> SuggestIndexMap(const Buffer& buffer,
const Array<PrimExpr>&
}
return a.lower_factor > b.lower_factor;
});
+ // Compute the inverse permutation by argsort
+ std::vector<int> inverse_order = order;
+ std::sort(inverse_order.begin(), inverse_order.end(),
+ [&order](int _a, int _b) -> bool { return order[_a] < order[_b];
});
// Step 5. Create the indexing mapping
auto f_alter_layout = [f_flatten_index = std::move(f_flatten_index), //
- split_exprs = std::move(split_exprs), //
- order = std::move(order), //
- shape = buffer->shape, //
+ &split_exprs, //
+ &order, //
+ & shape = buffer->shape, //
Review Comment:
```suggestion
& shape = buffer->shape, //
```
--
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]