I am still quite new to all things mlir-related and I was wondering if there’s a way with linalg.generic to read two elements at a time in a tensor/memref (perhaps with a stride?)?
I didn’t make it clear that my question was more general than this specific example, my apologies. I am actually wondering if there is a way for the computation block in a linalg.generic to act on, say, pairs of consecutive elements of a tensor, not specifically for such a reduction.
From what I gathered there’s no way to use a block that takes something else than a scalar value corresponding to the element type of the input (and output) tensor, right?
For a more involved example, say I have two tensor<MxNx2xT> as input, and a tensor<MxNx2XT> as output, and I want to use these as a representation of tensors of complex numbers (where the last dimension separates real and imaginary part), and I want to implement complex multiplication. I would thus need to read 2 consecutive elements at the time (the real and imaginary part) from my inputs to write 2 consecutive elements to my output, is there any way to do this in linalg (other than using the complex<T> element type)?
The following does not work because the computation block only accepts basic element types, but is there a general way to simulate it?