[Mlir-commits] [mlir] [mlir][vector] Allow 0-D vector acc/res in `vector.contract` (PR #234638)
Federico Bruzzone
llvmlistbot at llvm.org
Thu Oct 22 23:27:32 PDT 2026
================
@@ -1081,9 +1081,14 @@ static LogicalResult verifyOutputShape(
// Verify 'expectedResultDims'.
if (expectedResultDims.empty()) {
- // No batch or free dimension implies a scalar result.
- if (llvm::isa<VectorType>(resType) || llvm::isa<VectorType>(accType))
- return op.emitOpError("invalid accumulator/result vector shape");
+ // No batch or free dimension implies a scalar or 0-D vector result. The
+ // accumulator and the result must agree.
+ if (resType != accType)
+ return op.emitOpError("expected accumulator and result to have the same "
+ "type");
+ if (auto resVectorType = llvm::dyn_cast<VectorType>(resType))
+ if (resVectorType.getRank() != 0)
+ return op.emitOpError("invalid accumulator/result vector shape");
----------------
FedericoBruzzone wrote:
Indeed, good catch! Only the result is checked at that point. Thank you! FIxed.
https://github.com/llvm/llvm-project/pull/234638
More information about the Mlir-commits
mailing list