mlir-rs/melior

The rustic MLIR bindings in Rust

What it solves

Melior provides a safe and complete Rust API for interacting with MLIR (Multi-Level Intermediate Representation), removing the need to work directly with the complex and potentially unsafe MLIR C API.

How it works

It acts as a high-level wrapper around the MLIR C API, utilizing Rust's type system to implement a more sane ownership model for MLIR objects. It maps C-style creation and getter functions to idiomatic Rust naming conventions and handles the conversion of strings to UTF-8.

Who it’s for

Developers building compilers or machine learning frameworks in Rust who need to leverage the power of MLIR for intermediate representation and optimization.

Highlights

  • Type-Safe Wrapper: Simplifies the MLIR C API into a more accessible Rust interface.
  • Ownership Management: Uses specific naming conventions (e.g., Ref suffixes for borrowed objects) to manage MLIR's loose ownership model.
  • Dialect Support: Allows for the registration and loading of various MLIR dialects.
  • Crate Integration: Easily installable via cargo add melior.

Related

  • Project
  • Project
  • Project
  • Project
  • Project