Repository navigation
Replies: 3 comments 12 replies
|
I'm not a fan of the
my_pass = KAKBuilder(max_search_depth=10)
hugr = my_pass(hugr, in_place=True) |
8 replies
|
I think we should avoid "optimisation level" 0, 1, 2 etc. It gives the false impression that higher is always better, and gets hard to maintain. Prefer to have named passes. |
4 replies
|
QSystemPass is an awkward one. You can't not do a QSystemPass if you wanna run on a Q-System... So some of this is more about passing options to passes that necessarily happen. There's also the question of passes which may want to be kept private, i.e. without exposing results - most likely, these are Hugr->Opaque, and again, you can only give them options. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We need an interface to call optimisation on quantum programs written in Guppy. In the near term this will be done by extracting a pytket
Circuitfrom a HUGR and calling passes from pytket on theCircuitInternally a HUGR graph would be converted to a pytket Circuit with function calls being converted to CircBoxes if they have a supported function signature. Unsupported Ops are encoded as barrier metadata.
We discussed the following points to enable this
1. Guppy gets a tket dependency
Program optimisation gets exposed to the user and is controllable client-side. Guppy will have a minimal interface for optimisation which users make use of via
main.compile().2. Guppy defines some sensible defaults for optimisation, just like pytket
a) Classical "structural" optimisation is fine. E.g. removing
MakeTuplenodesb) Intrusive quantum optimisations are off by default to respect fault tolerance. The possible exception to this is 1Q gate squashing. This doesn't change how Pauli faults propagate around the program so doesn't break fault tolerance.
So effectively the default optimisation level would be 0 (or 1 if we include 1q squashing). More intensive optimisations like
KAKDecompositionandGreedyPauliSimpneed to be explicitly opted into.This will mean that we need a language guide section/notebook tutorial clearly documenting how to optimise programs and explaining the defaults.
3. How does the user control optimisation?
One such idea... pass a composite pass into
.compile(), avoids multiple args in.compileAnother idea
4. Define a
ComposablePassProtocol inhugr-pyWe will define a
ComposablePassprotocol inhugr-pywhich will be implenented my passes inCQCL/tket2.See Quantinuum/hugr#2617
5.
CQCL/tket2exposes pytket Passes in PythonAlternatively see #1300 (comment)
6. Passes act in place upon a
HugrPasses are a
Hugr->Hugrtransform. The user should be able to play around with passes on theHugrin addition to using themain.compile()interface.7. Rust ABI performance considerations
the tket Python interface is the only interface that promises performance. Because of this we will not bind any hugr-rs functions to hugr-py. This is for rust ABI reasons. See Quantinuum/hugr#2616
8. Optimisation within functions (future work).
Optimisation can take an entrypoint node for optimisation within Guppy functions. This requires that the user interpret the HUGR and find the appropriate
FuncDefnnode.Longer term we could make an interface for users to configure optimsation within regions by using compiler directives in the Guppy decorator -> #567 .
All reactions