From 5357a0d5a91be6e76b883b320ff1862199a54499 Mon Sep 17 00:00:00 2001 From: kalzoo <22137047+kalzoo@users.noreply.github.com> Date: Mon, 10 Apr 2023 07:29:40 -0700 Subject: [PATCH 1/4] feat!: introduce ExecutionDependency::Timing --- src/instruction.rs | 62 +++++++++++++++++-- src/program/graph.rs | 46 +++++++++++--- src/program/graphviz_dot.rs | 19 +++++- src/program/mod.rs | 8 +-- ...sts__graph__active_reset_single_frame.snap | 22 ++++--- ..._dot__tests__graph__blocking_2q_pulse.snap | 28 ++++++--- ...ph__blocking_pulses_after_nonblocking.snap | 31 ++++++---- ...aph__blocking_pulses_wrap_nonblocking.snap | 48 ++++++++++---- ...viz_dot__tests__graph__chained_pulses.snap | 42 +++++++++---- ...sts__graph__different_frames_blocking.snap | 22 ++++--- ...__graph__different_frames_nonblocking.snap | 18 ++++-- ...graphviz_dot__tests__graph__fence_all.snap | 9 ++- ...ph__fence_all_with_nonblocking_pulses.snap | 37 +++++++---- ..._dot__tests__graph__fence_one_wrapper.snap | 36 +++++++++++ ...hviz_dot__tests__graph__fence_wrapper.snap | 32 +++++++--- ...ram__graphviz_dot__tests__graph__jump.snap | 30 +++++---- ...z_dot__tests__graph__parametric_pulse.snap | 19 +++--- ...rametric_pulses_using_capture_results.snap | 45 +++++++++----- ...ot__tests__graph__pulse_after_capture.snap | 19 +++--- ...sts__graph__pulse_after_set_frequency.snap | 25 ++++++++ ...viz_dot__tests__graph__simple_capture.snap | 10 +-- ..._dot__tests__graph__single_dependency.snap | 18 ++++-- ...dot__tests__graph__single_instruction.snap | 10 +-- 23 files changed, 473 insertions(+), 163 deletions(-) create mode 100644 src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_one_wrapper.snap create mode 100644 src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_set_frequency.snap diff --git a/src/instruction.rs b/src/instruction.rs index e9171167b..dd3c58d35 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -1208,11 +1208,17 @@ impl Instruction { FrameMatchCondition::AnyOfNames(frame_names), ]) }), - Instruction::Fence(Fence { qubits }) => Some(if qubits.is_empty() { - FrameMatchCondition::All - } else { - FrameMatchCondition::AnyOfQubits(Cow::Borrowed(qubits)) - }), + Instruction::Fence(Fence { qubits }) => { + if include_blocked { + Some(if qubits.is_empty() { + FrameMatchCondition::All + } else { + FrameMatchCondition::AnyOfQubits(Cow::Borrowed(qubits)) + }) + } else { + None + } + } Instruction::Reset(Reset { qubit }) => { let qubits = match qubit { Some(qubit) => { @@ -1296,6 +1302,52 @@ impl Instruction { nom::combinator::all_consuming(parse_instruction)(&lexed).map_err(|e| e.to_string())?; Ok(instruction) } + + /// Per the language spec, whether this instruction's timing within the pulse + /// program must be precisely controlled, so as to begin exactly on the end of + /// the latest preceding timed instruction + pub(crate) fn requires_precise_timing(&self) -> bool { + match self { + Instruction::Capture(_) + | Instruction::Delay(_) + | Instruction::Fence(_) + | Instruction::Pulse(_) + | Instruction::RawCapture(_) => true, + Instruction::Arithmetic(_) + | Instruction::BinaryLogic(_) + | Instruction::CalibrationDefinition(_) + | Instruction::CircuitDefinition(_) + | Instruction::Convert(_) + | Instruction::Comparison(_) + | Instruction::Declaration(_) + | Instruction::Exchange(_) + | Instruction::FrameDefinition(_) + | Instruction::Gate(_) + | Instruction::GateDefinition(_) + | Instruction::Halt + | Instruction::Include(_) + | Instruction::Jump(_) + | Instruction::JumpUnless(_) + | Instruction::JumpWhen(_) + | Instruction::Label(_) + | Instruction::Load(_) + | Instruction::MeasureCalibrationDefinition(_) + | Instruction::Measurement(_) + | Instruction::Move(_) + | Instruction::Nop + | Instruction::Pragma(_) + | Instruction::Reset(_) + | Instruction::SetFrequency(_) + | Instruction::SetPhase(_) + | Instruction::SetScale(_) + | Instruction::ShiftFrequency(_) + | Instruction::ShiftPhase(_) + | Instruction::Store(_) + | Instruction::SwapPhases(_) + | Instruction::UnaryLogic(_) + | Instruction::WaveformDefinition(_) => false, + } + } } #[cfg(test)] diff --git a/src/program/graph.rs b/src/program/graph.rs index 349196813..6137b9aab 100644 --- a/src/program/graph.rs +++ b/src/program/graph.rs @@ -85,8 +85,8 @@ pub enum ExecutionDependency { /// The downstream instruction must wait for the given operation to complete. AwaitMemoryAccess(MemoryAccessType), - /// The instructions share a reference frame - ReferenceFrame, + /// The downstream instruction must immediately follow the upstream instruction + Timing, /// The ordering between these two instructions must remain unchanged StableOrdering, @@ -240,8 +240,8 @@ impl Default for PreviousNodes { /// (in other words, this instruction cannot be scheduled prior to the start of the instruction block). fn default() -> Self { Self { - using: None, - blocking: vec![ScheduledGraphNode::BlockStart].into_iter().collect(), + using: Some(ScheduledGraphNode::BlockStart), + blocking: HashSet::new(), } } } @@ -299,6 +299,8 @@ impl InstructionBlock { // Store the instruction index of the last instruction to block that frame let mut last_instruction_by_frame: HashMap = HashMap::new(); + let mut last_timed_instruction_by_frame: HashMap = + HashMap::new(); // Store memory access reads and writes. Key is memory region name. // NOTE: this may be refined to serialize by memory region offset rather than by entire region. @@ -328,23 +330,47 @@ impl InstructionBlock { let blocked_but_not_used_frames = blocked_frames.difference(&used_frames); for frame in &used_frames { + // If the instruction's timing must be precise, it is based on the previous timed instructions only. + // That is, the timing of a PULSE is set by a preceding PULSE but not a SET-FREQUENCY, which also + // "uses" that particular frame. + if instruction.requires_precise_timing() { + let previous_node_ids = last_timed_instruction_by_frame + .entry((*frame).clone()) + .or_default() + .get_dependencies_for_next_user(node); + + for previous_node_id in previous_node_ids { + add_dependency!(graph, previous_node_id => node, ExecutionDependency::Timing); + } + } + let previous_node_ids = last_instruction_by_frame .entry((*frame).clone()) .or_default() .get_dependencies_for_next_user(node); for previous_node_id in previous_node_ids { - add_dependency!(graph, previous_node_id => node, ExecutionDependency::ReferenceFrame); + add_dependency!(graph, previous_node_id => node, ExecutionDependency::StableOrdering); } } for frame in blocked_but_not_used_frames { + if instruction.requires_precise_timing() { + if let Some(previous_node_id) = last_timed_instruction_by_frame + .entry((*frame).clone()) + .or_default() + .get_dependency_for_next_blocker(node) + { + add_dependency!(graph, previous_node_id => node, ExecutionDependency::Timing); + } + } + if let Some(previous_node_id) = last_instruction_by_frame .entry((*frame).clone()) .or_default() .get_dependency_for_next_blocker(node) { - add_dependency!(graph, previous_node_id => node, ExecutionDependency::ReferenceFrame); + add_dependency!(graph, previous_node_id => node, ExecutionDependency::StableOrdering); } } @@ -390,9 +416,15 @@ impl InstructionBlock { // does not terminate until these are complete add_dependency!(graph, last_classical_instruction => ScheduledGraphNode::BlockEnd, ExecutionDependency::StableOrdering); + for previous_nodes in last_timed_instruction_by_frame.into_values() { + for node in previous_nodes.drain() { + add_dependency!(graph, node => ScheduledGraphNode::BlockEnd, ExecutionDependency::Timing); + } + } + for previous_nodes in last_instruction_by_frame.into_values() { for node in previous_nodes.drain() { - add_dependency!(graph, node => ScheduledGraphNode::BlockEnd, ExecutionDependency::ReferenceFrame); + add_dependency!(graph, node => ScheduledGraphNode::BlockEnd, ExecutionDependency::StableOrdering); } } diff --git a/src/program/graphviz_dot.rs b/src/program/graphviz_dot.rs index b57d179ba..a843bb32f 100644 --- a/src/program/graphviz_dot.rs +++ b/src/program/graphviz_dot.rs @@ -62,7 +62,7 @@ impl InstructionBlock { MemoryAccessType::Write => "await write", MemoryAccessType::Capture => "await capture", }, - ExecutionDependency::ReferenceFrame => "frame", + ExecutionDependency::Timing => "timing", ExecutionDependency::StableOrdering => "ordering", }) .collect::>(); @@ -352,6 +352,15 @@ FENCE 1 " ); + build_dot_format_snapshot_test_case!( + fence_one_wrapper, + r#" +FENCE 0 +NONBLOCKING PULSE 0 "rf" flat(iq: 1, duration: 4e-7) +FENCE 0 +"# + ); + build_dot_format_snapshot_test_case!( jump, "DECLARE ro BIT @@ -413,6 +422,14 @@ CAPTURE 0 \"ro_rx\" test ro PULSE 0 \"rf\" test" ); + // assert that a block "waits" for a capture to complete even with a pulse after it + build_dot_format_snapshot_test_case!( + pulse_after_set_frequency, + "DECLARE ro BIT +SET-FREQUENCY 0 \"rf\" 3e9 +PULSE 0 \"rf\" test" + ); + // assert that a block "waits" for a capture to complete build_dot_format_snapshot_test_case!( parametric_pulse, diff --git a/src/program/mod.rs b/src/program/mod.rs index db044dec6..cc409c13c 100644 --- a/src/program/mod.rs +++ b/src/program/mod.rs @@ -471,15 +471,11 @@ DEFFRAME 0 1 \"2q\": vec![r#"0 1 "2q""#], ), // A Fence with qubits specified uses and blocks all frames intersecting that qubit - ( - r#"FENCE 1"#, - vec![r#"1 "c""#, r#"0 1 "2q""#], - vec![r#"1 "c""#, r#"0 1 "2q""#], - ), + (r#"FENCE 1"#, vec![], vec![r#"1 "c""#, r#"0 1 "2q""#]), // Fence-all uses and blocks all frames declared in the program ( r#"FENCE"#, - vec![r#"0 "a""#, r#"0 "b""#, r#"1 "c""#, r#"0 1 "2q""#], + vec![], vec![r#"0 "a""#, r#"0 "b""#, r#"1 "c""#, r#"0 1 "2q""#], ), // Delay uses and blocks frames on exactly the given qubits and with any of the given names diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__active_reset_single_frame.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__active_reset_single_frame.snap index 3696f3ad4..de3b22eda 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__active_reset_single_frame.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__active_reset_single_frame.snap @@ -9,14 +9,18 @@ digraph { label="measure"; node [style="filled"]; "measure_start" [shape=circle, label="start"]; - "measure_start" -> "measure_0" [label="frame"]; - "measure_start" -> "measure_1" [label="frame"]; + "measure_start" -> "measure_0" [label="ordering +timing"]; + "measure_start" -> "measure_1" [label="ordering +timing"]; "measure_start" -> "measure_end" [label="ordering"]; "measure_0" [shape=rectangle, label="[0] NONBLOCKING PULSE 0 \"ro_tx\" test(duration: 1000000)"]; - "measure_0" -> "measure_end" [label="frame"]; + "measure_0" -> "measure_end" [label="ordering +timing"]; "measure_1" [shape=rectangle, label="[1] NONBLOCKING CAPTURE 0 \"ro_rx\" test(duration: 1000000) ro[0]"]; "measure_1" -> "measure_end" [label="await capture -frame"]; +ordering +timing"]; "measure_end" [shape=circle, label="end"]; } "measure_end" -> "end_start" [label="if ro[0] == 0"]; @@ -25,11 +29,13 @@ frame"]; label="feedback"; node [style="filled"]; "feedback_start" [shape=circle, label="start"]; - "feedback_start" -> "feedback_0" [label="frame"]; - "feedback_start" -> "feedback_end" [label="frame -ordering"]; + "feedback_start" -> "feedback_0" [label="ordering +timing"]; + "feedback_start" -> "feedback_end" [label="ordering +timing"]; "feedback_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "feedback_0" -> "feedback_end" [label="frame"]; + "feedback_0" -> "feedback_end" [label="ordering +timing"]; "feedback_end" [shape=circle, label="end"]; } "feedback_end" -> "measure_start" [label="always"]; diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_2q_pulse.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_2q_pulse.snap index a59ace263..49a280917 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_2q_pulse.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_2q_pulse.snap @@ -9,19 +9,27 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1e-6)"]; - "block_0_0" -> "block_0_2" [label="frame"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_2" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 1 \"rf\" test(duration: 1e-6)"]; - "block_0_1" -> "block_0_2" [label="frame"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] PULSE 0 1 \"cz\" test(duration: 1e-6)"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_after_nonblocking.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_after_nonblocking.snap index 66efd95d6..cd9709bc5 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_after_nonblocking.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_after_nonblocking.snap @@ -9,20 +9,29 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] NONBLOCKING PULSE 0 \"ro_tx\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_1" [label="frame"]; - "block_0_0" -> "block_0_2" [label="frame"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_2" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_2" [label="frame"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] PULSE 0 \"ro_rx\" test(duration: 1000000)"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_wrap_nonblocking.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_wrap_nonblocking.snap index 35fb10efd..7fdac3867 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_wrap_nonblocking.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__blocking_pulses_wrap_nonblocking.snap @@ -9,23 +9,47 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_3" [label="frame"]; - "block_0_start" -> "block_0_end" [label="ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_3" [label="ordering +timing"]; + "block_0_start" -> "block_0_4" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_1" [label="frame"]; - "block_0_0" -> "block_0_2" [label="frame"]; - "block_0_0" -> "block_0_3" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_2" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 0 \"ro_tx\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_2" [label="frame"]; - "block_0_1" -> "block_0_3" [label="frame"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_3" [label="ordering +timing"]; + "block_0_1" -> "block_0_4" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_2" -> "block_0_3" [label="frame"]; + "block_0_2" -> "block_0_3" [label="ordering +timing"]; + "block_0_2" -> "block_0_4" [label="ordering +timing"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_3" [shape=rectangle, label="[3] FENCE 0"]; - "block_0_3" -> "block_0_4" [label="frame"]; + "block_0_3" -> "block_0_end" [label="ordering +timing"]; "block_0_4" [shape=rectangle, label="[4] FENCE 0"]; - "block_0_4" -> "block_0_end" [label="frame"]; + "block_0_4" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__chained_pulses.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__chained_pulses.snap index 9c1170149..2dc648383 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__chained_pulses.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__chained_pulses.snap @@ -9,23 +9,41 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_3" [label="ordering +timing"]; + "block_0_start" -> "block_0_4" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_1" [label="frame"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_2" [label="frame"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_2" -> "block_0_3" [label="frame"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_3" [label="ordering +timing"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_3" [shape=rectangle, label="[3] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_3" -> "block_0_4" [label="frame"]; - "block_0_3" -> "block_0_end" [label="frame"]; + "block_0_3" -> "block_0_4" [label="ordering +timing"]; + "block_0_3" -> "block_0_end" [label="ordering +timing"]; "block_0_4" [shape=rectangle, label="[4] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_4" -> "block_0_end" [label="frame"]; + "block_0_4" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_blocking.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_blocking.snap index 47238a9d5..de100753d 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_blocking.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_blocking.snap @@ -9,17 +9,23 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 1 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] PULSE 2 \"rf\" test(duration: 1000000)"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_nonblocking.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_nonblocking.snap index 5f53bd7c0..b528fb0df 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_nonblocking.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__different_frames_nonblocking.snap @@ -9,16 +9,22 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; "block_0_start" -> "block_0_end" [label="ordering"]; "block_0_0" [shape=rectangle, label="[0] NONBLOCKING PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 1 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] NONBLOCKING PULSE 2 \"rf\" test(duration: 1000000)"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all.snap index 469d4bad0..586232d73 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all.snap @@ -9,10 +9,13 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] FENCE"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all_with_nonblocking_pulses.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all_with_nonblocking_pulses.snap index c912643e3..b71b9b601 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all_with_nonblocking_pulses.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_all_with_nonblocking_pulses.snap @@ -9,22 +9,37 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; - "block_0_start" -> "block_0_end" [label="ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] NONBLOCKING PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_2" [label="frame"]; + "block_0_0" -> "block_0_2" [label="ordering +timing"]; + "block_0_0" -> "block_0_3" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 1 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_2" [label="frame"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_4" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] FENCE"]; - "block_0_2" -> "block_0_3" [label="frame"]; - "block_0_2" -> "block_0_4" [label="frame"]; - "block_0_2" -> "block_0_end" [label="frame"]; + "block_0_2" -> "block_0_3" [label="ordering +timing"]; + "block_0_2" -> "block_0_4" [label="ordering +timing"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_3" [shape=rectangle, label="[3] NONBLOCKING PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_3" -> "block_0_end" [label="frame"]; + "block_0_3" -> "block_0_end" [label="ordering +timing"]; "block_0_4" [shape=rectangle, label="[4] NONBLOCKING PULSE 1 \"rf\" test(duration: 1000000)"]; - "block_0_4" -> "block_0_end" [label="frame"]; + "block_0_4" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_one_wrapper.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_one_wrapper.snap new file mode 100644 index 000000000..073f4a7cf --- /dev/null +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_one_wrapper.snap @@ -0,0 +1,36 @@ +--- +source: src/program/graphviz_dot.rs +expression: dot_format +--- +digraph { + entry -> "block_0_start"; + entry [label="Entry Point"]; + subgraph cluster_0 { + label="block_0"; + node [style="filled"]; + "block_0_start" [shape=circle, label="start"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; + "block_0_0" [shape=rectangle, label="[0] FENCE 0"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; + "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 0 \"rf\" flat(duration: 4e-7, iq: 1)"]; + "block_0_1" -> "block_0_2" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; + "block_0_2" [shape=rectangle, label="[2] FENCE 0"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; + "block_0_end" [shape=circle, label="end"]; + } +} + diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_wrapper.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_wrapper.snap index a7d4f4be6..00accceb7 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_wrapper.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__fence_wrapper.snap @@ -9,18 +9,34 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] FENCE"]; - "block_0_0" -> "block_0_1" [label="frame"]; - "block_0_0" -> "block_0_2" [label="frame"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_2" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 0 1 \"cz\" test(duration: 1e-6)"]; - "block_0_1" -> "block_0_3" [label="frame"]; + "block_0_1" -> "block_0_3" [label="ordering +timing"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] NONBLOCKING PULSE 1 \"rf\" test(duration: 1e-6)"]; - "block_0_2" -> "block_0_3" [label="frame"]; + "block_0_2" -> "block_0_3" [label="ordering +timing"]; + "block_0_2" -> "block_0_end" [label="ordering +timing"]; "block_0_3" [shape=rectangle, label="[3] FENCE 1"]; - "block_0_3" -> "block_0_end" [label="frame"]; + "block_0_3" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__jump.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__jump.snap index 59b3f4124..4de763058 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__jump.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__jump.snap @@ -9,11 +9,13 @@ digraph { label="first-block"; node [style="filled"]; "first-block_start" [shape=circle, label="start"]; - "first-block_start" -> "first-block_0" [label="frame"]; - "first-block_start" -> "first-block_end" [label="frame -ordering"]; + "first-block_start" -> "first-block_0" [label="ordering +timing"]; + "first-block_start" -> "first-block_end" [label="ordering +timing"]; "first-block_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "first-block_0" -> "first-block_end" [label="frame"]; + "first-block_0" -> "first-block_end" [label="ordering +timing"]; "first-block_end" [shape=circle, label="end"]; } "first-block_end" -> "third-block_start" [label="if ro[0] != 0"]; @@ -22,11 +24,13 @@ ordering"]; label="second-block"; node [style="filled"]; "second-block_start" [shape=circle, label="start"]; - "second-block_start" -> "second-block_0" [label="frame"]; - "second-block_start" -> "second-block_end" [label="frame -ordering"]; + "second-block_start" -> "second-block_0" [label="ordering +timing"]; + "second-block_start" -> "second-block_end" [label="ordering +timing"]; "second-block_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "second-block_0" -> "second-block_end" [label="frame"]; + "second-block_0" -> "second-block_end" [label="ordering +timing"]; "second-block_end" [shape=circle, label="end"]; } "second-block_end" -> "third-block_start" [label="always"]; @@ -34,11 +38,13 @@ ordering"]; label="third-block"; node [style="filled"]; "third-block_start" [shape=circle, label="start"]; - "third-block_start" -> "third-block_0" [label="frame"]; - "third-block_start" -> "third-block_end" [label="frame -ordering"]; + "third-block_start" -> "third-block_0" [label="ordering +timing"]; + "third-block_start" -> "third-block_end" [label="ordering +timing"]; "third-block_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "third-block_0" -> "third-block_end" [label="frame"]; + "third-block_0" -> "third-block_end" [label="ordering +timing"]; "third-block_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulse.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulse.snap index 5adbce3d0..ee4eec8bc 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulse.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulse.snap @@ -9,18 +9,23 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(a: param[0])"]; - "block_0_0" -> "block_0_1" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; "block_0_0" -> "block_0_end" [label="await read -frame"]; +ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] CAPTURE 0 \"ro_rx\" test(a: param[0]) ro[0]"]; "block_0_1" -> "block_0_end" [label="await capture await read -frame"]; +ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulses_using_capture_results.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulses_using_capture_results.snap index 42b0ff402..28ea1adbe 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulses_using_capture_results.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__parametric_pulses_using_capture_results.snap @@ -9,35 +9,50 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_2" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_2" [label="ordering +timing"]; + "block_0_start" -> "block_0_3" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] CAPTURE 0 \"ro_rx\" test(a: param[0]) ro[0]"]; "block_0_0" -> "block_0_1" [label="await capture -frame"]; - "block_0_0" -> "block_0_3" [label="frame"]; +ordering +timing"]; + "block_0_0" -> "block_0_3" [label="ordering +timing"]; "block_0_0" -> "block_0_end" [label="await read -frame"]; +ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] NONBLOCKING PULSE 0 \"rf\" test(a: ro[0])"]; "block_0_1" -> "block_0_3" [label="await read -frame"]; - "block_0_1" -> "block_0_4" [label="frame"]; +ordering +timing"]; + "block_0_1" -> "block_0_4" [label="ordering +timing"]; "block_0_2" [shape=rectangle, label="[2] NONBLOCKING PULSE 1 \"rf\" test(a: ro[0])"]; "block_0_2" -> "block_0_3" [label="await read"]; - "block_0_2" -> "block_0_5" [label="frame"]; + "block_0_2" -> "block_0_5" [label="ordering +timing"]; "block_0_3" [shape=rectangle, label="[3] CAPTURE 0 \"ro_rx\" test(a: param[0]) ro[0]"]; "block_0_3" -> "block_0_4" [label="await capture -frame"]; +ordering +timing"]; "block_0_3" -> "block_0_end" [label="await read -frame"]; +ordering +timing"]; "block_0_4" [shape=rectangle, label="[4] NONBLOCKING PULSE 0 \"rf\" test(a: ro[0])"]; "block_0_4" -> "block_0_end" [label="await read -frame"]; +ordering +timing"]; "block_0_5" [shape=rectangle, label="[5] NONBLOCKING PULSE 1 \"rf\" test(a: ro[0])"]; "block_0_5" -> "block_0_end" [label="await read -frame"]; +ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_capture.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_capture.snap index 1e3e7af8e..8e852ca47 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_capture.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_capture.snap @@ -9,16 +9,21 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_1" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] CAPTURE 0 \"ro_rx\" test ro[0]"]; - "block_0_0" -> "block_0_1" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; "block_0_0" -> "block_0_end" [label="await capture -frame"]; +ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 0 \"rf\" test"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_set_frequency.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_set_frequency.snap new file mode 100644 index 000000000..bbf06f3e6 --- /dev/null +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__pulse_after_set_frequency.snap @@ -0,0 +1,25 @@ +--- +source: src/program/graphviz_dot.rs +expression: dot_format +--- +digraph { + entry -> "block_0_start"; + entry [label="Entry Point"]; + subgraph cluster_0 { + label="block_0"; + node [style="filled"]; + "block_0_start" [shape=circle, label="start"]; + "block_0_start" -> "block_0_0" [label="ordering"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; + "block_0_0" [shape=rectangle, label="[0] SET-FREQUENCY 0 \"rf\" 3000000000"]; + "block_0_0" -> "block_0_1" [label="ordering"]; + "block_0_1" [shape=rectangle, label="[1] PULSE 0 \"rf\" test"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; + "block_0_end" [shape=circle, label="end"]; + } +} + diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__simple_capture.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__simple_capture.snap index ec294558a..b0158588f 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__simple_capture.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__simple_capture.snap @@ -9,12 +9,14 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] CAPTURE 0 \"ro_rx\" test ro[0]"]; "block_0_0" -> "block_0_end" [label="await capture -frame"]; +ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_dependency.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_dependency.snap index 489e44a6a..a1ff8276f 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_dependency.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_dependency.snap @@ -9,14 +9,20 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_1" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_1" [label="frame"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_1" [label="ordering +timing"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_1" [shape=rectangle, label="[1] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_1" -> "block_0_end" [label="frame"]; + "block_0_1" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } diff --git a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_instruction.snap b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_instruction.snap index 2c11c9aa0..0d1392dd5 100644 --- a/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_instruction.snap +++ b/src/program/snapshots/quil_rs__program__graphviz_dot__tests__graph__single_instruction.snap @@ -9,11 +9,13 @@ digraph { label="block_0"; node [style="filled"]; "block_0_start" [shape=circle, label="start"]; - "block_0_start" -> "block_0_0" [label="frame"]; - "block_0_start" -> "block_0_end" [label="frame -ordering"]; + "block_0_start" -> "block_0_0" [label="ordering +timing"]; + "block_0_start" -> "block_0_end" [label="ordering +timing"]; "block_0_0" [shape=rectangle, label="[0] PULSE 0 \"rf\" test(duration: 1000000)"]; - "block_0_0" -> "block_0_end" [label="frame"]; + "block_0_0" -> "block_0_end" [label="ordering +timing"]; "block_0_end" [shape=circle, label="end"]; } } From 7d757eb7f3a01a49923535e1c3a3e1da1702a75e Mon Sep 17 00:00:00 2001 From: Kalan <22137047+kalzoo@users.noreply.github.com> Date: Mon, 17 Apr 2023 23:43:29 -0700 Subject: [PATCH 2/4] chore: Update src/program/graphviz_dot.rs Co-authored-by: Mark Skilbeck --- src/program/graphviz_dot.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/program/graphviz_dot.rs b/src/program/graphviz_dot.rs index a843bb32f..3c5351041 100644 --- a/src/program/graphviz_dot.rs +++ b/src/program/graphviz_dot.rs @@ -425,9 +425,9 @@ PULSE 0 \"rf\" test" // assert that a block "waits" for a capture to complete even with a pulse after it build_dot_format_snapshot_test_case!( pulse_after_set_frequency, - "DECLARE ro BIT -SET-FREQUENCY 0 \"rf\" 3e9 -PULSE 0 \"rf\" test" + r#"DECLARE ro BIT +SET-FREQUENCY 0 "rf" 3e9 +PULSE 0 "rf" test"# ); // assert that a block "waits" for a capture to complete From f3e96dbdb1413781387fc65bce1f0339293db327 Mon Sep 17 00:00:00 2001 From: kalzoo <22137047+kalzoo@users.noreply.github.com> Date: Wed, 19 Apr 2023 19:31:49 -0700 Subject: [PATCH 3/4] refactor: timing -> scheduling --- src/instruction.rs | 6 +++--- src/program/graph.rs | 16 +++++++++------- src/program/graphviz_dot.rs | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/instruction.rs b/src/instruction.rs index dd3c58d35..44ac9aa97 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -1303,10 +1303,10 @@ impl Instruction { Ok(instruction) } - /// Per the language spec, whether this instruction's timing within the pulse - /// program must be precisely controlled, so as to begin exactly on the end of + /// Per the Quil-T spec, whether this instruction's timing within the pulse + /// program must be precisely controlled so as to begin exactly on the end of /// the latest preceding timed instruction - pub(crate) fn requires_precise_timing(&self) -> bool { + pub(crate) fn is_scheduled(&self) -> bool { match self { Instruction::Capture(_) | Instruction::Delay(_) diff --git a/src/program/graph.rs b/src/program/graph.rs index 6137b9aab..fba9dc502 100644 --- a/src/program/graph.rs +++ b/src/program/graph.rs @@ -85,8 +85,10 @@ pub enum ExecutionDependency { /// The downstream instruction must wait for the given operation to complete. AwaitMemoryAccess(MemoryAccessType), - /// The downstream instruction must immediately follow the upstream instruction - Timing, + /// The schedule of the downstream instruction depends on the upstream instruction. + /// Per the Quil-T specification, the downstream instruction begins execution at + /// the time that its latest upstream neighbor completes. + Scheduled, /// The ordering between these two instructions must remain unchanged StableOrdering, @@ -333,14 +335,14 @@ impl InstructionBlock { // If the instruction's timing must be precise, it is based on the previous timed instructions only. // That is, the timing of a PULSE is set by a preceding PULSE but not a SET-FREQUENCY, which also // "uses" that particular frame. - if instruction.requires_precise_timing() { + if instruction.is_scheduled() { let previous_node_ids = last_timed_instruction_by_frame .entry((*frame).clone()) .or_default() .get_dependencies_for_next_user(node); for previous_node_id in previous_node_ids { - add_dependency!(graph, previous_node_id => node, ExecutionDependency::Timing); + add_dependency!(graph, previous_node_id => node, ExecutionDependency::Scheduled); } } @@ -355,13 +357,13 @@ impl InstructionBlock { } for frame in blocked_but_not_used_frames { - if instruction.requires_precise_timing() { + if instruction.is_scheduled() { if let Some(previous_node_id) = last_timed_instruction_by_frame .entry((*frame).clone()) .or_default() .get_dependency_for_next_blocker(node) { - add_dependency!(graph, previous_node_id => node, ExecutionDependency::Timing); + add_dependency!(graph, previous_node_id => node, ExecutionDependency::Scheduled); } } @@ -418,7 +420,7 @@ impl InstructionBlock { for previous_nodes in last_timed_instruction_by_frame.into_values() { for node in previous_nodes.drain() { - add_dependency!(graph, node => ScheduledGraphNode::BlockEnd, ExecutionDependency::Timing); + add_dependency!(graph, node => ScheduledGraphNode::BlockEnd, ExecutionDependency::Scheduled); } } diff --git a/src/program/graphviz_dot.rs b/src/program/graphviz_dot.rs index 3c5351041..0af4b522a 100644 --- a/src/program/graphviz_dot.rs +++ b/src/program/graphviz_dot.rs @@ -62,7 +62,7 @@ impl InstructionBlock { MemoryAccessType::Write => "await write", MemoryAccessType::Capture => "await capture", }, - ExecutionDependency::Timing => "timing", + ExecutionDependency::Scheduled => "timing", ExecutionDependency::StableOrdering => "ordering", }) .collect::>(); From 4643052d5f59e519e5676006b2ef98ce47529d39 Mon Sep 17 00:00:00 2001 From: kalzoo <22137047+kalzoo@users.noreply.github.com> Date: Wed, 19 Apr 2023 19:36:50 -0700 Subject: [PATCH 4/4] chore: docs --- src/program/graph.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/program/graph.rs b/src/program/graph.rs index fba9dc502..141bd6715 100644 --- a/src/program/graph.rs +++ b/src/program/graph.rs @@ -219,7 +219,8 @@ impl Default for InstructionBlock { /// /// ## Examples /// -/// Note that "depends on" is equivalent to "must execute after completion of". +/// Note that "depends on" is equivalent to "must execute at or after completion of." The interpretation of +/// "at or after" depends on the type of dependency and the compiler. /// /// ```text /// user --> user # a second user takes a dependency on the first @@ -238,8 +239,10 @@ struct PreviousNodes { impl Default for PreviousNodes { /// The default value for [PreviousNodes] is useful in that, if no previous nodes have been recorded - /// as using a frame, we should consider that the start of the instruction block "blocks" use of that frame - /// (in other words, this instruction cannot be scheduled prior to the start of the instruction block). + /// as using a frame, we should consider that the start of the instruction block "uses" of that frame + /// + /// In other words, no instruction can be scheduled prior to the start of the instruction block + /// and all scheduled instructions within the block depend on the block's start time, at least indirectly. fn default() -> Self { Self { using: Some(ScheduledGraphNode::BlockStart), @@ -313,7 +316,7 @@ impl InstructionBlock { let instruction_role = InstructionRole::from(instruction); match instruction_role { - // Classical instructions must be strongly ordered by appearance in the program + // Classical instructions must be ordered by appearance in the program InstructionRole::ClassicalCompute => { add_dependency!(graph, last_classical_instruction => node, ExecutionDependency::StableOrdering); @@ -332,9 +335,6 @@ impl InstructionBlock { let blocked_but_not_used_frames = blocked_frames.difference(&used_frames); for frame in &used_frames { - // If the instruction's timing must be precise, it is based on the previous timed instructions only. - // That is, the timing of a PULSE is set by a preceding PULSE but not a SET-FREQUENCY, which also - // "uses" that particular frame. if instruction.is_scheduled() { let previous_node_ids = last_timed_instruction_by_frame .entry((*frame).clone())