catalyst.passes.PassPlugin¶
- class PassPlugin(path: pathlib.Path, name: str, *options: list[str], **valued_options: dict[str, str])[source]¶
Bases:
catalyst.passes.pass_api.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
Methods
Stringify options according to what mlir-opt expects.
- get_options()¶
Stringify options according to what mlir-opt expects.
ApplyRegisteredPassOp expects options to be a single StringAttr which follows the same format as the one used with mlir-opt.
Options passed to a pass are specified via the syntax {option1=value1 option2=value2 …}, i.e., use space-separated key=value pairs for each option.
https://mlir.llvm.org/docs/Tutorials/MlirOpt/#running-a-pass-with-options
Experimentally we found that single-options also work without values.