Hi everyone. Now I have lots of MLIR programs that are represented by different dialects. I want to execute them to see if their behaviors are as expected.
Referring to the test/Integration/
directory in the codebase, the solution seems clear: I need to lower those ops to LLVM/SPIRV dialect with different pass sequences first, and then the mlir-cpu-runner
to execute.
However, as a beginner to MLIR, the first step seems difficult to me:
It’s not easy to find the correct pass sequence for lowering. Some passes’ names are quite confusing to me, for example, the --convert-linalg-to-llvm
pass, which I thought may lower the entire ops in linalg dialect, only has one ConversionPattern YieldOpConversion
. For some passes, I don’t know when and where to use them. the pass sequence seems to be order-sensitive, which makes exploring space huge.
I also try to learn from tests in test/Integration/
, but they are insufficient: the lowering process lacks bufferization and some dialects/ops ( index dialect, affine dialect, etc…) are not involved.
I believe these questions will be solved as I go deeper into MLIR in the future. But for now, my question is: is there a direct way to compile MLIR (containing ops of many dialects) to LLVM IR, just like compiling C to LLVM IR?