Skip to main content

deq_runtime/proto/
deq.jit.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct JitLibrary {
4    #[prost(string, tag = "1")]
5    pub description: ::prost::alloc::string::String,
6    #[prost(message, repeated, tag = "2")]
7    pub gadget_types: ::prost::alloc::vec::Vec<JitGadgetType>,
8    #[prost(message, repeated, tag = "3")]
9    pub port_types: ::prost::alloc::vec::Vec<JitPortType>,
10    #[prost(message, repeated, tag = "5")]
11    pub program: ::prost::alloc::vec::Vec<JitInstruction>,
12    /// Reference metadata copied unchanged to the compiled deq.bin.Library.
13    #[prost(message, optional, tag = "6")]
14    pub metadata: ::core::option::Option<::prost_types::Struct>,
15}
16#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
17pub struct UnloadJitLibrary {
18    /// unloading the jit will also unload all the error model types and check
19    /// model types that are only used by the specified gadget types
20    #[prost(uint64, repeated, tag = "1")]
21    pub gtype: ::prost::alloc::vec::Vec<u64>,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct JitPortType {
25    #[prost(message, optional, tag = "1")]
26    pub base: ::core::option::Option<super::bin::PortType>,
27    #[prost(message, repeated, tag = "3")]
28    pub stabilizers: ::prost::alloc::vec::Vec<jit_port_type::Stabilizer>,
29    /// number of logical qubits encoded by this port type. Together with the
30    /// observable list in `base`, this fixes the column layout of any matrix
31    /// indexed by port observables: the first `2 * k` observables are logical
32    /// (`LX_0, LZ_0, LX_1, LZ_1, ...`) and the remaining ones are stabilizer
33    /// generators (one column per generator listed in `stabilizers`).
34    #[prost(uint64, tag = "4")]
35    pub k: u64,
36    /// number of physical data qubits carried by this port.
37    #[prost(uint64, tag = "5")]
38    pub n: u64,
39}
40/// Nested message and enum types in `JitPortType`.
41pub mod jit_port_type {
42    /// also need the information of the virtual stabilizer measurements
43    #[derive(Clone, PartialEq, ::prost::Message)]
44    pub struct Stabilizer {
45        #[prost(string, tag = "1")]
46        pub tag: ::prost::alloc::string::String,
47        #[prost(message, optional, tag = "2")]
48        pub relative: ::core::option::Option<super::super::visualizer::Position>,
49    }
50}
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct JitGadgetType {
53    #[prost(message, optional, tag = "1")]
54    pub base: ::core::option::Option<super::bin::GadgetType>,
55    /// finished checks are those that only involves physical measurements and
56    /// input virtual measurements; they can be expanded immediately and should
57    /// be constructed in the check model that binds to this gadget
58    #[prost(message, repeated, tag = "2")]
59    pub finished_checks: ::prost::alloc::vec::Vec<jit_gadget_type::Check>,
60    /// unfinished checks are those that involve ONE output virtual measurements;
61    /// they cannot be expanded immediately because we don't know the future
62    /// measurements yet. The number of unfinished checks should be equal to the
63    /// number of output stabilizers. Note that the check is excluding the output
64    /// virtual stabilizer measurement because it is implied by the check index.
65    #[prost(message, repeated, tag = "3")]
66    pub unfinished_checks: ::prost::alloc::vec::Vec<jit_gadget_type::Check>,
67    #[prost(message, repeated, tag = "4")]
68    pub errors: ::prost::alloc::vec::Vec<jit_gadget_type::Error>,
69}
70/// Nested message and enum types in `JitGadgetType`.
71pub mod jit_gadget_type {
72    /// define how to dynamically generate the check model for this gadget
73    /// the check model is generated immediately when the JIT gadget is
74    /// instantiated: it includes those finished checks (which, by definition,
75    /// involves only current and past measurements and thus satisfies the deq bin
76    /// semantics) and updates the unfinished checks in the JIT compiler.
77    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
78    pub struct PresentMeasurement {
79        /// if the measurement comes from an input port stabilizer, the port index is
80        /// provided; otherwise the measurement refers to a physical measurement of
81        /// this gadget
82        #[prost(uint64, optional, tag = "1")]
83        pub input_port: ::core::option::Option<u64>,
84        /// if input port is not set, then this is the physical measurement index of
85        /// the current gadget. Otherwise, it is a virtual measurement from an input
86        /// port, and the index refers to the stabilizer index in the JIT port type
87        #[prost(uint64, tag = "2")]
88        pub measurement_index: u64,
89    }
90    #[derive(Clone, PartialEq, ::prost::Message)]
91    pub struct Check {
92        /// reuse the base error definition in deq bin, but ignore the field of
93        /// remote measurements because here we only refer to local measurements
94        /// (virtual or not).
95        #[prost(message, optional, tag = "1")]
96        pub base: ::core::option::Option<super::super::bin::check_model_type::Check>,
97        #[prost(message, repeated, tag = "2")]
98        pub measurements: ::prost::alloc::vec::Vec<PresentMeasurement>,
99    }
100    /// define how to dynamically generate the error model for this gadget. Just
101    /// like the error model in deq bin, an error happening inside a gadget
102    /// belongs to the gadget's attaching error model. However, in JIT compilation,
103    /// the error model may not be immediately generated because some of the errors
104    /// trigger unfinished checks, which themselves have not been generated yet.
105    /// Even worse, due to the updates of unfinished checks, the degree of the
106    /// hyperedge is not determined yet. For example, an error triggering one
107    /// unfinished check might end up with triggering multiple checks due to
108    /// transversal logical CNOTs that propagates the error effect to multiple
109    /// logical qubits. In the JIT compiler, such errors are recorded in the memory
110    /// until all its referring unfinished checks are resolved. Only when all the
111    /// errors are resolved, an error model is generated and attached to the check
112    /// model.
113    #[derive(Clone, PartialEq, ::prost::Message)]
114    pub struct Error {
115        /// reuse the base error definition in deq bin, but ignore the field of
116        /// remote checks because here we only refer to local checks (finished or
117        /// not).
118        #[prost(message, optional, tag = "1")]
119        pub base: ::core::option::Option<super::super::bin::error_model_type::Error>,
120        /// the list of finished checks that it triggers
121        #[prost(uint64, repeated, tag = "2")]
122        pub finished_checks: ::prost::alloc::vec::Vec<u64>,
123        /// the list of unfinished checks that it triggers; if left empty, then the
124        /// error is resolved immediately; otherwise, it will wait until all the
125        /// unfinished checks and its propagated ones are completely resolved
126        #[prost(uint64, repeated, tag = "3")]
127        pub unfinished_checks: ::prost::alloc::vec::Vec<u64>,
128    }
129}
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct JitInstruction {
132    /// unlike the instruction in deq-bin which can instantiate either a gadget,
133    /// a check model or an error model, here in JIT compilation an instruction
134    /// can only instantiate a gadget, because the check model and error model are
135    /// dynamically generated based on the checks and errors defined in the JIT
136    /// gadget type.
137    #[prost(message, optional, tag = "1")]
138    pub gadget: ::core::option::Option<super::bin::Gadget>,
139    /// modify the probability of the errors
140    #[prost(message, optional, tag = "2")]
141    pub probability_modifier: ::core::option::Option<super::bin::ProbabilityModifier>,
142}