Skip to content

Commit

Permalink
Use ArrayRef where SmallVector is not needed (#1909)
Browse files Browse the repository at this point in the history
For some reason while porting SelectAndScatter I used SmallVector for
its verify function, and I used ArrayRef everywhere else. ArrayRef is a
slightly better fit as it is more efficient and meant for reading only.

#1578
  • Loading branch information
mlevesquedion authored Jan 9, 2024
1 parent 11804dd commit 54fce14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stablehlo/dialect/TypeInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4153,8 +4153,8 @@ LogicalResult verifyScatterOp(std::optional<Location> location,
// P5. Check if the result type of window operation matches the source type.
LogicalResult verifySelectAndScatterOp(
std::optional<Location> location, Value operand, Value source,
Value initValue, std::optional<SmallVector<int64_t>> windowDimensionsOpt,
std::optional<SmallVector<int64_t>> windowStridesOpt,
Value initValue, std::optional<ArrayRef<int64_t>> windowDimensionsOpt,
std::optional<ArrayRef<int64_t>> windowStridesOpt,
std::optional<DenseIntElementsAttr> padding, Region& select,
Region& scatter) {
auto operandType = operand.getType().cast<ShapedType>();
Expand Down
4 changes: 2 additions & 2 deletions stablehlo/dialect/TypeInference.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ LogicalResult verifyScatterOp(std::optional<Location> location,

LogicalResult verifySelectAndScatterOp(
std::optional<Location> location, Value operand, Value source,
Value initValue, std::optional<SmallVector<int64_t>> windowDimensions,
std::optional<SmallVector<int64_t>> windowStrides,
Value initValue, std::optional<ArrayRef<int64_t>> windowDimensions,
std::optional<ArrayRef<int64_t>> windowStrides,
std::optional<DenseIntElementsAttr> padding, Region& select,
Region& scatter);

Expand Down

0 comments on commit 54fce14

Please sign in to comment.