GPU-Accelerated Host-Aware Dead-Measurement Detection in Hybrid Quantum–Classical Programs: Full Version


Abstract

Hybrid programs combine a quantum circuit with a classical host program that consumes measurement outcomes. In such programs, an outcome may be syntactically read by the host but semantically non-contributory: changing the outcome cannot change the returned value. Such outcomes obscure gates that are dead only relative to the host semantics, and are therefore invisible to circuit-local optimizers.

We present a semantics-aware host-side static analysis that identifies non-contributory measurement outcomes by abstract interpretation, and prove its soundness. We implement the analysis and evaluate it on \(24\) application-faithful hybrid workloads across quantum chemistry, optimization, quantum machine learning, and quantum finance. Compared with a syntactic liveness baseline, our analysis identifies more than \(4\times\) as many non-contributory measurements, and it standalone enables the removal of \(37.98\%\) of total gates on average. Even after the state-of-the-art optimizers like Qiskit, t|ket\(\rangle\), and PyZX have already optimized the circuits, our analysis still enables removal of more than \(30\%\) of the post-optimized gates, showing that the host-semantic opportunities exposed by our analysis are not subsumed by circuit-local optimization. To scale our analysis, we further lower host programs to an SSA-style levelized intermediate representation that exposes level-wise parallelism for GPU execution, and implement a CUDA backend. We prove that this lowering preserves the analysis result, and the evaluation shows speedups of up to \(6.53\times\) over a sequential baseline as structural parallelism increases.

1 Introduction↩︎

Hybrid quantum–classical programs execute a quantum circuit whose measurement outcomes are consumed by a classical host program to compute the final result [1][7]. Although every measured qubit is typically read and its value flows through the host code, not all of those values truly influence the final return of the program. Contributions of these values could be semantically neutralized. As exemplified by 1, a value may cancel algebraically with others, vanish under an \(\texttt{int}(\cdot)\) truncation, or appear inside a sub-expression whose effect is later overwritten.

Example 1. In 1 the quantum circuit produces outcomes \(o_0,o_1,o_2\) which the host binds to \(\texttt{a,b,c}\). Although \(\texttt{a}\) is read multiple times and even guards a branch, the returned value is independent of the initial value feeding \(a\). If the then-branch is taken, then \(\texttt{u+v+w}=(\texttt{a+b})(\texttt{c-a})+\texttt{a}(\texttt{b-c})+\texttt{a}^2 = \texttt{bc}\), where all \(\texttt{a}\)–terms cancel. If the else-branch is taken, with \(\eta\!\in\!(0.1,0.5)\) and \(\texttt{a,b,c}\!\in\!\{0,1\}\), we have \(\texttt{int}(\eta\,\texttt{a+bc})=\texttt{bc}\), and \(\texttt{u+v+w}=\texttt{bc}\). Thus, despite being syntactically used, the initial value originating from \(o_0\) is non‑contributory, i.e., changing \(o_0\) does not influence the semantics of the program.

In 1, if the else-branch is taken, then semantically \(\texttt{a}=0\) and we get \(\texttt{int}(\eta\,\texttt{a+bc})=\texttt{int}(\texttt{bc})=\texttt{bc}\) without even accessing the range of \(\eta\). However, this would need a mechanism of propagating the branch-local constraint into branches, which we have not implemented within our analysis.

The standard liveness analysis [8], [9] is not enough to detect the semantic deadness of \(\texttt{a}\) in 1, as the liveness analysis is syntactic-based: \(\texttt{a}\) appears in the branch condition if(a), in the right-hand side of assignments in both branches, all of which syntactically contribute to the returned variables u, v, w, so a must be classified as potentially live.

Figure 1: A hybrid program where the host variable \texttt a, bound to measurement outcome o_0, is syntactically used but semantically non-contributory: the program’s return is invariant under changes to o_0. By non-contribution of o_0, the quantum gates enclosed by red dashed boxes are identified as redundancies: their removal leaves the host program’s returned result unchanged.

From the hardware perspective, measuring qubits whose outcomes are later neutralized increases readout traffic [10], [11] and adds readout error [12], [13] without any benefit to the final result. Performing gates that only influence those qubits is likewise unnecessary: they deepen the circuit, extend the required coherence window, and accumulate error across extra operations, which lowers overall fidelity despite contributing nothing to the result of calculation. For example, in the hybrid program 1, given \(o_0\) (feeding \(\texttt{a}\)) being non-contributory, the gates highlighted by the red dashed boxes are therefore dead and can be removed without changing the distribution of the contributory outcomes, i.e., \(o_1\) and \(o_2\), or the host program’s returned result.

As quantum stacks mature, cross‑disciplinary teams prototype quickly across library abstractions and mixed toolchains [14][17], and small but regular host‑side edits that obscure data flow could turn a seemingly used measurement into a non‑contributory one, of which effects are brittle under iteration and hard to catch in review, but the cost of leaving them in is paid on every shot of execution. Therefore, identifying as a compilation step semantically non-contributory measurement outcomes, and removing redundant operations accordingly, is crucial to improving quantum circuit efficiency and reliability.

Prior works. Existing methods address this problem only in part. Dead gate elimination (DGE) provides a rigorous circuit-level framework: if the action of a gate does not affect the probability distribution of contributory measurement outcomes, it can be removed without altering observable behaviour [18], but DGE assumes that the set of non-contributory outcomes is already known and cannot infer which ones semantically contribute to the host’s return value. In general, deciding semantic liveness at a program point—whether there exists an execution whose observable behaviour depends on the current value of a variable—is undecidable [19], [20], so classical liveness analyses are conservative static approximations computed via backward data-flow or abstract interpretation [21], [22]. Remme et al.optimize hybrid Quil programs using standard compiler analyses, but their liveness is a purely syntactic is-read notion and cannot establish result-invariance of measurement outcomes [23]. Static analyzers such as LintQ and QChecker provide AST-driven checks for suspicious Qiskit patterns, yet focus on syntactic use rather than host-semantic non-contribution and do not drive circuit pruning [24], [25]. Partial equivalence checking can certify that a simplified circuit preserves a user-chosen subset of outputs, but does not identify which outputs are irrelevant nor perform simplification automatically [26]; similarly, QuTracer prunes gates that do not affect a user-specified subset of measured qubits, but cannot discover that subset in a hybrid setting [27]. Extending code property graphs to quantum code enables cross-domain analysis and can detect measurements whose results are never used [28], but it cannot prove that syntactically used results are nonetheless semantically non-contributory. Quantum constant propagation exploits contextual host information to fold gates and simplify unitary blocks [29]; however, information flows only from host to circuit and does not track how measurement results are subsequently consumed, so it cannot prove semantic non-contribution of syntactically used outcomes. Finally, while it is well known that the outcome of a measured qubit depends only on operations in its causal light cone [30], there is no systematic approach that exploits this insight for hybrid program optimization when non-contributory qubits are obscured by complex classical post-processing.

Figure 2: Overview of our optimization pass. Given a hybrid quantum program, we analyze the classical host program to determine which measurement outcomes are non-contributory to the final return. These analysis results are then passed to the optimizer, which performs DGE-based pruning on the circuit and removes measurements and gates that affect only non-contributory outcomes. The host-side analysis can be executed either sequentially on a CPU backend or, after lowering to a levelized SSA representation, by a CUDA-based GPU backend.

Our contribution i. We present a semantics-aware host-side static analysis for hybrid quantum programs that identifies measurement outcomes that are syntactically read by the host but semantically non-contributory to the host return. The analysis is formulated as an abstract interpretation over the classical host program, tracking data and control contribution of measurement-bound initial values with exact symbolic reasoning when possible and conservative dependency information otherwise. We formalize semantic contribution and prove soundness: every reported non-contributory outcome is irrelevant to the host program’s returned value. We evaluate the analysis on \(24\) application-faithful hybrid workloads across four domains, with host computations derived from upstream application artifacts, and include a standard syntactic liveness analysis as baseline. We show that the result of the host-side analysis enables around \(38\%\) mean total-gate reduction standalone, and still removes about \(31\%\) of the post-optimized gates after SOTA circuit optimizers Qiskit [31], t|ket\(\rangle\) [32], and PyZX [33] have already run. Besides, our method detects \(4\times\) as many non-contributory measurements as a baseline standard syntactic liveness analysis. This indicates that the host-semantic simplifications exposed by our analysis are not subsumed by by either widely used circuit-local optimizers or standard syntactic liveness analysis.

A scalability challenge. The host-side static analysis introduced by our method is the main semantic phase that goes beyond circuit-only optimisation and, therefore, a primary source of compile-time cost in our flow. Accelerating this phase is appealing, but it is not straightforward: in its original form, the analysis exposes irregular dependences and limited explicit parallel structure, making it a poor match for CUDA’s SIMT execution model [34], [35]. This motivates an SSA-style reformulation. SSA makes definitions and data dependences explicit [36], and prior work has studied both the connection between SSA translation and abstract interpretation, and the semantics preservation of SSA-based compiler middle ends [37][39]. Inspired by this line of work, we use SSA in a narrower setting: to expose level-wise independent abstract-transfer tasks while preserving the host-side analysis result. Indeed, as shown empirically in the last report in 3.2, directly moving the source-order analysis to the GPU is ineffective. This observation motivates a dedicated reformulation of the host-side analysis for GPU execution, which we describe next.

Our contribution ii. We introduce an SSA-style, levelized intermediate representation for the host program to expose sufficient parallel structure for effective GPU acceleration of the host-side analysis. We prove that this lowering preserves the set of non-contributory outcomes computed by the host-side analysis. On top of this lowered representation, we implement a CUDA-based backend and evaluate the resulting GPU-accelerated host-side analysis, showing that the lowered backend achieves substantial speedups over a sequential baseline.

Overview of optimization flow. 2 provides an overview of the full flow of using our analysis to guide circuit optimization.

2 Method↩︎

2.0.0.1 Scope and assumptions

In this manuscript, we restrict our consideration to the following host program fragment: \[\begin{array}{rcl} S &::=& \texttt{skip} \mid \texttt{x} := e \mid \texttt{return}\;e \mid S;S \mid \texttt{if}\;(e)\;\texttt{then}\;S\;\texttt{else}\;S,\\[1mm] e &::=& \texttt x \mid c \mid -e \mid e_1 \odot e_2 \mid \texttt{int}(e) \mid \texttt{random}(L,U) \mid \texttt{f}(e_1,\ldots,e_n), \end{array}\] where \(\texttt x\) is a program variable, \(\odot \in \{+,-,\times,\div,\%\}\), and rational constants are interpreted exactly. Throughout the paper, \(\mathbb{Q}\) denotes the set of rational numbers. The operation \(\texttt{int}(\cdot)\) denotes truncation toward zero. \(\texttt{random}(L,U)\) has measurement-independent constant bounds. Function calls are assumed to be total, pure, and side-effect free. The grammar supports runtime-dependent structured conditionals, including nested conditionals. Arbitrary loops and recursion are outside the current implementation scope. Standard CFG-based fixpoint iteration with joins/widening, optionally combined with bounded unrolling, can extend the analysis to loops.

Next, we design abstract interpretation with a custom domain to symbolically evaluate the program.

2.1 Abstract domain↩︎

\(\mathcal{V}\) denotes the set of all program variables. \(\mathbf{M}\subseteq\mathcal{V}\) is a set of variables that take measurement outcome as initial value. Our goal is to perform a forward analysis on the host program to track which initial values of variables in \(\mathbf{M}\) influence the final return. \(\Sigma_0=\{\texttt{x}@0 \mid \texttt{x}\in \mathcal{V}\}\) denotes the set of symbols representing initial values: for each variable \(\texttt{x}\), \(\texttt{x}@0\) denotes its initial value.

2.1.0.1 Program state

An abstract state of the program is a mapping \(\rho : \mathcal{V}\cup\{\texttt{return}\} \rightarrow \mathcal{A}\) that maps each program variable to an abstract value. We reserve a distinguished symbol \(\texttt{return}\notin \mathbf{M}\) to hold the abstract return value, i.e., we use \(\rho(\texttt{return})\) to denote the abstract return value after executing the current statement. With \(\rho(\texttt{return}) = \bot\), it means current statement has no return. Besides, we maintain two auxiliary maps \(\mathbf{Dom}: \Sigma \rightarrow \{\boldsymbol{bin}, \boldsymbol{int}, \boldsymbol{real}\}\), and \(\mathbf{B}: \Sigma \rightarrow \{\bigcup_k[L_k, U_k] \mid L, U \in \mathbb{Q}\}\), where \(\Sigma\) is the set of all symbols, \(\mathbf{Dom}\) records the type/domain of each symbol, \(\mathbf{B}\) records the value range for every symbol. We maintain \(C_{\texttt{ctrl}} \subseteq \mathbf{M}\) as the set of measurement-bound variables whose initial values affect the evaluation of at least one conditional branch in a way that changes the observable post-conditional result, in particular the eventual abstract return.

2.1.0.2 Abstract value

An abstract value \(\mathcal{A}\) is either a polynomial form \(\langle p\rangle\) or a dependence form \(\langle D\rangle\): \[\mathcal{A} \mathrel{::=} \langle p\rangle \mid \langle D\rangle,\] where \(p\in\mathcal{P}\) is a multivariate polynomial over symbols in \(\Sigma\) with rational coefficients, and \(D\subseteq\Sigma\) is a set of symbols the abstract value may depend on.

In our analysis, an abstract value is either an exact polynomial, if we can precisely compute it within our domain (see 2) or a set of symbols it may depend on, if exact arithmetic is not feasible (see 3). The dependence form is a conservative fallback recording initial inputs that might influence the value. The polynomial form preserves more information: when \(\mathcal{A} = \langle p\rangle\), \(\mathcal{A}\) exactly depends on all symbols contained in the polynomial \(p\).

Example 2. A program with one statement: \(\texttt{x} := 2\texttt{a} - 3\texttt{b} + 5\). After its execution, the abstract state, if expressed in polynomial form for all variables, is \(\rho(\texttt{a})=\big\langle \texttt{a}@0\big\rangle\), \(\rho(\texttt{b})=\big\langle\texttt{b}@0\big\rangle\), \(\rho(\texttt{x})=\big\langle 2\texttt{a}@0 - 3\texttt{b}@0 + 5\big\rangle\); if expressed in dependence form for all variables, is \(\rho(\texttt{a})=\big\langle \{\texttt{a}@0\}\big\rangle\), \(\rho(\texttt{b})=\big\langle\{\texttt{b}@0\}\big\rangle\) \(\rho(\texttt{x})=\big\langle\{\texttt{a}@0, \texttt{b}@0\}\big\rangle\). We use polynomial forms whenever possible to hold more information.

Example 3. A program with one statement: \(\texttt{x} := 4\texttt{f}(\texttt{b}, \texttt{a}) - 1\), where \(\texttt{f}\) is a function call with unknown implementation. After its execution, \(\rho(\texttt{x})=\big\langle\{\texttt{a}@0, \texttt{b}@0\}\big\rangle\), since we lose track of the exact symbolic evaluation on \(\texttt{x}\), a polynomial form for \(\rho(\texttt{x})\) is impossible. \(\rho(\texttt{x})=\big\langle\{\texttt{a}@0, \texttt{b}@0\}\big\rangle\) only preserves the information that \(\texttt{x}\) depends on.

2.1.0.3 Exact abstract equality

Two abstract values are treated as equal only when they are both exact polynomial forms with the same normalized polynomial: \[\mathsf{Eq}_{\mathrm A}(A,B) = \begin{cases} \texttt{true}, & A=\langle p\rangle,\; B=\langle q\rangle,\; \mathrm{norm}(p-q)=0,\\[1mm] \texttt{true}, & A=B=\bot,\\[1mm] \texttt{false}, & \text{otherwise,} \end{cases}\] where \(\mathrm{norm}\) is a canonical polynomial simplification which collects like terms, orders monomials canonically, and drops zero terms. For example, \(\mathrm{norm}((\texttt{a}@0+\texttt{b}@0)-(\texttt{b}@0+\texttt{a}@0))=0\) and \(\mathrm{norm}(2\,\texttt{a}@0\cdot\texttt{b}@0+3\,\texttt{b}@0\cdot\texttt{a}@0)=5\,\texttt{a}@0\cdot\texttt{b}@0\).

2.2 Abstract evaluation↩︎

We define abstract evaluation of expressions. \([\![e]\!]^{\sharp}\) denotes the abstract evaluation of an expression \(e\) under environment \(\rho\). In the following, we use the notation \(\mathbf{Sym}(\cdot)\) very often: given any abstract value \(\mathcal{A}\), \(\mathbf{Sym}(\mathcal{A})\) is the set of all symbols occurring in \(\mathcal{A}\), including symbols in \(\Sigma_0\) and any fresh symbols introduced by random(\(\cdot,\cdot\)), for example, \(\mathbf{Sym}\!\left(\,\big\langle 2\,\texttt{a}@0 \;+\; 4\texttt{b}@0 \;-\; 3 \big\rangle\,\right) \;=\; \{\, \texttt{a}@0,\;\texttt{b}@0 \,\}\), \(\mathbf{Sym}\!\left(\,\big\langle \{\texttt{a}@0, \texttt{b}@0, \texttt{c}@0\} \big\rangle\,\right) \;=\; \{\, \texttt{a}@0,\;\texttt{b}@0,\;\texttt{c}@0 \,\}\). We set \(\mathbf{Sym}(\bot)\) to \(\varnothing\).

2.2.0.1 Base case

\[\frac{\texttt{x}\in\mathcal{V}}{[\![\texttt{x}]\!]^{\sharp}=\rho (\texttt{x})} \quad \frac{c\in\mathbb{Q}}{[\![c]\!]^{\sharp}=\langle c\rangle} \quad \frac{c\notin\mathbb{Q}}{[\![c]\!]^{\sharp}=\langle \varnothing\rangle}\]

2.2.0.2 Binary and unary arithmetic

When both operands have exact polynomial form, we compute the result exactly in the polynomial ring, using \(+\), \(-\), \(\times\), and then apply canonical polynomial simplification \(\mathrm{norm}\): \[\frac{[\![e_1]\!]^{\sharp}=\langle p\rangle \wedge [\![e_2]\!]^{\sharp}=\langle q\rangle\wedge p, q\in \mathcal{P}\wedge \odot\in\{+,-,\times\}}{[\![e_1 \odot e_2]\!]^{\sharp}=\langle \mathrm{norm}(p\;\odot\;q)\rangle}\] To keep the analysis efficient, we use a simplified polynomial domain: since division and modulo are not closed, we drop the polynomial form for these operators and return a dependence form: \[\frac{\mathcal{A}_1=[\![e_1]\!]^{\sharp}\wedge \mathcal{A}_2=[\![e_2]\!]^{\sharp}\wedge \odot\in\{\div, \%\}}{[\![e_1 \odot e_2]\!]^{\sharp}=\langle \mathbf{Sym}(\mathcal{A}_1)\cup \mathbf{Sym}(\mathcal{A}_2)\rangle}\] Similarly, if either operand is already in dependence form \(\langle D\rangle\): \[\frac{\mathcal{A}_1=[\![e_1]\!]^{\sharp}=\langle D\rangle\wedge D \subseteq \Sigma\wedge \mathcal{A}_2=[\![e_2]\!]^{\sharp} }{[\![e_1 \odot e_2]\!]^{\sharp}=[\![e_2 \odot e_1]\!]^{\sharp}=\langle \mathbf{Sym}(\mathcal{A}_1)\cup \mathbf{Sym}(\mathcal{A}_2)\rangle}\] Unary minus is value-preserving on dependencies: \[\frac{[\![e]\!]^{\sharp}=\langle p\rangle\wedge p\in\mathcal{P}}{[\![-e]\!]^{\sharp}=\langle -p\rangle} \qquad \frac{[\![e]\!]^{\sharp}=\langle D\rangle\wedge D\subseteq\Sigma}{[\![-e]\!]^{\sharp}=\langle D\rangle}\]

2.2.0.3 Operator int\((\cdot)\)

In this manuscript, int\((\cdot)\) is truncating toward zero: it discards the fractional part, and is not a flooring (e.g., \(\texttt{int}(1.2)=1\), \(\texttt{int}(-1.5)=-1\), \(\texttt{int}(-0.3)=0\)). If \([\![e]\!]^{\sharp}\) evaluates to an exact polynomial that is integer-valued under the domain map \(\mathbf{Dom}\), then \([\![\texttt{int}(e)]\!]^{\sharp}\) returns the same polynomial: \[\frac{C_{int}^1(e) \;\equiv\; [\![e]\!]^{\sharp}=\langle p\rangle \wedge \mathrm{IsInt}(p,\mathbf{Dom}) = \texttt{true}}{[\![\texttt{int}(e)]\!]^{\sharp}=\langle p\rangle}\] where \(\mathrm{IsInt}(p,\mathbf{Dom})\) holds iff all coefficients of \(p\) are integers and \(p\) mentions no symbol whose domain is real.

If \([\![e]\!]^{\sharp}\) evaluates to an exact polynomial \(p\) whose evaluation gives a value range \(I\) under the bound map \(\mathbf{B}\), and this value range lies entirely within a single truncation bin, then \([\![\texttt{int}(e)]\!]^{\sharp}\) constant-folds to an integer: \[\frac{C_{int}^2(e) \;\equiv\; [\![e]\!]^{\sharp}=\langle p\rangle \wedge \mathrm{eval}(p,\mathbf{B})=I \wedge \mathrm{trunc}(I)=c}{[\![\texttt{int}(e)]\!]^{\sharp}=\langle c\rangle}\] where the operator \(\mathrm{eval}(p,\mathbf{B})\) is the value range of \(p\) evaluated under the bounds of variables given by \(\mathbf{B}\); \(\forall i\in \mathbb{Z}: \mathrm{trunc}(S)=i\) iff \(\forall v\in S:\texttt{int}(v)=i\).

We further use the following integer-carrier rule: if an exact polynomial can be decomposed into an integer-valued part plus a residual whose feasible range cannot push the value across any truncation boundary, then truncation preserves the integer-valued part: \[\frac{ \begin{array}{l} C_{int}^3(e) \;\equiv\; [\![e]\!]^{\sharp}=\langle r\rangle \wedge \exists p,q\in\mathcal{P}:\; r=\mathrm{norm}(p+q)\wedge\mathrm{IsInt}(p,\mathbf{Dom})=\texttt{true} \wedge\\ \mathrm{eval}(p,\mathbf{B})=I_p \wedge \mathrm{eval}(q,\mathbf{B})=I_q \wedge \mathrm{NoCarry}(I_p,I_q)=\texttt{true} \end{array} }{[\![\texttt{int}(e)]\!]^{\sharp}=\langle p\rangle}\] where \(\mathrm{NoCarry}(I_p,I_q)\) holds iff \(\forall k\in (I_p\cap\mathbb{Z}),\;\forall \delta\in I_q:\;\texttt{int}(k+\delta)=k\).

A common sufficient pattern is \(I_q\subseteq [0,1)\) with \(I_p\subseteq [0,\infty)\), or symmetrically \(I_q\subseteq (-1,0]\) with \(I_p\subseteq (-\infty,0]\). In particular, if \(\eta\in(0.1,0.5)\) and \(\texttt{a},\texttt{b},\texttt{c}\in\{0,1\}\), then for \(p=\texttt{b}\cdot\texttt{c}\) and \(q=\eta\cdot\texttt{a}\), we have \(I_p\cap\mathbb{Z}=\{0,1\}\) and \(I_q\subseteq [0,0.5]\), so \(\mathrm{NoCarry}(I_p,I_q)\) holds and \[[\![\texttt{int}(\eta\cdot\texttt{a}+\texttt{b}\cdot\texttt{c})]\!]^{\sharp} = \langle \texttt{b}\cdot\texttt{c}\rangle.\] If none of the three cases holds, then: \[\frac{\neg C_{int}^1(e) \wedge \neg C_{int}^2(e) \wedge \neg C_{int}^3(e)}{[\![\texttt{int}(e)]\!]^{\sharp}=\langle \mathbf{Sym}([\![e]\!]^{\sharp})\rangle }\]

2.2.0.4 Operator random\((\cdot, \cdot)\)

Each occurrence of \(\texttt{random}(L,U)\) is abstracted as a fresh real-valued symbol \(\texttt r\) with bounds \([L,U]\). This rule is used only when \(L,U\in\mathbb{Q}\) are constants independent of all measurement-bound inputs. The generated symbol does not coincide with any symbol already used in the current analysis and carries no measurement dependency: \[\frac{ \begin{array}{c} L, U\in\mathbb{Q} \wedge \texttt{r}=\mathrm{gen}\text{-}\mathrm{fresh}()\wedge \mathbf{Dom}(\texttt{r})=\boldsymbol{real} \wedge \mathbf{B}(\texttt{r})=[L,U] \end{array} }{[\![\texttt{random}(L,U)]\!]^{\sharp}=\langle \texttt{r}\rangle}\] where \(\mathrm{gen}\text{-}\mathrm{fresh}()\) picks a fresh symbol for this particular occurrence of \(\texttt{random}\).

2.2.0.5 Function calls

We assume that function calls appearing in expressions are total, pure, and side-effect free, and the return can depend only on the values of arguments. We conservatively track the union of the argument supports: \[\frac{ n\in\mathbb{N} \wedge \bigcup_{i=1}^{n} \mathbf{Sym}([\![\texttt{a}_i]\!]^{\sharp}) = D_{\texttt{f}} }{ [\![ \texttt{f}(\texttt{a}_1,\dots,\texttt{a}_n) ]\!]^{\sharp} = \langle D_{\texttt{f}}\rangle }\]

2.3 Abstract effects↩︎

Abstract effects define how statements change the abstract state. We write \((\rho,C_{\texttt{ctrl}})\;\xRightarrow{\;S_b\;}\;(\rho',C_{\texttt{ctrl}}')\) for the abstract execution of a statement block \(S_b\) from state \((\rho,C_{\texttt{ctrl}})\) to \((\rho',C_{\texttt{ctrl}}')\), where \(S_b\) could be an empty statement, a single statement, or sequential composition of multiple statements. For conciseness, we omit the rules defining abstract effects on \(\mathbf{Dom}\) and \(\mathbf{B}\).

2.3.0.1 Sequencing

For statements \(S\), \(T\), we write \(S;T\) for sequencing: \[\frac{ (\rho,C_{\texttt{ctrl}}) \xRightarrow{ S } (\rho_1,C_{\texttt{ctrl}}^1) \wedge (\rho_1,C_{\texttt{ctrl}}^1) \xRightarrow{ T }(\rho_2,C_{\texttt{ctrl}}^2) }{ (\rho,C_{\texttt{ctrl}})\;\xRightarrow{\;S;T\;}\;(\rho_2,C_{\texttt{ctrl}}^2) }\]

2.3.0.2 Assignments and returns

Evaluate the expression and update \(\rho\): \[\frac{\rho'=\rho\oplus\{\texttt{x}\mapsto [\![e]\!]^{\sharp}\}}{(\rho, C_{\texttt{ctrl}}) ~\xRightarrow{\;\texttt{x := }e } (\rho', C_{\texttt{ctrl}})}\; \frac{ \rho'=\rho\oplus\{\texttt{return}\mapsto [\![e]\!]^{\sharp}\} }{ (\rho,C_{\texttt{ctrl}})\;\xRightarrow{\;\texttt{return }e }\;(\rho',C_{\texttt{ctrl}}) }\] where \(\oplus\) denotes updating the environment with the information in its second/right operand.

2.3.0.3 Conditionals

For \(S_{\texttt{cond}}\equiv\texttt{if (cond) then }S_t\texttt{ else }S_e\), we simulate both of the branches from the same input state and then merge their outputs variable-wise: if both branches yield the same abstract value for a variable, we keep it; otherwise we conservatively union their dependencies. If the abstract return values differ or some variable either differs between branches or appears in dependence form, then any measurement input that can affect cond is added to \(C_{\texttt{ctrl}}\): \[\frac{ (\rho,C_{\texttt{ctrl}}) \xRightarrow{S_t}(\rho_t,C_{\texttt{ctrl}}^t)\wedge (\rho,C_{\texttt{ctrl}}) \xRightarrow{ S_e\;} (\rho_e,C_{\texttt{ctrl}}^e) }{ (\rho,C_{\texttt{ctrl}})\;\xRightarrow{S_{\texttt{cond}} }\;(\rho_t \sqcup_{\mathrm{env}} \rho_e, C_{\texttt{ctrl}}') }\] where \[(\rho_a \sqcup_{\mathrm{env}} \rho_b)(\texttt{x}) = \begin{cases} \rho_a(\texttt{x}), & \mathsf{Eq}_{\mathrm A}(\rho_a(\texttt{x}),\rho_b(\texttt{x})),\\[1mm] \big\langle \mathbf{Sym}(\rho_a(\texttt{x})) \cup \mathbf{Sym}(\rho_b(\texttt{x})) \big\rangle, & \text{otherwise,} \end{cases}\] and \[C_{\texttt{ctrl}}' = C_{\texttt{ctrl}}^t \cup C_{\texttt{ctrl}}^e \cup \begin{cases} \{\texttt{m}\in\mathbf{M}\mid \texttt{m}@0\in\mathbf{Sym}([\![\texttt{cond}]\!]^{\sharp})\}, & \text{Diff}_{\rho_t,\rho_e},\\[1mm] \varnothing, & \text{otherwise,} \end{cases}\] where \(\text{Diff}_{\rho_t,\rho_e} = \exists \texttt{x}\in\mathcal{V}\cup\{\texttt{return}\}:\; \neg \mathsf{Eq}_{\mathrm A}(\rho_t(\texttt{x}),\rho_e(\texttt{x}))\).

2.3.0.4 Bounded lookahead for a common post-conditional return

A common pattern in hybrid host code is a structured conditional with return-free branches followed by one common return: \(S_{\texttt{if-ret}} \;\equiv\; \texttt{if (cond) then } S_t \texttt{ else } S_e \texttt{; return } e\), where \(S_t\) and \(S_e\) contain no return. We first analyze the two branches from the same input state, and then evaluate the common return expression once under each branch environment: \[\frac{ (\rho,C_{\texttt{ctrl}}) \xRightarrow{S_t} (\rho_t,C_{\texttt{ctrl}}^t) \;\wedge\; (\rho,C_{\texttt{ctrl}}) \xRightarrow{S_e} (\rho_e,C_{\texttt{ctrl}}^e) \;\wedge\; R_t = [\![e]\!]^{\sharp}_{\rho_t} \;\wedge\; R_e = [\![e]\!]^{\sharp}_{\rho_e} }{ (\rho,C_{\texttt{ctrl}}) \;\xRightarrow{S_{\texttt{if-ret}}}\; \bigl(\rho', C_{\texttt{ctrl}}'\bigr) }\] where \[\rho' = (\rho_t \sqcup_{\mathrm{env}} \rho_e) \oplus \{\texttt{return} \mapsto (R_t \sqcup_{\mathrm{A}} R_e)\},\] \[R_t \sqcup_{\mathrm{A}} R_e = \begin{cases} R_t, & \mathsf{Eq}_{\mathrm A}(R_t,R_e),\\[1mm] \bigl\langle \mathbf{Sym}(R_t)\cup \mathbf{Sym}(R_e)\bigr\rangle, & \text{otherwise,} \end{cases}\] and \[C_{\texttt{ctrl}}' = C_{\texttt{ctrl}}^t \cup C_{\texttt{ctrl}}^e \cup \begin{cases} \{\texttt{m}\in \mathbf{M}\mid \texttt{m}@0 \in \mathbf{Sym}([\![\texttt{cond}]\!]^{\sharp}_{\rho})\}, & \neg \mathsf{Eq}_{\mathrm A}(R_t,R_e),\\[1mm] \varnothing, & \text{otherwise.} \end{cases}\] Here the subscript in \([\![e]\!]^{\sharp}_{\rho_t}\) indicates that the abstract evaluation of \(e\) is performed under environment \(\rho_t\), and similarly for \(\rho_e\).

2.4 Detection of non-contributory values↩︎

After running the above stated static analysis on the host program, let \((\rho^\star, C_{\texttt{ctrl}}^\star)\) be the final abstract state produced by the host-side analysis. The set of symbols that are measurement-originated and may affect the observable host return is \[\mathbf{Obs}(\rho^\star, C_{\texttt{ctrl}}^\star) = \bigl(\mathbf{Sym}(\rho^\star(\texttt{return})) \cap \{\texttt{m}@0 \mid \texttt{m}\in\mathbf{M}\}\bigr) \cup \{\texttt{m}@0 \mid \texttt{m}\in C_{\texttt{ctrl}}^\star\}.\] Accordingly, the set of non-contributory measurement-bound variables is \[\mathbf{M}_{\mathrm{nc}} = \{\texttt{m}\in\mathbf{M}\mid \texttt{m}@0 \notin \mathbf{Obs}(\rho^\star, C_{\texttt{ctrl}}^\star)\}.\] 10 summarizes this procedure.

2.5 Soundness of Host-side Analysis↩︎

We summarize the formal connection between the concrete host semantics and the abstract analysis; detailed proofs are given in 5.4.

2.5.0.1 Concrete and abstract states.

For the proof, we use instrumented concrete states \(s=(\nu,\sigma,\delta)\), where \(\nu\) is a valuation of symbols in \(\Sigma\) respecting \(\mathbf{Dom}\) and \(\mathbf{B}\), \(\sigma\) maps variables in \(\mathcal{V}\cup\{\texttt{return}\}\) to concrete runtime values, and \(\delta:\mathcal{V}\cup\{\texttt{return}\}\to 2^{\mathbf{M}}\) records the exact set of measurement-bound variables on which each current runtime value semantically depends. The component \(\delta\) is ghost state used only in the proof; erasing it yields the ordinary concrete execution. The concrete collecting domain is \(2^{\mathcal{S}_{\mathrm c}}\), ordered by set inclusion.

The abstract states are the ones used by the analysis above: a state has the form \((\rho,C_{\texttt{ctrl}})\), together with the auxiliary maps \(\mathbf{Dom}\) and \(\mathbf{B}\), where \(\rho:\mathcal{V}\cup\{\texttt{return}\}\to\mathcal{A}\), \(C_{\texttt{ctrl}}\subseteq\mathbf{M}\). Here \(\mathcal{A}\) is the abstract-value domain from 2.1.

2.5.0.2 Description relation and concretization.

For an abstract value \(A\), define its measurement support as \(\mathbf{MSym}_{\mathbf{M}}(A) = \{\,\texttt{m}\in\mathbf{M} \mid \texttt{m}@0\in\mathbf{Sym}(A)\,\}\). A concrete value-dependency pair \((v,S_D)\) is described by \(A\) under \(C_{\texttt{ctrl}}\), written \((v,S_D)\Delta(A,C_{\texttt{ctrl}})\), if \(S_D\subseteq \mathbf{MSym}_{\mathbf{M}}(A)\cup C_{\texttt{ctrl}}\), and additionally, when \(A=\langle p\rangle\) is a polynomial form, \(v=\nu(p)\). For \(A=\bot\), we require that no concrete return value has been produced yet and \(S_D=\varnothing\). We lift \(\Delta\) pointwise to states. We write \(s\Delta(\rho,C_{\texttt{ctrl}})\) iff for every \(\texttt{x}\in\mathcal{V}\cup\{\texttt{return}\}\), \((\sigma(\texttt{x}),\delta(\texttt{x})) \Delta (\rho(\texttt{x}),C_{\texttt{ctrl}})\). The concretization of an abstract state is therefore \(\gamma(\rho,C_{\texttt{ctrl}}) = \{\,s\in\mathcal{S}_{\mathrm c} \mid s\Delta(\rho,C_{\texttt{ctrl}})\,\}\). We order abstract states by the concrete states they describe: \[(\rho_1,C_{\texttt{ctrl}}^1)\sqsubseteq_{\gamma} (\rho_2,C_{\texttt{ctrl}}^2) \quad\Longleftrightarrow\quad \gamma(\rho_1,C_{\texttt{ctrl}}^1) \subseteq \gamma(\rho_2,C_{\texttt{ctrl}}^2).\] Thus smaller concretizations are more precise.

2.5.0.3 Transfer soundness.

Let \(F_{S_b}\) be the concrete transfer of a statement block \(S_b\): \(F_{S_b}(X) = \{\,s'\mid \exists s\in X:\;s\xrightarrow{\;S_b\;}s'\,\}\). If the abstract transfer defined in 2.3 derives \((\rho,C_{\texttt{ctrl}}) \xRightarrow{\;S_b\;} (\rho',C_{\texttt{ctrl}}')\), then \[F_{S_b}\bigl(\gamma(\rho,C_{\texttt{ctrl}})\bigr) \subseteq \gamma(\rho',C_{\texttt{ctrl}}'). \] The proof is by induction over expressions and statements, using the rules in [subsec:abs-eval] [subsec:abs-effect]; see 5.4.

Applying \((\mathrm{AI}\text{-}\mathrm{S})\) to the whole host program \(H\) shows that the final abstract state \((\rho^\star,C_{\texttt{ctrl}}^\star)\) over-approximates the exact measurement dependencies of the concrete host return. Therefore \(\mathbf{Obs}(\rho^\star,C_{\texttt{ctrl}}^\star)\) over-approximates all measurement-originated symbols that can affect the return, and every \(\texttt{m}\in\mathbf{M}_{\mathrm{nc}}\) reported by find_nc is semantically non-contributory to the host return.

2.6 Examples↩︎

The following examples illustrate how our static analysis detects non-contributory measurement outcomes. Each example is presented in a step-by-step form: after every program statement, we show, on the comment line beginning with //, the corresponding abstract state produced by our static analysis.

Example 4. \(\texttt{q},\texttt{r}\in\mathbf{M}\), i.e., \(\texttt{q}\) and \(\texttt{r}\) initially hold measurement outcomes from the quantum circuit. \[\begin{array}{@{}l@{\qquad}r@{}} \texttt{def prog(q,r,b):} // \quad\text{Initial: }\rho(\texttt{q})=\langle \texttt{q}@0\rangle, \rho(\texttt{r})=\langle \texttt{r}@0\rangle, \rho(\texttt{b})=\langle \texttt{b}@0\rangle &\\ \quad \texttt{x = q + b} \quad// \rho(\texttt{x}) =[\![\texttt{q}+ \texttt{b}]\!]^{\sharp}=\mathrm{norm}(\langle \texttt{q}@0\rangle + \langle \texttt{b}@0\rangle)= \langle \texttt{q}@0 + \texttt{b}@0\rangle & \\ \quad \eta\texttt{ = random(0.1, 0.5)} \quad // \rho(\eta) = \langle \texttt{r}\rangle, \mathbf{Dom}(\texttt{r})=\boldsymbol{real},\;\mathbf{B}(\texttt{r})=[0.1,0.5] & \\ \quad \texttt{y = int(\eta * (q - r))} \quad // \rho(\texttt{y}) = \langle0\rangle & \\ \quad \texttt{q = q + 1} \quad // \rho(\texttt{q})=\langle \texttt{q}@0 + 1\rangle & \\ \quad \texttt{z = x - q - b} \quad // \rho(\texttt{z}) = [\![(\texttt{q}@0 + \texttt{b}@0) - (\texttt{q}@0 + 1) - \texttt{b}@0]\!]^{\sharp} = \langle -1\rangle & \\ \quad \texttt{return y + z} \quad // \rho^{\star}(\texttt{return}) = [\![\langle 0\rangle + \langle -1\rangle ]\!]^{\sharp} = \langle -1\rangle \end{array}\] \(\rho^{\star}(\texttt{return})\) depends on neither \(q@0\) nor \(r@0\). Thus, both initial values of \(\texttt{q}\) and \(\texttt{r}\) are not contributing to the final result.

Example 5. We assume \(\texttt{m}, \texttt{b}\in\mathbf{M}\). \[\begin{array}{@{}l@{\qquad}r@{}} \texttt{def prog(m,b):} & \\ \quad \texttt{u = (b + 3)/2} \quad // \rho(\texttt{u}) = \langle \{\texttt{b}@0\} \rangle & \\ \quad \texttt{v = foo(m)} \quad // \rho(\texttt{v}) = \langle \{\texttt{m}@0\} \rangle \quad \text{(unknown call \Rightarrow dependence on \texttt{m}@0)} & \\ \quad \eta\texttt{ = random(0.1, 0.5)} \quad // \rho(\eta) = \langle \texttt{r}\rangle,\;\mathbf{Dom}(\texttt{r})=\boldsymbol{real},\;\mathbf{B}(\texttt{r})=[0.1,0.5] & \\ \quad \texttt{t = int(\eta * (m - m))} \quad // \rho(\texttt{t}) = \langle 0\rangle & \\ \quad \texttt{m = random(0, 1)} \quad // \rho(\texttt{m})=\langle \texttt{r}'\rangle,\;\mathbf{Dom}(\texttt{r}')=\boldsymbol{real},\;\mathbf{B}(\texttt{r}')=[0,1] & \\ \quad \texttt{w = u + t + m} \quad // \rho(\texttt{w}) = \langle \{\texttt{b}@0,\, \texttt{r}'\} \rangle & \\ \quad \texttt{return w} \quad // \rho^{\star}(\text{return}) = \langle \{\texttt{b}@0,\, \texttt{r}'\} \rangle & \\ \end{array}\] The observable return depends on \(\texttt{b}@0\) and the fresh random value \(\texttt{r}'\), but not on the initial value \(\texttt{m}@0\). So the initial value of \(\texttt{b}\) contributes to the final result, but that of \(\texttt{m}\) does not.

Example 6. Assume \(\texttt{m},\texttt{n}\in\mathbf{M}\). \[\begin{array}{@{}l@{\qquad}r@{}} \texttt{def prog(m,n,b):} & \\ \quad \texttt{u = b + n} \quad // \rho(\texttt{u})=\langle \texttt{b}@0 + \texttt{n}@0\rangle \\ \quad \texttt{if (m):} \quad // [\![\texttt{m}]\!]^\sharp=\langle \texttt{m}@0\rangle \\ \qquad \texttt{return u} \qquad// \rho_t(\texttt{return})=\langle \texttt{b}@0 + \texttt{n}@0\rangle \\ \quad \texttt{else:} & \\ \qquad \texttt{return u + 1} \qquad// \rho_e(\texttt{return})=\langle \texttt{b}@0 + \texttt{n}@0 + 1\rangle &\\ // \rho^\star=\rho_t\sqcup_{\mathrm{env}}\rho_e, C_{\texttt{ctrl}}^{\star} = \{\} \cup \mathbf{Sym}([\![\texttt{m}]\!]^{\sharp})=\{\texttt{m}@0\} \end{array}\] Because \(\rho_e(\texttt{return}) \not\equiv \rho_t(\texttt{return})\), the branch changes the returned value, the post-conditional environment joins the two branch returns conservatively. So, the final return depends on \(\texttt{b}@0\) and \(\texttt{n}@0\); besides, although \(\texttt{m}@0\) does not appear in \(\rho^\star(\texttt{return})\), it is in \(C^\star_{\texttt{ctrl}}\), so \(\texttt{m}\) is also contributory.

2.7 Integration with circuit-level simplification↩︎

\(\mathbf{M}_{\mathrm{nc}}\) denotes the set of measurement outcomes identified as non-contributory by our analysis. In this section, we integrate the analysis into the circuit simplification pipeline so that every gate acting solely within the causal cones of \(\mathbf{M}_{\mathrm{nc}}\) is safely removed. \(Q\) denotes the set of circuit qubits, and the measurement map \(\mu:Q\rightharpoonup\mathcal{V}\) maps each measured qubit to the host variable that stores its outcome. For a measured qubit \(q\), its backward causal cone is the set of gates and wire segments that can reach the terminal measurement of \(q\) by following the circuit forward through wires and multi-qubit gates. A gate whose forward influence reaches only qubits mapped to \(\mathbf{M}_{\mathrm{nc}}\) is dead.

The workflow is 9. \(\mathrm{\small find\_nc}\) runs the host-side analysis to compute \(\mathbf{M}_{\mathrm{nc}}\), whose elements we map back to their qubits and treat as dead in the DGE sense. Any gate whose effects propagate only to dead qubits cannot change observable behaviour, so we sweep the circuit, delete such gates, and grow the dead-qubit set backwards along causal cones.

2.8 Asymptotic analysis↩︎

1 shows that, for typical hybrid programs with bounded abstract value sizes, our static analysis scales linearly in program size, enabling fast optimization on large codes. 2 provides the corresponding efficiency guarantee for the host-aware circuit optimization in 9, and 1 states its worst-case time complexity of our static analysis.

Let \(n\) be the number of operators in the host program, counting arithmetic, int\((\cdot)\), random\((\cdot,\cdot)\), conditionals, and function calls. Let \(|\mathcal{V}|\) be the number of variables tracked in the abstract environment, \(\mathcal{N}\) the maximum number of monomials appearing in any polynomial-form abstract value, and \(|D|\) the maximum size of any dependence-form symbol set. Detailed proofs are in 5.5.

Theorem 1. In the worst case, the proposed host-side static analysis runs in \(\mathcal{O}\!\left(n\cdot\mathcal{N}^2 + n\cdot|\mathcal{V}|\cdot|D|\right)\).

Corollary 1. When \(\max\big(\;\mathcal{N}, |\mathcal{V}|, |D|\;\big)\) is bounded by a constant value, the worst-case time complexity of the static analysis on the host program is \(\mathcal{O} \big(n \big)\).

Corollary 2. Let \(G\) be the number of gates in the input quantum circuit. The worst-case time complexity of the workflow in 9 is \(\mathcal{O}(n\cdot\mathcal{N}^2 +n\cdot|\mathcal{V}|\cdot|D| + G^2)\), and when \(\max\big(\;\mathcal{N}, |\mathcal{V}|, |D|\;\big)\) is bounded by a constant value, the complexity becomes \(\mathcal{O}(n + G^2)\).

2.9 Levelized SSA for GPU Acceleration↩︎

9 invokes find_nc to compute \(\mathbf{M}_{\mathrm{nc}}\), which, in this subsection, we discuss how to accelerate with GPUs. However, the challenge is, as confirmed later in the last report in 3.2, that directly applying GPU acceleration to the original host-side static analysis brings no practical benefit.

To expose parallel work, we lower the host program \(H\) to an SSA-style, levelized intermediate representation \(\widehat{H} = (\mathcal{L}_0,\mathcal{L}_1,\ldots,\mathcal{L}_{K-1})\), where each instruction writes a fresh destination and each level \(\mathcal{L}_k\) contains instructions that can be evaluated in static analysis in parallel. Writing \(\mathrm{Def}(\mathcal{L}_k)\) for the set of destinations defined in level \(\mathcal{L}_k\), and \(\mathrm{Use}(s)\) for the operands read by instruction \(s\), the lowering satisfies \(\forall s \in \mathcal{L}_k:\mathrm{Use}(s) \subseteq \Sigma_0 \cup \bigcup_{j<k}\mathrm{Def}(\mathcal{L}_j)\). Hence, two instructions in the same level never have read-after-write, write-after-read, or write-after-write hazards.

The host program \(H\) is lowered in two steps. First, it performs a semantics-preserving SSA/three-address expansion. Each assignment or return expression is decomposed into primitive operators already supported by our transfer functions, namely binary arithmetic, int\((\cdot)\), random\((\cdot,\cdot)\), conservative unknown calls, and branch merges. Every definition is rewritten to a fresh destination name. Nested expressions are flattened so that each lowered instruction contains only one primitive operator, and the final returned value is still written to the distinguished variable \(\texttt{return}\). For a structured conditional, we lower the two branches recursively and make the merge explicit by an instruction of the form \(u := \phi_{\mathrm{if}}(c,v_t,v_e)\), where \(c\) is the value of the condition, and \(v_t,v_e\) are the values produced by the then/else branches.

Second, the resulting SSA program is levelized. Let \(\lambda(v)\) denote the level at which the SSA value \(v\) becomes available. For any SSA value whose current SSA version is not defined by another lowered instruction we set \(\lambda(v)=-1\). For each lowered instruction \(s\), we then assign its level \(\ell(s)\) by the earliest-ready rule \(\ell(s)= 1+\max\bigl(\{-1\}\cup\{\lambda(v)\mid v\in \mathrm{Use}(s)\}\bigr)\), and define \(\mathcal{L}_k=\{\,s \mid \ell(s)=k\,\}\).

To make the levelized lowering concrete, see 7.

Example 7. Consider the following host program \(H\), where \(\texttt{q}, \texttt{r}, \texttt{b}\in\mathbf{M}\): \[\begin{array}{@{}l@{\qquad}r@{}} \texttt{def prog(q,r,b):} & \\ \quad \texttt{x = q + b} & \\ \quad \texttt{eta = random(0.1, 0.5)} & \\ \quad \texttt{y = int(eta * (q - r))} & \\ \quad \texttt{q = q + 1} & \\ \quad \texttt{z = x - q - b} & \\ \quad \texttt{return y + z} & \\ \end{array}\] Lower this program to \(\widehat H = (\mathcal{L}_0,\mathcal{L}_1,\mathcal{L}_2,\mathcal{L}_3,\mathcal{L}_4)\). \(\texttt q_0,\texttt r_0,\texttt b_0\) denote the incoming versions of the source variables, and each assignment \(s_i\) writes a fresh destination: \[\begin{align} \mathcal{L}_0 = \{ & s_1: x_1 := q_0 + b_0, s_2: \eta_1 := \texttt{random}(0.1,0.5), s_3: q_1 := q_0 + 1, s_4: t_1 := q_0-r_0 \},\\[1mm] \mathcal{L}_1 = \{ & s_5: p_1 := \eta_1 \cdot t_1,\; s_6: z_1 := x_1 - q_1 \}, \mathcal{L}_2 = \{ s_7: y_1 := \texttt{int}(p_1),\; s_8: z_2 := z_1 - b_0 \},\\[1mm] \mathcal{L}_3 = \{ & s_9: ret_1 := y_1 + z_2 \,\}, \mathcal{L}_4 = \{\; s_{10}: \texttt{return} := ret_1 \,\}. \end{align}\] The initial values here are the same as in those defined in 2.1, i.e., \(\rho(q_0)=\langle q@0\rangle\), \(\rho(r_0)=\langle r@0\rangle\), \(\rho(b_0)=\langle b@0\rangle\). The new names \(x_1,\eta_1,q_1,t_1,\ldots\) are only fresh SSA destinations used by the implementation to avoid overwriting abstract values in place. For this lowered program, some level-definition sets are \(\mathrm{Def}(\mathcal{L}_0)=\{x_1,\eta_1,q_1,t_1\}\), \(\mathrm{Def}(\mathcal{L}_1)=\{p_1,z_1\}\), and some use-sets are \(\mathrm{Use}(s_1)=\{q_0,b_0\}\), \(\mathrm{Use}(s_2)=\emptyset\), \(\mathrm{Use}(s_5)=\{\eta_1,t_1\}\). Here \(\mathrm{Use}(s)\) could be read as the set of operands that must already have values available before instruction \(s\) can be evaluated. For example, \(s_5\) cannot be placed in \(\mathcal{L}_0\), as it needs \(\eta_1\) and \(t_1\), both of which are only defined after \(\mathcal{L}_0\).

The GPU backend processes one level at a time: for each \(\mathcal{L}_k\), it launches \(|\mathcal{L}_k|\) threads, one thread per instruction, and synchronizes only between consecutive levels. As destinations within a level are disjoint and every source operand comes from an earlier level, the result is independent of the intra-level execution order.

Preservation of the lowered analysis. The GPU backend changes the representation and schedule of the host-side analysis, but it should not change the analysis result. 5.6 gives more details in showing that the above lowering is semantics-preserving with respect to our host-side analysis.

3 Evaluation↩︎

Our evaluation serves two complementary goals. (i) Effectiveness in 3.1: we evaluate whether the implemented host-aware optimization exposes circuit reductions missed by circuit-only optimizers. We first run \(3\) diagnostic workloads as smoke tests, then measure \(24\) upstream-artifact-driven workloads across quantum chemistry, quantum optimization, quantum machine learning, and quantum finance, with four controls checking the expected dead-set behavior. We compare our pass against Qiskit, t\(\ket{\text{ket}}\), and PyZX, and compose it before and after each optimizer, to quantify the benefit beyond reach of optimizers not taking host programs into account. We also compare against a syntactic host-liveness baseline, which distinguishes dead measurements detectable by syntactic liveness from those exposed only by our semantic reasoning. (ii) GPU acceleration in 3.2: we isolate the host-side static analysis \(\mathrm{\small find\_nc}(\cdot,\cdot)\) and compare a sequential baseline against a CUDA backend on controlled synthetic host programs with tunable structural parallelism. In addition, we verify that directly accelerating the original host-side static analysis on GPUs is ineffective, motivating the levelized-SSA lowering introduced in 2.9.

3.1 Effectiveness↩︎

Settings.

We evaluate whether the host-side analysis exposes optimizations that are missed by circuit-only optimizers. We use the following pipelines:

  • Pipeline q: Qiskit’s transpile at optimization level 3, using its default target-agnostic configuration.

  • Pipeline t: t\(\ket{\text{ket}}\) backend-agnostic optimization sequence DecomposeBoxes \(\rightarrow\) PeepholeOptimise2Q \(\rightarrow\) KAKDecomposition \(\rightarrow\) CommuteThroughMultis \(\rightarrow\) CliffordSimp \(\rightarrow\) RemoveRedundancies \(\rightarrow\) FullPeepholeOptimise. We invoke CliffordSimp with qubit permutations/SWAP introduction disabled when supported, so that this pipeline remains hardware agnostic.

  • Pipeline p: PyZX’s full_optimize, which converts the circuit to a ZX graph, applies ZX rewrites, and extracts a simplified circuit.

  • Pipeline h: our host-aware optimization. It first runs the host-side dependency analysis to compute which measurement variables can affect the host return value. Measurements outside this dependency set are mapped back to quantum wires, and the corresponding dead backward cones are removed.

  • Pipeline l: a syntactic host-liveness baseline. Following the standard backward live-variable/data-flow formulation for imperative programs [8], [9], it starts from the host return expression and propagates liveness backward through assignments and branch guards. The baseline is control-dependence-aware, but purely syntactic: it does not simplify arithmetic expressions, zero coefficients, equivalent branches, or bounded int/floor residuals. 13 summarizes its implementation.

  • Pipelines qh, hq, th, ht, ph, and hp: compositions of the above pipelines, where the concatenation “XY” means “run X, then Y”.

Smoke test. We first run our method on three small but realistically designed diagnostic workloads. Its setup and results are in 5.1.

The main effectiveness evaluation uses \(24\) upstream-artifact-driven workloads, six each from quantum chemistry, quantum optimization, quantum machine learning, and quantum finance. Each main workload is paired with a workload-specific quantum kernel derived from the MQTBench benchmark templates [40] and stored as an OpenQASM. The host program consumes measurement variables produced by the quantum kernel and computes an application-level quantity, such as an energy estimate, a QUBO objective value, a classifier score, or a financial payoff/risk quantity. The upstream artifacts model application-side preprocessing outputs like screened Hamiltonian terms, symmetry-sector certificates, QUBO presolve reports, sparse trained-model weights, portfolio exposures, and risk-reporting policies. A detailed description of the workloads is in 5.3. These artifacts define the host-side computation, and our host-side analysis computes which measurement variables are semantically irrelevant to the final host return value, driving DGE to prune quantum circuits.

We additionally run \(4\) control workloads. These controls are excluded from aggregate effectiveness numbers in 1. They are used only to validate the analysis: two all-live negative controls, one positive control with an expected screened chemistry tail, and one zero-weight trap control in which a locally zero coefficient does not make the corresponding measurement dead because the same feature is still used by an auxiliary live term.

Before recording metrics, each resulting circuit is canonicalized to the common basis \(\{\texttt{rz},\texttt{sx},\texttt{x},\texttt{cx}\}\). Here rz is a rotation around the \(Z\) axis, sx is the square-root of the Pauli-\(X\) gate, x is the Pauli-\(X\) bit flip, and cx is controlled-\(X\)/CNOT. We use this basis only to canonicalize gate counts across toolchains, not as a hardware target model. For each resulting circuit, we record the number of one-qubit gates, two-qubit gates, and circuit depth, excluding terminal measurements from the gate counts and depth. We also record total-gate percentage reduction, where total gates are defined as the sum of one- and two-qubit gates. The experiments run with Python 3.8.10 under WSL2 with Qiskit 0.46.3, pytket 1.3.0, PyZX 0.7.3.

Results. 1 summarizes the aggregate total-gate reductions on the \(24\) main workloads. Running our host-aware pass alone reduces total gate count by \(38.0\%\) on average. More importantly, the host-side analysis remains effective when composed with standard circuit-only optimizers. When applied after the circuit optimizer, it yields an additional \(31.6\%\) mean total-gate reduction after Qiskit, \(31.1\%\) after t\(\ket{\text{ket}}\), and \(31.1\%\) after PyZX. We also observe essentially the same reductions when the host-aware pass is applied before Qiskit or t\(\ket{\text{ket}}\) and the resulting circuit is then optimized, with means of \(31.6\%\) and \(31.1\%\), respectively. For PyZX, the pre-optimization composition is slightly less favorable but still gives a \(30.8\%\) mean reduction relative to PyZX alone.

Table 1: Aggregate total-gate reductions on the \(24\) main effectiveness workloads.
Comparison Mean total-gate reduction Range
original \(\rightarrow\) h 37.98% 15.67–62.88%
q \(\rightarrow\) qh 31.61% 3.88–65.62%
q \(\rightarrow\) hq 31.61% 3.88–65.62%
t \(\rightarrow\) th 31.09% 2.55–68.87%
t \(\rightarrow\) ht 31.09% 2.55–68.87%
p \(\rightarrow\) ph 31.10% 3.94–69.45%
p \(\rightarrow\) hp 30.75% 0.73–69.45%

4pt

3 breaks down the post-optimizer reductions per workload. The benefits appear across all four application families rather than being concentrated in a single domain. Chemistry and finance workloads exhibit more moderate but still consistently positive reductions, reflecting smaller or more localized dead backward cones than other workloads.

Figure 3: Per-workload total-gate reduction for the main effectiveness workloads. For each workload, the figure reports the additional total-gate reduction obtained by composing host-side analysis with Qiskit (q\rightarrowqh), t\ket{\text{ket}} (t\rightarrowth), and PyZX (p\rightarrowph). Workloads are grouped by application family.

As a side check closer to the novelty of the host analysis, we also compare against the syntactic liveness baseline l. To isolate the contribution of the host-side dead-measurement discovery from the circuit-pruning backend, we feed the dead measurements found by l and by our semantic analysis h into the same DGE backend. 2 reports both the measurement-level dead sets and the resulting circuit-level reductions. The baseline l identifies \(21\) dead measurement variables and reduces total gate count by \(5.06\%\) on average, while h identifies \(92\) dead measurement variables and reduces total gate count by \(37.98\%\) on average under the same DGE backend. Hence \(71\) dead measurements are semantic-only opportunities not recovered by the syntactic baseline.

Table 2: Comparison between the syntactic host-liveness baseline l and the semantic host-side analysis h on the \(24\) main workloads. Syn.-dead counts measurement variables detected by syntactic liveness; Sem.-dead counts measurement variables detected by our semantic analysis; Sem.-only is the additional dead set found only by semantic reasoning. DGE-l and DGE-h report mean total-gate reduction after feeding the corresponding dead-measurement set into the same DGE backend, starting from the original circuit.
Domain Workloads Meas. Syn.-dead Sem.-dead Sem.-only DGE-l DGE-h
Chemistry 6 62 17 25 8 11.05% 30.50%
Optimization 6 49 4 21 17 9.20% 47.03%
QML 6 65 0 23 23 0.00% 40.83%
Finance 6 73 0 23 23 0.00% 33.58%
Total 24 249 21 92 71 5.06% 37.98%

3pt

As shown in 3, both all-live negative controls produce an empty dead-measurement set and zero host-induced savings. The positive control recovers exactly the expected screened measurements, while the zero-weight trap control also produces an empty dead set because the zero-weighted feature remains live through an auxiliary term.

Table 3: Control-workload validation. Negative controls are expected to produce no dead measurements and no host-induced pruning. The positive control checks that the analysis can recover a known screened dead set.
Ctrl. Role Expected Observed Dead-set No-pruning
CTRL1 negative \(\emptyset\) \(\emptyset\) pass pass
CTRL2 negative \(\emptyset\) \(\emptyset\) pass pass
CTRL3 positive \(\{m_2,m_8,m_9,m_{10}\}\) \(\{m_2,m_8,m_9,m_{10}\}\) pass n/a
CTRL4 negative trap \(\emptyset\) \(\emptyset\) pass pass

4pt

Overall, these results show that host-side semantic information is complementary to circuit-only optimization. Circuit optimizers can simplify the quantum circuit structure, but they do not know which measured values are semantically consumed by the host computation. Our analysis exposes this information and enables additional dead-gate elimination even after Qiskit, t\(\ket{\text{ket}}\), and PyZX have optimized the same circuits. Combined with the result from 5.1, the best composition order is workload-dependent: in some cases applying h after a circuit-only optimizer is better, in some cases applying h first exposes more downstream simplification, and in other cases the order has little or no effect.

3.2 GPU acceleration of host-side analysis↩︎

Our goal in this subsection is to quantify the practical effect of GPU acceleration on the host-side static analysis find_nc\((\cdot,\cdot)\) (10). To this end, we compare a sequential baseline against a GPU backend over a family of synthetic host programs whose size, source-level parallel structure, and symbolic coupling can be varied independently.

Setting. Each generated input is an imperative host program with exactly \(|\mathbf{M}|\) measurement-bound inputs and \(s_h\) source statements. As illustrated in 4, generation is organized around active chains, each of which maintains its own current frontier value and advances mostly independently before the final reduction to return. A structural-parallelism knob \(p \in [0,1]\) determines the number of chains. Given \(|\mathbf{M}|\) and \(s_h\), we compute \(n_{\max}= \min\!\left( |\mathbf{M}|, \left\lfloor \frac{s_h+1}{2} \right\rfloor \right), n_{\mathrm{chain}}= 1+\left\lfloor p\,(n_{\max}-1)\right\rfloor\). This reserves \(n_{\mathrm{chain}}-1\) statements for the final reduction and leaves \(s_{\mathrm{body}} = s_h - (n_{\mathrm{chain}}-1)\) statements for the body. Round by round, each chain with remaining budget emits one statement that overwrites one variable in its small working set. Statements are sampled from the primitive operator family in 2; each non-constant operand is drawn from the same chain with probability \(1-\chi\) and from a different chain with probability \(\chi\), where \(\chi \in [0,1]\) controls cross-chain reads.

The sequential baseline analyzes the original host program directly on CPU, in source order, using a serial implementation of the host-side analysis. The GPU backend first lowers the host program on the CPU to the levelized SSA representation of 2.9 and then executes the resulting parallel analysis tasks on the GPU using CUDA. Both executables are compiled with nvcc 12.8.93. All experiments are run on the same node, where two NVIDIA H100 NVL devices are visible to the process. For every design point, both implementations analyze exactly the same program. Each point is instantiated by one deterministic source program from a fixed seed and timed over \(10\) repetitions after \(3\) warmup runs. The reported running time of the GPU backend includes both the CPU-side lowering time and the GPU execution time.

Figure 4: Illustration of active chains in input programs.

Results. Across all tested design points, the CUDA backend produced the same analysis result as the sequential baseline. We first summarize the speedup landscape in (a) of 5. Using the experimental setup described above, we sweep \(|\boldsymbol{M}|\in\{32,64,128,256\}\) and \(s_h\in\{1024,2048,4096,8192\}\), and evaluate the speedup as \(T_{\mathrm{seq}}/T_{\mathrm{gpu}}\) for several representative source-level parallelism settings. The trend is clearly visible: GPU acceleration becomes stronger as either the number of measurement-bound inputs \(|\boldsymbol{M}|\) or the host-program size \(s_h\) increases, and this trend is amplified by larger \(p\). This directly supports the intuition that, once lowering exposes sufficient structural parallelism in the host-side analysis, the analysis admits substantial parallel execution.

We next make the break-even behavior explicit in (b) of 5. This figure uses the same experimental sweep, but now keeps a larger set of parallelism settings \(p\in\{0,0.125,0.25,0.5,0.75,1.0\}\) and groups the results by the source host size \(s_h\). Each cell is still annotated by the measured speedup, but the background color indicates whether the GPU backend wins (\(\mathrm{speedup}>1\)) or loses (\(\mathrm{speedup}<1\)). The resulting phase diagram shows a clear break-even boundary. For the smallest host size (\(s_h=1024\)), the GPU backend requires moderate structural parallelism to become worthwhile. As the source host size increases, this boundary shifts leftward. By \(s_h=4096\) or \(8192\), the GPU backend already wins on all tested combinations.

Why lowering matters. We also examine what happens if the host-side analysis is moved to the GPU directly on the original host program, without first applying the levelized SSA lowering of 2.9. We compare two implementations of the same host-side analysis: the first, which we call the source-order CUDA implementation, analyzes the original host program directly on GPUs; the second remains the sequential baseline we used in our previous experiments. For each design point \((|\boldsymbol{M}|, s_h)\), we try all tested values of the requested structural parallelism \(p\) and record the best speedup over the sequential baseline observed for that design point. Across all tested design points, the source-order CUDA implementation remains far below break-even: even the best observed speedup lies only in the range \(0.026\times\)\(0.035\times\). This is expected: in its original form, the analysis exposes too little regular parallel work for SIMT execution, so kernel-launch overheads, irregular memory access, and synchronization costs dominate the useful computation. Thus, useful GPU acceleration requires the lowering step of 2.9 to expose additional parallelism first.

Figure 5: GPU acceleration results for host-side static analysis.

4 Conclusion↩︎

We present a static analysis to identify non-contributory measurement outcomes in hybrid quantum-classical programs and drive DGE circuit optimization. Our pass is orthogonal to existing circuit optimizers, yielding substantial circuit simplification both on its own and in composition with Qiskit, t\(\ket{\text{ket}}\), and PyZX. We further showed that, after lowering exposes sufficient level-wise parallelism, the host-side analysis admits an efficient GPU backend.

5 Appendix↩︎

5.1 Evaluation on diagnostic workloads↩︎

In addition to the application-faithful workloads in 3.1, we also implement three small diagnostic workloads with VQE-style and QPE-style kernels. These workloads are intentionally small and inspectable: the expected non-contributory measurements can be checked manually, which makes them useful for validating individual transfer rules, measurement-to-qubit mappings, and the end-to-end dead-gate elimination pipeline. They also serve as lightweight smoke tests for reproducing our artifact: before running the full application-faithful suite, one can run these diagnostic instances to check that the host analysis, circuit optimizers, canonicalization step, and pipeline compositions produce the expected behavior. These workloads are not intended to establish workload representativeness, and we therefore exclude them from the aggregate statistics and main effectiveness claims in 3.1. We run the same experimental setup as in 3.1 and report the diagnostic results in [table:resulting-circuits-metrics-toy,table:relative-optimization-toy].

Results. The results on our diagnostic workloads also give supportive evidence. Our host-aware pass h is effective on its own and yields orthogonal gains when composed with state-of-the-art optimizers (Qiskit, t\(\ket{\text{ket}}\), PyZX). As 4 shows, applying h already simplifies the circuits substantially: on 6 it prunes all gates; on 7 it reduces the metrics from \((82,26,61)\) to \((12,0,6)\), eliminating all two-qubit gates; on 8 it shrinks these metrics from \((40,16,37)\) to \((31,9,31)\). 5 further shows that inserting h around Qiskit/t\(\ket{\text{ket}}\)/PyZX yields large additional reductions over each optimizer’s standalone output. Running h before the optimizer sometimes exposes more simplifications (e.g., \(\hyperlink{passsettings}{\boldsymbol{q}}\!\to\!\hyperlink{passsettings}{\boldsymbol{hq}}\) achieves \((100\%,100\%,100\%)\) extra savings on 6 and \((83\%,100\%,90\%)\) on 7), while running h afterwards remains quite beneficial. The only minor adverse effect is for t\(\ket{\text{ket}}\) on 8 when applied after h\(\,\): single-qubit gates increase by 13%, but two-qubit gates drop by 40%, a favourable trade-off. Overall, these results corroborate: our host-semantics-aware optimization prunes result-invariant gates that host-unaware optimizers cannot, and composing h with existing toolchains amplifies simplification beyond their reach.

Figure 6: Diagnostic workload one: a toy hybrid program similar to the 1.
Figure 7: Diagnostic workload two: a VQE-style estimator/update kernel. The Ansatz (blue) uses a fixed 3-qubit entangling backbone followed by a layer of parameterized single-qubit rotations and a CX/CCX correlation-shaping layer to boost expressivity. The classical host (red) aggregates subsets of measurement shots into estimators (e.g., Z- and X-type energy terms), combines them into an objective, and updates the circuit parameters. This pattern matches how VQE, QAOA, and related variational algorithms are implemented in practice.
Figure 8: Diagnostic workload three: a QPE kernel where the counting register q_0,\ldots,q_{3} controls powers of a single–qubit phase U(\varphi)=R_z(\varphi) applied to the work state \ket{\psi}; readout uses QFT_{f}^{\dagger}, whose top stage is shown explicitly as R_3^{\dagger},R_2^{\dagger},R_1^{\dagger},H with R_i^{\dagger}\equiv\operatorname{CP}(-\pi/2^{\,i}). The host then executes the analyzing program in the red box.
Table 4: Gate counts and depth after applying set-up pipelines on the \(3\) diagnostic hybrid workloads. Each entry is a triple \((\#\text{1q-gate},\,\#\text{2q-gate},\,\text{depth})\) measured on the resulting circuit.Lower values indicate more simplification.
[fig:test-case-toy-example] [fig:test-case-vqe] [fig:test-case-qpe]
original circuit \((16, 8, 19)\) \((82,26,61)\) \((40 ,16 ,37)\)
q \((19, 7, 17)\) \((59 ,25, 54)\) \((40 ,9 ,28)\)
t \((24, 7, 26)\) \(( 105 ,25 ,83)\) \((53 , 10 ,36)\)
p \((10, 6, 11)\) \((79 ,32 ,69)\) \((47, 15 ,24)\)
h \((0, 0, 10)\) \((12 ,0 ,6)\) \((31 ,9 ,31)\)
qh \((3, 2, 14)\) \((17 ,6 ,16)\) \((34 ,5 ,21)\)
hq \((0,0,0)\) \((10 ,0 ,5)\) \(( 31, 5 ,22)\)
th \((3,2,4)\) \((42 ,6 ,41)\) \((41 ,6 ,28)\)
ht \((0,0,0)\) \(( 12 ,0 ,6)\) \((60, 6 ,39)\)
ph \((3,2,4)\) \((18 ,2 ,12)\) \((33, 8 ,22)\)
hp \((0,0,0)\) \((18 ,0 ,9)\) \((32 ,8 ,21)\)
Table 5: Percentage additional savings on diagnostic workloads by integrating our host-aware pass h with standard circuit optimizers.For the row \(X\! \rightarrow\! YZ\), each entry \((\Delta\text{1q-gate},\,\Delta\text{2q-gate},\,\Delta\text{depth})\) is\(100\times\frac{\text{metric after }X-\text{metric after }YZ}{\text{metric after }X}\)with the metric being #1-qubit gates, #2-qubit gates, and depth.Positive values indicate further reduction; negatives indicate regressions.
[fig:test-case-toy-example] [fig:test-case-vqe] [fig:test-case-qpe]
\(\hyperlink{passsettings}{\textbf{q}}\rightarrow\hyperlink{passsettings}{\textbf{qh}}\) \(( 84 ,71 ,76)\) \((71 ,76 ,70)\) \(( 15 ,44 ,25)\)
\(\hyperlink{passsettings}{\textbf{q}}\rightarrow\hyperlink{passsettings}{\textbf{hq}}\) \((100 ,100 ,100)\) \((83, 100 ,90)\) \((22 ,44 ,21)\)
\(\hyperlink{passsettings}{\textbf{t}}\rightarrow\hyperlink{passsettings}{\textbf{th}}\) \(( 87 ,71 ,84)\) \((60 ,76 ,50)\) \((22 ,40 ,22)\)
\(\hyperlink{passsettings}{\textbf{t}}\rightarrow\hyperlink{passsettings}{\textbf{ht}}\) \((100 ,100 ,100)\) \((88 ,100 ,92)\) \((-13 ,40 ,-8)\)
\(\hyperlink{passsettings}{\textbf{p}}\rightarrow\hyperlink{passsettings}{\textbf{ph}}\) \((70 ,66 ,63)\) \((77 ,93 ,82)\) \(( 29 ,46 ,8)\)
\(\hyperlink{passsettings}{\textbf{p}}\rightarrow\hyperlink{passsettings}{\textbf{hp}}\) \((100, 100, 100)\) \((77 ,100 ,87)\) \((31 ,46 ,12)\)

5.2 Pseudo-code implementations↩︎

In 11, InitAbsState creates the initial abstract environment and marks measurement-bound variables as binary inputs. In 12, AnalyzeBlock performs one forward abstract execution of the host block, using the expression transfer rules in 2.2 and the statement effects in 2.3. In 10, find_nc further uses the outcome of 11 12 to compute a set of non-contributory measurement outcomes.

13 14 describe a standard backward live-variable analysis over the host program, augmented only with conservative control dependence through branch guards. The operator \(\mathrm{Vars}(e)\) returns variables syntactically occurring in \(e\); it does not perform algebraic simplification. Thus, for example, \(\mathrm{Vars}(0\cdot\texttt{m})=\{\texttt{m}\}\) and equivalent branch returns are not identified as equal.

In 9, \(Q\) denotes the set of qubits. The call \(C_{\text{opt}}.\boldsymbol{frontier}()\) returns the current output-side frontier: the operators adjacent to terminal measurements. The procedure CloseUnderCones\((C_{\text{opt}},\mathbf{Q}_{\text{dead}})\) propagates deadness backward through the remaining circuit: whenever all output-side wire segments of a operator lead only to qubits in \(\mathbf{Q}_{\text{dead}}\), the input-side wire segments are also marked dead.

Figure 9: Host-aware circuit simplification
Figure 10: find_nc: detecting non-contributory measurements
Figure 11: InitAbsState: initializing the abstract state
Figure 12: AnalyzeBlock: abstract execution of a host block
Figure 13: SyntacticLive: syntactic host-liveness baseline
Figure 14: LiveBlock: backward syntactic transfer

5.3 Application-faithful workload descriptions↩︎

5.3.0.1 Quantum chemistry workloads.

These workloads model VQE-style molecular-estimator post-processing. The quantum kernels prepare parameterized Ansatz states and measure Pauli-style observable groups. The host programs map measured bits to Pauli eigenvalue variables, aggregate weighted Pauli products, and return an energy or selected molecular-property estimate. Such host-side Hamiltonian averaging and measurement aggregation are standard in VQE and near-term quantum chemistry workflows [41][43].

C1-pauli.

This workload represents a VQE energy-estimation step after Hamiltonian coefficient thresholding. The quantum kernel is an irregular RealAmplitudes VQE-style ansatz followed by measurements for Pauli-estimator groups. The host program converts each measurement bit into a Pauli eigenvalue and computes a weighted sum of Pauli products. The upstream chemistry artifact contains a screened low-magnitude Hamiltonian tail term; therefore, the measurements used only by that screened term no longer affect the returned energy. This models the common situation in which a chemistry workflow discards small Hamiltonian coefficients or measurement terms to reduce estimator cost [41], [42], [44].

C2-symmetry.

This workload models an estimator that uses known symmetry or tapering-sector information. The quantum kernel is an EfficientSU2/two-local VQE-style ansatz with nonuniform measurement groups. The host program first applies upstream constant replacements for measurements whose Pauli eigenvalues are fixed by a symmetry-sector certificate, and then evaluates the remaining energy terms. The quantum and host sides cooperate as follows: the quantum circuit still produces measurement variables, but the application-level host computation knows that some variables are fixed by the physical sector and therefore overwrites them with constants. This reflects symmetry-based qubit reduction and tapering techniques used in fermionic Hamiltonian simulation [43], [45].

C3-active-space.

This workload models active-space chemistry with frozen-orbital constants. The quantum kernel is an active-space VQE-style ansatz with an irregular tail corresponding to frozen or inactive orbital lines. The host program aggregates active-space Pauli terms but replaces selected frozen-orbital measurements by constants supplied by the upstream active-space artifact. Thus, the host return value depends only on the active-space portion of the measurement record. This reflects standard chemistry preprocessing in which inactive orbitals are treated classically while only the active space is handled by the quantum computation [43], [46].

C4-screened-obs.

This workload represents grouped observable evaluation after screening low-weight Pauli blocks. The quantum kernel contains heterogeneous grouped VQE observable blocks. The host program forms a molecular estimator by summing the retained observable groups. The upstream artifact records that one low-weight observable block was removed by application-level screening, so measurements used only by that block become semantically irrelevant. This captures the common VQE practice of grouping and filtering observable terms to reduce measurement overhead [42], [44].

C5-property-report.

This workload models a shared quantum estimator used for multiple molecular properties, where the application reports only a selected property subset. The quantum kernel measures heterogeneous observable blocks that could support several property reports. The host program aggregates only the observable blocks requested by the current report. A block corresponding to an unreported property is still present in the shared quantum kernel, but its measurements do not contribute to the host return value. This is application-faithful for chemistry workflows that reuse estimator templates across related observables while reporting only selected quantities [43], [44].

C6-lowrank-tail.

This workload models a low-rank chemistry estimator with a screened tail factor. The quantum kernel follows an irregular VQE-style estimator template with nonuniform groups corresponding to retained and tail factors. The host program computes the estimator by summing the retained low-rank terms. The upstream artifact records that a small low-rank tail factor was removed, so measurements used only by that tail factor are dead with respect to the final energy estimate. This reflects low-rank Hamiltonian decompositions and truncation strategies used to reduce the resource cost of electronic-structure simulation [43], [47].

5.3.0.2 Quantum optimization workloads.

These workloads model QAOA/QUBO-style workflows. The quantum kernels prepare candidate binary assignments using irregular QAOA-style circuits. The host program interprets measurement bits as decision variables and evaluates an application objective, typically a weighted QUBO expression. The upstream artifacts model presolve, component selection, fixed variables, disabled constraints, or scenario filtering. QAOA and QUBO formulations are standard near-term optimization models [48], [49].

O1-inactive-var.

This workload models a QUBO objective after preprocessing removes all objective terms incident to one decision variable. The quantum kernel is a QAOA/QUBO circuit that still measures all candidate variables. The host program evaluates the preprocessed objective by summing the nonzero weighted edges. The inactive variable may still be measured by the quantum kernel, but because all of its incident objective coefficients are zero in the upstream presolve artifact, it cannot affect the returned score. This reflects optimization pipelines in which classical presolve removes inactive variables before objective evaluation [48], [49].

O2-component-select.

This workload models a disconnected QUBO instance where the application reports only a selected connected component. The quantum kernel prepares and measures variables for both the selected component and an omitted component. The host program evaluates only the selected component’s objective edges. Measurements belonging solely to the unreported disconnected component are irrelevant to the returned objective value. This captures the application pattern in which a decomposed optimization model is solved or reported component-wise [48], [49].

O3-penalty-filter.

This workload represents a QUBO objective with disabled penalty or constraint blocks. The quantum kernel measures variables that would support both the main objective and several penalty terms. The host program evaluates the objective using the active upstream penalty configuration. Penalty blocks with zero weights are excluded from the returned score, so variables used only inside disabled blocks do not influence the host return value. This models application workflows in which constraints, soft penalties, or regularizers are conditionally enabled or disabled by a model export [48], [49].

O4-fixed-vars.

This workload models QUBO presolve with fixed decision variables. The quantum kernel measures a full candidate assignment, but the upstream artifact records that selected variables have been fixed by classical preprocessing. The host program first overwrites those variables with constants and then evaluates the QUBO objective. A measured variable that is fixed before the objective is computed no longer contributes semantically to the returned score. This reflects standard optimization presolve, where variables can be fixed before the remaining subproblem is evaluated [48], [49].

O5-multiobj.

This workload models a multi-objective QAOA/QUBO report in which the application queries only one objective component. The quantum kernel measures variables for heterogeneous objective components. The host program returns the selected objective score and omits the unqueried component from the current report. Measurements used only by the omitted component are therefore dead with respect to the current host return value. This is faithful to optimization workflows that share a quantum candidate generator across several objectives but report only a selected objective for a particular query [48], [49].

O6-robust-scen.

This workload models robust or scenario-weighted optimization. The quantum kernel prepares a QAOA-style assignment over variables that participate in several scenario components. The host program evaluates a robust objective using only scenarios retained by the upstream scenario filter. Measurements associated solely with filtered scenarios do not affect the returned robust score. This captures application workflows where a QUBO-style objective is evaluated under a subset of active scenarios or risk cases [48], [49].

5.3.0.3 Quantum machine learning workloads.

These workloads model quantum machine learning pipelines. The quantum kernels compute feature channels, support-vector/kernel estimates, ensemble features, or class-head features. The host program aggregates these measured features using a trained classical readout, such as a sparse linear head, an SVM-style decision function, an ensemble weight vector, or a selected class query. Quantum feature maps and quantum kernel methods are standard QML patterns, and support-vector models naturally produce sparse decision functions through zero dual coefficients [50][52].

M1-sparse-readout.

This workload models a QNN feature extractor followed by a sparse linear readout head. The quantum kernel consists of batched, nonuniform QNN feature-channel circuits. The host program converts measurements into channel features and computes a linear logit using trained readout weights. The upstream trained-model artifact contains a zero weight for one feature channel, as would arise from sparsity-inducing training or feature selection. That channel is still produced by the quantum kernel, but it does not affect the returned logit [50], [51], [53].

M2-kernel-svm.

This workload models a quantum-kernel/SVM decision function. The quantum kernel computes heterogeneous quantum feature or kernel-estimator blocks associated with candidate support vectors. The host program evaluates an SVM-style decision score by weighting these quantum features with exported dual coefficients. Non-support vectors have zero dual coefficients in the upstream model export, so measurements used only for those entries are irrelevant to the final decision score. This follows the standard SVM structure, where the decision function is sparse in support vectors [50][52].

M3-ensemble.

This workload models an ensemble of QNN submodels. The quantum kernel contains batched feature-extraction blocks for several submodels. The host program computes an ensemble score by summing submodel outputs with exported ensemble weights. The upstream artifact assigns zero weights to pruned submodels, so their corresponding measured features do not affect the final ensemble score. This reflects a common inference pattern in which an ensemble or model-selection stage keeps only a subset of candidate predictors [50], [51], [53].

M4-sensor-drop.

This workload models sensor or feature-channel selection before QML inference. The quantum kernel computes nonuniform feature channels, each representing a different input sensor or feature group. The host program aggregates only the channels included in the upstream sensor manifest. A dropped sensor channel may still be present in the shared quantum kernel template, but its feature is not consumed by the host return value. This captures application pipelines in which low-quality or unavailable feature channels are excluded at inference time [50], [51].

M5-multiclass.

This workload models a multiclass QNN with several class heads, where the application queries only a subset of class scores. The quantum kernel computes heterogeneous feature blocks that can feed multiple class heads. The host program evaluates only the requested class score or subset of scores. Measurements used exclusively by unqueried class heads are therefore semantically irrelevant to the current return value. This models selective inference in multiclass QML pipelines [50], [51].

M6-calib-filter.

This workload models calibrated QNN inference with feature-channel quality filtering. The quantum kernel produces several feature channels, including an auxiliary channel marked by the upstream calibration artifact as low quality. The host program computes the calibrated readout using only channels that pass the exported calibration filter. Measurements used only by the excluded channel do not contribute to the returned logit. This is faithful to QML pipelines where calibration, data quality, or confidence filters determine which quantum features are consumed by the classical readout [50], [51].

5.3.0.4 Quantum finance workloads.

These workloads model amplitude-estimation-style finance kernels followed by classical payoff, exposure, or risk-reporting logic. The quantum kernels encode price, payoff, scenario, or risk-factor information into measured registers. The host program decodes those registers and computes a portfolio value, payoff bin, VaR-style threshold, or sensitivity report. This matches the standard quantum-finance pattern in which quantum amplitude estimation or state-preparation circuits are followed by classical post-processing for pricing and risk metrics [54][56].

F1-zero-exposure.

This workload models a batched portfolio payoff computation with one zero-exposure asset or scenario. The quantum kernel contains AE-style scenario/payoff blocks, and the host program decodes each measured block into a payoff value. It then multiplies each payoff by an exposure exported by the portfolio artifact and returns the portfolio sum. A scenario with zero net exposure is still measured by the quantum kernel but does not affect the portfolio value. This reflects portfolio netting or exposure filtering in financial risk and pricing workflows [54], [55].

F2-coarse-binning.

This workload models coarse-binned option payoff evaluation. The quantum kernel produces a price register. The host program decodes the register with application-level bit weights, applies integer/floor-style binning, and returns a payoff derived from the coarse bin. Low-order residual bits that cannot change the selected bin are irrelevant to the returned payoff. This captures payoff policies where only coarse price buckets matter for the reported financial quantity [55], [56].

F3-scenario-filter.

This workload models scenario-weighted risk aggregation. The quantum kernel contains batched AE-style risk-scenario blocks. The host program decodes each scenario payoff and multiplies it by an eligibility or scenario weight from the upstream risk artifact. Scenarios filtered by zero eligibility weights do not contribute to the returned risk quantity. This matches risk-analysis workflows where only selected scenarios are included in a particular report [54], [57].

F4-hedged-leg.

This workload models a basket or hedge payoff computation where one leg is hedged out. The quantum kernel prepares and measures payoff registers for multiple basket or hedge legs. The host decodes each leg and combines them using net exposure coefficients. The upstream portfolio artifact records that one hedge leg has zero net coefficient after preprocessing, so measurements used only for that leg are dead. This reflects portfolio netting and hedging logic in option-pricing and risk workflows [54], [55].

F5-var-bucket.

This workload models a VaR-style threshold report after coarse risk bucketing. The quantum kernel produces a risk-score register. The host decodes the register, applies coarse bucketization, and returns an indicator of whether the bucket crosses a risk threshold. Low-order bits below the bucket resolution cannot affect the threshold outcome, and therefore do not contribute to the host return value. This is faithful to risk analysis workflows that report thresholded risk quantities such as Value at Risk [54], [57].

F6-greek-filter.

This workload models a sensitivity or Greek report with filtered risk factors. The quantum kernel computes batched AE-style estimators for several factor groups. The host program decodes each factor output and aggregates only the risk factors retained by the upstream sensitivity report. Factors that are hedged, inactive, or excluded from the report have zero host weights and their measurements do not affect the returned sensitivity. This follows the finance pattern of combining quantum-estimated payoff or risk quantities with classical exposure and reporting logic [54], [55].

5.3.0.5 Control workloads.

The control workloads are designed to validate the host-side analysis rather than to measure effectiveness. They are excluded from aggregate effectiveness statistics. Their purpose is to check that the analysis finds the expected dead set in a positive case and, more importantly, does not prune live measurements in all-live or zero-weight-trap cases.

CTRL1-all-live-qml.

This negative control reuses the QML feature-channel structure of M1, but the upstream trained-model artifact assigns nonzero readout weights to every feature channel. The quantum kernel therefore produces features that are all consumed by the host readout. The expected dead set is empty, and the host-aware pass should not reduce the circuit.

CTRL2-all-live-opt.

This negative control reuses a QAOA/QUBO-style kernel, but every measured decision variable participates in at least one nonzero objective edge. The host program evaluates a fully live QUBO objective, so each measurement can affect the returned score. The expected dead set is empty, and any pruning would indicate a false positive.

CTRL3-derived-screened-chem.

This positive control reuses a VQE-style Pauli-estimator kernel and applies the same upstream screening logic as the chemistry workloads. The upstream artifact removes a small tail observable, and the expected dead set is known in advance. The control checks that the host-side analysis can recover the screened measurements exactly.

CTRL4-zero-weight-live-escape.

This negative trap control reuses the QML feature-channel structure of M1. The upstream artifact contains a zero primary readout weight for one feature, but the same feature is also used by an auxiliary live calibration term. The correct result is therefore an empty dead set. This control demonstrates that the analysis is semantic: it does not prune a measurement merely because the measurement appears in one zero-weighted term.

5.4 Soundness of the host-side static analysis↩︎

2.5 summarizes the concrete domain, the abstract-state order, the description relation \(\Delta\), and the concretization \(\gamma\). We now give the detailed proofs.

Lemma 1 (Expression-transfer soundness). \(\forall s=(\nu,\sigma,\delta)\Delta(\rho,C_{\texttt{ctrl}}):\) if the concrete evaluation of expression \(e\) under \(s\) yields value \(v\) with exact measurement-dependency set \(S_D\), and the abstract evaluation yields \(A=[\![e]\!]^{\sharp}_{\rho}\), then \((v,S_D)\Delta(A,C_{\texttt{ctrl}})\).

Proof. By structural induction on \(e\), following the transfer rules in 2.2.

For constants, \(S_D=\varnothing\), and the abstract value is a constant polynomial, so the claim is immediate. For variables, the result follows directly from \(s\Delta(\rho,C_{\texttt{ctrl}})\).

For binary arithmetic and unary minus, when the operands are in polynomial form, the abstract transfer performs the same symbolic arithmetic and normalizes the polynomial. Hence the concrete value is exactly the valuation of the resulting polynomial, and the measurement support is included in \(\mathbf{MSym}_{\mathbf{M}}(A)\). When exact polynomial reasoning is not available, the abstract transfer falls back to dependence form and unions the operand supports, which conservatively contains the concrete dependency set.

For int, each exact rule is guarded by a side condition that makes the abstract result equal to the concrete integer result: the argument is already an integer polynomial, the interval evaluates to a constant integer, or the bounded residual cannot affect the integer part. If none of these conditions holds, the fallback dependence-form rule conservatively records the argument support.

For random\((L,U)\), the concrete semantics chooses a value in \([L,U]\), while the abstract semantics introduces a fresh non-measurement symbol with the same bound. This introduces no measurement dependency. For pure function calls, the abstract transfer conservatively unions the dependencies of the arguments, which over-approximates the measurement dependencies of the concrete call result. 0◻ ◻

Lemma 2 (Edge-effect soundness). Assume \(s\Delta(\rho,C_{\texttt{ctrl}})\). For every statement or block \(S_b\), if the concrete effect is \(s \xrightarrow{\;S_b\;} s'\) and the abstract effect is \((\rho,C_{\texttt{ctrl}}) \xRightarrow{\;S_b\;} (\rho',C_{\texttt{ctrl}}')\), then \(s'\Delta(\rho',C_{\texttt{ctrl}}')\).

Proof. By induction on the derivation of the concrete edge \(s\xrightarrow{\;S_b\;}s'\), with cases matching the abstract effects in 2.3.

Sequencing. For \(S;T\), the concrete execution first reaches an intermediate state \(s_1\), and the abstract execution first reaches \((\rho_1,C_{\texttt{ctrl}}^1)\). By the induction hypothesis for \(S\), \(s_1\Delta(\rho_1,C_{\texttt{ctrl}}^1)\). Applying the induction hypothesis again to \(T\) gives the desired result.

Assignment. For \(\texttt{x := }e\), the concrete effect updates only \(\texttt{x}\). Let the concrete evaluation of \(e\) produce value \(v\) and dependency set \(S_D\). By 1, \[(v,S_D)\Delta([\![e]\!]^{\sharp}_{\rho},C_{\texttt{ctrl}}).\] The abstract effect updates \(\rho'=\rho\oplus\{\texttt{x}\mapsto[\![e]\!]^{\sharp}_{\rho}\}\) and leaves \(C_{\texttt{ctrl}}\) unchanged. Therefore the updated \(\texttt{x}\) component is described by \(\rho'(\texttt{x})\), and all other variables remain described because they are unchanged.

Return. The case \(\texttt{return }e\) is identical to assignment, except that the updated component is the distinguished variable \(\texttt{return}\).

Conditional. Consider \(S_{\texttt{cond}}\equiv \texttt{if (cond) then }S_t\texttt{ else }S_e\). The concrete execution follows one branch, while the abstract semantics analyzes both branches from the same input state. By the induction hypothesis, the concrete post-state of either branch is described by the corresponding abstract branch output: \((\rho_t,C_{\texttt{ctrl}}^t) \text{ or } (\rho_e,C_{\texttt{ctrl}}^e)\). The environment join \(\rho_t\sqcup_{\mathrm{env}}\rho_e\) is sound: If the two branch abstract values are provably equal by \(\mathsf{Eq}_{\mathrm A}\), the join keeps that value, which describes both branch results; otherwise, the join uses dependence form with the union of the two branch supports, which describes either branch result conservatively.

It remains to account for the dependency through the branch choice itself. When the observable post-conditional abstract results may differ, the transfer rule adds \(\{\texttt{m}\in\mathbf{M}\mid \texttt{m}@0\in\mathbf{Sym}([\![\texttt{cond}]\!]^{\sharp}_{\rho})\}\) to \(C_{\texttt{ctrl}}'\). By 1, this set contains every measurement-bound variable that can affect the concrete value of cond. Hence every measurement dependency introduced through the concrete branch choice is recorded in \(C_{\texttt{ctrl}}'\). If the abstract branch results are provably equal, then the branch choice does not change the described post-state, and no new control dependency is needed.

Therefore, the concrete post-state is described by \((\rho_t\sqcup_{\mathrm{env}}\rho_e,C_{\texttt{ctrl}}')\).

Common-return lookahead. For the bounded-lookahead rule, the proof is the same as the conditional case, but the equality test is applied to the two abstract return values \(R_t\) and \(R_e\). If they differ, the measurement dependencies of cond are added to \(C_{\texttt{ctrl}}'\); otherwise the two branches produce the same described return. Thus the abstract effect describes the concrete effect in both cases. 0◻ ◻

Theorem 2 (Soundness of abstract execution). Let \[(\rho_0,\mathbf{Dom},\mathbf{B}) = \mathrm{\small InitAbsState}(H,\mathbf{M})\] and suppose a well-formed initial concrete state \(s_0\) satisfies \(s_0\Delta(\rho_0,\varnothing)\). If the concrete execution of \(H\) yields \(s_0\xrightarrow{\;H\;}s^\star\) and the abstract execution yields \((\rho_0,\varnothing) \xRightarrow{\;H\;} (\rho^\star,C_{\texttt{ctrl}}^\star)\), then \(s^\star\Delta(\rho^\star,C_{\texttt{ctrl}}^\star)\).

Proof. By repeated application of 2 along the execution of \(H\). The initial relation holds by construction of InitAbsState: each program variable \(\texttt{x}\) is initialized to \(\langle\texttt{x}@0\rangle\), and each measurement-bound variable \(\texttt{m}\in\mathbf{M}\) is initialized as a binary input with bound \([0,1]\). 0◻ ◻

Theorem 3 (Soundness of find_nc). Let \(\mathbf{M}_{\mathrm{nc}}=\mathrm{\small find\_nc}(H,\mu)\). For every \(\texttt{m}\in\mathbf{M}_{\mathrm{nc}}\), the initial measurement outcome \(\texttt{m}@0\) is semantically non-contributory to the host return.

Proof. Let \(s^\star=(\nu,\sigma^\star,\delta^\star)\) be the final concrete state and let \((\rho^\star,C_{\texttt{ctrl}}^\star)\) be the final abstract state computed by 10. By 2, \(s^\star\Delta(\rho^\star,C_{\texttt{ctrl}}^\star)\). By definition of \(\Delta\) at \(\texttt{return}\), we get \(\delta^\star(\texttt{return}) \subseteq \mathbf{MSym}_{\mathbf{M}}(\rho^\star(\texttt{return})) \cup C_{\texttt{ctrl}}^\star\). By the definition of \(\mathbf{Obs}\) in 2.4, \[\mathbf{MSym}_{\mathbf{M}}(\rho^\star(\texttt{return})) \cup C_{\texttt{ctrl}}^\star = \{\texttt{m}\in\mathbf{M}\mid \texttt{m}@0\in \mathbf{Obs}(\rho^\star,C_{\texttt{ctrl}}^\star)\}.\] Therefore, if \(\texttt{m}\in\mathbf{M}_{\mathrm{nc}}\), then \(\texttt{m}\notin\delta^\star(\texttt{return})\). Since \(\delta^\star(\texttt{return})\) is the exact concrete measurement-dependency set of the host return, changing only \(\texttt{m}@0\) cannot change the concrete return value. Hence \(\texttt{m}\) is non-contributory. 0◻ ◻

5.5 Proof details in 2.8↩︎

1. In the worst case, the proposed host-side static analysis runs in \(\mathcal{O}\!\left(n\cdot\mathcal{N}^2 + n\cdot|\mathcal{V}|\cdot|D|\right)\).

Proof. Polynomial addition/subtraction costs \(\mathcal{O}(\mathcal{N})\) by scanning monomials once; polynomial multiplication costs \(\mathcal{O}(\mathcal{N}^2)\) due to pairwise monomial products; and each int\((\cdot)\) requires \(\mathcal{O}(\mathcal{N})\) for integer checks and interval folding. A random\((\cdot,\cdot)\) is \(\mathcal{O}(1)\), introducing a single fresh symbol. Each conditional requires \(\sqcup_{\mathrm{env}}\), which compares all variables in \(\mathcal{V}\) and, when they differ, unions two dependence sets of size at most \(|D|\), costing \(\mathcal{O}(|\mathcal{V}|\cdot|D|)\). For the bounded-lookahead rule on \(S_{\texttt{if-ret}}\), the common return expression is evaluated once under each branch environment. This adds only a constant-factor overhead relative to the branch analyses already accounted for, and therefore does not change the asymptotic bound. Operators falling back to dependence form (e.g., division, modulo, unknown calls) also require set unions and therefore cost \(\mathcal{O}(|D|)\). Let \(n_+, n_\times, n_{\texttt{int}}, n_{\texttt{r}}, n_{\texttt{c}}, n_{D}\) denote the counts of addition, multiplication, int, random, conditional, and dependence-form operators. Since \(n_+,n_\times,n_{\texttt{int}},n_{\texttt r},n_{\texttt c},n_D \le n\), the total is \(\mathcal{O}\!\big( n_+\mathcal{N} + n_\times \mathcal{N}^2 + n_{\texttt{int}}\mathcal{N} + n_{\texttt{r}} + n_{\texttt{c}}|\mathcal{V}|\cdot|D| + n_{D}|D| \big) = \mathcal{O}\!\left(n\cdot\mathcal{N}^2 + n\cdot|\mathcal{V}|\cdot|D|\right)\). ◻

1. When \(\max\big(\;\mathcal{N}, |\mathcal{V}|, |D|\;\big)\) is bounded by a constant value, the worst-case time complexity of the static analysis on the host program is \(\mathcal{O} \big(n \big)\).

Proof. It follows directly from 1. ◻

2. Let \(G\) be the number of gates in the input quantum circuit. The worst-case time complexity of the workflow in 9 is \(\mathcal{O}(n\cdot\mathcal{N}^2 +n\cdot|\mathcal{V}|\cdot|D| + G^2)\), and when \(\max\big(\;\mathcal{N}, |\mathcal{V}|, |D|\;\big)\) is bounded by a constant value, the complexity becomes \(\mathcal{O}(n + G^2)\).

Proof. It directly follows 1 and Theorem \(4\) in [18]. ◻

5.6 Proof details in 2.9↩︎

During lowering, we maintain a representative map \[\kappa:\mathcal{V}\cup\{\texttt{return}\}\to \widehat{\mathcal{V}}\cup\{\texttt{return}\},\] which maps each source-level variable to its current SSA representative in the lowered program. The initial map \(\kappa_0\) maps each source variable to its incoming SSA version and maps return to return. For the whole program, we write \[(\widehat H,\kappa^\star)=\mathrm{\small lowerBlock}(H,\kappa_0),\] where \(\kappa^\star\) is the final representative map produced by the lowering.

Given a lowered abstract environment \(\widehat{\rho}\), its projection back to source-level variables under a representative map \(\kappa\) is \[\pi_\kappa(\widehat{\rho})(\texttt{x}) = \widehat{\rho}(\kappa(\texttt{x})) \qquad \text{for all } \texttt{x}\in\mathcal{V}\cup\{\texttt{return}\}.\] This projection forgets lowering-introduced temporaries and keeps only the abstract values of source-level representatives.

Let \((\rho_0,\mathbf{Dom},\mathbf{B}) = \mathrm{\small InitAbsState}(H,\mathbf{M})\). The initial lowered environment \(\widehat{\rho}_0\) is defined by \[\widehat{\rho}_0(\kappa_0(\texttt{x}))=\rho_0(\texttt{x}) \qquad \text{for all } \texttt{x}\in\mathcal{V}\cup\{\texttt{return}\}.\] The maps \(\mathbf{Dom}\) and \(\mathbf{B}\) are shared by the source and lowered analyses.

The following proposition shows that, after projecting the lowered environment back to source-level variables, the lowered analysis produces the same abstract return value and the same control-dependency set \(C_{\texttt{ctrl}}\), and therefore the same output of find_nc (10).

Let \((\widehat H,\kappa^\star)=\mathrm{\small lowerBlock}(H,\kappa_0)\) be the levelized SSA lowering of \(H\). Suppose \((\rho^\star,C^\star_{\texttt{ctrl}}) = \mathrm{\small AnalyzeBlock}(H,\rho_0,\varnothing,\mathbf{M})\) and \((\widehat{\rho}^\star,\widehat{C}^\star_{\texttt{ctrl}}) = \mathrm{\small AnalyzeBlock}(\widehat H,\widehat{\rho}_0,\varnothing,\mathbf{M})\). Then \(\pi_{\kappa^\star}(\widehat{\rho}^\star)=\rho^\star\) and \(\widehat{C}^\star_{\texttt{ctrl}}=C^\star_{\texttt{ctrl}}\).

Proof. We prove a simulation invariant for the representative map maintained by the lowering. Consider any source block \(S_b\) and write \[(\widehat{S_b},\kappa_{\mathrm{out}}) = \mathrm{\small lowerBlock}(S_b,\kappa_{\mathrm{in}}).\] Assume the input states agree under the entry representative map: \[\pi_{\kappa_{\mathrm{in}}}(\widehat{\rho}_{\mathrm{in}}) = \rho_{\mathrm{in}} \qquad \text{and} \qquad \widehat{C}^{\mathrm{in}}_{\texttt{ctrl}} = C^{\mathrm{in}}_{\texttt{ctrl}}.\] We show, by structural induction on \(S_b\), that the output states agree under the exit representative map: \[\pi_{\kappa_{\mathrm{out}}}(\widehat{\rho}_{\mathrm{out}}) = \rho_{\mathrm{out}} \qquad \text{and} \qquad \widehat{C}^{\mathrm{out}}_{\texttt{ctrl}} = C^{\mathrm{out}}_{\texttt{ctrl}}.\]

For an assignment \(\texttt{x}:=e\), the lowering decomposes \(e\) into an acyclic sequence of primitive SSA instructions. Let \(v_e\) be the final destination of this sequence. The lowering updates the representative map by setting \(\kappa_{\mathrm{out}}(\texttt{x})=v_e\) and leaving the representatives of all other source variables unchanged. By induction on the syntax of \(e\), the lowered instruction sequence computes at \(v_e\) exactly the same abstract value as the source abstract evaluation of \(e\). Fresh temporaries introduced during this decomposition do not appear in the projection. Hence the projected lowered environment agrees with the source environment after the assignment. The case of \(\texttt{return }e\) is identical, except that the final destination becomes the representative of return.

Sequencing follows immediately by applying the induction hypothesis to the first statement and then to the second.

For a structured conditional, the lowering recursively lowers both branches from the same entry representative map, producing branch representative maps for the then- and else-branches. For each source-level live-out variable, the lowering either reuses a common branch representative or introduces an explicit merge \(u_{\texttt{x}} := \phi_{\mathrm{if}}(c,v_{\texttt{x}}^t,v_{\texttt{x}}^e)\). The abstract transfer of this merge is defined by the same branch-join rule as the source analysis: the merged value is \(\widehat{\rho}_t(v_{\texttt{x}}^t) \sqcup_{\mathrm A} \widehat{\rho}_e(v_{\texttt{x}}^e)\), and the same condition-dependent measurements are added to \(C_{\texttt{ctrl}}\) exactly when the source conditional rule would add them. By the induction hypothesis, the branch output states already agree after projection. Therefore the lowered merges reproduce the source environment join \(\sqcup_{\mathrm{env}}\) and the same control-dependency update. Hence the invariant is preserved across conditionals.

It remains to justify the levelized GPU schedule. By the levelization property, every instruction in a level reads only incoming SSA values or values defined in earlier levels, and destinations inside the same level are distinct. Thus same-level instructions do not interfere through reads or writes. The only shared update is the enlargement of \(C_{\texttt{ctrl}}\), which is a set union and is independent of the intra-level execution order. Therefore the level-wise GPU execution computes the same lowered abstract state as a sequential execution of \(\widehat H\).

Applying the invariant to the whole program gives \(\pi_{\kappa^\star}(\widehat{\rho}^\star)=\rho^\star\) and \(\widehat{C}^\star_{\texttt{ctrl}}=C^\star_{\texttt{ctrl}}\). 0◻ ◻

References↩︎

[1]
Preskill, J.: Quantum computing in the nisq era and beyond. Quantum 2,  79 (Aug 2018). , http://dx.doi.org/10.22331/q-2018-08-06-79.
[2]
McCaskey, A., Dumitrescu, E., Liakh, D., Humble, T.: Hybrid programming for near-term quantum computing systems. In: 2018 IEEE International Conference on Rebooting Computing (ICRC). pp. 1–12 (2018).
[3]
Bouland, A., van Dam, W., Joorati, H., Kerenidis, I., Prakash, A.: Prospects and challenges of quantum finance (2020), https://arxiv.org/abs/2011.06492.
[4]
Matondo-Mvula, N., Elleithy, K.: Advances in quantum medical image analysis using machine learning: Current status and future directions. In: 2023 IEEE International Conference on Quantum Computing and Engineering (QCE). vol. 01, pp. 367–377 (2023).
[5]
Bermot, E., Zoufal, C., Grossi, M., Schuhmacher, J., Tacchino, F., Vallecorsa, S., Tavernelli, I.: Quantum Generative Adversarial Networks For Anomaly Detection In High Energy Physics . In: 2023 IEEE International Conference on Quantum Computing and Engineering (QCE). pp. 331–341. IEEE Computer Society, Los Alamitos, CA, USA (Sep 2023). , https://doi.ieeecomputersociety.org/10.1109/QCE57702.2023.00045.
[6]
Quetschlich, N., Forster, T., Osterwind, A., Helms, D., Wille, R.: Towards equivalence checking of classical circuits using quantum computing (2024), https://arxiv.org/abs/2408.14539.
[7]
Jojo, J., Khandelwal, A., Chandra, M.G.: Quantum algorithms for tensor-svd (2024), https://arxiv.org/abs/2405.19485.
[8]
Kildall, G.A.: A unified approach to global program optimization. In: Proceedings of the 1st annual ACM SIGACT-SIGPLAN symposium on Principles of programming languages. pp. 194–206 (1973).
[9]
Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Pearson, 2 edn. (2007).
[10]
Khammassi, N., Morris, R.W., Premaratne, S., Luthi, F., Borjans, F., Suzuki, S., Flory, R., Ibarra, L.P.O., Lampert, L., Matsuura, A.Y.: A scalable microarchitecture for efficient instruction-driven signal synthesis and coherent qubit control. arXiv preprint arXiv:2205.06851 (2022).
[11]
van Dijk, J.P., Charbon, E., Sebastiano, F.: The electronic interface for quantum processors. Microprocessors and Microsystems 66, 90–101 (2019).
[12]
Maciejewski, F.B., Zimborás, Z., Oszmaniec, M.: Mitigation of readout noise in near-term quantum devices by classical post-processing based on detector tomography. Quantum 4,  257 (2020).
[13]
Nachman, B., Urbanek, M., de Jong, W.A., Bauer, C.W.: Unfolding quantum computer readout noise. npj Quantum Information 6(1),  84 (2020).
[14]
Broughton, M., Verdon, G., McCourt, T., Martinez, A.J., Yoo, J.H., Isakov, S.V., Massey, P., Halavati, R., Niu, M.Y., Zlokapa, A., Peters, E., Lockwood, O., Skolik, A., Jerbi, S., Dunjko, V., Leib, M., Streif, M., Dollen, D.V., Chen, H., Cao, S., Wiersema, R., Huang, H.Y., McClean, J.R., Babbush, R., Boixo, S., Bacon, D., Ho, A.K., Neven, H., Mohseni, M.: Tensorflow quantum: A software framework for quantum machine learning (2021), https://arxiv.org/abs/2003.02989.
[15]
Bergholm, V., Izaac, J., Schuld, M., Gogolin, C., Ahmed, S., Ajith, V., Alam, M.S., Alonso-Linaje, G., AkashNarayanan, B., Asadi, A., Arrazola, J.M., Azad, U., Banning, S., Blank, C., Bromley, T.R., Cordier, B.A., Ceroni, J., Delgado, A., Matteo, O.D., Dusko, A., Garg, T., Guala, D., Hayes, A., Hill, R., Ijaz, A., Isacsson, T., Ittah, D., Jahangiri, S., Jain, P., Jiang, E., Khandelwal, A., Kottmann, K., Lang, R.A., Lee, C., Loke, T., Lowe, A., McKiernan, K., Meyer, J.J., Montañez-Barrera, J.A., Moyard, R., Niu, Z., O’Riordan, L.J., Oud, S., Panigrahi, A., Park, C.Y., Polatajko, D., Quesada, N., Roberts, C., Sá, N., Schoch, I., Shi, B., Shu, S., Sim, S., Singh, A., Strandberg, I., Soni, J., Száva, A., Thabet, S., Vargas-Hernández, R.A., Vincent, T., Vitucci, N., Weber, M., Wierichs, D., Wiersema, R., Willmann, M., Wong, V., Zhang, S., Killoran, N.: Pennylane: Automatic differentiation of hybrid quantum-classical computations (2022), https://arxiv.org/abs/1811.04968.
[16]
Steiger, D.S., Häner, T., Troyer, M.: ProjectQ: an open source software framework for quantum computing. Quantum2,  49 (Jan 2018). , https://doi.org/10.22331/q-2018-01-31-49.
[17]
LaRose, R., Mari, A., Kaiser, S., Karalekas, P.J., Alves, A.A., Czarnik, P., El Mandouh, M., Gordon, M.H., Hindy, Y., Robertson, A., Thakre, P., Wahl, M., Samuel, D., Mistri, R., Tremblay, M., Gardner, N., Stemen, N.T., Shammah, N., Zeng, W.J.: Mitiq: A software package for error mitigation on noisy quantum computers. Quantum6,  774 (Aug 2022). , https://doi.org/10.22331/q-2022-08-11-774.
[18]
Chen, Y., Mendl, C.B., Seidl, H.: Dead gate elimination. In: Lees, M.H., Cai, W., Cheong, S.A., Su, Y., Abramson, D., Dongarra, J.J., Sloot, P.M.A. (eds.) Computational Science – ICCS 2025. pp. 135–150. Springer Nature Switzerland, Cham (2025).
[19]
Péter, R.: H. g. rice. classes of recursively enumerable sets and their decision problems. transactions of the american mathematical society, vol. 74 (1953) pp. 358–366. Journal of Symbolic Logic 19(2), 121–122 (1954).
[20]
Møller, A., Schwartzbach, M.I.: Static program analysis (October 2018), department of Computer Science, Aarhus University, http://cs.au.dk/~amoeller/spa/.
[21]
Nielson, F., Nielson, H., Hankin, C.: Principles of Program Analysis (01 1999).
[22]
Seidl, H., Wilhelm, R., Hack, S.: Compiler Design: Analysis and Transformation. Springer (2012).
[23]
Remme, L., Weinert, A., Waschk, A.: Optimization of hybrid quantum-classical algorithms (2025), https://arxiv.org/abs/2505.12853.
[24]
Zhao, P., Wu, X., Li, Z., Zhao, J.: Qchecker: Detecting bugs in quantum programs via static analysis (2023), https://arxiv.org/abs/2304.04387.
[25]
Paltenghi, M., Pradel, M.: Analyzing quantum programs with lintq: A static analysis framework for qiskit. Proceedings of the ACM on Software Engineering 1(FSE), 2144–2166 (Jul 2024). , http://dx.doi.org/10.1145/3660802.
[26]
Chen, T.F., Jiang, J.H.R., Hsieh, M.H.: Partial equivalence checking of quantum circuits. In: 2022 IEEE International Conference on Quantum Computing and Engineering (QCE). p. 594–604. IEEE (Sep 2022). , http://dx.doi.org/10.1109/QCE53715.2022.00082.
[27]
Li, P., Liu, J., Gonzales, A., Saleem, Z.H., Zhou, H., Hovland, P.: Qutracer: Mitigating quantum gate and measurement errors by tracing subsets of qubits. In: 2024 ACM/IEEE 51st Annual International Symposium on Computer Architecture (ISCA). p. 103–117. IEEE (Jun 2024). , http://dx.doi.org/10.1109/ISCA59077.2024.00018.
[28]
Kaul, M., Küchler, A., Banse, C.: A uniform representation of classical and quantum source code for static code analysis. In: 2023 IEEE International Conference on Quantum Computing and Engineering (QCE). p. 1013–1019. IEEE (Sep 2023). , http://dx.doi.org/10.1109/QCE57702.2023.00115.
[29]
Chen, Y., Stade, Y.: Quantum constant propagation. In: Hermenegildo, M.V., Morales, J.F. (eds.) Static Analysis. pp. 164–189. Springer Nature Switzerland, Cham (2023), https://link.springer.com/chapter/10.1007/978-3-031-44245-2_9.
[30]
Abedi, E., Beigi, S., Taghavi, L.: Quantum Lazy Training. Quantum7,  989 (Apr 2023). , https://doi.org/10.22331/q-2023-04-27-989.
[31]
Qiskit contributors: Qiskit: An open-source framework for quantum computing (2023).
[32]
Sivarajah, S., Dilkes, S., Cowtan, A., Simmons, W., Edgington, A., Duncan, R.: t|ket⟩: a retargetable compiler for nisq devices. Quantum Science and Technology 6(1), 014003 (nov 2020). , https://dx.doi.org/10.1088/2058-9565/ab8e92.
[33]
Kissinger, A., van de Wetering, J.: Pyzx: Large scale automated diagrammatic reasoning. arXiv preprint arXiv:1904.04735 (2019).
[34]
NVIDIA: Cuda c++ programming guide. https://docs.nvidia.com/cuda/cuda-programming-guide/(2026), accessed 2026-04-14.
[35]
NVIDIA: Cuda c++ best practices guide. https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/(2026), accessed 2026-04-14.
[36]
Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1991).
[37]
Lemerre, M.: SSA translation is an abstract interpretation. Proceedings of the ACM on Programming Languages 7(POPL), 1895–1924 (2023).
[38]
Barthe, G., Demange, D., Pichardie, D.: Formal verification of an SSA-based middle-end for CompCert. ACM Transactions on Programming Languages and Systems 36(1) (2014).
[39]
Zhao, J., Nagarakatte, S., Martin, M.M., Zdancewic, S.: Formal verification of ssa-based optimizations for llvm. SIGPLAN Not. 48(6), 175–186 (Jun 2013). , https://doi.org/10.1145/2499370.2462164.
[40]
Quetschlich, N., Burgholzer, L., Wille, R.: MQT Bench: Benchmarking software and design automation tools for quantum computing. Quantum 7,  1062 (2023).
[41]
Peruzzo, A., McClean, J., Shadbolt, P., Yung, M.H., Zhou, X.Q., Love, P.J., Aspuru-Guzik, A., O’Brien, J.L.: A variational eigenvalue solver on a photonic quantum processor. Nature Communications 5,  4213 (2014).
[42]
McClean, J.R., Romero, J., Babbush, R., Aspuru-Guzik, A.: The theory of variational hybrid quantum-classical algorithms. New Journal of Physics 18(2), 023023 (2016).
[43]
McArdle, S., Endo, S., Aspuru-Guzik, A., Benjamin, S.C., Yuan, X.: Quantum computational chemistry. Reviews of Modern Physics 92(1), 015003 (2020).
[44]
Verteletskyi, V., Yen, T.C., Izmaylov, A.F.: Measurement optimization in the variational quantum eigensolver using a minimum clique cover. The Journal of Chemical Physics 152(12), 124114 (2020).
[45]
Bravyi, S., Gambetta, J.M., Mezzacapo, A., Temme, K.: Tapering off qubits to simulate fermionic hamiltonians. arXiv preprint arXiv:1701.08213 (2017).
[46]
Qiskit Nature: Freezecoretransformer. https://qiskit-community.github.io/qiskit-nature/stubs/qiskit_nature.second_q.transformers.FreezeCoreTransformer.html(2024).
[47]
Motta, M., Ye, E., McClean, J.R., Li, Z., Minnich, A.J., Babbush, R., Chan, G.K.L.: Low rank representations for quantum simulation of electronic structure. npj Quantum Information 7,  83 (2021).
[48]
Farhi, E., Goldstone, J., Gutmann, S.: A quantum approximate optimization algorithm (2014), https://arxiv.org/abs/1411.4028.
[49]
Glover, F., Kochenberger, G., Du, Y.: Quantum bridge analytics I: A tutorial on formulating and using QUBO models. 4OR 17, 335–371 (2019).
[50]
Havlíček, V., Córcoles, A.D., Temme, K., Harrow, A.W., Kandala, A., Chow, J.M., Gambetta, J.M.: Supervised learning with quantum-enhanced feature spaces. Nature 567, 209–212 (2019).
[51]
Schuld, M., Killoran, N.: Quantum machine learning in feature hilbert spaces. Physical Review Letters 122, 040504 (2019).
[52]
Cortes, C., Vapnik, V.: Support-vector networks. Machine Learning 20, 273–297 (1995).
[53]
Tibshirani, R.: Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B 58(1), 267–288 (1996).
[54]
Woerner, S., Egger, D.J.: Quantum risk analysis. npj Quantum Information 5,  15 (2019).
[55]
Stamatopoulos, N., Egger, D.J., Sun, Y., Zoufal, C., Iten, R., Shen, N., Woerner, S.: Option pricing using quantum computers. Quantum 4,  291 (2020).
[56]
Montanaro, A.: Quantum speedup of monte carlo methods. Proceedings of the Royal Society A 471(2181), 20150301 (2015).
[57]
Egger, D.J., Gutiérrez, R.G., Mestre, J.C., Woerner, S.: Credit risk analysis using quantum computers. IEEE Transactions on Computers 70(12), 2136–2145 (2021).