catalyst.passes.PassPlugin

class PassPlugin(path: Path, name: str, *options: list[str], **valued_options: dict[str, str])[source]

Bases: Pass

Similar to Pass but takes into account the plugin.

The plugin is used during the creation of the compilation command. E.g.,

–pass-plugin=path/to/plugin –dialect-plugin=path/to/plugin

People working on MLIR plugins may use this or Pass to schedule their compilation pass. E.g.,

def an_optimization(qnode):
    @functools.wraps(qnode)
    def wrapper(*args, **kwargs):
        pass_pipeline = kwargs.pop("pass_pipeline", [])
        pass_pipeline.append(PassPlugin(path_to_plugin, "my_optimization", *args, **kwargs))
        kwargs["pass_pipeline"] = pass_pipeline
        return qnode(*args, **kwargs)
return wrapper

get_options()

Build a dictionary mapping option names to MLIR attributes.

get_options()

Build a dictionary mapping option names to MLIR attributes. ApplyRegisteredPassOp expects options to be a dictionary from strings to attributes. See https://github.com/llvm/llvm-project/pull/143159