[Mlir-commits] [mlir] [MLIR][Vector] Update Transfer{Read|Write}DropUnitDimsPattern patterns (PR #112394)

Andrzej Warzyński llvmlistbot at llvm.org
Sat Oct 19 02:20:25 PDT 2024


banach-space wrote:

> I was looking for some tests with shape_cast ops generated; I found that it does not support the below case. Can you take a look?
> 
> Note: it is a test in the original file and I just added a `vector.mask` op around it.
> 
> ```mlir
> func.func @transfer_read_and_vector_rank_reducing_to_0d_masked(
>       %arg : memref<1x1x1x1x1xf32>,
>       %mask: vector<1x1x1xi1>) -> vector<1x1x1xf32> {
>     %c0 = arith.constant 0 : index
>     %cst = arith.constant 0.0 : f32
>     %v = vector.mask %mask {
>       vector.transfer_read %arg[%c0, %c0, %c0, %c0, %c0], %cst :
>       memref<1x1x1x1x1xf32>, vector<1x1x1xf32>
>     } : vector<1x1x1xi1> -> vector<1x1x1xf32>
>     return %v : vector<1x1x1xf32>
> }
> module attributes {transform.with_named_sequence} {
>   transform.named_sequence @__transform_main(%root : !transform.any_op {transform.readonly}) {
>     %func_op = transform.structured.match ops{["func.func"]} in %root : (!transform.any_op) -> !transform.op<"func.func">
>     transform.apply_patterns to %func_op {
>       transform.apply_patterns.vector.rank_reducing_subview_patterns
>     } : !transform.op<"func.func">
>     transform.yield
>   }
> }
> ```

Great catch, thanks for checking! Turns out `vector.mask` doesn't support 0-d vectors. This should be easy to extend, but let's bail out for now - I am a bit blocked 😅 

https://github.com/llvm/llvm-project/pull/112394


More information about the Mlir-commits mailing list