[Mlir-commits] [mlir] [MLIR][Linalg] Add static shape masking option in vectorization (PR #214812)

Jianhui Li llvmlistbot at llvm.org
Thu Aug 13 23:03:10 PDT 2026


Jianhui-Li wrote:

Thanks for the review feedback.  @banach-space and @dcaballe 

I would like to point out that padding and masking are not completely alternatives. They address the dynamic shape issue from different angles and can be applied together. Say for matmul, 1) Padding gives a static storage tile, which the fixed-shape op / its vector.contract lowering requires.  2) Masking restricts the compute to the valid extent N, so the computation over padded columns can be skipped.  

One of our motivations is to keep (or add) the masking semantics at the vector level for a dynamic-shape-padded-to-static tile, so that allow vector dialect to generate optimized code.  This is important for XeGPU since the vector size can be very big (as we support workgroup level vector), so preserving mask semantic would allow us to optimize further. But this would be also beneficial for other backend as well.  Do you have any rough idea how this should be done - we can do the padding on linalg, but we also want to trigger the vectorization process to add a mask on top of selective operations (after padding)? 

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


More information about the Mlir-commits mailing list