[mlir][nfc] Update comments

1. Updates and clarifies a few comments related to hooks for
   vector.{insert|extract}_strided_slice.

2. For consistency with vector.insert_strided_slice, removes a TODO from
   vector.extract_strided_slice Op def. It's self-explenatory that
   adding support for non-unit strides is a "TODO".
This commit is contained in:
Andrzej Warzynski 2024-01-22 14:21:21 +00:00
parent 52a8bed426
commit 75b0c913a5
2 changed files with 9 additions and 8 deletions

View File

@ -1121,7 +1121,6 @@ def Vector_ExtractStridedSliceOp :
attribute and extracts the n-D subvector at the proper offset. attribute and extracts the n-D subvector at the proper offset.
At the moment strides must contain only 1s. At the moment strides must contain only 1s.
// TODO: support non-1 strides.
Returns an n-D vector where the first k-D dimensions match the `sizes` Returns an n-D vector where the first k-D dimensions match the `sizes`
attribute. The returned subvector contains the elements starting at offset attribute. The returned subvector contains the elements starting at offset

View File

@ -2789,9 +2789,11 @@ isIntegerArrayAttrConfinedToShape(OpType op, ArrayAttr arrayAttr,
return success(); return success();
} }
// Returns true if all integers in `arrayAttr` are in the interval [min, max}. // Returns true if, for all indices i = 0..shape.size()-1, val is in the
// interval. If `halfOpen` is true then the admissible interval is [min, max). // [min, max} interval:
// Otherwise, the admissible interval is [min, max]. // val = `arrayAttr1[i]` + `arrayAttr2[i]`,
// If `halfOpen` is true then the admissible interval is [min, max). Otherwise,
// the admissible interval is [min, max].
template <typename OpType> template <typename OpType>
static LogicalResult isSumOfIntegerArrayAttrConfinedToShape( static LogicalResult isSumOfIntegerArrayAttrConfinedToShape(
OpType op, ArrayAttr arrayAttr1, ArrayAttr arrayAttr2, OpType op, ArrayAttr arrayAttr1, ArrayAttr arrayAttr2,
@ -2845,8 +2847,8 @@ LogicalResult InsertStridedSliceOp::verify() {
auto stridesName = InsertStridedSliceOp::getStridesAttrName(); auto stridesName = InsertStridedSliceOp::getStridesAttrName();
if (failed(isIntegerArrayAttrConfinedToShape(*this, offsets, destShape, if (failed(isIntegerArrayAttrConfinedToShape(*this, offsets, destShape,
offName)) || offName)) ||
failed(isIntegerArrayAttrConfinedToRange(*this, strides, 1, 1, failed(isIntegerArrayAttrConfinedToRange(*this, strides, /*min=*/1,
stridesName, /*max=*/1, stridesName,
/*halfOpen=*/false)) || /*halfOpen=*/false)) ||
failed(isSumOfIntegerArrayAttrConfinedToShape( failed(isSumOfIntegerArrayAttrConfinedToShape(
*this, offsets, *this, offsets,
@ -3250,8 +3252,8 @@ LogicalResult ExtractStridedSliceOp::verify() {
failed(isIntegerArrayAttrConfinedToShape(*this, sizes, shape, sizesName, failed(isIntegerArrayAttrConfinedToShape(*this, sizes, shape, sizesName,
/*halfOpen=*/false, /*halfOpen=*/false,
/*min=*/1)) || /*min=*/1)) ||
failed(isIntegerArrayAttrConfinedToRange(*this, strides, 1, 1, failed(isIntegerArrayAttrConfinedToRange(*this, strides, /*min=*/1,
stridesName, /*max=*/1, stridesName,
/*halfOpen=*/false)) || /*halfOpen=*/false)) ||
failed(isSumOfIntegerArrayAttrConfinedToShape(*this, offsets, sizes, failed(isSumOfIntegerArrayAttrConfinedToShape(*this, offsets, sizes,
shape, offName, sizesName, shape, offName, sizesName,