tarides / hackocaml

OCaml hacking ideas, small and large.
MIT License
19 stars 1 forks source link

Compile OCaml to MLIR #38

Open kayceesrk opened 2 hours ago

kayceesrk commented 2 hours ago

Some references. Triton would be a good starting point (https://github.com/triton-lang/triton) which lowers Python AST to different MLIR Dialects (https://www.youtube.com/watch?v=AtbnRIzpwho). There are also other examples, such as Flang (MLIR/LLVM-based compiler) https://mlir.llvm.org/users/. Also, this talk would be useful, especially for functional programming languages (https://www.youtube.com/watch?v=cyMQbZ0B84Q&pp=ygUTbGFtYmRhIHNzYSBsbHZtIGRldg%3D%3D).

kayceesrk commented 2 hours ago

Potential starting points might be either bytecode (as in the case of js_of_ocaml and wasm_of_ocaml compilers) or flambda2 (after the optimisations passes https://github.com/ocaml-flambda/flambda-backend/)