memref.subview support mixed SSA values/Attributes for offsets, sizes and strides. The idea of this RFC is to extend this “mixed” representation to other ops that index into ranked shaped types.
%0 = tensor.extract_slice %t [%offset, 5] [10, 10] [1, 1] : ... ^ ^ dynamic static
- Provide an op interface that has convenience methods for dealing with “mixed values”. Things such as
OffsetSizeAndStrideOpInterface, but without the sizes and strides. Prototype: https://reviews.llvm.org/D156899
- Gradually extend operations that operate on shaped types to support mixed offsets:
- Change the signature of
Value. (At the moment, it tries to fold the result to an Attribute, and then materializes it as an SSA value with a constant operation.)
- Maybe: Use a similar approach to support static/dynamic values for
- More opportunities for op verification: Out-of-bounds access of static indices can be verified. Dynamic indices could be verified in some cases, but such verifiers are discouraged according to the MLIR developer guide (“only verify local aspects of an operation”). Example for
tensor.insert_slice: ⚙ D156061 [mlir][tensor] Improve verifiers: detect out-of-bounds accesses
- Better integration with various MLIR helpers that produce or accept
affine::makeComposedFoldedAffineApply, various op builders, …
- Fewer operations and IR that is easier to read. In particular, unrolling vector transfer ops generates many
I have heard mixed opinions about “mixed values”, so I wanted to discuss this before doubling down on this design principle.