[Mlir-commits] [mlir] [mlir][linalg] Preserve unsigned integer widening in named contraction vectorization (PR #216283)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Aug 23 20:09:52 PDT 2026
================
@@ -348,6 +348,96 @@ module attributes {transform.with_named_sequence} {
// -----
+func.func @matmul_mixed_precision_unsigned(
+ %A: tensor<4x16xi8>, %B: tensor<16x4xi8>,
+ %C: tensor<4x4xi32>) -> tensor<4x4xi32> {
+ %0 = linalg.matmul {cast = #linalg.type_fn<cast_unsigned>}
----------------
Pecco-314 wrote:
The signed case is covered by `@matmul_mixed_precision_signed`. `cast_signed` is the default for `linalg.matmul`, so the attribute is omitted. Unlike the unsigned case, mixed-width integer `vector.contract`
already has implicit sign-extension semantics, so no explicit `extsi` is needed. The checks verify that no extension is inserted.
See [VectorOps.td](https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td), line 77:
> If operands and the result have types of different bitwidths, operands are
> promoted to have the same bitwidth as the result before performing the
> contraction. For integer types, only signless integer types are supported,
> and the promotion happens via sign extension.
https://github.com/llvm/llvm-project/pull/216283
More information about the Mlir-commits
mailing list