[Mlir-commits] [mlir] [mlir][vector] Add tests for `TransferWritePermutationLowering` (PR #95529)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Jun 14 08:28:28 PDT 2024


================
@@ -1,14 +1,81 @@
 // RUN: mlir-opt %s --transform-interpreter --split-input-file | FileCheck %s
 
 ///----------------------------------------------------------------------------------------
-/// vector.transfer_write
+/// vector.transfer_write -> vector.transpose + vector.transfer_read
----------------
banach-space wrote:

> Maybe naming the actual pattern being tested here TransferWritePermutationLowering makes sense.

This is a bit tricky - what do you we for tests that are meant to trigger multiple patterns? What if later such patterns are split into other patterns? I guess it's safe if it's just one pattern, but doesn't scale well.

> Overall, I find the name of this pattern maybe a bit confusing. 

* It's a pattern for `vector.transfer_write`, hence `TransferWrite`
* It looks at the attached `permutation_map` to decide what to do, hence `Permutation`
* It "lowers" a complex `xfer_write` with an explicit permutation map, into a much simpler `xfer_write`

Also, from https://mlir.llvm.org/docs/Dialects/Vector/#vectortransfer_read-vectortransferreadop,
> The permutation_map [attribute](https://mlir.llvm.org/docs/LangRef/) is an [affine-map](https://mlir.llvm.org/docs/Dialects/Affine/) which specifies the transposition on the slice to match the vector shape. The permutation map may be implicit and omitted from parsing and printing if it is the canonical minor identity map (i.e. if it does not permute or broadcast any dimension).

So a minor identity map is consider the "lower level" canonical form. In this sense then name makes sense. WDYT? I'm happy to rename it though if there's sth better.

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


More information about the Mlir-commits mailing list