diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -1874,9 +1874,9 @@ static LogicalResult verifyYield(linalg::YieldOp op, LinalgOp linalgOp) { if (op.getNumOperands() != linalgOp.getNumDpsInits()) return op.emitOpError("expected number of yield values (") - << linalgOp.getNumDpsInits() - << ") to match the number of operands of the enclosing " - << "LinalgOp (" << op.getNumOperands() << ")"; + << op.getNumOperands() + << ") to match the number of inits / outs operands of the enclosing " + << "LinalgOp (" << linalgOp.getNumDpsInits() << ")"; for (OpOperand &opOperand : op->getOpOperands()) { OpOperand *outputOperand = diff --git a/mlir/test/Dialect/Linalg/invalid.mlir b/mlir/test/Dialect/Linalg/invalid.mlir --- a/mlir/test/Dialect/Linalg/invalid.mlir +++ b/mlir/test/Dialect/Linalg/invalid.mlir @@ -70,7 +70,7 @@ // ----- func.func @generic_mismatched_num_returns(%arg0: memref) { - // expected-error @+6 {{op expected number of yield values (1) to match the number of operands of the enclosing LinalgOp (0)}} + // expected-error @+6 {{op expected number of yield values (0) to match the number of inits / outs operands of the enclosing LinalgOp (1)}} linalg.generic { indexing_maps = [ affine_map<() -> ()> ], iterator_types = []} @@ -202,7 +202,7 @@ // ----- func.func @generic_mismatched_num_arguments(%arg0: memref) { - // expected-error @+6 {{'linalg.yield' op expected number of yield values (2) to match the number of operands of the enclosing LinalgOp (1)}} + // expected-error @+6 {{'linalg.yield' op expected number of yield values (1) to match the number of inits / outs operands of the enclosing LinalgOp (2)}} linalg.generic { indexing_maps = [ affine_map<() -> ()>, affine_map<() -> ()> ], iterator_types = []} @@ -399,7 +399,7 @@ outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 - // expected-error @+1{{'linalg.yield' op expected number of yield values (1) to match the number of operands of the enclosing LinalgOp (2)}} + // expected-error @+1{{'linalg.yield' op expected number of yield values (2) to match the number of inits / outs operands of the enclosing LinalgOp (1)}} linalg.yield %0, %0: f32, f32 } func.return %add : tensor<64xf32>