quil-rs
quil-rs copied to clipboard
Label instructions with category to inform program execution target support
Not all execution targets support all quil instructions, particularly the QVM does not support Quil-T (see https://github.com/rigetti/pyquil/issues/1684). Currently, there is no way to know which Instruction
is from Quil-T.
However, that information alone may not be enough. One approach to adapt a program containing Quil-T instructions for QVM compatibility may be to simply remove any Quil-T instructions, which is perhaps fine for instructions that only affect program composition like DEFFRAME
, but removing instructions affecting RF control like PULSE
will change a program's semantics.
To allow users of this library the ability to make compatibility decisions, they should be able to deduce the Category (or spec version/extension?) of any Instruction
along with that instruction's impact on execution semantics (from InstructionRole
or similar).
An example solution might add something like this (names are placeholders):
pub enum InstructionCategory {
Base,
QuilT,
// ...?
}
impl From<&Instruction> for InstructionCategory {
fn from(instruction: &Instruction) -> Self { ... }
}