onnx / onnx-mlir

Representation and Reference Lowering of ONNX Models in MLIR Compiler Infrastructure
Apache License 2.0
767 stars 320 forks source link

What does ”std dialect“ do? I didn't find a way to convert "onnx dialect /affine dialect" to ”std dialect“. #3007

Open pyl3000 opened 5 days ago

pyl3000 commented 5 days ago

image

AlexandreEichenberger commented 5 days ago

I believe this slides say "std" for the standard MLIR dialects like SCF, MemRef, Math, Arith,...

In general, we have a few Krnl operations that are lowered late; most are lowered during the krnl-to-affine but a few are lowered later, up to lowering to LLVM.

That is the standard path that we use here. If you want to hook it up to MLIR to continue optimizations there, you may have a few paths; TOSA or StableHLO which takes ONNX dialects to these, which can then be moved to MLIR. Potentially, you can also pick up some of our lowering patterns for KRNL and applying them in a different order. You are welcome to experiment, and changes could be integrated under a different --EmitXXX option (see onnx-mlir -help for the emit target that we currently support).