Memref cast

Can you send a patch for review since you already implemented this?

Independently, note that this wouldn’t solve the issue at hand: such a memref_cast cannot be legalized by itself on certain backends and needs to be folded into the memory operations.
This folding could be done at conversion time but letting the memory op “bitcast on the fly” seems like a desirable abstraction to avoid requiring (multiple) HW-specific type conversions to be able to legalize the op.

How does this work then your ?x? is 1x1 at runtime?