Beaver.MLIR.RewritePatternSet (beaver v0.4.8)

Copy Markdown

This module defines functions working with MLIR RewritePatternSet.

Summary

Functions

Add a rewrite pattern into a MLIR.RewritePatternSet.

Creates a dialect conversion pattern and transfers it into this set.

Freeze the given MLIR.RewritePatternSet to a MLIR.FrozenRewritePatternSet. Note that the ownership of the input set is transferred into the frozen set after this call.

Destroy the given MLIR.RewritePatternSet or MLIR.FrozenRewritePatternSet outside a BEAM scheduler thread.

Create a MLIR.RewritePatternSet from the given PDL patterns. The patterns is a list of functions that accept two arguments: ctx and block, and create PDL patterns in the given block under the given ctx. The opts may contain

Types

t()

@type t() :: %Beaver.MLIR.RewritePatternSet{ref: term()}

Functions

add(set, pattern)

@spec add(t(), Beaver.MLIR.RewritePattern.t()) :: t()

Add a rewrite pattern into a MLIR.RewritePatternSet.

The set takes ownership of a raw MLIR.RewritePattern. Native descriptors are materialized through the existing callback-backed rewrite bridge before ownership is transferred.

add(set, descriptor, opts)

@spec add(t(), Beaver.Pattern.Native.Descriptor.t(), keyword()) :: t()
@spec add(t(), term(), module() | function() | Beaver.Pattern.Native.Descriptor.t()) ::
  t()

add(set, root_name, descriptor, opts)

@spec add(
  t(),
  term(),
  module() | function() | Beaver.Pattern.Native.Descriptor.t(),
  keyword()
) :: t()

add_conversion(set, root_name, converter, match_and_rewrite, opts \\ [])

Creates a dialect conversion pattern and transfers it into this set.

create(context)

See Beaver.MLIR.CAPI.mlirRewritePatternSetCreate/1.

destroy(set)

See Beaver.MLIR.CAPI.mlirRewritePatternSetDestroy/1.

freeze(set)

Freeze the given MLIR.RewritePatternSet to a MLIR.FrozenRewritePatternSet. Note that the ownership of the input set is transferred into the frozen set after this call.

make(value)

threaded_destroy(ctx, set)

Destroy the given MLIR.RewritePatternSet or MLIR.FrozenRewritePatternSet outside a BEAM scheduler thread.

with_pdl_patterns(patterns, opts \\ [])

Create a MLIR.RewritePatternSet from the given PDL patterns. The patterns is a list of functions that accept two arguments: ctx and block, and create PDL patterns in the given block under the given ctx. The opts may contain:

  • :ctx - (required) the MLIR.Context to create the patterns in.
  • :debug - (optional) if set to true, dump each created pattern for debugging.