Beaver. MLIR. Rewrite
(beaver v0.4.8)
Copy Markdown
This module defines functions working with MLIR rewrite patterns and pattern sets.
Summary
Types
Callback used to customize a greedy rewrite config before application.
Opaque greedy rewrite driver config handle passed to configuration callbacks.
Supported high-level rewrite config options.
Processed MLIR diagnostic tree emitted during rewrite application.
Pattern callback entries accepted by the list-based rewrite surface.
IR surfaces accepted by the rewrite driver.
Types
@type apply_result() :: {Beaver.MLIR.LogicalResult.t(), diagnostics()}
@type config_callback() :: (config_handle() -> any())
Callback used to customize a greedy rewrite config before application.
@type config_handle() :: term()
Opaque greedy rewrite driver config handle passed to configuration callbacks.
@type config_input() :: config_opts() | config_callback() | nil
@type config_option() :: {:max_iterations, integer()} | {:max_num_rewrites, integer()} | {:use_top_down_traversal, boolean()} | {:enable_folding, boolean()} | {:enable_constant_cse, boolean()}
Supported high-level rewrite config options.
@type config_opts() :: [config_option()]
@type diagnostic() :: {severity :: atom(), location :: String.t(), message :: String.t(), nested :: [diagnostic()]}
Processed MLIR diagnostic tree emitted during rewrite application.
@type diagnostics() :: [diagnostic()]
@type match_and_rewrite() :: (Beaver.MLIR.RewritePattern.t(), Beaver.MLIR.Operation.t(), Beaver.MLIR.PatternRewriter.t(), any() -> {:ok, any()} | {:error, any()})
Pattern callback entries accepted by the list-based rewrite surface.
@type pattern_entry() :: Beaver.Pattern.Native.Descriptor.t() | {root_name :: term(), match_and_rewrite() | Beaver.Pattern.Native.Descriptor.t()}
@type pattern_list() :: [pattern_entry()]
@type rewrite_ir() :: Beaver.MLIR.Module.t() | Beaver.MLIR.Operation.t()
IR surfaces accepted by the rewrite driver.
Functions
@spec apply_patterns(rewrite_ir(), Beaver.MLIR.FrozenRewritePatternSet.t()) :: apply_result()
@spec apply_patterns(rewrite_ir(), Beaver.MLIR.RewritePatternSet.t()) :: apply_result()
@spec apply_patterns(rewrite_ir(), pattern_list()) :: apply_result()
@spec apply_patterns( rewrite_ir(), Beaver.MLIR.FrozenRewritePatternSet.t(), config_input() ) :: apply_result()
@spec apply_patterns( rewrite_ir(), Beaver.MLIR.RewritePatternSet.t(), config_input() ) :: apply_result()
@spec apply_patterns(rewrite_ir(), pattern_list(), config_input()) :: apply_result()
@spec apply_patterns!(rewrite_ir(), Beaver.MLIR.FrozenRewritePatternSet.t()) :: rewrite_ir()
@spec apply_patterns!(rewrite_ir(), Beaver.MLIR.RewritePatternSet.t()) :: rewrite_ir()
@spec apply_patterns!(rewrite_ir(), pattern_list()) :: rewrite_ir()
@spec apply_patterns!( rewrite_ir(), Beaver.MLIR.FrozenRewritePatternSet.t(), config_input() ) :: rewrite_ir()
@spec apply_patterns!( rewrite_ir(), Beaver.MLIR.RewritePatternSet.t(), config_input() ) :: rewrite_ir()
@spec apply_patterns!(rewrite_ir(), pattern_list(), config_input()) :: rewrite_ir()
@spec stop_thread_pool() :: :ok
@spec to_config_callback(config_input()) :: config_callback()
@spec with_default_config((config_handle() -> result)) :: result when result: var
@spec with_default_config(config_input(), (config_handle() -> result)) :: result when result: var