Skip to content

Commit b6f5cba

Browse files
committed
Review comments that weren't suggestions
1 parent 0b396e5 commit b6f5cba

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mlir/include/mlir/Dialect/Affine/IR/AffineOps.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,29 +1109,29 @@ def AffineLinearizeIndexOp : Affine_Op<"linearize_index",
11091109
The `affine.linearize_index` operation takes a sequence of index values and a
11101110
basis of the same length and linearizes the indices using that basis.
11111111

1112-
That is, for indices `%idx_1` through `%i_N` and basis elements `b_1` through `b_N`,
1112+
That is, for indices `%idx_1` through `%idx_N` and basis elements `b_1` through `b_N`,
11131113
it computes
11141114

11151115
```
11161116
sum(i = 1 to N) %idx_i * product(j = i + 1 to N) B_j
11171117
```
11181118

11191119
If the `disjoint` property is present, this is an optimization hint that,
1120-
for all i, 0 <= %idx_i < B_i - that is, no index affects any other index,
1121-
except that %idx_0 may be negative to make the index as a whole negative.
1120+
for all `i`, `0 <= %idx_i < B_i` - that is, no index affects any other index,
1121+
except that `%idx_0` may be negative to make the index as a whole negative.
11221122

11231123
Note that the outputs of `affine.delinearize_index` are, by definition, `disjoint`.
11241124

11251125
Example:
11261126

11271127
```mlir
1128-
%linear_index = affine.delinearize_index [%index_0, %index_1, %index_2] (16, 224, 224) : index
1128+
%linear_index = affine.linearize_index [%index_0, %index_1, %index_2] (2, 3, 5) : index
11291129
```
11301130

11311131
In the above example, `%linear_index` conceptually holds the following:
11321132

11331133
```mlir
1134-
#map = affine_map<()[s0, s1, s2] -> (s0 * 50176 + s1 * 224 + s2)>
1134+
#map = affine_map<()[s0, s1, s2] -> (s0 * 15 + s1 * 5 + s2)>
11351135
%linear_index = affine.apply #map()[%index_0, %index_1, %index_2]
11361136
```
11371137
}];

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4700,15 +4700,18 @@ void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
47004700
LogicalResult AffineLinearizeIndexOp::verify() {
47014701
if (getStaticBasis().empty())
47024702
return emitOpError("basis should not be empty");
4703+
47034704
if (getMultiIndex().size() != getStaticBasis().size())
47044705
return emitOpError("should be passed an index for each basis element");
4706+
47054707
auto dynamicMarkersCount =
47064708
llvm::count_if(getStaticBasis(), ShapedType::isDynamic);
47074709
if (static_cast<size_t>(dynamicMarkersCount) != getDynamicBasis().size())
47084710
return emitOpError(
47094711
"mismatch between dynamic and static basis (kDynamic marker but no "
47104712
"corresponding dynamic basis entry) -- this can only happen due to an "
47114713
"incorrect fold/rewrite");
4714+
47124715
return success();
47134716
}
47144717

0 commit comments

Comments
 (0)