forked from OSchip/llvm-project
[mlir][interfaces][NFC] Remove ViewLikeInterface::expandToRank
This helper function is no longer needed. Differential Revision: https://reviews.llvm.org/D129145
This commit is contained in:
parent
a4772cbaf0
commit
fb0654ced3
|
@ -457,20 +457,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
|
|||
::mlir::OffsetSizeAndStrideOpInterface::getStaticStridesAttrName(),
|
||||
::mlir::OpTrait::AttrSizedOperandSegments<void>::getOperandSegmentSizeAttr()};
|
||||
return names;
|
||||
}
|
||||
/// Assume target is a shaped type and offsets/sizes/strides are vectors of
|
||||
/// the same length and lower than target's rank.
|
||||
/// Complete missing dims `i` with offset=0, size=dim(target, i), stride=1
|
||||
/// until all vectors have size rank. The commpletion occurs for the most
|
||||
/// minor dimensions (i.e. fastest varying).
|
||||
/// Take a `createDim` lambda that knows how to build the size of a
|
||||
/// particular dimension of `target` (to avoid dialect dependencies).
|
||||
static void expandToRank(
|
||||
Value target,
|
||||
SmallVector<OpFoldResult> &offsets,
|
||||
SmallVector<OpFoldResult> &sizes,
|
||||
SmallVector<OpFoldResult> &strides,
|
||||
llvm::function_ref<OpFoldResult(Value, int64_t)> createDim);
|
||||
}
|
||||
}];
|
||||
|
||||
let verify = [{
|
||||
|
|
|
@ -179,25 +179,6 @@ bool mlir::detail::sameOffsetsSizesAndStrides(
|
|||
return true;
|
||||
}
|
||||
|
||||
void OffsetSizeAndStrideOpInterface::expandToRank(
|
||||
Value target, SmallVector<OpFoldResult> &offsets,
|
||||
SmallVector<OpFoldResult> &sizes, SmallVector<OpFoldResult> &strides,
|
||||
llvm::function_ref<OpFoldResult(Value, int64_t)> createOrFoldDim) {
|
||||
auto shapedType = target.getType().cast<ShapedType>();
|
||||
unsigned rank = shapedType.getRank();
|
||||
assert(offsets.size() == sizes.size() && "mismatched lengths");
|
||||
assert(offsets.size() == strides.size() && "mismatched lengths");
|
||||
assert(offsets.size() <= rank && "rank overflow");
|
||||
MLIRContext *ctx = target.getContext();
|
||||
Attribute zero = IntegerAttr::get(IndexType::get(ctx), APInt(64, 0));
|
||||
Attribute one = IntegerAttr::get(IndexType::get(ctx), APInt(64, 1));
|
||||
for (unsigned i = offsets.size(); i < rank; ++i) {
|
||||
offsets.push_back(zero);
|
||||
sizes.push_back(createOrFoldDim(target, i));
|
||||
strides.push_back(one);
|
||||
}
|
||||
}
|
||||
|
||||
SmallVector<OpFoldResult, 4>
|
||||
mlir::getMixedOffsets(OffsetSizeAndStrideOpInterface op,
|
||||
ArrayAttr staticOffsets, ValueRange offsets) {
|
||||
|
|
Loading…
Reference in New Issue