[Mlir-commits] [mlir] [mlir][linalg] Relax structured op region filler check (PR #123741)

Adam Siemieniuk llvmlistbot at llvm.org
Wed Jan 22 02:32:22 PST 2025


================
@@ -121,14 +121,11 @@ using RegionBuilderFn = llvm::function_ref<void(ImplicitLocOpBuilder &, Block &,
 /// `regionBuilder`. The method is used by both named structured ops created by
 /// ods-gen and by manually defined C++ ops. It is called by both builders and
 /// parsers and creates a block with arguments corresponding to the elemental
-/// types of `inputTypes` and `outputTypes`. All output types are asserted to be
-/// ShapedType.
+/// types of `inputTypes` and `outputTypes`.
 static void fillStructuredOpRegion(OpBuilder &opBuilder, Region &region,
                                    TypeRange inputTypes, TypeRange outputTypes,
                                    ArrayRef<NamedAttribute> attrs,
                                    RegionBuilderFn regionBuilder) {
-  assert(llvm::all_of(outputTypes, llvm::IsaPred<ShapedType>));
----------------
adam-smnk wrote:

I would leave it to the verifier to validate type correctness.
AFAIK, nothing in the current logic or usage of this function restricts it to `ShapedType`.

I suppose the original motivation behind this check was that Linalg ops are restricted to buffers or tensors only. IMO, it's not the best place to enforce this rule with a debug assert.

https://github.com/llvm/llvm-project/pull/123741


More information about the Mlir-commits mailing list