Add hierarchical qubit types #2369
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: Catalyst currently only supports a single, universal qubit type in its MLIR program representation:
!quantum.bit. In order to express FTQC workloads in the compiler, we require a more expressive type system to represent a program that is successively lowered from the user program to a hardware-agnostic QEC layer and to a hardware-specific error-corrected MBQC physical layer. We also anticipate that the definitions of these new types will simplify the implementation of a number of other components in the FTQC software stack, especially those that operate at multiple levels of qubit-type abstraction, such as a Pauli frame tracking system.Description of the Change: This change introduces the following qubit levels:
!quantum.bit<abstract>!quantum.bit<logical>!quantum.bit<qec>!quantum.bit<physical>The
abstractlevel is the default and is equivalent to!quantum.bit. In addition to the qubit level, the following qubit roles have been defined to specialize theqecandphysicalqubit types:null,data,xcheckandzcheck. These roles are represented in the IR as, for example:!quantum.bit<physical, null>!quantum.bit<physical, data>!quantum.bit<physical, xcheck>!quantum.bit<physical, zcheck>The
nullrole is the default for all levels and can be omitted. The purpose of the role parameter is to distinguish data qubits and syndrome qubits to extract X and Z corrections in CSS QEC codes by way of stabilizer measurements. As such, the IR restricts these role parameters to theqecandphysicalqubit types;abstractandlogicalqubits currently do not permit specifying a role other thannull.To allow for correct type parsing while continuing to use the custom assembly format that quantum operations use, all quantum ops that consume and return qubit values are now restricted to input and output qubits of the same type. This restrictions is accomplished by adding
AllTypesMatch<["in_qubit", "out_qubit"]>traits to the appropriate quantum operations. This restriction means that operations such asare permitted, but operations that mix types, such as
are not.
Benefits: More expressive IR for FTQC workloads; simplifies implementation of compilation passes that convert between levels of abstractions.
Possible Drawbacks: The details of the compilation passes that convert a program to the QEC and physical layers are still being established, therefore the requirements for these new qubit types may change as these future passes develop.
[sc-107427], [sc-107428], [sc-107429], [sc-107430], [sc-107433]