Numerical casting in linalg.conv_2d

Hi,

Convolution Ops from Linalg can do numeric casting when needed (from the docs):

Numeric casting is performed on the operands to the inner multiply, promoting them to the same data type as the accumulator/output.

However, currently this seems to be always a signed extension:

  • conv_2d from “/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml”,
  • promote from “mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp”.

My input is unsigned and hence I need an unsigned extension :slight_smile: What would be the most Linalg-friendly way to support unsigned extensions?

I see that there’s linalg.matmul_unsigned, but that approach for convolutions would mean additional 21 ops (that’s the number of convolutions ops), so not really an option.

CC @nicolasvasilache

Thanks,
-Andrzej