[Mlir-commits] [mlir] [mlir][tosa][WIP] More informative error messages on block scaled types (PR #209736)
Luke Hutton
llvmlistbot at llvm.org
Thu Jul 23 07:39:10 PDT 2026
================
@@ -172,35 +172,42 @@ def AtLeastRankOne : And<[
CPred<"::llvm::cast<::mlir::RankedTensorType>($_self).getRank() >= 1">]>;
def IsValidBlockScaledTensorType
- : CPred<"::mlir::succeeded(::mlir::tosa::verifyBlockScaledTensorType($_self, false))">;
+ : CPred<"::mlir::succeeded(::mlir::tosa::"
+ "verifyBlockScaledTensorType($_self))">;
+
+// Analogous to ShapedContainerType, but with additional 'summary' information.
+// This is used to provide more informative error messages when a type predicate
+// is false.
+class TosaShapedContainerType<list<Type> allowedTypes, Pred containerPred, string descr, string cppType = "::mlir::Type"> :
+ Type<And<[containerPred,
+ Concat<"[](::mlir::Type elementType) { return ",
+ SubstLeaves<"$_self", "elementType",
+ AnyTypeOf<allowedTypes>.predicate>,
+ "; }(::llvm::cast<::mlir::ShapedType>($_self).getElementType())">]>,
----------------
lhutton1 wrote:
Thanks, I've addressed in https://github.com/llvm/llvm-project/pull/211569
https://github.com/llvm/llvm-project/pull/209736
More information about the Mlir-commits
mailing list