Beaver.MLIR.Sigils (beaver v0.2.19)
Sigils return a function to create MLIR elements by parsing the content.
Link to this section Summary
Functions
Create an attribute creator. You might add a modifier to it as a shortcut to annotate the type
Create a module creator.
Create a type creator. You might add a modifier to it as a shortcut to make it a higher order type.
Link to this section Functions
Link to this function
sigil_a(string, modifier)
Create an attribute creator. You might add a modifier to it as a shortcut to annotate the type
examples
Examples
iex> ctx = MLIR.Context.create()
iex> Attribute.equal?(Attribute.float(Type.f(32), 0.0).(ctx), ~a{0.0}f32.(ctx))
true
iex> ~a{1 : i32}.(ctx) |> MLIR.to_string()
"1 : i32"
iex> ctx |> MLIR.Context.destroy
Link to this function
sigil_m(string, list)
Create a module creator.
examples
Examples
iex> ctx = MLIR.Context.create()
iex> %MLIR.Module{} = ~m"""
...> module {
...> func.func @add(%arg0 : i32, %arg1 : i32) -> i32 attributes { llvm.emit_c_interface } {
...> %res = arith.addi %arg0, %arg1 : i32
...> return %res : i32
...> }
...> }
...> """.(ctx) |> MLIR.Operation.verify!()
iex> ctx |> MLIR.Context.destroy
Link to this function
sigil_t(string, modifier)
Create a type creator. You might add a modifier to it as a shortcut to make it a higher order type.
examples
Examples
iex> ctx = MLIR.Context.create()
iex> Type.equal?(Type.unranked_tensor(Type.f32()).(ctx), ~t{tensor<*xf32>}.(ctx))
true
iex> Type.equal?(Type.complex(Type.f32()).(ctx), ~t<f32>complex.(ctx))
true
iex> ctx |> MLIR.Context.destroy