catalyst.CompileOptions¶
- class CompileOptions(verbose: bool | None = False, logfile: TextIOWrapper | None = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, target: str | None = 'binary', link: bool | None = True, keep_intermediate: str | int | bool | KeepIntermediateLevel | None = False, use_nameloc: bool | None = False, pipelines: List[Any] | None = None, autograph: bool | None = False, autograph_include: Iterable[str] | None = (), async_qnodes: bool | None = False, static_argnums: int | Iterable[int] | None = None, static_argnames: str | Iterable[str] | None = None, abstracted_axes: Dict[int, str] | None=None, lower_to_llvm: bool | None = True, checkpoint_stage: str | None = '', disable_assertions: bool | None = False, seed: int | None = None, circuit_transform_pipeline: dict[str, dict[str, str]] | None=None, pass_plugins: Set[Path] | None = None, dialect_plugins: Set[Path] | None = None, capture: bool | Literal['global'] = 'global', skip_preprocess: bool = False, runtime_artifacts: tuple[str, ...]=(), collect_decomp_rules: bool = True)[source]¶
Bases:
objectGeneric compilation options, for which reasonable default values exist.
- Parameters:
verbose (Optional[bool]) – Flag indicating whether to enable verbose output. Default is
False.logfile (Optional[TextIOWrapper]) – The logfile to write output to. Default is
sys.stderr.keep_intermediate (Optional[Union[str, int, bool]]) –
Level controlling intermediate file generation.
Falseor0or"none"(default): No intermediate files are kept.Trueor1or"pipeline": Intermediate files are saved after each pipeline.2or"changed": Intermediate files are saved after each pass only if changed.3or"pass": Intermediate files are saved after each pass, even if unchanged.
use_nameloc (Optional[bool]) – If
True, add function parameter names to the IR as name locations.pipelines (Optional[List[Tuple[str,List[str]]]]) – A list of tuples. The first entry of the tuple corresponds to the name of a pipeline. The second entry of the tuple corresponds to a list of MLIR passes.
autograph (Optional[bool]) – Flag indicating whether experimental autograph support is to be enabled.
autograph_include (Optional[Iterable[str]]) – A list of (sub)modules to be allow-listed for autograph conversion.
async_qnodes (Optional[bool]) – Flag indicating whether experimental asynchronous execution of QNodes support is to be enabled.
lower_to_llvm (Optional[bool]) – Flag indicating whether to attempt the LLVM lowering after the main compilation pipeline is complete. Default is
True.static_argnums (Optional[Union[int, Iterable[int]]]) – Indices of static arguments. Default is
None.static_argnames (Optional[Union[str, Iterable[str]]]) – Names of static arguments. Default is
None.abstracted_axes (Optional[Any]) – Store the abstracted_axes value. Default is
None.disable_assertions (Optional[bool]) – Disable all assertions. Default is
False.seed (Optional[int]) – the seed for random operations in a qjit call. Default is
None.circuit_transform_pipeline (Optional[dict[str, dict[str, str]]]) – A dictionary that specifies the quantum circuit transformation pass pipeline order, and optionally arguments for each pass in the pipeline. Default is
None.pass_plugins (Optional[Iterable[Path]]) – List of paths to pass plugins.
dialect_plugins (Optional[Iterable[Path]]) – List of paths to dialect plugins.
capture (Optional[Union[str, bool]]) –
Controls whether to use PennyLane program capture.
"global"(default): Defer toqp.capture.enabled()True: Force program capture on, regardless of global settingFalse: Force program capture off (use old frontend)
skip_preprocess (bool) – Controls whether or not to skip quantum device preprocessing. If
True, transforms used to preprocess and validate the user program before executing on a quantum backend will not be used, and the user is expected to ensure the validity of the program themselves. Ifcapture=False, orcapture="global"andqp.capture.enabled() == False, this argument will be ignored.Falseby default.collect_decomp_rules (bool) – Controls whether or not to compile the decomposition rules. If
False, only the circuit itself will be compiled. IfTrue, all the decomposition rules reachable from all gates in the circuit will be compiled. Ifcapture=False, orcapture="global"andqp.capture.enabled() == False, this argument will be ignored.Trueby default.
Attributes
- abstracted_axes: Iterable[Iterable[str]] | Dict[int, str] | None = None¶
- async_qnodes: bool | None = False¶
- autograph: bool | None = False¶
- autograph_include: Iterable[str] | None = ()¶
- capture: bool | Literal['global'] = 'global'¶
- checkpoint_stage: str | None = ''¶
- circuit_transform_pipeline: dict[str, dict[str, str]] | None = None¶
- collect_decomp_rules: bool = True¶
- dialect_plugins: Set[Path] | None = None¶
- disable_assertions: bool | None = False¶
- keep_intermediate: str | int | bool | KeepIntermediateLevel | None = False¶
- link: bool | None = True¶
- logfile: TextIOWrapper | None = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>¶
- lower_to_llvm: bool | None = True¶
- pass_plugins: Set[Path] | None = None¶
- pipelines: List[Any] | None = None¶
- runtime_artifacts: tuple[str, ...] = ()¶
- seed: int | None = None¶
- skip_preprocess: bool = False¶
- static_argnames: str | Iterable[str] | None = None¶
- static_argnums: int | Iterable[int] | None = None¶
- target: str | None = 'binary'¶
- use_nameloc: bool | None = False¶
- verbose: bool | None = False¶
Methods
Get effective pipelines
Returns all stages in order for compilation