Beaver.MLIR.Bytecode (beaver v0.4.8)

Copy Markdown

Reads and writes versioned MLIR bytecode.

:desired_emit_version asks MLIR to emit a specific bytecode version. MLIR returns an error instead of silently emitting another version when the requested version cannot be honored.

Summary

Types

write_option()

@type write_option() :: {:desired_emit_version, integer() | nil}

Functions

read(bytecode, opts \\ [])

@spec read(
  binary(),
  keyword()
) :: {:ok, Beaver.MLIR.Module.t()} | {:error, Beaver.MLIR.diagnostics()}

See Beaver.MLIR.Module.create/2.

read!(bytecode, opts \\ [])

@spec read!(
  binary(),
  keyword()
) :: Beaver.MLIR.Module.t()

See Beaver.MLIR.Module.create!/2.

write(module_or_operation, opts \\ [])

@spec write(Beaver.MLIR.Module.t() | Beaver.MLIR.Operation.t(), [write_option()]) ::
  {:ok, binary()} | {:error, :unsupported_bytecode_version}

write!(module_or_operation, opts \\ [])