Beaver.MLIR.TransformOpInterface behaviour (beaver v0.4.8)

Copy Markdown

Implements MLIR's TransformOpInterface for dynamic operations.

apply/4 callbacks receive the transform operation, a borrowed Beaver.MLIR.TransformRewriter, borrowed results storage, and borrowed transform state. They return :ok, {:ok, mappings}, a silenceable failure, or a definite failure. Result mappings associate an operation result (or its integer index) with {:ops, operations}, {:values, values}, or {:params, attributes}.

{:ok, %{0 => {:ops, payload_operations}}}

All borrowed values are valid only for the dynamic extent of the callback. Use payload_ops/2, payload_values/2, and params/2 to inspect mappings, and rewriter_base/1 to use the normal rewriter API.

Summary

Functions

Attaches a callback-backed transform operation interface model.

Returns parameters mapped to a transform handle.

Returns payload operations mapped to a transform handle.

Returns payload values mapped to a transform handle.

Casts a borrowed transform rewriter to the normal rewriter base.

Types

apply_result()

@type apply_result() ::
  :ok
  | {:ok, result_mapping() | nil}
  | :silenceable_failure
  | :definite_failure
  | {:error, :silenceable | :definite}

result_mapping()

@type result_mapping() ::
  %{
    optional(non_neg_integer() | Beaver.MLIR.Value.t()) =>
      {:ops, [Beaver.MLIR.Operation.t()]}
      | {:values, [Beaver.MLIR.Value.t()]}
      | {:params, [Beaver.MLIR.Attribute.t()]}
  }
  | keyword()

Callbacks

allows_repeated_handle_operands?(t)

(optional)
@callback allows_repeated_handle_operands?(Beaver.MLIR.Operation.t()) :: boolean()

apply(t, t, t, t)

Functions

attach(context, operation_name, implementation, opts \\ [])

Attaches a callback-backed transform operation interface model.

params(state, handle)

Returns parameters mapped to a transform handle.

payload_ops(state, handle)

Returns payload operations mapped to a transform handle.

payload_values(state, handle)

Returns payload values mapped to a transform handle.

rewriter_base(rewriter)

Casts a borrowed transform rewriter to the normal rewriter base.