[Mlir-commits] [mlir] [mlir][vector] Test that transpose folds keep per-dim info (PR #219611)

Jianhui Li llvmlistbot at llvm.org
Fri Aug 28 22:28:11 PDT 2026


================

----------------
Jianhui-Li wrote:

my motivation case is the following. 

%0 = vector.shape_cast %x : vector<1x32x1xf32> to vector<1x32xf32> 
%1 = vector.broadcast %0 : vector<1x32xf32> to vector<64x1x32xf32>
%2 = vector.transpose %1, [1, 2, 0] : vector<64x1x32xf32> to vector<1x32x64xf32> 

The #215940 try to fold it as:  %2 = vector.broadcast %x : vector<1x32x1xf32> to vector<1x32x64xf32> 

Below is my understanding of dim_tags propagation works. Does it make sense? 

%0 = vector.shape_cast %x : vector<1x32x1xf32> to vector<1x32xf32>  {dim_tags = array<i64: 111, 222, 333>}
%1 = vector.broadcast %0 : vector<1x32xf32> to vector<64x1x32xf32>  {dim_tags = array<i64: 111, 222>}
%2 = vector.transpose %1, [1, 2, 0] : vector<64x1x32xf32>
                                                      to vector<1x32x64xf32>   {dim_tags = array<i64: -1, 111, 222>}
// CHECK-SAME: propagated_tags = array<i64: 111, 222, -1>

if folded, then dim_tags is array<i64: 111, 222, 333>, which I think should be considered match since -1 works like "*".  

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


More information about the Mlir-commits mailing list