bloqade-python
bloqade-python copied to clipboard
IR 2.0: ideas collection
opening this to track some ideas and issues we have for a refactor of the IR.
- #665 reminds me that maybe we should make the IR a SSA IR this time
- #661 the new IR should has its own metaclass/dataclass
I think we should probably extend IR to include execution instructions to the different backends:
- For hardware this is straightforward we would need a device nodes and nodes to describe sync/async execution
- For emulator we can work off of current emulator IR just add execution instructions, e.g.:
- Sampling at specific time points
- Measurement of operators
I propose the following. Since we don't really plan on expanding AHS too much more, we should:
- remove dictionaries from the IR types and replace them with attributes, e.g.
rydberg, andhyperfineare attributes of theSequence - Remove compositions on the level of the Pulse IR, this will significantly decrease the complexity of code generation for the full IR. e.g. have a
Pulsenode to storedetuningphaseandamplitude. - ComplexField for the Rabi term.
class SequenceExpr
...
class ComplexField:
amplitude: Field
phase: Optional[Field]
class Pulse:
detuning: Optional[Field]
rabi: Optional[ComplexField]
class Sequence(SeqenceExpr):
rydberg: Optional[Pulse]
hyperfine: Optional[Pulse]
# keep compositions of Sequence
# ...