Version: 1.1.0

Inline MLIR

Inline MLIR is an escape hatch to operations the surface language does not wrap yet, including some hardware intrinsics.

Essentials

  • The builtin accepts an MLIR snippet and Mojo values to bind.
  • Types on the Mojo side must match the dialect operation.
  • This is a compiler interface. It can change between nightlies.
  • Prefer a standard-library wrapper when one exists.

Example

# Pseudocode shape. Keep dialect ops inside the builtin the compiler provides.
fn widen(value: Int) -> Int:
    return value

Keep in mind

If you need inline MLIR in application code, file an issue. Most programs should stay in surface Mojo.