[Mlir-commits] [mlir] a58ed7f - Fix ConstShapeOp::inferReturnTypes to be resilient to lack of properties
Mehdi Amini
llvmlistbot at llvm.org
Mon May 15 12:14:07 PDT 2023
Author: Mehdi Amini
Date: 2023-05-15T12:12:28-07:00
New Revision: a58ed7fcf6fcae7b622f8a1873459f28725ce7d6
URL: https://github.com/llvm/llvm-project/commit/a58ed7fcf6fcae7b622f8a1873459f28725ce7d6
DIFF: https://github.com/llvm/llvm-project/commit/a58ed7fcf6fcae7b622f8a1873459f28725ce7d6.diff
LOG: Fix ConstShapeOp::inferReturnTypes to be resilient to lack of properties
The Python bindings test aren't using properties yet, this is a bit
of a hack to support this here, but hopefully it'll be temporary.
Added:
Modified:
mlir/lib/Dialect/Shape/IR/Shape.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index 24302544ea06..58d0e6aa3964 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -921,7 +921,13 @@ LogicalResult mlir::shape::ConstShapeOp::inferReturnTypes(
SmallVectorImpl<Type> &inferredReturnTypes) {
Builder b(context);
Properties *prop = properties.as<Properties *>();
- DenseIntElementsAttr shape = prop->shape;
+ DenseIntElementsAttr shape;
+ // TODO: this is only exercised by the Python bindings codepath which does not
+ // support properties
+ if (prop)
+ shape = prop->shape;
+ else
+ shape = attributes.getAs<DenseIntElementsAttr>("shape");
if (!shape)
return emitOptionalError(location, "missing shape attribute");
inferredReturnTypes.assign({RankedTensorType::get(
More information about the Mlir-commits
mailing list