docs.rs failed to build melior-0.4.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Melior is the rustic MLIR bindings for Rust. It aims to provide a simple, safe, and complete API for MLIR with a reasonably sane ownership model represented by the type system in Rust.
This crate is a wrapper of the MLIR C API.
Dependencies
LLVM/MLIR 16 needs to be installed on your system. On Linux and macOS, you can install it via Homebrew.
Safety
Although Melior aims to be completely safe, some part of the current API is not.
- Access to operations, types, or attributes that belong to dialects not loaded in contexts can lead to runtime errors or segmentation faults in the worst case.
- Fix plan: Load all dialects by default on creation of contexts, and provide unsafe constructors of contexts for advanced users.
- IR object references returned from functions that move ownership of arguments might get invalidated later.
- This is because we need to borrow
&selfrather than&mut selfto return such references. - e.g.
Region::append_block() - Fix plan: Use dynamic check, such as
RefCell, for the objects.
Examples
Building a function to add integers
use ;
let registry = new;
register_all_dialects;
let context = new;
context.append_dialect_registry;
context.get_or_load_dialect;
let location = unknown;
let module = new;
let integer_type = integer;
let function = ;
module.body.append_operation;
assert!;