I tried to run the flow from tf graph to llvm dialect.
It looks right from tf gragh to affine dialect.
Then, I used -affine-super-vectorize
to convert code to vector dialect and -convert-vector-to-llvm
to llvm dialect.
However, the result didn’t convert to llvm dialect.
Here is my result in affine dialect.
Here is my result in vector dialect.
Here is my result in llvm dialect.
Is there any misunderstanding? Thanks!
As you might have noticed, the code before and after -affine-super-vectorization is exactly the same. This most likely means that the vectorization pass could not process the IR and left it untouched.
If you just want to lower the IR to the LLVM dialect, something like
-lower-affine -convert-scf-to-std -convert-memref-to-llvm -convert-std-to-llvm should work in this case. There will be zero optimization though.
Two side notes:
MLIR is almost never “in X dialect”, it is almost always a combination of dialects. In this case, it is a combination of affine, builtin, memref, TF and standard dialects. Most conversions are partial: they will convert some operations from dialect X to dialect Y, but may keep some operations from X they don’t know how to convert and all operations from other dialects.
The picture flow you are using is extremely outdated, I’ve posted a couple of newer versions.
Thanks for your notes! It helps me to clarify some concepts.
I don’t just want to lower the IR to the LLVM dialect.
I want that the converting path is like affine → vector → llvm which has the specific order.
By the way, I want to ask the reason why the conversion fail between vector dialect and llvm dialect.
I mean I know the pass may leave some operation unchanged, but if I try to convert it to LLVM dialect, it should look like the below picture.
The picture I get from the official website ('vector' Dialect - MLIR) is outdated.
Could you give me some link or hint to help me find the newer version, please?
-debug-only=early-vect to get additional information from the pass. Your guess as to why it fails to vectorize is as good as mine.