From 35bd41916b10a9312ec33e90580497bc4c7f22fe Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Thu, 14 Apr 2022 19:54:12 -0700 Subject: [PATCH] [mlir] Add assert to fail with more info (NFC) This would have assert before during tensor type construction with opaque error, assert and fail earlier now. --- mlir/lib/Interfaces/InferTypeOpInterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mlir/lib/Interfaces/InferTypeOpInterface.cpp b/mlir/lib/Interfaces/InferTypeOpInterface.cpp index ff17ed0..8f29682 100644 --- a/mlir/lib/Interfaces/InferTypeOpInterface.cpp +++ b/mlir/lib/Interfaces/InferTypeOpInterface.cpp @@ -191,6 +191,8 @@ LogicalResult mlir::detail::inferReturnTensorTypes( return failure(); for (const auto &shapeAndType : retComponents) { assert(shapeAndType.getAttribute() == nullptr && "attribute not supported"); + assert(shapeAndType.getElementType() && + "element type required to construct tensor"); if (shapeAndType.hasRank()) inferredReturnTypes.push_back(RankedTensorType::get( shapeAndType.getDims(), shapeAndType.getElementType())); -- 2.7.4