I am working on raising the abstraction level from imported C-code.
Basically, we compile snippets representing interpreter instruction behavior (these are implemented in C, with language specific intrinsics) to LLVM IR, then import that in the MLIR LLVM dialect and from there apply the conversion framework to turn this into another dialect which is higher level to some extent. The dialect does expect to convert intrinsics to instructions. On the other hand some of our dialect is inspired by Generic Machine IR, so we have low level instructions as well in it.
The usecase is to generate a code generator for our interpreter with faster code generation speed (but naturally lower optimization level) than ORCjit can provide, for use in a tier 1 JITter for our project. ORCjit can still be used at a higher tier.
In any case, has anyone else worked with raising abstraction levels in MLIR, maybe there are some lessions learned available?
I am taking notes and will append these to this thread, I think we already had some issues when deleting function arguments for example, but I will come back with more info later.
Yes this is expected, because we are using MLIR offline for generating a code generator that will be emitting machine code directly; we will not emit IR for processing at runtime.
Of-course, this means that only trivial optimisations are applied that can be done quickly, like some naive register allocation, constant evaluation and some isel level stuff like strength reduction of multiplies / divides with power of two constants.