[Mlir-commits] [mlir] [mlir][tosa] Change the start and size of slice to tosa shape type (PR #124209)
Tai Ly
llvmlistbot at llvm.org
Fri Jan 24 16:57:57 PST 2025
================
@@ -891,8 +891,18 @@ LogicalResult tosa::SliceOp::inferReturnTypeComponents(
MLIRContext *context, ::std::optional<Location> location,
SliceOp::Adaptor adaptor,
SmallVectorImpl<ShapedTypeComponents> &inferredReturnShapes) {
- auto start = adaptor.getStart();
- auto size = adaptor.getSize();
+
+ Type inputType = getElementTypeOrSelf(adaptor.getInput1().getType());
+ SmallVector<int64_t> start;
+ SmallVector<int64_t> size;
+
+ if (!tosa::getConstShapeValue(adaptor.getStart().getDefiningOp(), start) ||
----------------
Tai78641 wrote:
we could change return value to LogicalResult from bool.
in fact there is a similar function in TF,
tensorflow/compiler/mlir/tensorflow/transforms/tensor_list_ops_decomposition.cc
// Parses an R1 value to `shape` if it is a TF::ConstOp output. Otherwise,
// returns an error.
LogicalResult GetConstShapeValue(Value shape_value,
llvm::SmallVector<int64_t, 8>* shape) {
https://github.com/llvm/llvm-project/pull/124209
More information about the Mlir-commits
mailing list