[Mlir-commits] [mlir] [mlir][linalg][conv] Flatten the channel dimension when vectorizing (PR #71918)

Andrzej Warzyński llvmlistbot at llvm.org
Fri Nov 10 02:45:50 PST 2023


banach-space wrote:

For context, here's the previous conversation on this specialisation:
* https://reviews.llvm.org/D149155

We have tried to implement this as **pre-processing phase** (as discussed in D149155), but that leads to either:
*  `linalg.generic`s with indexing maps which are not permutations (does not vectorize), or
* strided loads (which are bound to be slow).

So, we rejected the idea of any pre-processing and have considered two alternatives:
1. add **a special case** to the **vectoriser** (implemented here), or
2. implement a **post-processing phase** that would flatten the channel dimension (potential alternative).

The benefits of Option 1. are that: 
* it's available today (and this is now quite critical for us), and 
* it only requires changes in one place (i.e. the vectorizer). 

The benefits of Option 2. would be that:
* we wouldn't be adding any new cases to the vectorizer (is that the design goal?),

However, I expect that we might see some missing canonicalisations or other issues (TBH, I've only looked at it briefly).

I am happy to investigate Option 2. if that's preferable. However, I would prefer to do it in follow-up patches and to have this in-tree in the meantime.

WDYT? And thank you for all the feedback so far :) 🙏🏻 

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


More information about the Mlir-commits mailing list