Beaver.MLIR.TypeConverter (beaver v0.4.8)

Copy Markdown

An owning MLIR type converter whose Elixir callbacks are safe across native worker threads, process termination, and NIF upgrades.

Conversion callbacks may return one type (1:1), multiple types (1:N), an empty list (type erasure), :declined, or {:error, reason}.

Summary

Types

conversion_result()

@type conversion_result() ::
  Beaver.MLIR.Type.t()
  | {:ok, Beaver.MLIR.Type.t()}
  | :declined
  | {:error, term()}

materialization_result()

@type materialization_result() ::
  Beaver.MLIR.Value.t()
  | {:ok, Beaver.MLIR.Value.t()}
  | :declined
  | {:error, term()}

one_to_n_materialization_result()

@type one_to_n_materialization_result() ::
  [Beaver.MLIR.Value.t()]
  | {:ok, [Beaver.MLIR.Value.t()]}
  | :declined
  | {:error, term()}

one_to_n_result()

@type one_to_n_result() ::
  [Beaver.MLIR.Type.t()]
  | {:ok, [Beaver.MLIR.Type.t()]}
  | :declined
  | {:error, term()}

t()

@type t() :: %Beaver.MLIR.TypeConverter{
  ref: term(),
  registration: term(),
  timeout_ms: term()
}

Functions

add_1_to_n_conversion(converter, callback)

@spec add_1_to_n_conversion(t(), (Beaver.MLIR.Type.t() -> one_to_n_result())) :: t()

add_1_to_n_target_materialization(converter, callback)

@spec add_1_to_n_target_materialization(
  t(),
  (Beaver.MLIR.RewriterBase.t(),
   [Beaver.MLIR.Type.t()],
   [Beaver.MLIR.Value.t()],
   Beaver.MLIR.Location.t(),
   Beaver.MLIR.Type.t()
   | nil ->
     one_to_n_materialization_result())
) :: t()

add_conversion(converter, callback)

@spec add_conversion(t(), (Beaver.MLIR.Type.t() -> conversion_result())) :: t()

add_source_materialization(converter, callback)

add_target_materialization(converter, callback)

convert(converter, type)

@spec convert(t(), Beaver.MLIR.Type.t()) ::
  {:ok, Beaver.MLIR.Type.t()} | {:error, term()}

create(opts \\ [])

@spec create(keyword()) :: t()

destroy(type_converter)

@spec destroy(t()) :: :ok

make(value)

with(opts \\ [], fun)

@spec with(
  keyword(),
  (t() -> result)
) :: result
when result: var