Skip to content

Commit

Permalink
Move stage note into docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
tzunghanjuang committed Aug 12, 2024
1 parent 41ba48e commit da0d01d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions doc/dev/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@ The compilation process of a QJITed quantum function moves through various stage
- **Bufferized MLIR**: All tensors are `converted <https://mlir.llvm.org/docs/Bufferization>`_ to memory buffer allocations at this step.
- **LLVM Dialect**: Lowering the code to the `LLVM Dialect <https://mlir.llvm.org/docs/Dialects/LLVM/>`_ in MLIR simplifies the translation to LLVMIR by providing a one-to-one mapping.
- **QIR (LLVMIR)**: a `specification <https://learn.microsoft.com/en-us/azure/quantum/concepts-qir>`_ for quantum programs in LLVMIR
- **CoroOPt**: `Coroutine lowering <https://llvm.org/docs/Coroutines.html>`_ only happens when ``AsyncQnode`` is involved.
- **O2Opt**: `O2 optimization <https://llvm.org/doxygen/classllvm_1_1OptimizationLevel.html#a9c0836ff9219a0b737a11979991c3389>`_ only happens when gradient presents.
- **Enzyme**: `Automatic differentiation <https://github.com/EnzymeAD/Enzyme>`_ only happens when gradient presents.
To ensure that you have access to all the stages, the ``keep_intermediate=True`` flag must be specified in the ``qjit`` decorator.
In the following example, we also compile ahead-of-time so that there is no requirements to pass actual parameters:
Expand Down
8 changes: 8 additions & 0 deletions frontend/catalyst/debug/compiler_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def get_compilation_stage(fn, stage):
The stages are indexed by their Catalyst compilation pipeline name, which are either provided
by the user as a compilation option, or predefined in ``catalyst.compiler``.
All the available stages are:
- MILR: mlir, HLOLoweringPass, QuantumCompilationPass, BufferizationPass, and
MLIRToLLVMDialect.
- LLVM: llvm_ir, CoroOpt, O2Opt, Enzyme, and last.
Note that `CoroOpt` (Coroutine lowering), `O2Opt` (O2 optimization), and `Enzyme` (Automatic
differentiation) passes do not always happen. `last` denotes the stage right before object file
generation.
Requires ``keep_intermediate=True``.
Args:
Expand Down

0 comments on commit da0d01d

Please sign in to comment.