[mlir][sparse] introduce operations to query sparse tensor slice offset/strides at the given dimenion

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D141442
This commit is contained in:
Peiming Liu
2023-01-10 23:46:45 +00:00
parent a851d46e07
commit c738b430c4
5 changed files with 135 additions and 0 deletions

View File

@@ -765,6 +765,20 @@ LogicalResult ToValuesOp::verify() {
return success();
}
LogicalResult ToSliceOffsetOp::verify() {
auto rank = getRankedTensorType(getSlice()).getRank();
if (rank <= getDim().getSExtValue() || getDim().getSExtValue() < 0)
return emitError("requested dimension out of bound");
return success();
}
LogicalResult ToSliceStrideOp::verify() {
auto rank = getRankedTensorType(getSlice()).getRank();
if (rank <= getDim().getSExtValue() || getDim().getSExtValue() < 0)
return emitError("requested dimension out of bound");
return success();
}
LogicalResult GetStorageSpecifierOp::verify() {
RETURN_FAILURE_IF_FAILED(verifySparsifierGetterSetter(
getSpecifierKind(), getDim(), getSpecifier(), getOperation()))