csullivan commented on a change in pull request #9091:
URL: https://github.com/apache/tvm/pull/9091#discussion_r717743045
##########
File path: src/tir/transforms/storage_flatten.cc
##########
@@ -137,8 +152,15 @@ class BufferShapeLegalize : public StmtExprMutator {
<< "Inconsistent dimensions for buffer " << op->buffer->name;
Array<PrimExpr> new_indices;
- for (size_t i = 0; i < entry.realized_begins.size(); i++) {
- new_indices.push_back(op->indices[i] - entry.realized_begins[i]);
+
+ // Pad leading indices with zero, matching the "fuzzy_match"
+ // behavior from ArgBinder::BindBuffer.
+ size_t diff = entry.realized_begins.size() - op->indices.size();
+ for (size_t i = 0; i < diff; i++) {
+ new_indices.push_back(0);
Review comment:
Assuming this is for matching cases like [1, 1, n, m], do we need to
check that the leading axes are indeed extent=1?
##########
File path: src/tir/transforms/storage_flatten.cc
##########
@@ -137,8 +152,15 @@ class BufferShapeLegalize : public StmtExprMutator {
<< "Inconsistent dimensions for buffer " << op->buffer->name;
Array<PrimExpr> new_indices;
- for (size_t i = 0; i < entry.realized_begins.size(); i++) {
- new_indices.push_back(op->indices[i] - entry.realized_begins[i]);
+
+ // Pad leading indices with zero, matching the "fuzzy_match"
+ // behavior from ArgBinder::BindBuffer.
+ size_t diff = entry.realized_begins.size() - op->indices.size();
+ for (size_t i = 0; i < diff; i++) {
+ new_indices.push_back(0);
Review comment:
Let me ask a more general question, is it possible to expand or squeeze
all shapes and then do exact matching as before? Noticing a fair amount of
special casing in this commit for handling the extra unit dimensions.
--
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]