Our code is available at https://github.com/uiuc-focal-lab/constraintflow.git
Introduction
Abstract interpretation [7 ] is widely used for formal certification of Deep Neural Networks (DNNs). A DNN abstract interpreter propagates constraints on neuron values to establish properties over large, potentially infinite sets of inputs. As for programs, there is a tradeoff between the cost and precision of a DNN abstract interpreter. Interval Bound Propagation (IBP) maintain independent
Authors’ Contact Information: Avaljot Singh, avaljot2@illinois.edu, University of Illinois Urbana-Champaign, USA; Dushyant Bharadwaj, db50@illinois.edu, University of Illinois Urbana-Champaign, USA; Yasmin Chandini Sarita, University of Illinois Urbana-Champaign, USA, yasmin@illinois.edu; Heng Zhong, University of Illinois Urbana-Champaign, USA, hengz2@illinois.edu; Charith Mendis, University of Illinois Urbana-Champaign, USA, charithm@illinois.edu; Gagandeep Singh, University of Illinois Urbana-Champaign, USA, ggnds@illinois.edu.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM XXXX-XXXX/2026/11-ART
https://doi.org/10.1145/nnnnnnn.nnnnnnn bounds on each neuron, whereas polyhedral analyzers such as DeepZ [16 ] and DeepPoly [17 ] capture relationships between neurons. These relationships can establish properties that intervals alone cannot. However, maintaining and combining them requires substantial computation and memory. On larger networks, users may therefore have to resort to simpler analyses that lack the precision needed to prove the desired properties. Making precise analyses practical at scale remains a central challenge in DNN certification.
Substantial research and engineering effort has made DNN abstract interpreters increasingly efficient, with hand-written implementations such as auto_LiRPA [24 ] , IVAN [21 ] , LUNA [11 ] and GPUPoly [12 ] , and frameworks such as Neuton [15 ] . These implementations exploit the dependencies encoded in abstract values to avoid unnecessary storage and computation. However, these dependencies evolve as the abstract interpreter combines and refines bounds. The implementation must therefore determine how each intermediate abstract value is computed from the preceding ones. This introduces work beyond the numerical evaluation of the bounds. General implementations perform both kinds of work together and repeat the decisions about these relationships during every analysis. Further, when the same DNN is certified for different properties or the subregions produced by input splitting, much of this non-numerical work remains unchanged, although the numerical bounds differ. The challenge is to scale precise abstract interpreters to larger DNNs without repeatedly computing information that can be determined from the network architecture.
This work. We present Scepter, a framework that scales precise DNN abstract interpreters to networks beyond the reach of existing implementations. Scepter specializes the interpreter to a given architecture, resolving the computation determined by that architecture ahead of certification and generating executable certifier code for that architecture. For instance, Scepter executes DeepPoly [17 ] , one of the most widely used DNN certifiers, on ResNet50 [8 ] with 2.94 million neurons and VGG-16 [5 ] with 13.6 million neurons. None of the compared DeepPoly baselines completes either network. The largest network in our suite completed by any of them is ResNet34 with about 968K neurons. Scepter therefore executes the same analysis on networks with 3.0 × 3.0\times 3.0 × and 14 × 14\times 14 × as many neurons, respectively. Across other networks and certifiers in our evaluation, we observe runtime speedups of one to two orders of magnitude (§ 6 ).
The key insight is that, for a fixed abstract interpreter, the structure of intermediate abstract values often depends on the DNN architecture rather than the weights or input regions. We call the work that determines these patterns and the operations on them structural computation. The coefficients and bounds change with the weights and input regions, but this structural computation can be reused. However, separating the two computations is nontrivial because the abstract interpreter interleaves them throughout its execution. Each operation can change the structure of the abstract values used by subsequent operations. We must determine how these intermediate structures evolve without computing their numerical values, identify which structural computations can be performed in advance, and bring them together before numerical execution.
We develop novel structural semantics for DNN abstract interpreters to perform this separation. The semantics makes the structural information in abstract values explicit and defines how each operation transforms this information. We define the structural semantics for composable operations that hold across abstract domains and abstract transformers. Its rules derive each result’s structure from the structures of its inputs, while recording code required for the numerical computation. We also reformulate coefficient-dependent control so that structural execution can proceed through the abstract interpreter without knowing the bounds. Executing these rules for a fixed DNN architecture brings together the structural computation before numerical evaluation. The output is executable certifier code specialized to that architecture, reusable with different weights, input regions, and perturbation specification. We prove that specialization preserves the general interpreter’s bounds. Decisions that still require numerical values remain in the generated code, with the computations they invoke specialized separately.
This separation is particularly useful on GPUs. Numerical operations can execute quickly, making the intervening CPU work a bottleneck. When a CPU decision reads a GPU result, the next GPU operation must wait for that decision even if transferring the result takes negligible time. Specialization also exposes larger sequences of numerical operations to a tensor compiler, allowing it to combine operations and eliminate intermediate storage. We further use the dependencies in the generated program to process independent groups of neurons separately and release their large intermediate tensors earlier.
The structural patterns captured by our semantics arise across DNN certifier implementations. For example, auto_LiRPA uses convolutional patches [24 ] , IVAN applies diagonal ReLU transformations through neuronwise coefficients [21 ] , and GPUPoly stores coefficients within dependence sets determined by the network architecture [12 ] . These implementations use different data structures to exploit similar structural patterns, combining computation on these structures with arithmetic on coefficient values. The generalized block compressed sparse representation (g-BCSR), introduced by Neuton [15 ] , provides a unified representation of these patterns. We build our structural semantics on this representation and implement Scepter for the tensor programs generated by Neuton from ConstraintFlow [14 ] specifications, providing one specialization procedure for different abstract domains and certification algorithms.
We evaluate Scepter on eight abstract interpreters and 44 DNNs against six baseline systems on GPUs and CPUs. Across the analyses, Scepter handles networks with up to 153 × 153 \times 153 × as many neurons as the largest completed by the corresponding baselines, and completes 20 certifier–network pairs that no corresponding baseline completes. On GPUs, speedups over Neuton range from 11.9 × 11.9 \times 11.9 × to 44.4 × 44.4 \times 44.4 × across all eight analyses. For DeepPoly, Scepter is 5.69 × 5.69 \times 5.69 × faster than auto_LiRPA, 6.57 × 6.57 \times 6.57 × faster than GPUPoly, and 22.3 × 22.3 \times 22.3 × faster than IVAN. The gains also extend to CPU execution, where Scepter is 87.4 × 87.4 \times 87.4 × faster than ERAN for DeepPoly and 522 × 522 \times 522 × faster for DeepZ. Scepter also reduces peak GPU memory by a factor of 2.60 × 2.60 \times 2.60 × relative to Neuton over shared configurations. The runtime gains have a direct benefit for input splitting, where the same network is repeatedly analyzed over smaller regions. Using Scepter and auto_LiRPA as DeepPoly backends for the same splitting procedure, Scepter proves 68 properties within a 25-second budget per instance for which the auto_LiRPA backend times out. Figure 1 shows Scepter’s geometric-mean GPU speedup for each abstract interpreter. We divide the fastest evaluated baseline’s runtime by Scepter’s runtime separately on each network, then take the geometric mean over networks where at least one baseline completes.
Figure 1. Scepter’s geometric-mean GPU speedup over the fastest evaluated baseline on each network. Parentheses indicate the number of networks completed by at least one baseline.
Main contributions.
We implement these semantics in Scepter for abstract interpreters generated by Neuton from ConstraintFlow specifications. Scepter provides a common specialization procedure for different abstract domains and certification algorithms, and exposes the generated numerical code to tensor compilation and memory planning.
We evaluate Scepter on eight abstract interpreters and 44 DNNs. Scepter completes 20 certifier–network pairs that no corresponding baseline completes and enables analyses to process networks with up to 153× as many neurons as the largest completed by their baselines. We also observe runtime speedups of one to two orders of magnitude.
Background
We introduce DNN abstract interpreters, tensor computation, and the g-BCSR representation.
DNNs and Certification. A feedforward DNN is a Directed Acyclic Graph (DAG) whose nodes are neurons . Each neuron applies an operation to the values of its predecessors. For example, an affine neuron computes n = b + ∑ j w j n j n = b + \sum_j w_j n_j n = b + ∑ j w j n j , and a ReLU neuron computes n = max ( 0 , n 1 ) n = \max(0, n_1) n = max ( 0 , n 1 ) . Neurons are grouped into layers. Fully connected and convolutional layers are both affine layers: their outputs are weighted sums of inputs, possibly with a bias. Activation layers apply functions such as ReLU. The architecture specifies these operations, their connectivity, and their dimensions. Learned weights and biases supply their numerical parameters. A connection remains in the architecture even when its weight is zero.
A certification problem consists of a DNN N \mathcal{N} N , an input region X \mathcal{X} X , and an output property ψ \psi ψ , represented as a set of permitted outputs. The goal is to establish N ( X ) ⊆ ψ \mathcal{N}(\mathcal{X}) \subseteq\psi N ( X ) ⊆ ψ . For local robustness, every input in a perturbation region around x 0 x_0 x 0 must receive the same classification t t t .
Abstract Values and Tensor Computation. Abstract interpretation [7 ] reasons about possibly infinite sets of neuron values using abstract values . An abstract transformer computes an abstract value for an operation’s outputs from those of its inputs. A sound transformer over-approximates the operation, retaining every result possible for the input abstraction. Starting from an abstraction containing X \mathcal{X} X , an abstract interpreter therefore computes an output abstraction a o u t a_{\mathrm{out}} a out such that N ( X ) ⊆ γ ( a o u t ) \mathcal{N}(\mathcal{X}) \subseteq\gamma(a_{\mathrm{out}}) N ( X ) ⊆ γ ( a out ) , where γ \gamma γ maps an abstract value to the concrete values it represents. The property is certified if γ ( a o u t ) ⊆ ψ \gamma(a_{\mathrm{out}}) \subseteq\psi γ ( a out ) ⊆ ψ . Otherwise, the approximation may be too coarse to establish the property.
Abstract interpreters use different representations for these constraints. Intervals retain a lower and upper bound for each neuron independently. DeepPoly [17 ] uses affine lower and upper bounds that relate neurons to other neurons in the network. DeepZ [16 ] uses zonotopes, whose shared symbolic variables capture relationships between neuron values. These representations lead to different numerical computations and different storage requirements.
For example, consider affine lower bounds for the network’s neurons n p n_p n p : n p ≥ b p + ∑ q L [ p , q ] n q n_p \geq b_p + \sum_q L[p,q]n_q n p ≥ b p + ∑ q L [ p , q ] n q , where coefficients form a tensor L L L , with rows and columns indexed by network neurons. Constants are stored separately. Operations on these bounds become tensor operations on their coefficients. If a bound does not refer to a neuron, its coefficient is zero. For a convolution, each output refers to a local window of inputs, and the same weights are used at different positions. So, coefficient tensors contain both sparse regions and repeated values.
Existing Specification and Execution Frameworks. ConstraintFlow [14 ] is a domain-specific language for specifying abstract interpreters at the neuron level. A specification describes abstract values, transformers, and how they are applied across a DNN. Neuton [15 ] translates these specifications into tensor programs that process entire layers. We call such an executable a general program : its code supports different DNN architectures and determines the required tensor operations from the DNN supplied at run time.
g-BCSR Tensors. Neuton introduced the generalized block compressed sparse representation (g-BCSR) for the tensors used by these programs [15 ] . A g-BCSR tensor is a tuple T = ( d , S , B , Z ) \mathcal{T} = (d, S, B, Z) T = ( d , S , B , Z ) , where d d d is the background value, Z Z Z is its shape, and B = { B k } k = 1 m B = \{B_k\}_{k=1}^{m} B = { B k } k = 1 m is a list of blocks at start indices S = { s k } k = 1 m S = \{s_k\}_{k=1}^{m} S = { s k } k = 1 m . The blocks occupy pairwise disjoint boxes. The dense tensor represented by T \mathcal{T} T is
⟦ T ⟧ [ i ] = { ⟦ B k ⟧ [ i − s k ] , i lies in the box of B k , d , i lies in no block. \llbracket\mathcal{T} \rrbracket[\mathbf{i}] =
\begin{cases}
\llbracket B_k \rrbracket[\mathbf{i} - s_k], & \mathbf{i}\text{ lies in the box of }B_k,\\
d, & \mathbf{i}\text{ lies in no block.}
\end{cases} [ [ T ] ] [ i ] = { [ [ B k ] ] [ i − s k ] , d , i lies in the box of B k , i lies in no block.
Here ⟦ B k ⟧ \llbracket B_k \rrbracket [ [ B k ] ] denotes the dense block represented by B k B_k B k . The background can be zero, or a value such as + ∞ +\infty + ∞ or − ∞ -\infty − ∞ used to initialize bounds. A block’s type determines how its core is interpreted. For example, a StencilBlock stores the kernel weights shared across convolution windows, a DiagonalBlock stores diagonal entries, and a WindowBlock stores coefficients within windows without requiring them to be shared. The represented tensor can therefore be much larger than the stored numerical data. Neuton proved that operations on g-BCSR match their dense counterparts. §4 refines the block model to separate structure from numerical values and justify specialization.
Overview
We illustrate Scepter on a small convolutional network, describing the computation of output bounds, its execution using g-BCSR, and its specialization.
Computing Output Bounds
The running example. Consider the network in Figure 2 : a convolution, a ReLU, and a second convolution. Its layers 1, 2, 3, and 4 contain the neurons x = ( x 0 , … , x 6 ) x = (x_0, \ldots, x_6) x = ( x 0 , … , x 6 ) , h = ( h 0 , … , h 4 ) h = (h_0, \ldots, h_4) h = ( h 0 , … , h 4 ) , r = ( r 0 , … , r 4 ) r = (r_0, \ldots, r_4) r = ( r 0 , … , r 4 ) , and y = ( y 0 , y 1 , y 2 ) y = (y_0, y_1, y_2) y = ( y 0 , y 1 , y 2 ) , respectively. We use one-dimensional convolutions, so each layer is a row of values. Both convolutions have one input channel and one output channel. Their kernels k 1 , k 2 ∈ R 1 × 1 × 3 k_1, k_2 \in\mathbb{R}^{1 \times1 \times3} k 1 , k 2 ∈ R 1 × 1 × 3 have three weights each, where the dimensions are output channels, input channels, and kernel width. Write these weights as ( v 0 , v 1 , v 2 ) (v_0, v_1, v_2) ( v 0 , v 1 , v 2 ) and ( w 0 , w 1 , w 2 ) (w_0, w_1, w_2) ( w 0 , w 1 , w 2 ) . With stride 1, no padding, and biases omitted, the network computes h j = ∑ t = 0 2 v t x j + t h_j = \sum_{t=0}^{2} v_t x_{j+t} h j = ∑ t = 0 2 v t x j + t , r j = max ( 0 , h j ) r_j = \max(0, h_j) r j = max ( 0 , h j ) , y a = ∑ t = 0 2 w t r a + t y_a = \sum_{t=0}^{2} w_t r_{a+t} y a = ∑ t = 0 2 w t r a + t , where j ∈ { 0 , … , 4 } j \in\{0, \ldots, 4\} j ∈ { 0 , … , 4 } and a ∈ { 0 , 1 , 2 } a \in\{0, 1, 2\} a ∈ { 0 , 1 , 2 } .
Figure 2. The running network. Solid blue edges mark one window per convolution. Other connections are dashed.
Bounds as coefficient tensors. A common computation in DNN abstract interpretation is to express bounds on output neurons in terms of input neurons. The input region can then be used to obtain numerical output bounds. We illustrate this computation using affine lower bounds. Similar bound computation arises in several abstract interpreters. DeepPoly and CROWN-IBP use affine bounds over network neurons [17 , 25 ] . DeepZ instead expresses neuron values using shared noise variables [16 ] . Its affine transformers also update coefficient tensors through matrix multiplication, although the coefficient columns denote noise variables. With arbitrary weight signs, polyhedral interpreters use numerical tensor operations to select lower or upper bounds when substituting neuron terms. We assume non-negative weights in the second convolution to illustrate the resulting tensor computations using only lower bounds.
Suppose the abstract interpreter has chosen slopes λ j \lambda_j λ j such that λ j h j \lambda_j h_j λ j h j is a lower bound for the ReLU output r j r_j r j . Combining these bounds with the affine layers gives y a ≥ ∑ t = 0 2 ∑ q = 0 2 w t λ a + t v q x a + t + q y_a \ge\sum_{t=0}^{2}\sum_{q=0}^{2} w_t\lambda_{a+t}v_qx_{a+t+q} y a ≥ ∑ t = 0 2 ∑ q = 0 2 w t λ a + t v q x a + t + q . Tensor implementations compute such lower bounds through matrix multiplications. We write L i j ∈ R m i × m j L^{j}_{i} \in\mathbb{R}^{m_i \times m_j} L i j ∈ R m i × m j for the coefficients of lower bounds on layer i i i in terms of layer j j j , where m i m_i m i is the number of neurons in layer i i i . Thus the subscript identifies the layer being bounded, and the superscript identifies the layer of the neurons used in the bounds. In our example, L 2 1 ∈ R 5 × 7 L^{1}_{2} \in\mathbb{R}^{5 \times7} L 2 1 ∈ R 5 × 7 and L 4 3 ∈ R 3 × 5 L^{3}_{4} \in\mathbb{R}^{3 \times5} L 4 3 ∈ R 3 × 5 contain the convolution coefficients, while L 3 3 = diag ( λ 0 , … , λ 4 ) L^{3}_{3} = \operatorname{diag}(\lambda_0,\ldots,\lambda_4) L 3 3 = diag ( λ 0 , … , λ 4 ) contains the ReLU bound coefficients. Constants are stored separately and omitted here. Starting with L 4 3 L^{3}_{4} L 4 3 , we compute the output bounds in terms of successively earlier layers using L 4 i − 1 = L 4 i @ L i i − 1 L^{i-1}_{4} = L^{i}_{4} \mathbin{@} L^{i-1}_{i} L 4 i − 1 = L 4 i @ L i i − 1 for i = 3 , 2 i = 3, 2 i = 3 , 2 . Thus we first compute L 4 2 = L 4 3 @ L 3 2 L^{2}_{4} = L^{3}_{4} \mathbin{@} L^{2}_{3} L 4 2 = L 4 3 @ L 3 2 over layer 2, then L 4 1 = L 4 2 @ L 2 1 L^{1}_{4} = L^{2}_{4} \mathbin{@} L^{1}_{2} L 4 1 = L 4 2 @ L 2 1 over the input layer. The final block L 4 1 L^{1}_{4} L 4 1 contains the coefficients relating the output bounds to the input neurons, w t λ a + t v q w_t\lambda_{a+t}v_q w t λ a + t v q .
The tensor program performs these computations on whole sparse tensors. The full coefficient tensor L i ∈ R m i × n L_i \in\mathbb{R}^{m_i \times n} L i ∈ R m i × n stores the coefficients of lower polyhedral bounds on layer i i i and has columns for all n n n neurons in the network (n = 20 n = 20 n = 20 here). Its block L i j L^{j}_{i} L i j occupies the columns for layer j j j . Columns not used by the bounds contain zeros. Stacking the initial lower-bound tensors for all layers gives the network-wide tensor L ∈ R n × n L \in\mathbb{R}^{n \times n} L ∈ R n × n , which remains fixed during this computation.
At the step for layer i i i , the current output-layer tensor L 4 L_4 L 4 contains L 4 i L^{i}_{4} L 4 i in the columns for layer i i i , and zeros elsewhere. The whole-tensor call L 4 @ L L_4 \mathbin{@} L L 4 @ L selects the block product L 4 i @ L i i − 1 L^{i}_{4} \mathbin{@} L^{i-1}_{i} L 4 i @ L i i − 1 and returns a tensor containing L 4 i − 1 L^{i-1}_{4} L 4 i − 1 in the columns for layer i − 1 i-1 i − 1 . The result is used at the next step. Thus the recurrence above describes the matrix multiplications that compute the changing coefficient block, while L 4 L_4 L 4 denotes the full tensor that stores it. Each operation has operand shapes 3 × n 3 \times n 3 × n and n × n n \times n n × n . The sparse representation stores the blocks directly without allocating the dense n × n n \times n n × n tensor.
Interleaved Computation
Figure 3 a shows L L L and Figure 3 b shows the full output-layer tensor at three stages, containing L 4 3 L^{3}_{4} L 4 3 , L 4 2 L^{2}_{4} L 4 2 , and L 4 1 L^{1}_{4} L 4 1 , respectively. Each surrounding grid has columns for all 20 network neurons. Most entries are zero. Within each convolution block, a row contains three potentially nonzero coefficients, and the same kernel weights are shared across rows. The ReLU block is diagonal. The g-BCSR representation described in Neuton [15 ] exploits the sparsity and repeated values in the L L L tensors to avoid materializing the dense coefficient tensors. It records the sparsity patterns: L 2 1 L^{1}_{2} L 2 1 and L 4 3 L^{3}_{4} L 4 3 use the StencilBlock type, while L 3 2 L^{2}_{3} L 3 2 uses the DiagonalBlock type. The result block L 4 2 L^{2}_{4} L 4 2 still has windows of width 3, but its entries w t λ a + t w_t\lambda_{a+t} w t λ a + t need not be shared across rows. It therefore uses a WindowBlock. The final tensor contains the block L 4 1 L^1_4 L 4 1 , a WindowBlock of width 5 in the columns of x x x .
Figure 3. The initial tensor L L L and successive full output-layer tensors. In (b), L 4 3 L^{3}_{4} L 4 3 , L 4 2 L^{2}_{4} L 4 2 , and L 4 1 L^{1}_{4} L 4 1 label the highlighted blocks within the full tensors. The two convolution blocks in (a) use different hues, with repeated shades indicating shared weights within each block. Distinct colors in the result blocks show different values.
While the g-BCSR representation reduces the storage and computation in § 3.1 , the calls L 4 @ L L_4 @ L L 4 @ L must determine which blocks contribute and how to represent each result. The first call matches the columns for r r r in L 4 4 L^4_4 L 4 4 with the rows for r r r in L L L , selects L 4 3 L^3_4 L 4 3 and L 3 2 L^2_3 L 3 2 , and determines that their product has windows of width three in the columns for h h h . The next call receives a different intermediate representation. It matches the columns for h h h , selects L 4 2 L^2_4 L 4 2 and L 2 2 L^2_2 L 2 2 , and determines the width-five windows of L 4 1 L^1_4 L 4 1 . These decisions are made during execution, alongside computing the coefficient values.
Making these decisions during execution introduces dependencies between the CPU and GPU. The CPU matches blocks and selects the numerical operations that the GPU will perform. When a decision also reads computed coefficients, the CPU must wait for the corresponding GPU result before selecting and issuing the next operation. The GPU must then wait for the CPU to complete this work. These dependencies can leave the GPU idle even when transferring the result takes negligible time. They also restrict the sequence of tensor operations available to a compiler, limiting its ability to combine operations across such decisions.
A further inefficiency is that these decisions are repeated across certification runs. The same abstract interpreter often analyzes one DNN for different properties or for the subregions produced by input splitting. New input regions can change the ReLU slopes and coefficient values. Nevertheless, whenever an operation executes, the program again matches the same layer ranges and determines the same convolution windows and admissible result layouts. Thus, compact coefficient storage still requires repeated computation of information that remains valid across runs. We now show how Scepter specializes the interpreter to a fixed DNN architecture to separate these representation decisions from coefficient computation. Their results can then be computed once and reused across certification runs.
Specializing to DNN Architecture
We distinguish two kinds of computation in the running example. First, structural computation involves matching the operand blocks, determining the result’s positions and internal representation, and selecting the arithmetic to perform. Second, numerical computation evaluates the arithmetic on weights, bounds, and relaxation parameters. For the first multiplication, determining that L 4 2 L^2_4 L 4 2 uses width-three windows is structural computation, while evaluating its entries w t λ a + t w_t\lambda_{a+t} w t λ a + t is numerical computation. Figure 4 illustrates this distinction. In the general GPU implementation, structural computation executes on the CPU, while numerical computation operates on coefficient arrays using GPU kernels.
Figure 4. Computing L 4 2 L^2_4 L 4 2 with the whole-tensor call L 4 @ L L_4 @ L L 4 @ L .
Our solution is based on two observations. First, for a fixed abstract interpreter, the DNN architecture determines the structural patterns used by these tensor operations. In the example, the layer dimensions determine the block positions, while the convolution and ReLU operations determine the value-sharing patterns. Changing the weights or input region changes the coefficients, but the dimensions of L 4 2 L_4^2 L 4 2 and L 4 1 L_4^1 L 4 1 remain constant. Second, the structure of an intermediate result can determine the structure needed by the next operation without evaluating the intermediate coefficients. Knowing the dimensions of L 4 2 L_4^2 L 4 2 and the convolution kernel size of L 1 2 L_1^2 L 1 2 is sufficient to determine the width-five representation of L 4 1 L_4^1 L 4 1 . We can therefore delay the numerical computation of L 4 2 L_4^2 L 4 2 and first perform the structural computation for both multiplications. This structural computation can be reused across runs with different numerical inputs.
SCEPTER formalizes this separation using novel structural semantics for DNN abstract interpreters. Each tensor has a descriptor recording its structure and a payload containing its numerical values. A structural rule computes the result descriptor from the operand descriptors and records the numerical code to execute later. Applying these rules successively determines intermediate descriptors without evaluating their payloads. The recorded code preserves dependencies between numerical operations. Structural execution applies these rules to the interpreter and assembles the recorded numerical code into an executable for the fixed architecture. Figure 5 illustrates this separation. The resulting numerical code consists of tensor operations whose dependencies are available before certification begins. A tensor compiler can therefore apply kernel fusion and memory planning across these operations. The same information also allows SCEPTER to process independent neuron computations in groups, retaining their final bounds while releasing large intermediate tensors between groups. Structural computation is performed once, and the executable can be reused with different weights and input regions, including the subregions produced by input splitting. § 4 defines structural semantics for tensor operations and proves its correctness. § 5 uses these structural semantics to specialize DNN abstract interpreters and proves preservation of the computed bounds. § 6 evaluates SCEPTER, and § 7 discusses related work.
Figure 5. Execution before and after specialization for a sequence of numerical calls κ i \kappa_i κ i . Subfigure (a) includes CPU decisions that consume GPU results. In (b), all structural work precedes numerical execution.
Structural Semantics of g-BCSR
We define structural semantics that determine the result descriptor and numerical calls of a tensor operation from its input descriptors. We develop it for the g-BCSR representation introduced by NEUTON [15 ] . We first give meaning to its descriptors, then define rules for tensor operations and
_footer: , Vol. 1, No. 1, Article . Publication date: November 2026. prove their correspondence with numerical execution. The resulting semantics can be applied successively to a fixed sequence of operations. §5 extends it to the control of an abstract interpreter.
Descriptor and Payload of a g-BCSR Tensor
A g-BCSR tensor T = ( d , S , B , Z ) \mathcal{T}=(d,S,B,Z) T = ( d , S , B , Z ) stores background d d d , shape Z Z Z , and blocks B = { B k } k = 1 m B=\{B_k\}_{k=1}^{m} B = { B k } k = 1 m at positions S = { s k } k = 1 m S=\{s_k\}_{k=1}^{m} S = { s k } k = 1 m (§2). Each block has a structural support S S S of positions that may be nonzero and an equivalence relation ≈ \approx ≈ specifying which positions share a stored value. A structural type describes all arrays satisfying these constraints.
Definition 4.1 (Structural model of a g-BCSR block). Let R ‾ = R ∪ { − ∞ , + ∞ } \overline{\mathbb{R}}=\mathbb{R}\cup\{-\infty,+\infty\} R = R ∪ { − ∞ , + ∞ } be the extended reals. A block is a tuple B = ( Ω , S , ≈ , b ) B=(\Omega,S,\approx,b) B = ( Ω , S , ≈ , b ) , where Ω \Omega Ω is a finite rectangular index domain, S ⊆ Ω S\subseteq\Omega S ⊆ Ω is its structural support, ≈ \approx ≈ is an equivalence relation on S S S , and the core b : S / ≈ → R ‾ b:S/\mathord{\approx}\to\overline{\mathbb{R}} b : S / ≈ → R assigns a value to each equivalence class. Write [ ι ] ≈ [\iota]_{\approx} [ ι ] ≈ for the class containing ι \iota ι . For ι ∈ Ω \iota\in\Omega ι ∈ Ω , the block denotes ⟦ B ⟧ [ ι ] = b [ [ ι ] ≈ ] \llbracket B\rrbracket[\iota]=b[[\iota]_{\approx}] [ [ B ] ] [ ι ] = b [[ ι ] ≈ ] if ι ∈ S \iota\in S ι ∈ S , and zero otherwise. Its structural type is the projection τ = ( Ω , S , ≈ ) \tau=(\Omega,S,\approx) τ = ( Ω , S , ≈ ) . The denotation ⟦ τ ⟧ \llbracket\tau\rrbracket [ [ τ ] ] consists of arrays A : Ω → R ‾ A:\Omega\to\overline{\mathbb{R}} A : Ω → R satisfying A [ ι ] = 0 A[\iota]=0 A [ ι ] = 0 for ι ∈ Ω ∖ S \iota\in\Omega\setminus S ι ∈ Ω ∖ S , and A [ ι ] = A [ ι ′ ] A[\iota]=A[\iota'] A [ ι ] = A [ ι ′ ] whenever ι ≈ ι ′ \iota\approx\iota' ι ≈ ι ′ .
Definition 4.2 (Descriptor and payload of a g-BCSR tensor). For a tensor T = ( d , S , B , Z ) \mathcal{T}=(d,S,B,Z) T = ( d , S , B , Z ) with blocks B k = ( Ω k , S k , ≈ k , b k ) B_k=(\Omega_k,S_k,\approx_k,b_k) B k = ( Ω k , S k , ≈ k , b k ) and types τ k = ( Ω k , S k , ≈ k ) \tau_k=(\Omega_k,S_k,\approx_k) τ k = ( Ω k , S k , ≈ k ) , its descriptor and payload are, respectively,
π ( T ) = ( d , Z , { ( s k , τ k ) } k = 1 m ) , ϱ ( T ) = { b k } k = 1 m . (1) \pi(\mathcal{T})=\left(d,Z,\{(s_k,\tau_k)\}_{k=1}^{m}\right),\qquad\varrho(\mathcal{T})=\{b_k\}_{k=1}^{m}. \tag*{(1)} π ( T ) = ( d , Z , {( s k , τ k ) } k = 1 m ) , ϱ ( T ) = { b k } k = 1 m . (1) The descriptor records the background, tensor shape, block positions, and block types, including their index domains. The payload contains the numerical cores. The background is a fixed representation parameter. Values that vary across certification runs belong to the payload. Together the two projections determine T \mathcal{T} T and extend componentwise to tuples and environments of tensors.
Structural Rules for Tensor Operations
We represent a block during structural evaluation by β = ( τ , u ) \beta=(\tau,u) β = ( τ , u ) . Here τ \tau τ is its structural type, and u u u is a variable that will hold its numerical core when the generated code runs. Structural evaluation uses this variable without reading the core. An arrow above a symbol denotes a tuple. We first define operations on two blocks over a common rectangular region r r r . The tensor operation constructs these regions when operand blocks occupy different positions.
Operations on blocks. An operand over r r r is either a symbolic block ( τ ℓ , u ℓ ) (\tau_\ell,u_\ell) ( τ ℓ , u ℓ ) or d ℓ d_\ell d ℓ , meaning the operand has its background value throughout r r r . With operator ⊙ \odot ⊙ and output background d ′ d' d ′ fixed, the block judgment is β ⃗ ⇒ r ⊙ ( β , κ ) \vec{\beta}\xRightarrow[\ r\ ]{\ \odot\ }(\beta,\kappa) β ⊙ r ( β , κ ) , where β ⃗ = ( β 1 , β 2 ) \vec{\beta}=(\beta_1,\beta_2) β = ( β 1 , β 2 ) . It produces a symbolic result block β \beta β and recorded numerical calls κ \kappa κ . The result β = ⊥ \beta=\perp β =⊥ means that no output block is needed because the region equals d ′ d' d ′ . We write ϵ \epsilon ϵ for an empty call sequence. Figure 6 defines the three cases.
Figure 6. Structural rules for two operands over a common region r r r . { i , j } = { 1 , 2 } \{i,j\}=\{1,2\} { i , j } = { 1 , 2 } .
B-Identity applies when one operand is a block and the other supplies its background value d j d_j d j . If combining with this background leaves the block unchanged, as tested by id j ( ⊙ , d j ) \operatorname{id}_j(\odot,d_j) id j ( ⊙ , d j ) on operand
≈ ~ ℓ = ≈ ℓ ∪ ( ( Ω ∖ S ℓ ) × ( Ω ∖ S ℓ ) ) , \widetilde{\approx}_{\ell}=\approx_{\ell}\cup\left((\Omega\setminus S_{\ell})\times(\Omega\setminus S_{\ell})\right), ≈ ℓ = ≈ ℓ ∪ ( ( Ω ∖ S ℓ ) × ( Ω ∖ S ℓ ) ) ,
S + = S 1 ∪ S 2 , S_{+}=S_{1}\cup S_{2}, S + = S 1 ∪ S 2 ,
S × = S 1 ∩ S 2 , S_{\times}=S_{1}\cap S_{2}, S × = S 1 ∩ S 2 ,
≈ ⊙ = ( ≈ ~ 1 ∩ ≈ ~ 2 ) ∣ S ⊙ , \approx_{\odot}=\left.(\widetilde{\approx}_{1}\cap\widetilde{\approx}_{2})\right|_{S_{\odot}}, ≈ ⊙ = ( ≈ 1 ∩ ≈ 2 ) ∣ S ⊙ ,
⊙ ∈ { + , × } . \odot\in\{+,\times\}. ⊙ ∈ { + , × } .
(a) Block-type transfer.
G = Refine ( π ⃗ ) ( β ⃗ r , α r ) = Align ( r , π ⃗ ) \mathcal{G}=\operatorname{Refine}(\vec{\pi})\qquad
(\vec{\beta}_{r},\alpha_{r})=\operatorname{Align}(r,\vec{\pi}) G = Refine ( π ) ( β r , α r ) = Align ( r , π )
β ⃗ r ⟹ ⊙ r ( β r , κ r ) ( r ∈ G ) \vec{\beta}_{r}\mathrel{\overset{\odot}{\Longrightarrow}_{r}}(\beta_{r},\kappa_{r})\qquad(r\in\mathcal{G}) β r ⟹ ⊙ r ( β r , κ r ) ( r ∈ G )
π ′ = ( d ′ , Z , { ( s r , τ r ) ∣ r ∈ G , β r = ( τ r , u r ) } ) \pi'=(d',Z,\{(s_{r},\tau_{r})\mid r\in\mathcal{G},\ \beta_{r}=(\tau_{r},u_{r})\}) π ′ = ( d ′ , Z , {( s r , τ r ) ∣ r ∈ G , β r = ( τ r , u r )})
κ = ( ; { α r ; κ r } r ∈ G ) ; [ return ( u r ) β r ≠ ⊥ ] \kappa=\left(\ ;\ \{\alpha_{r};\kappa_{r}\}_{r\in\mathcal{G}}\right);\ [\operatorname{return}(u_{r})_{\beta_{r}\ne\perp}] κ = ( ; { α r ; κ r } r ∈ G ) ; [ return ( u r ) β r = ⊥ ]
π ⃗ ⟹ ⊙ ( π ′ , κ ) \vec{\pi}\mathrel{\overset{\odot}{\Longrightarrow}}(\pi',\kappa) π ⟹ ⊙ ( π ′ , κ )
(b) Operation on complete tensors.
Fig. 7. The type calculation used by B-Compute and (b) shows the tensor rule that applies the block rules across regions.
side j j j , the rule reuses the block’s type and core and emits ϵ \epsilon ϵ . B-Annihilator applies when the operation produces d j d_j d j at every position regardless of the block’s entries, expressed by ann ( ⊙ , d j ) \operatorname{ann}(\odot,d_j) ann ( ⊙ , d j ) . If d j = d ′ d_j=d' d j = d ′ , the output background already represents this result, so the rule returns ⊥ \perp ⊥ and emits ϵ \epsilon ϵ . B-Compute handles the remaining cases. Its helper Lift r \operatorname{Lift}_r Lift r retains block operands and replaces a background operand with a constant block, recording its core construction in λ \lambda λ . The rule then selects an admissible result type τ = τ 1 ⊙ τ 2 \tau=\tau_1\mathbin{\odot}\tau_2 τ = τ 1 ⊙ τ 2 and records the numerical conversions and arithmetic in the kernel call K ⊙ , τ ⃗ K_{\odot,\vec{\tau}} K ⊙ , τ . The new block is ( τ , u ) (\tau,u) ( τ , u ) , where u u u will hold that call’s result. Fig. 7a gives the constraints used to select the result type for addition and multiplication. It uses the union of supports for addition and their intersection for multiplication. Sharing is retained where both operands guarantee equality. The extension ≈ ~ ℓ \widetilde{\approx}_{\ell} ≈ ℓ also relates positions outside S ℓ S_{\ell} S ℓ , which are known zeros. Restriction to S ⊙ S_{\odot} S ⊙ keeps only pairs in the result support. Appendix § 10 .2.1 explains all three rules in detail, and Appendix § 10 .2.2 gives the result-type selection using the block-type order and tables.
Operations on g-BCSR tensors. We now define an operation f f f on complete tensors T ⃗ = ( T 1 , … , T q ) \vec{T}=(T_1,\ldots,T_q) T = ( T 1 , … , T q ) . Given their descriptors π ⃗ = π ( T ⃗ ) \vec{\pi}=\pi(\vec{T}) π = π ( T ) , structural evaluation produces a result descriptor π ′ \pi' π ′ and code κ \kappa κ , written π ⃗ ⟹ f ( π ′ , κ ) \vec{\pi}\mathrel{\overset{f}{\Longrightarrow}}(\pi',\kappa) π ⟹ f ( π ′ , κ ) . For an element-wise operation f = ⊙ f=\odot f = ⊙ , the two operands have common shape Z Z Z and backgrounds d 1 , d 2 d_1,d_2 d 1 , d 2 . T-Elementwise in Fig. 7 first uses Refine to choose ordered, disjoint regions covering their blocks. For each region r r r , Align describes both operands in β ⃗ r \vec{\beta}_r β r using the background value when no block is defined, and records any restriction or materialization calls in α r \alpha_r α r . The block rules then produce β r \beta_r β r and κ r \kappa_r κ r for each region. For each r ∈ G r\in\mathcal{G} r ∈ G with β r = ( τ r , u r ) \beta_r=(\tau_r,u_r) β r = ( τ r , u r ) , the descriptor retains ( s r , τ r ) (s_r,\tau_r) ( s r , τ r ) and the return retains u r u_r u r . The output background is d ′ = d 1 ⊙ d 2 d'=d_1\mathbin{\odot}d_2 d ′ = d 1 ⊙ d 2 when defined, and zero otherwise. The recorded program concatenates each region’s alignment calls α r \alpha_r α r and block calls κ r \kappa_r κ r in order. Alignment calls remain even when a block rule emits ϵ \epsilon ϵ . These choices depend only on descriptors. The recorded code computes the numerical values when executed on the input payloads. Appendix § 10 .2.3 defines the auxiliary functions and gives an example of the complete operation.
Tensor multiplication. For zero backgrounds, block pairs contribute when the left block’s column range overlaps the right block’s row range. We partition their output boxes into disjoint regions, determine each product’s support from its operand types, and accumulate contributions using the addition rule. Nonzero backgrounds instead require a dense fallback. Appendix § 10 .2.5 gives the full procedure. Both constructions use fixed region, type-selection, and accumulation policies.
Correctness and Composition
The structural rules separate a tensor operation into descriptor computation and numerical calls. Correctness requires that executing these calls and combining their result with the computed descriptor gives the same tensor values as direct dense evaluation and the existing g-BCSR operation. This must hold for every numerical payload compatible with the input descriptors. We write Pack ( π , ρ ) \operatorname{Pack}(\pi,\rho) Pack ( π , ρ ) for the tensor reconstructed from descriptor π \pi π and compatible payload ρ \rho ρ . Thus Pack ( π ( T ) , ρ ( T ) ) = T \operatorname{Pack}(\pi(T),\rho(T))=T Pack ( π ( T ) , ρ ( T )) = T . Both reconstruction and denotation extend componentwise to tuples and environments of tensors.
We use f f f for the operation defined by the structural rules and its dense counterpart, distinguished by their operands, and f g b f_{\mathrm{gb}} f gb for the existing g-BCSR operation. We fix compatible shapes, operation parameters, and structural policies, and use exact arithmetic. We define contracts for the semantics of procedures such as Align, Refine, and Lift r \operatorname{Lift}_r Lift r . Numerical kernels also must terminate and compute their specified operations correctly whenever the corresponding dense computation is defined. Appendix § 10 .§ 3 states these contracts and proves the following theorem.
Theorem 4.3 (Correctness of the structural rules). Let f f f be an operation defined by the rules of Figure 6 and 7 or the multiplication construction of Appendix § 10 .2.5. Under the contracts above, structural evaluation of compatible operand descriptors π ⃗ \vec{\pi} π terminates with π ⃗ ⟹ f ( π ′ , κ ) \vec{\pi} \mathrel{\overset{f}{\Longrightarrow}} (\pi',\kappa) π ⟹ f ( π ′ , κ ) , independently of payloads. For every tensor tuple T ⃗ \vec{T} T with π ⃗ ( T ⃗ ) = π ⃗ \vec{\pi}(\vec{T})=\vec{\pi} π ( T ) = π whose dense computation is defined, executing κ ( ρ ⃗ ( T ⃗ ) ) \kappa(\vec{\rho}(\vec{T})) κ ( ρ ( T )) terminates with a payload ρ ′ \rho' ρ ′ compatible with π ′ \pi' π ′ such that
⟦ Pack ( π ′ , ρ ′ ) ⟧ = f ( ⟦ T ⃗ ⟧ ) = ⟦ f g b ( T ⃗ ) ⟧ . \llbracket\operatorname{Pack}(\pi',\rho')\rrbracket=f(\llbracket\vec{T}\rrbracket)=\llbracket f_{\mathrm{gb}}(\vec{T})\rrbracket. [ [ Pack ( π ′ , ρ ′ ) ] ] = f ( [ [ T ] ] ) = [ [ f gb ( T ) ] ] . The equality concerns tensor values. The structural rules retain redundant blocks that the existing operation may remove, so their result descriptor requires no numerical tests. Figure 8 a shows the descriptor computation for the rule-defined operation.
Figure 8. Structural evaluation of one operation (a) and a fixed sequence (b). (a) shows the descriptor component of π ⃗ ⇒ ( π ′ , κ ) \vec{\pi} \Rightarrow(\pi',\kappa) π ⇒ ( π ′ , κ ) . (b) shows the intermediate descriptors and calls κ j \kappa_j κ j generated for later numerical execution.
Composition of tensor operations. To extend the theorem to a sequence, we must determine each operation’s result descriptor and numerical calls before evaluating the operation on its input payloads. The following definition states these requirements using the judgment defined in § 4.2 .
Definition 4.4 (Supported operations). An operation f f f with fixed parameters and policies is supported if, for every compatible input descriptor tuple π ⃗ \vec{\pi} π , structural evaluation determines π ⃗ ⟹ f ( π ′ , κ ) \vec{\pi} \mathrel{\overset{f}{\Longrightarrow}} (\pi',\kappa) π ⟹ f ( π ′ , κ ) in finitely many steps without reading payloads, and the following hold for every T ⃗ \vec{T} T with π ⃗ ( T ⃗ ) = π ⃗ \vec{\pi}(\vec{T})=\vec{\pi} π ( T ) = π whose dense computation is defined.
Dense equivalence: f ( T ⃗ ) f(\vec{T}) f ( T ) terminates and ⟦ f ( T ⃗ ) ⟧ = f ( ⟦ T ⃗ ⟧ ) \llbracket f(\vec{T})\rrbracket=f(\llbracket\vec{T}\rrbracket) [ [ f ( T ) ] ] = f ( [ [ T ] ] ) .
Descriptor separation: π ( f ( T ⃗ ) ) = π ′ \pi(f(\vec{T}))=\pi' π ( f ( T )) = π ′ .
Fixed numerical calls: κ \kappa κ has a fixed finite sequence of numerical calls and fixed structural index arguments. On ρ ( T ⃗ ) \rho(\vec{T}) ρ ( T ) , it terminates with ρ ( f ( T ⃗ ) ) \rho(f(\vec{T})) ρ ( f ( T )) .
Theorem 4.3 establishes these properties for the rule-defined operations. Figure 8 b shows how they allow structural computation to proceed through a sequence before any numerical calls execute. Let E j E_j E j contain the inputs and first j j j results of a fixed sequence f 1 , … , f N f_1,\ldots,f_N f 1 , … , f N , with each operation reading inputs or earlier results. Starting from π ( E 0 ) \pi(E_0) π ( E 0 ) , each structural judgment adds the next result descriptor to the environment and records its calls κ j \kappa_j κ j . Condition (ii) permits later operations to use this descriptor without computing the payload. Condition (iii) supplies the calls to execute once the payloads are available. § 5 formalizes this composition for tensor programs, including branches and loops, and proves correctness of the generated code.
Structural Execution and Specialization
§ 4 separates structural and numerical computation when the sequence of tensor operations is fixed. To apply this result to an abstract interpreter, we must determine which operations it executes without computing numerical values. Let P P P be a tensor program that Neuton generates from a ConstraintFlow specification. Numerical inputs b b b contain weights, biases, input region bounds and perturbation radii. The architecture determines the layer sequence and the transformer applied at each layer. Given a fixed DNN architecture, we unroll these calls and inline them in topological order. A transformer may contain loops that traverse the DNN and depend on computed coefficients. So, we first replace DNN traversals that select neurons using coefficients with traversals that select them using structural information. Then, we use the structural semantics on the transformed program to generate the numerical code.
Specializing DNN Traversals
DNN certifiers often refine a bound by traversing the network and replacing neuron terms with bounds over other neurons. The traversal repeats these substitutions until it reaches a stopping condition. Backsubstitution in DeepPoly [17 ] and the backward bounding pass used in CROWN-IBP [25 ] follow this pattern. We consider a traversal that selects terms with nonzero coefficients and stops when none require further substitution. Each selection therefore depends on coefficients computed by earlier iterations. We replace these numerical tests with selections based on tensor descriptors and DNN connectivity.
Numerical traversal. Write E = ( E i ) i E=(E_i)_i E = ( E i ) i , where E i = d i + ∑ j c i , j n j E_i=d_i+\sum_j c_{i,j}n_j E i = d i + ∑ j c i , j n j is a bound expression for neuron i i i , and let C = ( c i , j ) C=(c_{i,j}) C = ( c i , j ) be the coefficient tensor. These expressions describe the rows of a tensor updated by Neuton. Each iteration applies the replacements to all rows together. The neuron indices below specify the entries affected by this tensor computation. They do not introduce a separate execution for each neuron. The function g ( n , c ) g(n,c) g ( n , c ) replaces the term c n cn c n . The priority p r i pri p r i orders substitutions, and s t o p stop s t o p identifies neurons requiring no further substitution. A traversal direction selects which network edges to follow. In ConstraintFlow, these four components specify the traversal construct. A term is active when its coefficient is nonzero and its neuron has not reached the stopping condition, giving A i ( E ) = { j : c i , j ≠ 0 ∧ ¬ s t o p ( n j ) } A_i(E)=\{j:c_{i,j}\ne0\land\neg stop(n_j)\} A i ( E ) = { j : c i , j = 0 ∧ ¬ s t o p ( n j )} . The loop selects the highest priority among all active terms. For nonempty ⋃ i A i ( E ) \bigcup_i A_i(E) ⋃ i A i ( E ) , let p ( E ) = max j ∈ ⋃ i A i ( E ) p r i ( n j ) p(E)=\max_{j\in\bigcup_i A_i(E)}pri(n_j) p ( E ) = max j ∈ ⋃ i A i ( E ) p r i ( n j ) and Z i ( E ) = { j ∈ A i ( E ) : p r i ( n j ) = p ( E ) } \mathcal{Z}_i(E)=\{j\in A_i(E):pri(n_j)=p(E)\} Z i ( E ) = { j ∈ A i ( E ) : p r i ( n j ) = p ( E )} . One iteration computes E i ′ = d i + ∑ j ∈ Z i ( E ) c i , j n j + ∑ j ∈ Z i ( E ) g ( n j , c i , j ) E'_i=d_i+\sum_{j\in\mathcal{Z}_i(E)}c_{i,j}n_j+\sum_{j\in\mathcal{Z}_i(E)}g(n_j,c_{i,j}) E i ′ = d i + ∑ j ∈ Z i ( E ) c i , j n j + ∑ j ∈ Z i ( E ) g ( n j , c i , j ) . The loop ends when all active sets are empty. We require p r i pri p r i and s t o p stop s t o p to depend only on structure. Any numerical choices within g g g , such as selecting lower or upper bounds by coefficient sign, remain at runtime. We also require the following replacement conditions.
Definition 5.1 (Replacement conditions). A replacement g g g is zero-preserving if g ( n , 0 ) = 0 g(n,0)=0 g ( n , 0 ) = 0 for every neuron n n n . It follows the DNN if every nonstopped neuron n j n_j n j mentioned by g ( n , c ) g(n,c) g ( n , c ) is reachable from n n n in the traversal direction by a nonempty path whose intermediate neurons are unstopped and have priority strictly greater than pri ( n j ) \operatorname{pri}(n_j) pri ( n j ) .
Structural traversal. Assume these conditions and a finite acyclic network. The structural traversal maintains a set B B B of neuron positions to visit. It selects the highest-priority positions and replaces them with their neighbors. Let U = { j : ¬ stop ( n j ) } \mathcal{U}=\{j:\neg\operatorname{stop}(n_j)\} U = { j : ¬ stop ( n j )} and let nbr ( J ) \operatorname{nbr}(J) nbr ( J ) be the neighbors of J J J in the traversal direction. Initialize B 0 = U ∩ cols ( π ( C ) ) B^0=\mathcal{U}\cap\operatorname{cols}(\pi(C)) B 0 = U ∩ cols ( π ( C )) , where cols \operatorname{cols} cols contains all columns covered by stored blocks, or all columns when the background is nonzero. For nonempty B m B^m B m , select and update
Σ m = { j ∈ B m : pri ( n j ) = max k ∈ B m pri ( n k ) } , (2) \Sigma^m=\{j\in B^m:\operatorname{pri}(n_j)=\max_{k\in B^m}\operatorname{pri}(n_k)\}, \tag*{(2)} Σ m = { j ∈ B m : pri ( n j ) = k ∈ B m max pri ( n k )} , (2)
B m + 1 = ( B m ∖ Σ m ) ∪ ( nbr ( Σ m ) ∩ U ) . (3) B^{m+1}=(B^m\setminus\Sigma^m)\cup(\operatorname{nbr}(\Sigma^m)\cap\mathcal{U}). \tag*{(3)} B m + 1 = ( B m ∖ Σ m ) ∪ ( nbr ( Σ m ) ∩ U ) . (3)
We apply the numerical traversal’s update with Σ m \Sigma^m Σ m in place of each Σ i ( E ) \Sigma_i(E) Σ i ( E ) and stop when B B B is empty. The traversal therefore selects substitutions without computing coefficients. A stored bound may skip layers, so an active term need not yet belong to B B B . However, it remains reachable from B B B through unstopped positions of higher priority. This ordering ensures that whenever a structural iteration selects a nonzero coefficient, it selects exactly the original loop’s maximum-priority active terms. The additional substitutions all have coefficient zero and leave the expression unchanged. Appendix § 11 .§ 3 proves that the traversal covers the active terms, preserves the bound expressions, and terminates.
Let σ \sigma σ collect the fixed interpreter and architecture, input and batch shapes, element type, and structural constants and policies. Combining the fixed layer sequence with the structural traversals gives P s = Structuralize ( P , σ ) P_s=\operatorname{Structuralize}(P,\sigma) P s = Structuralize ( P , σ ) . Its tensor operations retain redundant blocks so that numerical tests do not change their descriptors. These transformations preserve tensor values and bound expressions. The original program P P P observes tensors through their dense values, so ⟦ P s ( b ) ⟧ = ⟦ P ( b ) ⟧ \llbracket P_s(\mathbf{b})\rrbracket=\llbracket P(\mathbf{b})\rrbracket [ [ P s ( b ) ] ] = [ [ P ( b ) ] ] when both executions are defined. The program P s P_s P s still contains traversal loops, but their selection and stopping decisions now depend on structural information. The remaining code consists of finite sequences of tensor operations, assignments, and conditionals. Structural execution will evaluate these loops while generating the code for their numerical computations.
Generating Specialized Code by Structural Execution
We now specialize the transformed program P s P_s P s from §5.1 to the fixed inputs σ \sigma σ . We first consider programs whose remaining control depends only on structural information. Numerical decisions that remain in program control are handled by specializing the regions they invoke, as discussed below. The complete specialization is written ( P , σ ) ⇝ G σ (P,\sigma)\leadsto G_\sigma ( P , σ ) ⇝ G σ , where G σ G_\sigma G σ is executable tensor code. Each certification run supplies numerical inputs b \mathbf{b} b to this code to compute its bounds. We define structural execution using big-step rules for expressions and statements, following the tensor execution semantics of NEUTON [15 ] . This is partial evaluation [9 ] , with structural computations evaluated during specialization and numerical computations recorded for later execution.
Structural environment. We distinguish tensor variables x x x from structural variables z z z . The environment Γ \Gamma Γ maps each tensor variable to its descriptor and each structural variable to its known value. These values include layer indices and the sets maintained by structural traversals. The fixed inputs determine the initial environment Γ 0 ( σ ) \Gamma_0(\sigma) Γ 0 ( σ ) . A structural expression a a a reads known values or descriptor fields from Γ \Gamma Γ . Its value, written ⟦ a ⟧ Γ \llbracket a\rrbracket_\Gamma [ [ a ] ] Γ , must agree with the corresponding computation in P s P_s P s for every compatible numerical input. Such expressions determine operation parameters, update traversal variables, and evaluate guards. Numerical decisions within tensor operations, such as selecting bounds by coefficient sign, remain in the generated code.
Definition 5.2 (Descriptor-determined program). A program is descriptor-determined if its structural environment determines all guards, structural assignments, and tensor-operation parameters at every reached statement, independently of numerical payloads.
Tensor expressions. We first define specialization of a tensor expression i e i_e i e . It reads Γ \Gamma Γ and produces a result descriptor π \pi π and an expression i e ′ i'_e i e ′ that computes the result’s payload, written Γ ⊢ i e ⇝ ( π , i e ′ ) \Gamma\vdash i_e \leadsto(\pi, i'_e) Γ ⊢ i e ⇝ ( π , i e ′ ) . During specialization, a tensor variable denotes its descriptor in Γ \Gamma Γ . In i e ′ i'_e i e ′ , the same variable denotes its payload. Expression specialization leaves Γ \Gamma Γ unchanged. The judgment extends to tuples.
Figure 9 gives the variable and operation rules. E-VAR obtains a variable’s descriptor and retains its name in the generated expression. E-OP specializes the operand expressions to obtain their descriptors π ⃗ \vec{\pi} π and generated expressions i ⃗ e ′ \vec{i}'_e i e ′ . It then applies the operation judgment of § 4.2 , with structural parameters instantiated from Γ \Gamma Γ , to obtain ( π ′ , κ ) (\pi', \kappa) ( π ′ , κ ) . The generated expression κ ( i ⃗ e ′ ) \kappa(\vec{i}'_e) κ ( i e ′ ) evaluates its arguments once in order and executes the recorded calls. Its structural parameters remain fixed even if Γ \Gamma Γ changes later. Here f f f ranges over supported operations (Definition 4.4). Appendix § 11 .2.1 gives the constant rule and proves expression correctness using the results of § 4.3 .
Figure 9. Tensor-expression rules. f Γ f_{\Gamma} f Γ instantiates f f f ’s structural parameters from Γ \Gamma Γ .
Statements. A statement i s i_s i s can assign variables, define sequences, or affect control flow. Specializing i s i_s i s yields numerical code K K K and an updated structural environment Γ ′ \Gamma' Γ ′ . Γ ⊢ i s ⇝ ( Γ ′ , K ) \Gamma\vdash i_s \leadsto(\Gamma', K) Γ ⊢ i s ⇝ ( Γ ′ , K ) . We write ϵ \epsilon ϵ for empty code and K 1 ⋅ K 2 K_1 \cdot K_2 K 1 ⋅ K 2 for execution of K 1 K_1 K 1 followed by K 2 K_2 K 2 . Figure 10 defines the rules. In S-ASSIGN, the expression judgment produces the assigned tensor’s descriptor and numerical expression i e ′ i'_e i e ′ . The rule updates Γ ( x ) \Gamma(x) Γ ( x ) and records the assignment x ← i e ′ x \leftarrow i'_e x ← i e ′ . S-STATIC instead evaluates an assignment to a structural variable, updates its known value, and emits no code. S-SEQ uses the first statement’s updated environment to specialize the second and concatenates their generated code. S-WHILE-T applies when the condition is true in Γ \Gamma Γ . It specializes the body, then the remaining loop using the updated environment. Its numerical code is the current iteration’s code followed by that of the remaining iterations. S-WHILE-F ends this process when the condition is false. Thus the generated code retains the numerical computations in order while the structural loop control is evaluated during specialization. Repeated assignments to a tensor variable are permitted. Each generated assignment evaluates its entire right-hand side before updating the payload variable. Appendix § 11 .§ 2 gives the empty-statement and ite rules. The traversal termination result of § 5.1 ensures that the loops of P s P_s P s have finite specialization derivations.
Figure 10. Statement rules. Guards and structural assignments are evaluated during specialization.
Specialized program. Write P s = ( i s , o ⃗ ) P_s = (i_s,\vec{o}) P s = ( i s , o ) for the transformed program’s body and returned tensor variables. Specializing the body from Γ 0 ( σ ) \Gamma_0(\sigma) Γ 0 ( σ ) produces its numerical code K K K and final environment Γ f \Gamma_f Γ f . We append a return that reconstructs the output tensors from their descriptors and payloads.
P s = Structuralize ( P , σ ) = ( i s , o ⃗ ) Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) ( P , σ ) ⇝ K ⋅ [ return Pack ( Γ f ( o ⃗ ) , o ⃗ ) ] (4) \frac{P_s = \operatorname{Structuralize}(P,\sigma) = (i_s,\vec{o}) \qquad\Gamma_0(\sigma) \vdash i_s \leadsto(\Gamma_f,K)}
{(P,\sigma) \leadsto K \cdot[\operatorname{return}\ \operatorname{Pack}(\Gamma_f(\vec{o}),\vec{o})]} \tag*{(4)} ( P , σ ) ⇝ K ⋅ [ return Pack ( Γ f ( o ) , o )] P s = Structuralize ( P , σ ) = ( i s , o ) Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) (4)
The final executable specialized program G σ G_\sigma G σ takes input variables b \mathbf{b} b , executes the numerical calls in K K K , then returns the output tensors reconstructed from their computed payloads. The output descriptors Γ f ( o ⃗ ) \Gamma_f(\vec{o}) Γ f ( o ) and all structural parameters are embedded as constants in the generated code. This exposes a sequence of purely numerical calls to torch.compile [4 ] for kernel fusion and elimination of intermediate tensors. We can further optimize the execution by performing additional static analyses to reduce the memory footprint. Appendix § 12 gives these analyses and their proofs. If an interpreter uses numerical bounds to choose which analysis to perform, we retain these decisions. For example, BoxPoly is a DeepPoly variant implemented in auto_LiRPA and GPUPoly and supported by Neuton. It keeps interval bounds for neurons whose ReLU is stable for every input region and refines the others by backsubstitution. Scepter preserves each region’s output by preserving the numerical decisions. Appendix B.4 gives complete details.
Correctness and Reuse
We establish correctness by proving the traversal transformation and the specialization rules both preserve the bounds. The following theorem establishes the result for full specialization.
Theorem 5.3 (Specialization). Fix specialization inputs σ \sigma σ . Let P P P be a Neuton-generated tensor program with the finite layer schedule and traversal conditions of § 5.1 , and set P s = Structuralize ( P , σ ) P_s = \operatorname{Structuralize}(P,\sigma) P s = Structuralize ( P , σ ) . Suppose P P P ’s tensor operations compute their dense counterparts and P s P_s P s is descriptor-determined with supported operations. Then ( P , σ ) ⇝ G σ (P,\sigma) \leadsto G_{\sigma} ( P , σ ) ⇝ G σ has a finite derivation, and
⟦ G σ ( b ) ⟧ = ⟦ P s ( b ) ⟧ = ⟦ P ( b ) ⟧ \llbracket G_{\sigma}(b) \rrbracket= \llbracket P_s(b) \rrbracket= \llbracket P(b) \rrbracket [ [ G σ ( b ) ] ] = [ [ P s ( b ) ] ] = [ [ P ( b ) ] ] for every compatible input b b b on which P P P and P s P_s P s have defined dense executions in exact arithmetic. The numerical calls and output descriptors of G σ G_{\sigma} G σ are fixed by σ \sigma σ .
Appendix B.3 proves that the control transformation preserves bound expressions and terminates. Lemma B.4 proves by induction on the big-step derivation that executing the generated code reconstructs the tensors computed by P s P_s P s . It uses Lemma B.1 for tensor expressions. Together, these results give equivalence with Neuton’s tensor execution. Neuton’s semantic-preservation result supplies the connection to the original ConstraintFlow specification.
Evaluation
We evaluate Scepter on eight abstract interpreters, including commonly used interval, zonotope, and polyhedral analyses and variants with different transformers and backsubstitution procedures. The evaluation uses 44 benchmark DNNs, ranging from small fully connected networks to convolutional and residual networks with millions of neurons. We first compare GPU runtime and scalability, followed by CPU runtime, memory use, and CPU–GPU interaction. We then examine how the runtime gains affect repeated verification through an input-splitting case study.
Certifiers, Baselines, and Benchmarks. The eight abstract interpreters are IBP, CROWN-IBP, DeepZ, DeepPoly, BoxPoly, SkipPoly, ReuseCert, and ZID. They use different abstract domains and transformers, and include analyses that combine domains or reuse intermediate bounds. BoxPoly is the variant of DeepPoly that uses interval bounds to identify stable ReLU neurons and avoids backsubstitution for these neurons. Its decisions depend on numerical bounds, so its specialized program retains some CPU computation. All eight interpreters use the same specialization procedure. We compare Scepter with Neuton, auto_LiRPA, IVAN, LUNA and GPUPoly on the GPU, and additionally include ERAN on the CPU. Table 1 lists the analyses and devices included in each comparison. The networks come from the ERAN [18 ] and VNN-COMP benchmark suites [1 , 5 ] and the robustness library [8 ] , and include fully connected, convolutional, and residual architectures. We group them by neuron count using the four ranges in Table 1 . The two very large networks are ResNet50 with 2.94M neurons and VGG-16 with 13.6M neurons. Table 7 lists all networks and maps the plot indices to their original identifiers.
Table 1. Abstract interpreters and devices evaluated for each system, and the network size groups. Dots mark evaluated configurations and dashes indicate no comparison.
Table 7.
For each network, we compute bounds for L ∞ L_\infty L ∞ perturbations of test inputs. We compute speedup as the baseline runtime divided by Scepter’s runtime, and report geometric means using only networks on which both systems complete. We also report the largest networks completed.
Experimental Setup. The GPU experiments use an NVIDIA A100 with 80 GB of device memory on a server with two Intel Xeon Platinum 8358 processors and 256 GB of host memory. The CPU experiments use two 28-core Intel Xeon Gold 6348 processors and 1 TB of RAM, with each run pinned to four physical cores and a 120 GB memory budget. Figure 11 lists the network configurations and batch sizes, and Table 10 gives per-network runtimes. For each run, we set a timeout of 1000 seconds.
Figure 11. Largest network completed per certifier. Multipliers indicate the increase in network size over the best baseline.
Runtime and Scalability
Scalability. Scepter enables precise abstract interpreters to process networks with up to 153× as many neurons as the largest networks completed by their baselines. Figure 11 compares the largest network completed by Scepter with the largest completed by any baseline for each analysis. Scepter runs DeepPoly, BoxPoly, and SkipPoly on VGG-16 with 13.6M neurons, increasing the largest completed network by 14×, 4.6×, and 153×, respectively. These gains extend across abstract domains and backsubstitution procedures. DeepZ reaches ResNet18 with 558K neurons, a 7.8× increase over its best baseline, while ReuseCert reaches ResNet50, a 3.0× increase. Across the suite, Scepter completes 20 certifier–network pairs that no corresponding baseline completes. In particular, it completes the widely used DeepPoly analysis on both very large networks, VGG-16 and ResNet50, whereas none of the evaluated DeepPoly baselines completes either.
We additionally compare Scepter with α , β \alpha,\beta α , β -CROWN [20 ] to assess scalability on the two largest networks in our suite, ResNet50 and VGG-16. α , β \alpha,\beta α , β -CROWN is a state-of-the-art DNN verifier that goes beyond abstract interpretation. Even this verifier fails to complete either experiment. It exhausts GPU memory on ResNet50 and times out on VGG-16, while Scepter certifies both.
GPU Runtime Speedup. Program specialization achieves substantial speedups over GPU libraries with implementations tailored to individual analyses. For the widely used DeepPoly analysis, Scepter achieves geometric-mean speedups of 5.69× over auto_LiRPA, 6.57× over GPUPoly, 22.3× over IVAN, and 30.7× over Neuton. Table 2 reports the results for all eight analyses, with ResNet50 and VGG-16 in separate columns. Figure 12 shows per-network results for DeepPoly, CROWN-IBP, and DeepZ, representing polyhedral, hybrid, and zonotope analyses. The remaining five per-network plots are in the appendixF.
Table 2. GPU speedups (geometric means) on networks completed by both systems, with the number of such networks in parentheses. A cross (✗) marks networks that the baseline does not complete, and a dash (—) networks that neither system completes.
Figure 12. GPU speedups for DeepPoly (top), CROWN-IBP (bottom left), and DeepZ (bottom right). Networks are numbered as in Table 7 . A missing bar means the baseline or Scepter does not complete that network.
Scepter improves both runtime and scalability over the baselines. On networks completed by auto_LiRPA, the geometric-mean speedups over it are 5.69× for DeepPoly, 8.40× for BoxPoly, 11.0× for CROWN-IBP, and 14.8× for IBP, with improvements on every analysis. Against
GPUPoly, the speedups are 6.57 × 6.57\times 6.57 × for DeepPoly and 3.54 × 3.54\times 3.54 × for BoxPoly. Similarly, Scepter achieves speedups over IVAN of 22.3 × 22.3\times 22.3 × for DeepPoly, 2.83 × 2.83\times 2.83 × for DeepZ, and 1.58 × 1.58\times 1.58 × for IBP. It is faster on every network for DeepPoly and DeepZ. Against LUNA, Scepter is 8.01 × 8.01\times 8.01 × faster on IBP, 5.71 × 5.71\times 5.71 × on CROWN-IBP, and 3.68 × 3.68\times 3.68 × on BoxPoly. Finally, against Neuton, Scepter is faster on every network across all eight analyses, with geometric-mean speedups ranging from 11.9 × 11.9\times 11.9 × to 44.4 × 44.4\times 44.4 × . In this evaluation, we used torch.compile to optimize Scepter’s specialized code. In Appendix § 19 , we show that i) specialization alone accounts for most of the speedup, ii) even without torch.compile, Scepter remains faster than the baselines, and iii) torch.compile without specialization is not effective.
CPU Runtime. We evaluate CPU runtime on the the small, medium, and large networks. GPUPoly targets GPUs and has no CPU implementation, so we compare with Neuton, auto_LiRPA, IVAN, and LUNA and with ERAN’s CPU implementations of DeepPoly and DeepZ. Across these 42 networks, Scepter achieves overall geometric-mean speedups of 5.27 × 5.27\times 5.27 × over Neuton, 2.30 × 2.30\times 2.30 × over auto_LiRPA, 4.49 × 4.49\times 4.49 × over IVAN, 3.48 × 3.48\times 3.48 × over LUNA and 182 × 182\times 182 × over ERAN. These comparisons use the certifier–network pairs completed by both systems. Table 8 in the appendix reports the results for each analysis and baseline.
Table 8. CPU speedups for each abstract interpreter and baseline on the 28 small, seven medium, and seven large networks. Entries are geometric means of baseline runtime divided by Scepter runtime on networks completed by both systems.
The largest gains are against ERAN, with geometric-mean speedups of 87.4 × 87.4\times 87.4 × for DeepPoly and 522 × 522\times 522 × for DeepZ. For DeepPoly, Scepter is also 5.58 × 5.58\times 5.58 × faster than Neuton, 2.04 × 2.04\times 2.04 × faster than auto_LiRPA, and 19.7 × 19.7\times 19.7 × faster than IVAN. For DeepZ, the corresponding speedups over Neuton and IVAN are 4.02 × 4.02\times 4.02 × and 4.66 × 4.66\times 4.66 × . The gains extend to interval and hybrid analyses, with IBP and CROWN-IBP speedups of 5.30 × 5.30\times 5.30 × and 7.74 × 7.74\times 7.74 × over Neuton, respectively. Against LUNA, Scepter is 2.90 × 2.90\times 2.90 × faster for BoxPoly and CROWN-IBP and 5.01 × 5.01\times 5.01 × faster for IBP.
Memory Use and CPU–GPU Interaction
Memory Use. Scepter reduces peak GPU memory by geometric-mean factors of 2.60 × 2.60\times 2.60 × relative to Neuton, 1.32 × 1.32\times 1.32 × relative to auto_LiRPA, 4.51 × 4.51\times 4.51 × relative to IVAN, and 1.74 × 1.74\times 1.74 × relative to LUNA, over configurations completed by both systems (Table 9 ). For DeepPoly alone, the reductions are 3.14 × 3.14\times 3.14 × , 1.40 × 1.40\times 1.40 × , and 11.2 × 11.2\times 11.2 × , respectively (Table 3 ). Scepter also completes networks on which these baselines exhaust device memory. We omit GPUPoly from the memory comparison because it processes inputs individually, while the other systems process input batches, so their peak memory measurements do not represent the same workload.
Table 3. DeepPoly memory use and execution profiles. Ratios compare the baseline with SCEPTER. Copies are median D2H and H2D copies per batch (baseline / SCEPTER), across networks profiled with both systems.
Table 9. Memory use and execution profiles per baseline and certifier (Table 3 for all analyses).
CPU–GPU Interaction. We profile execution separately from the runtime experiment and measure GPU idle time as the part of the profiled run where no kernel, copy, or memory-set operation occurs. Across all analyses, SCEPTER reduces GPU idle time by geometric-mean factors of 52.7× relative to Neuton, 11.4× relative to auto_LiRPA, 3.02× relative to GPUPoly, 1.66× relative to IVAN, and 4.61× relative to LUNA, and transfer time by 3.74×, 11.3×, 4.06×, 2.04×, and 3.56× respectively (Table 9 ). For DeepPoly, SCEPTER reduces GPU idle time by geometric-mean factors of 128× relative to Neuton, 14.2× relative to auto_LiRPA, and 2.74× relative to IVAN, over 38, 41, and 26 networks profiled with both systems, respectively. The corresponding reductions in transfer time are 2.34×, 11.3×, and 2.83× (Table 3 ). The separate profiling comparisons with GPUPoly give reductions of 3.52× in GPU idle time and 2.69× in transfer time, respectively. For Neuton, the 128× reduction in idle time is much larger than the 2.34× reduction in transfer time. This is consistent with reducing the repeated CPU work between GPU operations, whose cost is not reflected in transfer time. The transfer counts further show the reduction in CPU–GPU communication. For DeepPoly, SCEPTER has zero median D2H copies (versus 6–281 for baselines) and 14–16 median H2D copies (versus 35–77).
Input Splitting Case Study
We now show a practical benefit of specializing the code of an abstract interpreter. Input splitting [22 ] is a common technique in formal verification that divides a problem into smaller subproblems and verifies them individually. In DNN certification, it partitions the input region into subregions and computes bounds on each. A property that cannot be established over the original region may become provable over these smaller regions. General implementations of DNN abstract interpreters repeat architecture-dependent computation for each call, although the DNN remains fixed throughout the splitting procedure. SCEPTER specializes the interpreter once for that DNN and reuses the resulting code across subregions. It can therefore devote more of the time budget to computing bounds, allowing more subregions to be processed and more properties to be established.
We use two benchmark families from VNN-COMP [2 ] . The lsnc_relu workload contains 80 Lyapunov-stability properties of a neural quadrotor controller. The Cersyve workload checks safety certificates for nine control systems. We evaluate its 36 network–property pairs, including the 12 official competition instances. We use time budgets of 25 s per property for lsnc_relu and 100 s per instance for Cersyve. An instance is solved by a proof or a counterexample. We compare input splitting using Scepter and auto_LiRPA as the bound-computation backends. We show DeepPoly, a widely used abstract interpreter for DNN certification, with the same splitting procedure and search settings for both backends. Scepter reuses the specialized code for all bound computations on each network. Runtime speedups are geometric means over instances solved by both backends. All reported counterexamples are validated.
Figure 13 shows that Scepter solves all 80 lsnc_relu instances within 19 s, whereas auto_LiRPA solves only 12 within 25 s. Scepter additionally proves the other 68 properties, all of which time out with auto_LiRPA. Scepter processes a median of 6.27 million subregions per second, with a geometric-mean throughput improvement of 5.42× over auto_LiRPA. This higher throughput allows the splitting procedure to establish properties that remain unresolved with the baseline. On the 12 instances solved by both backends, Scepter is 5.94× faster.
Figure 13. Instances of lsnc_relu solved by input splitting with DeepPoly.
On Cersyve, Scepter solves 33 of 36 instances, compared with 32 for auto_LiRPA. Both find counterexamples for 18 instances, while Scepter proves 15 properties and auto_LiRPA proves 14. The remaining three Scepter instances and four auto_LiRPA instances time out. Both solve all 12 official competition instances. Although the final solved counts are close, Scepter is 3.37× faster on the 32 instances solved by both backends. The same splitting procedure therefore benefits both from proving additional properties and from completing shared instances sooner.
Related Work
Scaling DNN certification. Existing DNN certifiers reduce the cost of precise analysis by exploiting structure in coefficient tensors. GPUPoly restricts computation to neuron dependence sets and uses parallel GPU algorithms [12 ] , while auto_LiRPA stores convolutional coefficients as patches [24 ] . Neuton generates tensor programs from ConstraintFlow [14 ] specifications and introduces g-BCSR to exploit sparse and repeated coefficients [15 ] . These systems still execute general programs that determine how to represent intermediate results and which operations to perform for the supplied DNN. Scepter builds on Neuton’s tensor programs and representation to perform this reusable work before certification, preserving the chosen interpreter’s bounds.
Scaling abstract interpretation. Exploiting structure also improves the scalability of abstract interpretation for conventional programs. Fast Polyhedra [19 ] decomposes polyhedra into independent groups of variables and adapts domain operators to this decomposition without losing precision. The groups are maintained online as constraints change. Scepter also preserves precision, but identifies structural patterns whose evolution can be determined from the DNN architecture before numerical execution. EigenCFA [13 ] accelerates control-flow analysis by expressing as sparse matrix operations on GPUs. In our setting, Neuton already supplies tensor execution. Scepter removes structural computation that remains interleaved with these numerical operations.
Partial evaluation. Partial evaluation [9 ] evaluates computations determined by known inputs and generates code for the remainder. Wei et al. [23 ] specialize abstract interpreters to a fixed program, retaining computations that depend on dynamic analysis state. Their work studies control-flow analyses executed on CPUs. Scaling precise DNN certification involves computations over large tensors and has CPU-GPU dependencies. Scepter uses structural semantics to derive intermediate tensor descriptors without numerical coefficients and transforms eligible coefficient-dependent traversals into structural ones. This allows the corresponding CPU computation to be performed before GPU execution, producing a sequence of numerical calls available to the tensor compiler.
Sparse representations and compilation. TACO [10 ] and Finch [3 ] generate sparse iteration code for given tensor computations using properties of their storage formats. Scepter instead executes descriptor-dependent analysis control ahead of certification, deriving a sequence of numerical tensor calls that remains valid across compatible numerical inputs. Sympiler [6 ] predicts intermediate sparsity using symbolic inspectors designed for particular sparse matrix algorithms. Our structural semantics instead composes rules for tensor operations, providing one specialization procedure across arbitrary certifiers without a separate symbolic inspector for each analysis.
Conclusion
We presented Scepter, a framework that uses structural semantics to scale precise DNN abstract interpreters. Scepter separates structural computation from numerical evaluation and generates executable code specialized to a fixed architecture. The code is reusable across certification runs and enables tensor compilation and memory planning. We prove that specialization preserves the interpreter’s bounds in exact arithmetic. Across eight abstract interpreters and 44 DNNs, Scepter achieves runtime speedups of one to two orders of magnitude and scales DeepPoly to ResNet50 and VGG-16, which none of the evaluated DeepPoly baselines completes. These runtime gains also allow input splitting to prove additional properties within the same time budget.
References
Structural Semantics of g-BCSR
This appendix gives the definitions and proofs used in § 4 . We first describe the block types and relate the structural block model to Neuton’s representation. We then define the auxiliary functions used by the structural rules and explain the result-type calculations. Finally, we prove operation correctness and descriptor propagation through sequences. The reference procedures retain the operational design of Neuton [15 ] . Our structural rules separate their descriptor computation from the numerical calls.
Tensor Representation and Block Types
For a fixed index domain Ω \Omega Ω , we abbreviate the structural type ( Ω , S , ≈ ) (\Omega,\mathcal{S},\approx) ( Ω , S , ≈ ) by ( S , ≈ ) (\mathcal{S},\approx) ( S , ≈ ) . Type comparisons use this common domain; descriptors retain the domain of each block as in Definition 4.2 . The implementation stores a core as a tensor and represents the quotient map ι ↦ [ ι ] ≈ \iota\mapsto[\iota]_{\approx} ι ↦ [ ι ] ≈ by an index map ψ \psi ψ into that core. An index in the block’s support reads its mapped core entry; other indices in the block hold zero. Positions outside all block boxes take the tensor background. Some physical core entries may be unused, so the allocated core can contain more entries than the number of sharing classes.
Named Block Types
The named block types describe the sparsity and sharing patterns of DNN coefficient tensors. A block is indexed by a row space R \mathcal{R} R and a column space C \mathcal{C} C , the neurons of two layers, and we index it by a pair ι = ( ρ , γ ) \iota=(\rho,\gamma) ι = ( ρ , γ ) with ρ ∈ R \rho\in\mathcal{R} ρ ∈ R and γ ∈ C \gamma\in\mathcal{C} γ ∈ C . Four of the six types below are defined over arbitrary index spaces. The remaining two arise from convolutional layers and require the spatial structure of such a layer, for which we fix the following conventions. Write [ m ] = { 0 , … , m − 1 } [m]=\{0,\ldots,m-1\} [ m ] = { 0 , … , m − 1 } . The column space factors as c c c channels and i i i spatial positions and the row space as K K K channels and o o o positions, so that a position is a pair of pairs ( ( κ , a ) , ( γ , y ) ) ((\kappa,a),(\gamma,y)) (( κ , a ) , ( γ , y )) with κ ∈ [ K ] \kappa\in[K] κ ∈ [ K ] , a ∈ [ o ] a\in[o] a ∈ [ o ] , γ ∈ [ c ] \gamma\in[c] γ ∈ [ c ] and y ∈ [ i ] y\in[i] y ∈ [ i ] . All spatial reasoning here is one-dimensional; the two-dimensional case is the product of two independent copies and every statement extends componentwise.
A convolution carries three further parameters, θ = ( k , s , p ) \theta=(k,s,p) θ = ( k , s , p ) for kernel extent, stride and padding. Output position a a a reads the k k k consecutive input positions beginning at a s − p as-p a s − p , of which only those inside [ i ] [i] [ i ] exist, so the window of a a a is
W θ ( a ) = { a s − p + d : d ∈ [ k ] } ∩ [ i ] . W_{\theta}(a)=\{as-p+d:d\in[k]\}\cap[i]. W θ ( a ) = { a s − p + d : d ∈ [ k ]} ∩ [ i ] .
For the first convolution of the running example, with k = 3 k=3 k = 3 , s = 1 s=1 s = 1 , p = 0 p=0 p = 0 and i = 7 i=7 i = 7 , this gives W ( 0 ) = { 0 , 1 , 2 } W(0)=\{0,1,2\} W ( 0 ) = { 0 , 1 , 2 } , W ( 1 ) = { 1 , 2 , 3 } W(1)=\{1,2,3\} W ( 1 ) = { 1 , 2 , 3 } and so on up to W ( 4 ) = { 4 , 5 , 6 } W(4)=\{4,5,6\} W ( 4 ) = { 4 , 5 , 6 } . The window of a row is the block L 2 1 L^1_2 L 2 1 in Figure 3 . The window pattern S θ \mathcal{S}_{\theta} S θ is the set of positions whose column lies in the window of its row, { ( ( κ , a ) , ( γ , y ) ) : y ∈ W θ ( a ) } \{((\kappa,a),(\gamma,y)):y\in W_{\theta}(a)\} {(( κ , a ) , ( γ , y )) : y ∈ W θ ( a )} , over all channel pairs. A window is clipped when a s − p < 0 as-p<0 a s − p < 0 or a s − p + k − 1 ≥ i as-p+k-1\geq i a s − p + k − 1 ≥ i , in which case ∣ W θ ( a ) ∣ < k |W_{\theta}(a)|<k ∣ W θ ( a ) ∣ < k , and we write χ = k o − ∑ a ∈ [ o ] ∣ W θ ( a ) ∣ \chi=ko-\sum_{a\in[o]}|W_{\theta}(a)| χ = k o − ∑ a ∈ [ o ] ∣ W θ ( a ) ∣ for the number of spatial positions removed by clipping per channel pair. For the coefficient block of a convolutional layer, §A.1.2 derives the output extent o = ⌊ ( i + 2 p − k ) / s ⌋ + 1 o=\lfloor(i+2p-k)/s\rfloor+1 o = ⌊( i + 2 p − k ) / s ⌋ + 1 from the same reading. The types below do not require it: o o o and i i i are the extents of the block, and p p p may be any integer.
Definition A.1 (The g-BCSR block types). Write T \mathsf{T} T for the set of all positions of a block’s box and = = = for the identity relation, which relates no two distinct positions. Four types are defined over arbitrary index spaces:
(a) DenseBlock = ( T , = ) \operatorname{DenseBlock}=(\mathsf{T},=) DenseBlock = ( T , = ) . Its support is the whole domain, and no two distinct positions are related. Any block whose structure matches none of the types below falls back to DenseBlock, whose core is the block itself and whose index map is the identity. It stores ∣ R ∣ ⋅ ∣ C ∣ |\mathcal{R}|\cdot|\mathcal{C}| ∣ R ∣ ⋅ ∣ C ∣ values.
(b) DiagonalBlock = { ( ( ρ , ρ ) : ρ ∈ R ) , = } \operatorname{DiagonalBlock}=\{((\rho,\rho):\rho\in\mathcal{R}),=\} DiagonalBlock = {(( ρ , ρ ) : ρ ∈ R ) , = } , defined when R = C \mathcal{R}=\mathcal{C} R = C . All the non-zero entries lie on a single diagonal, which arises when the expression of a neuron references exactly
one other neuron, e.g., when computing the bounds of a ReLU layer. The core stores the diagonal entries, so the block stores ∣ R ∣ |R| ∣ R ∣ values.
(c) BroadcastBlockj _j j = ( ⊤ , ≈ j ) = (\top, \approx_j) = ( ⊤ , ≈ j ) , where ≈ j \approx_j ≈ j relates two positions that agree on every axis but the j j j th. The block has full support and one slice repeated along axis j j j , which arises when an operand is broadcast against another of higher rank. The core stores the slice. We drop the subscript where the axis is clear.
(d) UniformBlock = ( ⊤ , ⊤ × ⊤ ) = (\top, \top\times\top) = ( ⊤ , ⊤ × ⊤ ) . The block has full support with every position in a single class, which arises from a scalar literal in a specification. The core stores one value.
The remaining two types are those of a convolutional layer, and use the spatial conventions fixed above:
(e) StencilBlockθ _\theta θ = ( S θ , ≈ θ ) = (S_\theta, \approx_\theta) = ( S θ , ≈ θ ) , where ( ( κ , a ) , ( γ , y ) ) ≈ θ ( ( κ ′ , a ′ ) , ( γ ′ , y ′ ) ) ((\kappa, a), (\gamma, y)) \approx_\theta((\kappa', a'), (\gamma', y')) (( κ , a ) , ( γ , y )) ≈ θ (( κ ′ , a ′ ) , ( γ ′ , y ′ )) exactly when κ = κ ′ \kappa= \kappa' κ = κ ′ , γ = γ ′ \gamma= \gamma' γ = γ ′ and y − a s = y ′ − a ′ s y-as = y'-a's y − a s = y ′ − a ′ s . In a convolutional layer each output neuron is an affine combination of a fixed-size window of the input, with weights shared across all spatial positions, so the coefficient block of such a layer has a shifted-repeat structure: before clipping, each row has k k k kernel positions per input channel, shifted by a s as a s relative to spatial position 0. The core stores the kernel values once and θ \theta θ encodes the shift pattern, so the core holds K c k Kck K c k values.
(f) WindowBlockθ _\theta θ = ( S θ , = ) = (S_\theta, =) = ( S θ , = ) . The support of a convolution with no sharing. This arises for certifiers that maintain per-neuron polyhedral expressions over a previous layer, e.g., after backsubstituting through a convolutional layer: the non-zero entries of each row occupy the window of that row, and different rows carry unrelated values. The core stores the entries of every window and θ \theta θ encodes where each window begins and ends. The block has K c ( k o − χ ) K_c(k_o-\chi) K c ( k o − χ ) values, which the implementation stores in a core of K c k o K_ck_o K c k o entries, one window of extent k k k per output position.
The list separates the two sources of compression. DiagonalBlock constrains only the support, and UniformBlock and BroadcastBlock constrain only the sharing. StencilBlockθ _\theta θ and WindowBlockθ _\theta θ have the same support and differ only in ≈ \approx ≈ . The cost of the last pair differs by the number of output positions: ignoring clipping, WindowBlockθ _\theta θ stores K c k o K_ck_o K c k o values where StencilBlockθ _\theta θ stores K c k K_ck K c k , a ratio of o o o , which is 1024 for a 32 × 32 feature map.
Index Maps and the Structural Model
The named types admit compact index maps. The map sends a position in a block’s support to the core entry that stores its value. The following maps use the convolution coordinates fixed above. For the coefficient block of a convolutional layer, the output positions are those whose window lies within the padded input [ − p , i + p ) [-p, i+p) [ − p , i + p ) . The last of them, a = o − 1 a=o-1 a = o − 1 , is the largest with a s − p + k ≤ i + p as-p+k \le i+p a s − p + k ≤ i + p , so ( o − 1 ) s ≤ i + 2 p − k (o-1)s \le i+2p-k ( o − 1 ) s ≤ i + 2 p − k and
o = ⌊ ( i + 2 p − k ) / s ⌋ + 1. o = \lfloor(i+2p-k)/s \rfloor+ 1. o = ⌊( i + 2 p − k ) / s ⌋ + 1.
The block types do not require this equation, and §A.2.3 uses blocks that do not satisfy it.
The index maps of the named types are then as follows.
Table 11.
WindowBlock and StencilBlock differ only in whether the output index a a a survives into the core index. Dropping a a a makes the same kernel entry serve every output position.
Lemma A.2 (Correspondence of the block models). Let an index-map block on Ω \Omega Ω have a finite core index set Q Q Q , a core c : Q → R c: Q \to\mathbb{R} c : Q → R , and a partial map ψ : Ω ⇀ Q \psi: \Omega\rightharpoonup Q ψ : Ω ⇀ Q . Its lookup returns c [ ψ ( ι ) ] c[\psi(\iota)] c [ ψ ( ι )] when ψ ( ι ) \psi(\iota) ψ ( ι ) is defined and zero otherwise. Set
S = dom ψ , ι ≈ ι ′ ⟺ ψ ( ι ) = ψ ( ι ′ ) ( ι , ι ′ ∈ S ) , S = \operatorname{dom}\psi,\qquad\iota\approx\iota' \Longleftrightarrow\psi(\iota) = \psi(\iota')\quad(\iota,\iota' \in S), S = dom ψ , ι ≈ ι ′ ⟺ ψ ( ι ) = ψ ( ι ′ ) ( ι , ι ′ ∈ S ) , b [ [ ι ] ≈ ] = c [ ψ ( ι ) ] . b[[\iota]_{\approx}] = c[\psi(\iota)]. b [[ ι ] ≈ ] = c [ ψ ( ι )] . Then B = ( Ω , S , ≈ , b ) B = (\Omega,S,\approx,b) B = ( Ω , S , ≈ , b ) has the same array denotation as the index-map block. Applying this construction to each block while retaining the tensor’s background, positions, and shape preserves the tensor denotation.
Proof. The fibers of ψ \psi ψ form the equivalence classes of ≈ \approx ≈ , so b b b is well defined. At an index in S S S , both lookups return c [ ψ ( ι ) ] c[\psi(\iota)] c [ ψ ( ι )] ; outside S S S , both return zero. Tensor lookup selects the same block at each covered position and the same background elsewhere. Physical core entries outside im ψ \operatorname{im}\psi im ψ are unobserved and need not be retained by this construction. The conclusion therefore concerns dense values, without identifying physical core arrays with quotient-indexed cores. □ \square □
Type Ordering
Lemma A.3. For a block type τ \tau τ , the real tensors in ⟦ τ ⟧ \llbracket\tau\rrbracket [ [ τ ] ] form a linear subspace whose dimension is the number of ≈ \approx ≈ -classes.
Proof. Addition and scalar multiplication preserve both constraints. Positions outside the support remain zero, and positions in one sharing class remain equal. The zero tensor satisfies every type. Each admitted tensor is determined by one freely chosen real value per sharing class, so this subspace is isomorphic to R N \mathbb{R}^{N} R N for N N N classes. □ \square □
The number of classes is the number of values a block of type τ \tau τ holds, which can differ from the storage the implementation allocates for it. A window is clipped when a s − p < 0 as-p < 0 a s − p < 0 or a s − p + k − 1 ≥ i as-p+k-1 \ge i a s − p + k − 1 ≥ i , in which case ∣ W θ ( a ) ∣ < k |W_{\theta}(a)| < k ∣ W θ ( a ) ∣ < k , and we write χ = k o − ∑ a ∈ [ o ] ∣ W θ ( a ) ∣ \chi= k_o - \sum_{a \in[o]} |W_{\theta}(a)| χ = k o − ∑ a ∈ [ o ] ∣ W θ ( a ) ∣ for the number of spatial positions removed by clipping per channel pair. For WindowBlockθ _\theta θ there are K c ( k o − χ ) K_c(k_o-\chi) K c ( k o − χ ) classes, and the implementation stores a core of K c k o K_ck_o K c k o entries, one window of extent k k k per output position. The core of a type can therefore have entries that no position maps to, and widening a block need not increase the storage that the implementation allocates. For StencilBlockθ _\theta θ there are K c K_c K c classes for each kernel offset d ∈ [ k ] d \in[k] d ∈ [ k ] that some output position reads, and the implementation stores the whole kernel, K c k K_ck K c k entries. The two counts differ when the input is too small for some offset to be read: with i = o = 1 i=o=1 i = o = 1 and θ = ( 3 , 1 , 1 ) \theta=(3,1,1) θ = ( 3 , 1 , 1 ) , only the middle offset is read, and there are K c K_c K c classes.
Block types are ordered by containment of the tensors they admit. We write τ ⊑ τ ′ \tau\sqsubseteq\tau' τ ⊑ τ ′ when ⟦ τ ⟧ ⊆ ⟦ τ ′ ⟧ \llbracket\tau\rrbracket\subseteq\llbracket\tau'\rrbracket [ [ τ ] ] ⊆ [ [ τ ′ ] ] , so that
S t e n c i l B l o c k θ ⊑ W i n d o w B l o c k θ ⊑ D e n s e B l o c k , U n i f o r m B l o c k ⊑ B r o a d c a s t B l o c k j ⊑ D e n s e B l o c k , D i a g o n a l B l o c k ⊑ D e n s e B l o c k . \begin{aligned}
\mathrm{StencilBlock}_{\theta} &\sqsubseteq\mathrm{WindowBlock}_{\theta} \sqsubseteq\mathrm{DenseBlock},\\
\mathrm{UniformBlock} &\sqsubseteq\mathrm{BroadcastBlock}_{j} \sqsubseteq\mathrm{DenseBlock},\\
\mathrm{DiagonalBlock} &\sqsubseteq\mathrm{DenseBlock}.
\end{aligned} StencilBlock θ UniformBlock DiagonalBlock ⊑ WindowBlock θ ⊑ DenseBlock , ⊑ BroadcastBlock j ⊑ DenseBlock , ⊑ DenseBlock .
By Lemma A.3, τ ⊑ τ ′ \tau\sqsubseteq\tau' τ ⊑ τ ′ implies that τ \tau τ has no more ≈ \approx ≈ -classes than τ ′ \tau' τ ′ ; the stencil, window, and dense types have at most K c k K_ck K c k , exactly K c ( k o − χ ) K_c(k_o-\chi) K c ( k o − χ ) , and ∣ R ∣ ∣ C ∣ |\mathcal{R}||\mathcal{C}| ∣ R ∣∣ C ∣ classes. Some edges of the order depend on the parameters. Over three positions, StencilBlock( 1 , 1 , 0 ) ⊑ _{(1,1,0)} \sqsubseteq ( 1 , 1 , 0 ) ⊑ StencilBlock( 3 , 1 , 1 ) _{(3,1,1)} ( 3 , 1 , 1 ) , since the kernel [ a ] [a] [ a ] is the kernel [ 0 , a , 0 ] [0,a,0] [ 0 , a , 0 ] with one position of padding, and DiagonalBlock ⊑ \sqsubseteq ⊑ WindowBlockθ _\theta θ whenever the diagonal lies in S θ S_\theta S θ . Figure 14 shows the edges that hold for all parameters. A block of type τ \tau τ is also a block of every τ ′ ⊒ τ \tau' \sqsupseteq\tau τ ′ ⊒ τ , so widening is always available. It preserves the tensor that the block denotes, and since the wider type has at least as many ≈ \approx ≈ -classes, it can lose compression and increase the arithmetic of the kernels. The storage that the implementation allocates need not grow, since the core of a type can have entries that no position maps to (as described at the start of this appendix). Widening gives a fallback: where no rule below applies, we widen to DenseBlock.
Figure 14. Order on the named block types. Higher types admit more tensors; the diagram shows relations valid for all parameters, not the full lattice. Labels count stored value classes: K K K , c c c are channel counts, o o o the output extent, k k k the kernel extent, and χ \chi χ the number of clipped window positions; R \mathcal{R} R and C C C are the row and column spaces. The stencil count assumes every kernel offset is read; n n n is the diagonal extent.
The full family of support-and-sharing types on a finite box forms a lattice (Lemma A.4), although the six named types need not contain its joins or meets. Specialization requires a sound, deterministic result type; it does not require a least result type or lattice meets.
Throughout this subsection the two operands’ types are read on a common ambient index space, with every position outside a support treated as a known zero. The positions outside a support are related to one another as well as to themselves, since all of them hold the same value. The convention preserves the equalities between known zeros, which the intersection of two sharing relations would otherwise forget. Relating each off-support position only to itself would give Zero⊔ \sqcup ⊔ UniformBlock = DenseBlock, since the identity relation of the first operand meets the all-relation of the second in the identity, whereas every matrix of either type is constant and UniformBlock admits them all. Relating the off-support positions to one another gives UniformBlock.
With this convention, the union-of-supports and intersection-of-relations construction is
τ 1 ⊔ τ 2 = ( S 1 ∪ S 2 , ( ≈ ~ 1 ∩ ≈ ~ 2 ) ∣ S 1 ∪ S 2 ) , (5) \tau_1 \sqcup\tau_2 = \left(S_1 \cup S_2,(\widetilde{\approx}_1 \cap\widetilde{\approx}_2)|_{S_1\cup S_2}\right), \tag*{(5)} τ 1 ⊔ τ 2 = ( S 1 ∪ S 2 , ( ≈ 1 ∩ ≈ 2 ) ∣ S 1 ∪ S 2 ) , (5)
where ≈ ~ j \widetilde{\approx}_j ≈ j extends ≈ j \approx_j ≈ j by relating all positions outside S j S_j S j to one another. Element-wise multiplication uses the intersection of supports with the same intersection of extended sharing relations, restricted to that support. This operation is not the lattice meet: an equality guaranteed by only one operand need not survive multiplication.
Lemma A.4 (Type lattice). On a fixed finite box, the support-and-sharing types ordered by semantic inclusion form a lattice. Their join is the union-of-supports and intersection-of-extended-relations construction of Equation (5) . Their meet denotes the intersection of their sets of tensors.
Proof. Represent a type by equations x l = 0 x_l = 0 x l = 0 outside its support and x l = x l ′ x_l = x_{l'} x l = x l ′ for each sharing class. Conjoining the equations for two types represents their intersection: take the equivalence closure of all equality constraints, mark a class zero if it contains a position forced to zero by either type, remove these classes from the support, and retain the remaining classes as the sharing relation. This gives a type and is the greatest lower bound by its denotation.
For the join, every position possible in either operand must be in the support of an upper bound: it can be assigned a nonzero value in that operand. A pair of positions must be equal in every tensor of one type exactly when they lie in the same sharing class or are both outside its support. Thus any equality imposed by an upper bound must belong to both extended relations. The construction keeps exactly these equalities over the union of the supports. It admits both operand types, and every upper bound admits it, so it is their least upper bound. The empty support and full support with independent entries give bottom and top. Since the box is finite, so is the family of types; these operations also yield joins and meets of arbitrary families. □
Structural Rules for Tensor Operations
The rules of § 4.2 first operate on two blocks over a common region, then combine their results into a tensor. We follow the same order here. The regional rules use the block types to choose the output representation and numerical calls. For complete tensors, refinement and alignment identify the regional operands. These choices use descriptors; the recorded calls compute the numerical cores.
A.2.1 Operations on Blocks. The three rules operate on aligned operands over one local index domain. An operand is a symbolic pair ( τ , u ) (\tau,u) ( τ , u ) or a background marker d d d . The background d ′ d' d ′ of the eventual result tensor is fixed when applying the rules.
B-Identity handles a marker that is an identity on its operand side. It returns the other block’s type and core name, with no new numerical call. B-Annihilator handles an annihilator equal to d ′ d' d ′ and returns no block. Its result is represented by the tensor background. Both decisions inspect the marker’s descriptor value; neither tests a stored core for equality with an identity or annihilator.
B-Compute covers the remaining cases. Constant lifting first gives two block types on the same domain. The support and sharing construction of §A.2.2 yields a sound type in the full type lattice; the fixed library rule selects an admissible named type above it. The result need not be a least named type, and the element-wise multiplication rule is not the lattice meet. The rule then records the lifting calls followed by the numerical kernel, including any conversions needed for that selected type. Its result core name is fresh. Lemma A.15 proves these three cases; T-Elementwise composes their calls and places their outputs in the tensor. We define constant lifting below, then give the result-type calculation in §A.2.2.
Both tests depend on the operator, and the identity test also depends on the operand side. We use the following elements of a binary operator ⊙ \odot ⊙ .
A right identity 1 ⊙ R 1_{\odot}^{\mathrm{R}} 1 ⊙ R is a value such that x ⊙ 1 ⊙ R = x x \odot1_{\odot}^{\mathrm{R}} = x x ⊙ 1 ⊙ R = x for all x x x , and a left identity 1 ⊙ L 1_{\odot}^{\mathrm{L}} 1 ⊙ L is a value such that 1 ⊙ L ⊙ x = x 1_{\odot}^{\mathrm{L}} \odot x = x 1 ⊙ L ⊙ x = x for all x x x .
The annihilator element 0 ⊙ 0_{\odot} 0 ⊙ is the value such that x ⊙ 0 ⊙ = 0 ⊙ ⊙ x = 0 x \odot0_{\odot} = 0_{\odot} \odot x = 0 x ⊙ 0 ⊙ = 0 ⊙ ⊙ x = 0 for all x x x at which these are defined.
Table 4 lists them for the operators the library provides. Subtraction and division have a right identity and no left identity: 0 − x 0-x 0 − x and 1 ÷ x 1 \div x 1 ÷ x differ from x x x in general. We say that a background is an identity of ⊙ \odot ⊙ on its side if it is the background d 2 d_2 d 2 of T 2 \mathcal{T}_2 T 2 and equals 1 ⊙ R 1_{\odot}^{\mathrm{R}} 1 ⊙ R , or the background d 1 d_1 d 1 of T 1 \mathcal{T}_1 T 1 and equals 1 ⊙ L 1_{\odot}^{\mathrm{L}} 1 ⊙ L .
Table 4. Identity and annihilator elements of the element-wise operators. A dash marks an operator with no such element.
The predicate id j ( ⊙ , d ) \operatorname{id}_{j}(\odot,d) id j ( ⊙ , d ) holds when d d d is an identity of ⊙ \odot ⊙ on side j j j , with side 1 on the left and side 2 on the right. The predicate ann ( ⊙ , d ) \operatorname{ann}(\odot,d) ann ( ⊙ , d ) holds when d d d is a two-sided annihilator of ⊙ \odot ⊙ . The condition d = d ′ d=d' d = d ′ in B-Annihilator ensures that omitting the output block represents the regional result correctly.
Constant lifting. For a region r r r with origin s r s_r s r , let Ω r = { ι − s r : ι ∈ r } \Omega_r=\{\iota-s_r:\iota\in r\} Ω r = { ι − s r : ι ∈ r } be its local index domain. Set τ c , r = ( Ω r , Ω r , Ω r × Ω r ) \tau_{c,r}=(\Omega_r,\Omega_r,\Omega_r\times\Omega_r) τ c , r = ( Ω r , Ω r , Ω r × Ω r ) and define
L r ( ( τ , u ) ) = ( τ , u , ϵ ) , L_r((\tau,u))=(\tau,u,\epsilon), L r (( τ , u )) = ( τ , u , ϵ ) ,
L r ( d ) = ( τ c , r , c , [ c ← ( d ) ] ) , c fresh . L_r(d)=(\tau_{c,r},c,[c\leftarrow(d)]),\qquad c\text{ fresh}. L r ( d ) = ( τ c , r , c , [ c ← ( d )]) , c fresh .
The recorded assignment constructs the one-entry core ( d ) (d) ( d ) . For regional operands, Lift r \operatorname{Lift}_r Lift r is defined exactly when neither B-Identity nor B-Annihilator applies, and then
( τ ℓ , u ℓ , λ ℓ ) = L r ( β ℓ ) ( ℓ = 1 , 2 ) , (\tau_\ell,u_\ell,\lambda_\ell)=L_r(\beta_\ell)\qquad(\ell=1,2), ( τ ℓ , u ℓ , λ ℓ ) = L r ( β ℓ ) ( ℓ = 1 , 2 ) ,
Lift r ( β ⃗ ) = ( ( τ 1 , τ 2 ) , ( u 1 , u 2 ) , λ 1 ; λ 2 ) . \operatorname{Lift}_r(\vec{\beta})=((\tau_1,\tau_2),(u_1,u_2),\lambda_1;\lambda_2). Lift r ( β ) = (( τ 1 , τ 2 ) , ( u 1 , u 2 ) , λ 1 ; λ 2 ) .
Lifting inspects the type or background marker and records numerical construction; it does not read any numerical core.
A.2.2 Result Types. Take two block types over the same index domain. Every position outside an operand’s support holds 0 by Definition 4.1 , independently of its tensor’s background, so the structural result type depends on how ⊙ \odot ⊙ treats 0. These are the type computations used by B-Compute after any constant lifting.
Definition A.5 (Disjunctive and conjunctive operators). A binary operator ⊙ \odot ⊙ is conjunctive at 0 if 0 is its annihilator, and disjunctive at 0 if 0 ⊙ 0 = 0 0\odot0=0 0 ⊙ 0 = 0 and 0 is not its annihilator.
Addition, subtraction, maximum, minimum and disjunction are disjunctive at 0, as are the strict comparisons and ≠ \ne = , since 0 < 0 0<0 0 < 0 and 0 ≠ 0 0\ne0 0 = 0 are false and false is the zero of the Boolean semiring. Multiplication and conjunction are conjunctive at 0. Four operators are neither: ≤ \le ≤ , ≥ \ge ≥ and = = = return true at ( 0 , 0 ) (0,0) ( 0 , 0 ) , and 0 ÷ 0 0\div0 0 ÷ 0 is undefined, so for these we compute the region and assign the result the type DenseBlock.
In the conjunctive case a position at which either operand lies outside its support contributes 0, so the support of the result is contained in the intersection of the two supports. In the disjunctive case only a position at which both operands lie outside their supports is guaranteed to contribute 0, so the support of the result is contained in their union:
supp ( A ⊙ B ) ⊆ { supp ( A ) ∪ supp ( B ) disjunctive , supp ( A ) ∩ supp ( B ) conjunctive . (6) \operatorname{supp}(A\odot B)\subseteq
\begin{cases}
\operatorname{supp}(A)\cup\operatorname{supp}(B) & \text{disjunctive},\\
\operatorname{supp}(A)\cap\operatorname{supp}(B) & \text{conjunctive}.
\end{cases} \tag*{(6)} supp ( A ⊙ B ) ⊆ { supp ( A ) ∪ supp ( B ) supp ( A ) ∩ supp ( B ) disjunctive , conjunctive . (6)
A diagonal tensor added to a dense tensor is therefore dense, while a diagonal tensor multiplied element-wise by a dense tensor is diagonal.
The sharing relations are intersected in either case, since two positions of the result are guaranteed to be equal whenever both operands constrain them to be equal. Here each sharing relation is read over the whole box, with the positions outside its support related to one another, since all of them hold 0. The intersection of two relations read this way is an equivalence relation on the box, and we restrict it to the support of the result. Define
τ 1 ⊔ τ 2 = ( S 1 ∪ S 2 , ( ≈ ^ 1 ∩ ≈ ^ 2 ) ∣ S 1 ∪ S 2 ) , \tau_1\sqcup\tau_2=(S_1\cup S_2,(\hat{\approx}_1\cap\hat{\approx}_2)|_{S_1\cup S_2}), τ 1 ⊔ τ 2 = ( S 1 ∪ S 2 , ( ≈ ^ 1 ∩ ≈ ^ 2 ) ∣ S 1 ∪ S 2 ) ,
τ 1 ⊓ τ 2 = ( S 1 ∩ S 2 , ( ≈ ^ 1 ∩ ≈ ^ 2 ) ∣ S 1 ∩ S 2 ) . \tau_1\sqcap\tau_2=(S_1\cap S_2,(\hat{\approx}_1\cap\hat{\approx}_2)|_{S_1\cap S_2}). τ 1 ⊓ τ 2 = ( S 1 ∩ S 2 , ( ≈ ^ 1 ∩ ≈ ^ 2 ) ∣ S 1 ∩ S 2 ) .
where the hats denote the extensions of the equation in Fig. 7a. These constructions give sound structural result types for disjunctive and conjunctive operators, respectively. The operation ⊔ \sqcup ⊔ is the join of the full type order. The operation ⊓ \sqcap ⊓ is not its meet: a meet combines constraints from both operands, whereas multiplication preserves only equalities guaranteed by both. The constructions apply to all six named families, including the full-support types UniformBlock and BroadcastBlock.
Selecting a named result type. A structural result need not belong to a named family. The fixed library rule ⊙ \odot ⊙ therefore selects an admissible named type above it, using DenseBlock when necessary. Selection can enlarge support or forget sharing, but every defined dense result remains admitted. It depends on types and operator parameters, not the core values. Table 5 records the choices for the four displayed families, with matching window parameters. It does not specify every pair among the six families; other cases use the same support/sharing construction and the fixed library selection policy, with the dense fallback. We derive the displayed entries below after establishing support and sharing propagation.
Table 5. Result types for element-wise operations over a region that both operands cover. Top: operators disjunctive at 0 (+ + + , − - − , max, min, the strict comparisons, ≠ \ne = , ∨ \lor ∨ ). Bottom: operators conjunctive at 0 (× \times × , ∧ \land ∧ ). The two differ only in whether supports are united or intersected. An asterisk marks an entry that can be strictly above the result of ⊔ \sqcup ⊔ or ∧ \wedge ∧ . The accompanying text derives each entry.
Lemma A.6 (Support propagation). Let A ⊙ B A \odot B A ⊙ B be defined. If ⊙ \odot ⊙ is disjunctive at 0 (Definition A.5) then supp ( A ⊙ B ) ⊆ supp ( A ) ∪ supp ( B ) \operatorname{supp}(A \odot B) \subseteq\operatorname{supp}(A) \cup\operatorname{supp}(B) supp ( A ⊙ B ) ⊆ supp ( A ) ∪ supp ( B ) ; if it is conjunctive at 0 then supp ( A ⊙ B ) ⊆ supp ( A ) ∩ supp ( B ) \operatorname{supp}(A \odot B) \subseteq\operatorname{supp}(A) \cap\operatorname{supp}(B) supp ( A ⊙ B ) ⊆ supp ( A ) ∩ supp ( B ) .
Proof. Entrywise. If ι \iota ι lies outside both supports then A [ ι ] = B [ ι ] = 0 A[\iota] = B[\iota] = 0 A [ ι ] = B [ ι ] = 0 and 0 ⊙ 0 = 0 0 \odot0 = 0 0 ⊙ 0 = 0 , which the disjunctive case assumes and the conjunctive case gives by annihilation. If ι \iota ι lies outside supp ( A ) \operatorname{supp}(A) supp ( A ) alone then A [ ι ] = 0 A[\iota] = 0 A [ ι ] = 0 and the conjunctive case gives 0 by annihilation, and symmetrically for B B B . □ \square □
Both inclusions are conservative and neither is attained in general. The operator x ⊙ y = y x \odot y = y x ⊙ y = y is disjunctive at 0, yet supp ( A ⊙ B ) = supp ( B ) \operatorname{supp}(A \odot B) = \operatorname{supp}(B) supp ( A ⊙ B ) = supp ( B ) , which is a proper subset of the union whenever A A A has support outside B B B ’s. We use the inclusions as transfer rules and claim no tightness for them; a rule that over-approximates the support assigns a wider type, which the fallback property of §A.1 makes sound.
Lemma A.7 (Sharing propagation). Let A ∈ [ τ 1 ] A \in[\tau_1] A ∈ [ τ 1 ] and B ∈ [ τ 2 ] B \in[\tau_2] B ∈ [ τ 2 ] , and suppose A ⊙ B A \odot B A ⊙ B is defined. If ι ∼ ~ 1 ι ′ \iota\mathrel{\tilde{\sim}_1} \iota' ι ∼ ~ 1 ι ′ and ι ∼ ~ 2 ι ′ \iota\mathrel{\tilde{\sim}_2} \iota' ι ∼ ~ 2 ι ′ , then ( A ⊙ B ) [ ι ] = ( A ⊙ B ) [ ι ′ ] (A \odot B)[\iota] = (A \odot B)[\iota'] ( A ⊙ B ) [ ι ] = ( A ⊙ B ) [ ι ′ ] .
Proof. For each operand, the two positions either share a core entry or both lie outside its support and hold zero. Thus both operands take equal values at the two positions, and applying the same scalar operation gives equal result values. □ \square □
The converse fails, so ∧ \land ∧ is a sound rule and not a complete one. Taking ⊙ \odot ⊙ to be multiplication and τ 1 \tau_1 τ 1 the type whose every matrix is zero, the result is zero at both positions however ≈ 2 \mathrel{\approx_2} ≈ 2 relates them, so the shared-equality hypothesis is not necessary. A rule that forgets an equality assigns a wider type, which is again sound by the fallback property.
These lemmas justify the support and sharing calculations in the equation in Fig. 7a. The operation ⊔ \sqcup ⊔ is the join of the type order: it is the least type admitting every matrix of either operand type. The operation ∧ \wedge ∧ retains only equalities guaranteed by both operands, as required by Lemma A.7. In contrast, the lattice meet conjoins the two sets of constraints and can impose additional equalities that multiplication does not preserve.
The entries of Table 5 follow by computing ⊔ \sqcup ⊔ and ∧ \wedge ∧ on the named types. Write Δ \Delta Δ for the diagonal.
Two window types with the same parameters share the support S θ S_\theta S θ . Intersecting ≈ θ \approx_\theta ≈ θ with itself gives ≈ θ \approx_\theta ≈ θ , and intersecting it with the identity relation gives the identity, so the results are StencilBlockθ _\theta θ for two StencilBlockθ _\theta θ operands and WindowBlockθ _\theta θ otherwise, under either operation.
Under ⊔ \sqcup ⊔ , a type combined with DenseBlock has full support and the identity relation, which is DenseBlock. Under ∧ \wedge ∧ it keeps its own support and has the identity relation, which is WindowBlockθ _\theta θ for both window types and DiagonalBlock for DiagonalBlock.
Two DiagonalBlock operands give DiagonalBlock under either operation.
A window type combined with DiagonalBlock under ∧ \wedge ∧ has support S θ ∩ Δ S_\theta\cap\Delta S θ ∩ Δ and the identity relation, which DiagonalBlock admits. It equals DiagonalBlock when Δ ⊆ S θ \Delta\subseteq S_\theta Δ ⊆ S θ , and lies strictly below it otherwise.
A window type combined with DiagonalBlock under ⊔ \sqcup ⊔ has support S θ ∪ Δ S_\theta\cup\Delta S θ ∪ Δ , and the table assigns DenseBlock. When Δ ⊆ S θ \Delta\subseteq S_\theta Δ ⊆ S θ , WindowBlockθ _\theta θ also admits the result.
The last two items are the entries Table 5 marks with an asterisk.
Refinement and Alignment
The block rules require both operands to be described over the same region. The tensor rule obtains these regions by refining the operand block boxes. For layer-aligned operands, the boxes coincide or are disjoint, as in Figure 15 a. Partially overlapping boxes require splitting or materialization, as in Figure 15 b.
Figure 15. A common refinement of two block lists. (a) Aligned operands: the boxes coincide or are disjoint, and each block is a cell. (b) Partially overlapping operands: splitting the union into rectangles gives five cells; the dotted outline is the bounding box that merging would use instead.
Write box ( B ) \operatorname{box}(B) box ( B ) for the box a block occupies. Two blocks overlap if their boxes intersect.
Definition A.8 (Common refinement). A common refinement of two block lists is a finite set of pairwise disjoint boxes r t r_t r t with labels L t = ( L t 1 , L t 2 ) L_t = (L_t^1,L_t^2) L t = ( L t 1 , L t 2 ) such that the r t r_t r t cover the union of all the boxes, and for each t t t and each operand l l l , the set L t l L_t^l L t l collects the blocks of operand l l l whose box contains r t r_t r t , with no block of operand l l l partially overlapping r t r_t r t .
The construction first groups the blocks of both operands by overlap. Grouping is transitive: if a block B 1 B_1 B 1 of the first operand overlaps a block B 2 B_2 B 2 of the second, and B 2 B_2 B 2 overlaps another block B 3 B_3 B 3 of the first, then B 1 B_1 B 1 and B 3 B_3 B 3 belong to the same group even though they do not overlap, since both determine values in the region of B 2 B_2 B 2 . The groups are therefore the connected components of the graph whose vertices are the blocks of both operands and whose edges join overlapping blocks. Our implementation finds them by depth-first search; a union-find structure computes the same components. Distinct components occupy disjoint regions, so the construction resolves each independently.
A component is realized either by splitting it into smaller disjoint cells or by merging it into one cell. Splitting keeps the blocks small at the cost of extra bookkeeping: two overlapping boxes that differ along at most one axis split into three pieces along that axis, and the number of pieces grows once the boxes are offset along several axes, as in Figure 15 b. Merging is always possible, at the cost of the structure of the blocks. The construction splits a component when its boxes differ along at most one axis, pairwise into at most three pieces along that axis. Otherwise the component is merged : each operand’s blocks within the component are first materialized into a single block covering the component’s bounding box, padded with that operand’s background, the bounding box becomes one cell. Materialization is what makes the merge policy satisfy the second condition of Definition A.8 , since afterwards each operand contributes exactly one block to the cell. The output is therefore a common refinement of the block lists after materialization, in which the blocks of each merged component are replaced by the materialized ones, and uniformity, as well as the case analysis of the proof of Theorem A.16 , refers to these blocks.
Disjointness needs one step more. A component’s bounding box may be strictly larger than the union of its blocks and so may overlap other components, in which case emitting both cells would violate the first condition. Concretely, with A = [ 0 , 4 ) × [ 0 , 1 ) A = [0, 4) \times[0, 1) A = [ 0 , 4 ) × [ 0 , 1 ) and C = [ 2 , 3 ) × [ 2 , 3 ) C = [2, 3) \times[2, 3) C = [ 2 , 3 ) × [ 2 , 3 ) in the first operand and B = [ 0 , 1 ) × [ 0 , 4 ) B = [0, 1) \times[0, 4) B = [ 0 , 1 ) × [ 0 , 4 ) in the second, the blocks A A A and B B B overlap and their bounding box [ 0 , 4 ) × [ 0 , 4 ) [0, 4) \times[0, 4) [ 0 , 4 ) × [ 0 , 4 ) contains C C C , which overlaps neither. The construction therefore recomputes overlap components using the enlarged boxes and repeats whenever a new overlap joins distinct components. Each such nonterminal repetition merges at least two components, so the process terminates. At termination, no cells from distinct components overlap.
Lemma A.9 (Uniform cells). In the common refinement that the construction produces, each cell is contained in at most one block of each operand, after materialization, and the cells together cover every index that either operand covers.
Proof. The cells cover the union of the boxes by the first condition of Definition A.8 , and they are pairwise disjoint by the argument of the previous paragraph. A cell produced by splitting lies in at most one block of each operand, since the blocks of one operand are disjoint, and a cell produced by merging lies in exactly one materialized block of each operand. □
Lemma A.10 (Support-determinacy). The refinement that the construction above produces, including its choice between splitting and merging, is a function of the block boxes and the tensor shape alone. It does not depend on the core tensors, on the backgrounds, or on the operator.
Proof. Every choice of the construction is made on boxes. The overlap relation and its connected components are defined by box intersection; the choice between splitting and merging a component tests whether its boxes differ along at most one axis; the pieces of a split and the bounding box of a merge are computed from the boxes; and the recomputation of the components after an enlargement uses box intersection and containment again. None of these steps reads a core, a background or the operator. Materialization reads the background to fill the materialized block, but it does not change the box of that block, so it does not affect the cells.
Theorem 4.3 uses Lemma A.10 for the cells of an element-wise result.
Restriction and extension. The refinement produces cells that may be smaller or larger than the operand blocks, so each operand must be restricted or extended to the cell before the type rules apply. The types assigned are as follows. A restriction of DiagonalBlock keeps its type when the row and column ranges of the sub-box coincide, and a restriction of a window type keeps its type, with parameters θ ′ \theta' θ ′ , when the sub-box is a product in the sense below. The table assigns DenseBlock otherwise.
Table 12.
For the two window types, call a sub-box a product if, in the coordinates of Definition A.1, it is a range of output channels and positions beginning at ( κ 0 , a 0 ) (\kappa_0, a_0) ( κ 0 , a 0 ) together with a range of input channels and positions beginning at ( γ 0 , y 0 ) (\gamma_0,y_0) ( γ 0 , y 0 ) . Position ( a ′ , y ′ ) (a',y') ( a ′ , y ′ ) of such a sub-box is position ( a ′ + a 0 , y ′ + y 0 ) (a' + a_0,y' + y_0) ( a ′ + a 0 , y ′ + y 0 ) of the block, and
( y ′ + y 0 ) − ( a ′ + a 0 ) s + p = y ′ − a ′ s + p ′ , p ′ = p − a 0 s + y 0 (y' + y_0) - (a' + a_0)s + p = y' - a's + p', \qquad p' = p - a_0s + y_0 ( y ′ + y 0 ) − ( a ′ + a 0 ) s + p = y ′ − a ′ s + p ′ , p ′ = p − a 0 s + y 0
so it lies in the window of its row exactly when it does under θ ′ = ( k , s , p ′ ) \theta' = (k,s,p') θ ′ = ( k , s , p ′ ) , and it reads the same kernel offset. The restriction of a StencilBlockθ _\theta θ block is therefore the StencilBlockθ ′ _{\theta'} θ ′ block whose core is the kernel restricted to the selected channels, and the restriction of a WindowBlockθ _\theta θ block is the WindowBlockθ ′ _{\theta'} θ ′ block whose core holds the windows of the selected rows. The padding p ′ p' p ′ can be negative or exceed k k k , which the window definition allows. A sub-box of the flattened neurons of a layer need not be a product: a range of columns that ends inside a row of the image selects part of that row.
Lemma A.11 (Widening). Let β \beta β be a block of type τ \tau τ on a box r r r and let r ′ r' r ′ be a sub-box of r r r . Write τ ∣ r ′ \tau|_{r'} τ ∣ r ′ for the restriction of τ \tau τ to r ′ r' r ′ : the type whose support is supp ( τ ) ∩ r ′ \operatorname{supp}(\tau) \cap r' supp ( τ ) ∩ r ′ and whose sharing relation is that of τ \tau τ restricted to r ′ r' r ′ , both read in the index space of r ′ r' r ′ . Then the restriction of β \beta β to r ′ r' r ′ has type τ ∣ r ′ \tau|_{r'} τ ∣ r ′ , and the type assigned to it above lies above τ ∣ r ′ \tau|_{r'} τ ∣ r ′ in the order on types over r ′ r' r ′ . Extending β \beta β to a box r ′ ′ ⊇ r r'' \supseteq r r ′′ ⊇ r with a background of 0 gives a block of type τ \tau τ read in the index space of r ′ ′ r'' r ′′ , and extending it with any background gives a block that DenseBlock, the type assigned to it, admits.
Both comparisons in Lemma A.11 are made within one index space, since a type over r r r and a type over r ′ r' r ′ are not comparable. The type τ \tau τ read in the index space of r ′ ′ r'' r ′′ embeds the support and the sharing relation of τ \tau τ , and leaves the added positions outside the support. It is in general not the named type of τ \tau τ over r ′ ′ r'' r ′′ : extending the UniformBlock [5 ] by one position with background 0 gives [5, 0], which is not constant. The table therefore assigns DenseBlock to every extension.
Proof of Lemma A.11. Restriction removes positions and changes no value. The support can only shrink, and two surviving positions that were equal are still equal, so the restricted block has type τ ∣ r ′ \tau|_{r'} τ ∣ r ′ . Each type the table assigns to a restriction lies above type τ ∣ r ′ \tau|_{r'} τ ∣ r ′ : DenseBlock lies above every type, the restrictions of UniformBlock and BroadcastBlock remain constant and repeated along the same axis, a sub-box whose row and column ranges coincide contains the diagonal of its own index space and no other position of the support, and the paragraph above shows that the restriction of a window type to a product has the window type with parameters θ ′ \theta' θ ′ . Extension with a background of 0 adds positions outside the support and related to nothing, so the extended block has type $\tau read in the index space of r ′ ′ r^{\prime\prime} r ′′ . Every extension is assigned DenseBlock, which admits it whatever the background.
The structural helpers. Assign each input block a symbolic core name. Write Q ℓ k Q_{\ell k} Q ℓ k for its tensor-coordinate box and Ω Z \Omega_Z Ω Z for the tensor index domain. The local domain Ω r \Omega_r Ω r is defined in §A.2.1. The fixed split/merge construction of §A.2.3 defines Refine ( π ⃗ ) = ( r 1 , … , r m ) \operatorname{Refine}(\vec{\pi})=(r_1,\ldots,r_m) Refine ( π ) = ( r 1 , … , r m ) , with
⋃ ℓ , k Q ℓ k ⊆ ⋃ t r t ⊆ Ω Z , r t ∩ r s = ∅ ( t ≠ s ) . \bigcup_{\ell,k} Q_{\ell k}\subseteq\bigcup_t r_t\subseteq\Omega_Z,\qquad r_t\cap r_s=\varnothing\quad(t\ne s). ℓ , k ⋃ Q ℓ k ⊆ t ⋃ r t ⊆ Ω Z , r t ∩ r s = ∅ ( t = s ) .
Each nonempty rectangular region carries the construction’s alignment plan for each operand: absent, restrict a specified block, or materialize over the region. We also use r r r for the region’s box. Merging may make the first inclusion strict; the plan is retained even when a merged region fits within one original block.
Alignment follows these plans and returns
Align ( r , π ⃗ ) = ( ( β 1 r , β 2 r ) , α 1 r ; α 2 r ) . \operatorname{Align}(r,\vec{\pi})=((\beta_{1r},\beta_{2r}),\alpha_{1r};\alpha_{2r}). Align ( r , π ) = (( β 1 r , β 2 r ) , α 1 r ; α 2 r ) .
For an absent operand, β ℓ r = d ℓ \beta_{\ell r}=d_\ell β ℓ r = d ℓ and α ℓ r = ϵ \alpha_{\ell r}=\epsilon α ℓ r = ϵ . For a restriction plan, β ℓ r = ( τ ℓ r , u ℓ r ) \beta_{\ell r}=(\tau_{\ell r},u_{\ell r}) β ℓ r = ( τ ℓ r , u ℓ r ) , with the restricted, reindexed type selected as in Lemma A.11 ; α ℓ r \alpha_{\ell r} α ℓ r records the prescribed restriction and conversion calls. A materialization plan instead selects DenseBlock on Ω r \Omega_r Ω r and records calls producing its core. Within an operand’s block boxes, materialization uses the blocks’ full denotations, including structural zeros; only positions outside those boxes take d ℓ d_\ell d ℓ . Output core names are fresh unless the fixed plan reuses an existing block.
Example. On the index interval [ 0 , 4 ) [0,4) [ 0 , 4 ) , let the first operand have one block on [ 0 , 2 ) [0,2) [ 0 , 2 ) and background 0, and the second one block on [ 1 , 3 ) [1,3) [ 1 , 3 ) and background 2. Refinement gives r 0 = [ 0 , 1 ) r_0=[0,1) r 0 = [ 0 , 1 ) , r 1 = [ 1 , 2 ) r_1=[1,2) r 1 = [ 1 , 2 ) , and r 2 = [ 2 , 3 ) r_2=[2,3) r 2 = [ 2 , 3 ) . Alignment records the corresponding block restrictions. On r 0 r_0 r 0 , it returns the first block’s restriction and 2; for either addition or multiplication, lifting constructs a constant core (2) and B-Compute records the operation. On r 1 r_1 r 1 , both operands supply blocks, so B-Compute needs no lifting calls. On r 2 r_2 r 2 , addition uses B-Identity, while multiplication uses B-Annihilator; its alignment calls remain recorded in both cases. T-Elementwise places the retained results in their regions and sets the background to 2 for addition or 0 for multiplication. The regions and rule choices do not depend on any block’s numerical entries.
Element-wise Operations on Tensors
We now relate the structural rules to the existing g-BCSR operation. Algorithm 1 records its operational steps under fixed structural policies. Unlike the rules, the procedure executes each numerical call when it encounters it. It retains redundant result blocks so that the correspondence can identify both descriptors and payloads.
Let T 1 = ( d 1 , S 1 , B 1 , Z ) \mathcal{T}_1=(d_1,S_1,B_1,Z) T 1 = ( d 1 , S 1 , B 1 , Z ) and T 2 = ( d 2 , S 2 , B 2 , Z ) \mathcal{T}_2=(d_2,S_2,B_2,Z) T 2 = ( d 2 , S 2 , B 2 , Z ) be two g-BCSR tensors and let T 3 = T 1 ∘ T 2 \mathcal{T}_3=\mathcal{T}_1\circ\mathcal{T}_2 T 3 = T 1 ∘ T 2 for a binary operator ∘ \circ ∘ . To compute T 3 \mathcal{T}_3 T 3 we must determine which blocks of the operands participate in the computation, where the blocks of T 3 \mathcal{T}_3 T 3 lie, the type of each of them, and the background d 3 d_3 d 3 .
The following procedure makes the refinement and identity, annihilator, and constant-lifting cases explicit. The block rules of Figure 6 and the tensor rule of Fig. 7b are defined independently on descriptors and symbolic cores. Lemma A.17 compares their chosen representation with this procedure under the same fixed policies, with redundant blocks retained.
Algorithm 1 forms the regions on line 1, determines d 3 d_3 d 3 on line 2, and applies the regional computation to each cell. Alignment on line 5 follows the plans of §A.2.3. It restricts an operand block to the cell or materializes its contribution there, including the background outside its block boxes. In this reference procedure, β \beta β denotes the resulting numerical block and τ ( β ) \tau(\beta) τ ( β ) its type. The structural rules instead represent that block by its type and a symbolic core name. Lines 16–17
Algorithm 1 Element-wise operations over g-BCSR tensors
Input: Two g-BCSR tensors T 1 = ( d 1 , S 1 , B 1 , Z 1 ) \mathcal{T}_1 = (d_1, S_1, B_1, Z_1) T 1 = ( d 1 , S 1 , B 1 , Z 1 ) and T 2 = ( d 2 , S 2 , B 2 , Z 2 ) \mathcal{T}_2 = (d_2, S_2, B_2, Z_2) T 2 = ( d 2 , S 2 , B 2 , Z 2 ) of the same shape; an element-wise operator ⊙ \odot ⊙ such that every scalar operation of ⟦ T 1 ⟧ ⊙ ⟦ T 2 ⟧ \llbracket\mathcal{T}_1 \rrbracket\odot\llbracket\mathcal{T}_2 \rrbracket [ [ T 1 ] ] ⊙ [ [ T 2 ] ] is defined.
Output: T 3 \mathcal{T}_3 T 3 with ⟦ T 3 ⟧ = ⟦ T 1 ⟧ ⊙ ⟦ T 2 ⟧ \llbracket\mathcal{T}_3 \rrbracket= \llbracket\mathcal{T}_1 \rrbracket\odot\llbracket\mathcal{T}_2 \rrbracket [ [ T 3 ] ] = [ [ T 1 ] ] ⊙ [ [ T 2 ] ] .
G ← Refine ( S 1 , B 1 , S 2 , B 2 ) G \gets\operatorname{Refine}(S_1, B_1, S_2, B_2) G ← Refine ( S 1 , B 1 , S 2 , B 2 ) — The cells of a common refinement
d 3 ← d 1 ⊙ d 2 d_3 \gets d_1 \odot d_2 d 3 ← d 1 ⊙ d 2 , or 0 0 0 if it is undefined — Background of the result
S 3 , B 3 ← ∅ , ∅ S_3, B_3 \gets\varnothing, \varnothing S 3 , B 3 ← ∅ , ∅ ; Z 3 ← Z 1 Z_3 \gets Z_1 Z 3 ← Z 1
For each cell r ∈ G r \in G r ∈ G Do
β 1 ← Align ( r , T 1 ) \beta_1 \gets\operatorname{Align}(r, \mathcal{T}_1) β 1 ← Align ( r , T 1 ) ; β 2 ← Align ( r , T 2 ) \beta_2 \gets\operatorname{Align}(r, \mathcal{T}_2) β 2 ← Align ( r , T 2 ) — The operand over r r r ; ⊥ \perp ⊥ if no block of it meets r r r
If β 1 = ⊥ \beta_1 = \perp β 1 =⊥ or β 2 = ⊥ \beta_2 = \perp β 2 =⊥ Then
j ← j \gets j ← the index of the absent operand; β ← β 3 − j \beta\gets\beta_{3-j} β ← β 3 − j ; d ← d j d \gets d_j d ← d j
If id j ( ⊙ , d ) \operatorname{id}_j(\odot, d) id j ( ⊙ , d ) Then
Append ( r , β ) (r, \beta) ( r , β ) to ( S 3 , B 3 ) (S_3, B_3) ( S 3 , B 3 ) ; Continue — Copy the block
Else If ann ( ⊙ , d ) \operatorname{ann}(\odot, d) ann ( ⊙ , d ) Then
Continue — The cell equals d 3 d_3 d 3 throughout; emit no block
Else
Lift d d d to a UniformBlock over r r r and let it play the absent operand
End If
End If
τ ← τ ( β 1 ) ⊙ τ τ ( β 2 ) \tau\gets\tau(\beta_1) \odot^{\tau} \tau(\beta_2) τ ← τ ( β 1 ) ⊙ τ τ ( β 2 ) — §A.2.2
b ← Kernel ( ⊙ , τ ( β 1 ) , τ ( β 2 ) , β 1 , β 2 ) b \gets\operatorname{Kernel}(\odot, \tau(\beta_1), \tau(\beta_2), \beta_1, \beta_2) b ← Kernel ( ⊙ , τ ( β 1 ) , τ ( β 2 ) , β 1 , β 2 ) — Core of the result
Append ( r , ( τ , b ) ) (r, (\tau, b)) ( r , ( τ , b )) to ( S 3 , B 3 ) (S_3, B_3) ( S 3 , B 3 )
End For
Return ( d 3 , S 3 , B 3 , Z 3 ) (d_3, S_3, B_3, Z_3) ( d 3 , S 3 , B 3 , Z 3 )
the result type using ⊙ τ \odot^{\tau} ⊙ τ and compute its core. In addition to the alignment calls, each cell requires at most one result-computation kernel call. The block-type calculation is the one developed in §A.2.2.
The background value. The background of the result is d 3 = d 1 ⊙ d 2 d_3 = d_1 \odot d_2 d 3 = d 1 ⊙ d 2 , since every entry that is background in both operands takes this value. The combination d 1 ⊙ d 2 d_1 \odot d_2 d 1 ⊙ d 2 can be undefined even when the dense operation is defined, because the blocks can cover every position at which both backgrounds would apply. For example, let A = [ 2 , 4 ] A = [2, 4] A = [ 2 , 4 ] and B = [ 1 , 2 ] B = [1, 2] B = [ 1 , 2 ] each be one block with background 0 0 0 : the quotient A ÷ B = [ 2 , 2 ] A \div B = [2, 2] A ÷ B = [ 2 , 2 ] is defined, while 0 ÷ 0 0 \div0 0 ÷ 0 is not. Under the definedness assumption of Theorem A.16 , no position then reads both backgrounds, and line 2 sets d 3 = 0 d_3 = 0 d 3 = 0 . The choice of 0 0 0 also gives the correct value in the cells that line 11 omits because the background of one operand is the annihilator 0 0 0 of multiplication (§A.3.1). The identities and annihilators in Table 4 determine when an operand block can be reused or omitted. The remaining cases lift a background to a constant block and use the result-type rule. These are precisely the three cases of Figure 6 .
Tensor Multiplication
Tensor multiplication combines block pairs whose contracted ranges overlap. Unlike an element-wise operation, an output position can receive contributions from several such pairs. For T 3 = T 1 @ T 2 \mathcal{T}_3 = \mathcal{T}_1 @ \mathcal{T}_2 T 3 = T 1 @ T 2 , each entry is
T 3 [ i , k ] = ∑ j T 1 [ i , j ] ⋅ T 2 [ j , k ] , (7) \mathcal{T}_3[i,k] = \sum_j \mathcal{T}_1[i,j] \cdot\mathcal{T}_2[j,k], \tag*{(7)} T 3 [ i , k ] = j ∑ T 1 [ i , j ] ⋅ T 2 [ j , k ] , (7)
so a block of T 1 \mathcal{T}_1 T 1 interacts with a block of T 2 \mathcal{T}_2 T 2 whenever the column range of the first meets the row range of the second. For a pair ( β 1 , β 2 ) (\beta_1, \beta_2) ( β 1 , β 2 ) with nonempty contracted intersection $J = cols ( β 1 ) ∩ rows ( β 2 ) \operatorname{cols}(\beta_1) \cap\operatorname{rows}(\beta_2) cols ( β 1 ) ∩ rows ( β 2 ) , its output box is F = rows ( β 1 ) × cols ( β 2 ) F = \operatorname{rows}(\beta_1) \times\operatorname{cols}(\beta_2) F = rows ( β 1 ) × cols ( β 2 ) . These boxes can partially overlap. Meet cuts each free axis at every endpoint of the output boxes and retains the resulting cells covered by at least one box. For each cell r r r , the list P [ r ] \mathcal{P}[r] P [ r ] contains exactly the pairs whose output box contains all of r r r . Contributing pairs are therefore constant throughout a cell; cells are not merged across a boundary where this list changes.
For each pair in P [ r ] \mathcal{P}[r] P [ r ] , Trim returns the restrictions γ 1 = β 1 ∣ rows ( r ) × J \gamma_1 = \beta_1|_{\operatorname{rows}(r)\times J} γ 1 = β 1 ∣ rows ( r ) × J and γ 2 = β 2 ∣ J × cols ( r ) \gamma_2 = \beta_2|_{J\times\operatorname{cols}(r)} γ 2 = β 2 ∣ J × cols ( r ) . Their product covers the whole cell r r r . We compute its core and sum the partial products into the output block of r r r , using the join ⊔ \sqcup ⊔ of their types for the sum. This construction depends only on block positions and extents.
The background value requires more care than in the element-wise case. The enumeration over pairs of blocks computes only those terms of Equation (7) in which both factors lie in a block, so it agrees with the dense product only when both backgrounds are 0. For instance, if T 1 \mathcal{T}_1 T 1 is the single block [ 2 ] [2] [ 2 ] with background 0 and T 2 \mathcal{T}_2 T 2 has no blocks and background 1, the dense product is [ 2 ] [2] [ 2 ] , whereas the enumeration finds no pair and returns [ 0 ] [0] [ 0 ] . We therefore fall back to the dense product unless d 1 = d 2 = 0 d_1 = d_2 = 0 d 1 = d 2 = 0 . The fallback stores this product as one DenseBlock with background 0 and shape Z 3 Z_3 Z 3 . In practice, the tensors that backsubstitution multiplies have background 0, so this case does not arise. The identity shortcut of Algorithm 1 also does not apply: a background of 1 is the identity for element-wise multiplication, but the all-ones matrix is not the identity for tensor multiplication,
( 1 2 3 4 ) ( 1 1 1 1 ) = ( 3 3 7 7 ) . \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}
=
\begin{pmatrix} 3 & 3 \\ 7 & 7 \end{pmatrix}. ( 1 3 2 4 ) ( 1 1 1 1 ) = ( 3 7 3 7 ) .
Algorithm 2 is the reference procedure for the multiplication construction of § 4.2 ; Lemma A.17 proves their correspondence. Lines 1–3 test the backgrounds, lines 5 and 9 compute the regions, line 10 computes the type, and line 11 computes the core. During structural evaluation, this numerical work is recorded for runtime, together with any conversions and additions needed for accumulation. The dense fallback on line 2 stores its product as one DenseBlock covering the output shape, with background 0. It therefore also returns a g-BCSR tensor.
The accumulation ⊞ \boxplus ⊞ in Algorithm 2 adds blocks over the same output region using the addition type rule and its numerical routine. The accumulator ⊥ \bot ⊥ denotes the absence of a contribution, with ⊥ ⊞ B = B \bot\boxplus B = B ⊥ ⊞ B = B . Subsequent additions convert the cores to the selected result type as needed before summing them.
It remains to give the type of the result. The parameters of the two operands compose, so we treat the convolutional types first. Call a tensor a window operator with parameters θ = ( k , s , p ) \theta= (k,s,p) θ = ( k , s , p ) if its support is contained in S θ \mathcal{S}_\theta S θ , which holds for both StencilBlockθ _\theta θ and WindowBlockθ _\theta θ .
Lemma A.12 (Window composition). Let M 1 M_1 M 1 be a window operator from an input space to a middle space with parameters ( k i , s i , p i ) (k_i,s_i,p_i) ( k i , s i , p i ) and let M o M_o M o be a window operator from that middle space to an output space with ( k o , s o , p o ) (k_o,s_o,p_o) ( k o , s o , p o ) . If the product is defined, M o @ M i M_o \mathbin{@} M_i M o @ M i is a window operator with parameters
s ′ ′ = s o s i , p ′ ′ = p o s i + p i , k ′ ′ = ( k o − 1 ) s i + k i . (8) s'' = s_o s_i,\qquad p'' = p_o s_i + p_i,\qquad k'' = (k_o - 1)s_i + k_i. \tag*{(8)} s ′′ = s o s i , p ′′ = p o s i + p i , k ′′ = ( k o − 1 ) s i + k i . (8) The core of the composite is
P ′ ′ [ ( k , A ) , ( γ , f ) ] = ∑ ( e , d ) : e s i + d = f m ( A , e ) ∈ [ M ] ∑ μ P o [ ( k , A ) , ( μ , e ) ] P i [ ( μ , m ( A , e ) ) , ( γ , d ) ] . P''[(k,A),(\gamma,f)] =
\sum_{\substack{(e,d):\,e s_i+d=f\\m(A,e)\in[M]}}
\sum_{\mu}
P_o[(k,A),(\mu,e)]\,P_i[(\mu,m(A,e)),(\gamma,d)]. P ′′ [( k , A ) , ( γ , f )] = ( e , d ) : e s i + d = f m ( A , e ) ∈ [ M ] ∑ μ ∑ P o [( k , A ) , ( μ , e )] P i [( μ , m ( A , e )) , ( γ , d )] . where m ( A , e ) = A s o − p o + e m(A,e)=As_o-p_o+e m ( A , e ) = A s o − p o + e and M M M is the extent of the middle space.
Proof of Lemma A.12. A term of the matrix product is non-zero only if m ∈ W o ( A ) m \in\mathcal{W}_o(A) m ∈ W o ( A ) and n ∈ W i ( m ) n \in\mathcal{W}_i(m) n ∈ W i ( m ) . Write m = A s o − p o + e m = As_o-p_o+e m = A s o − p o + e and n = m s i − p i + d n = ms_i-p_i+d n = m s i − p i + d , both forced and unique by injectivity
Algorithm 2 Multiplication of g-BCSR tensors
Input: T ℓ = ( d ℓ , S ℓ , B ℓ , Z ℓ ) \mathcal{T}_{\ell} = (d_{\ell}, S_{\ell}, B_{\ell}, Z_{\ell}) T ℓ = ( d ℓ , S ℓ , B ℓ , Z ℓ ) , ℓ ∈ { 1 , 2 } \ell\in\{1,2\} ℓ ∈ { 1 , 2 } , with compatible contracted extents. Output: T 3 \mathcal{T}_{3} T 3 with \llbracket\mathcal{T}_{3} \rrbracket= \llbracket\mathcal{T}_{1} \rrbracket@ \llbracket\mathcal{T}_{2} \rrbracket . Write Z 3 Z_{3} Z 3 for the output shape formed from the non-contracted axes of Z 1 Z_{1} Z 1 and Z 2 Z_{2} Z 2 .
If d 1 ≠ 0 d_{1} \ne0 d 1 = 0 or d 2 ≠ 0 d_{2} \ne0 d 2 = 0 Then
Return Dense ( T 1 ) @ Dense ( T 2 ) \operatorname{Dense}(\mathcal{T}_{1}) @ \operatorname{Dense}(\mathcal{T}_{2}) Dense ( T 1 ) @ Dense ( T 2 )
End If
d 3 ← 0 d_{3} \leftarrow0 d 3 ← 0 ; S 3 , B 3 ← ∅ , ∅ S_{3}, B_{3} \leftarrow\varnothing, \varnothing S 3 , B 3 ← ∅ , ∅
P ← Meet ( S 1 , B 1 , S 2 , B 2 ) \mathcal{P} \leftarrow\operatorname{Meet}(S_{1}, B_{1}, S_{2}, B_{2}) P ← Meet ( S 1 , B 1 , S 2 , B 2 )
For r ∈ dom ( P ) r \in\operatorname{dom}(\mathcal{P}) r ∈ dom ( P ) Do
A ← ⊥ A \leftarrow\bot A ← ⊥
For ( β 1 , β 2 ) ∈ P [ r ] (\beta_{1}, \beta_{2}) \in\mathcal{P}[r] ( β 1 , β 2 ) ∈ P [ r ] Do
( γ 1 , γ 2 ) ← Trim ( r , β 1 , β 2 ) (\gamma_{1}, \gamma_{2}) \leftarrow\operatorname{Trim}(r, \beta_{1}, \beta_{2}) ( γ 1 , γ 2 ) ← Trim ( r , β 1 , β 2 )
τ ← τ ( γ 1 ) @ τ ( γ 2 ) \tau\leftarrow\tau(\gamma_{1}) @ \tau(\gamma_{2}) τ ← τ ( γ 1 ) @ τ ( γ 2 )
b ← Kernel ( @ , τ ( γ 1 ) , τ ( γ 2 ) , γ 1 , γ 2 ) b \leftarrow\operatorname{Kernel}(@, \tau(\gamma_{1}), \tau(\gamma_{2}), \gamma_{1}, \gamma_{2}) b ← Kernel ( @ , τ ( γ 1 ) , τ ( γ 2 ) , γ 1 , γ 2 )
A ← A ⊞ ( τ , b ) A \leftarrow A \boxplus(\tau, b) A ← A ⊞ ( τ , b )
End For
Append ( r , A ) (r,A) ( r , A ) to ( S 3 , B 3 ) (S_{3},B_{3}) ( S 3 , B 3 )
End For
Return ( d 3 , S 3 , B 3 , Z 3 ) (d_{3},S_{3},B_{3},Z_{3}) ( d 3 , S 3 , B 3 , Z 3 )
of the window map in its second argument. Substituting,
n = A s o s i − ( p o s i + p i ) + ( e s i + d ) , n = A_{s_o s_i} - (p_{o}s_i + p_i) + (e s_i + d), n = A s o s i − ( p o s i + p i ) + ( e s i + d ) ,
which gives s ′ ′ s^{\prime\prime} s ′′ and p ′ ′ p^{\prime\prime} p ′′ . As e e e and d d d range over their intervals the offset e s i + d e s_i + d e s i + d takes values in [ 0 , ( k o − 1 ) s i + k i − 1 ] = [ k ′ ′ ] [0,(k_o-1)s_i+k_i-1]=[k^{\prime\prime}] [ 0 , ( k o − 1 ) s i + k i − 1 ] = [ k ′′ ] . Hence the support is contained in the window pattern of θ ′ ′ \theta^{\prime\prime} θ ′′ , and since a window type imposes no sharing this gives membership. Collecting the terms landing on each offset yields the core. □
The three parameter laws follow from one geometric observation (Figure 16 ): an output position reads k o k_o k o consecutive middle positions, and the windows of consecutive output positions start s o s_o s o apart; each middle position reads k i k_i k i input positions, and the windows of consecutive middle positions start s i s_i s i apart, so converting a middle offset to an input offset multiplies it by s i s_i s i . Strides therefore multiply, paddings accumulate with a stride weighting, and the composite window spans k o − 1 k_o-1 k o − 1 gaps of size s i s_i s i together with the extent of one inner window. In the running example this gives 2 ⋅ 1 + 3 = 5 2 \cdot1 + 3 = 5 2 ⋅ 1 + 3 = 5 , the width observed in §D.1.
Figure 16. Window extent under composition: the composite window has extent ( k o − 1 ) s i + k i (k_o - 1)s_i + k_i ( k o − 1 ) s i + k i . Each tap of the outer window contributes one inner window; consecutive inner windows are s i s_i s i apart, and the composite spans all of them.
The composite weights are obtained by accumulating products into offset slots: the pairs of taps ( e , d ) (e,d) ( e , d ) that land on composite offset f f f are those with e s i + d = f e s_i + d = f e s i + d = f , and several pairs may land on one slot, which produces the sum of three products seen in §D.1. For k i ≥ s i k_i \ge s_i k i ≥ s i , which holds whenever consecutive inner windows overlap or abut, every offset in [ k ′ ′ ] [k^{\prime\prime}] [ k ′′ ] is of the form e s i + d e s_i + d e s i + d . For k i < s i k_i < s_i k i < s i the offsets of this form are k o k_o k o runs of length k i k_i k i spaced s i s_i s i apart, and the composite weights at the remaining offsets are 0.
Lemma A.12 states a containment, and the support of the product can be smaller than S θ ′ ′ S_{\theta^{\prime\prime}} S θ ′′ even when k i ≥ s i k_i \ge s_i k i ≥ s i . At an output position that reads a middle position outside the middle space, the inputs that only that middle position would read have coefficient 0. With input extent 6, inner parameters ( 3 , 2 , 0 ) (3, 2, 0) ( 3 , 2 , 0 ) and outer parameters ( 3 , 1 , 1 ) (3, 1, 1) ( 3 , 1 , 1 ) , the window of the second output position contains input 5, which neither of the middle positions it reads depends on.
The sharing relation requires a side condition. Call the composition unclipped if every middle position that an output position reads lies inside the middle space. When the outer operator has the output extent of its convolution, with p o ≥ 0 p_o \ge0 p o ≥ 0 and at least one output position, this holds exactly when p o = 0 p_o = 0 p o = 0 .
Lemma A.13 (Tying under composition). Assume the product is defined. If the composition is unclipped, the product of two StencilBlock operators is a StencilBlockθ ′ ′ _{\theta^{\prime\prime}} θ ′′ operator.
Without this hypothesis it is a WindowBlockθ ′ ′ _{\theta^{\prime\prime}} θ ′′ operator, and its output positions that read only middle positions inside the middle space share a common kernel.
Proof of Lemma A.13 . By Lemma A.12 , the product has the composite window support. Let A A A be an output position such that m ( A , e ) ∈ [ M ] m(A,e) \in[M] m ( A , e ) ∈ [ M ] for every outer offset e e e . The two input cores are independent of their output-position indices. Hence the composite-core sum ranges over all pairs ( e , d ) (e,d) ( e , d ) with e s i + d = f e s_i + d = f e s i + d = f , independently of A A A , and all such output positions share a kernel. If the composition is unclipped, this holds at every output position and gives the sharing relation of StencilBlockθ ′ ′ _{\theta^{\prime\prime}} θ ′′ .
The examples below show that padding can make the boundary rows differ from the interior rows, so this hypothesis cannot be dropped. With no outer padding, every output position reads middle positions that exist, so neither the index set of the accumulation nor the composite weights depend on the output position; this is the sharing relation of StencilBlockθ ′ ′ _{\theta^{\prime\prime}} θ ′′ . With outer padding, the output positions near the border read middle positions outside the middle space and acquire weights that differ from the interior ones, so the sharing holds on the interior alone. When the outer operator has the output extent of its convolution, at most ⌈ p o / s o ⌉ \lceil p_o/s_o \rceil ⌈ p o / s o ⌉ output positions at each end of a spatial axis read a middle position outside the middle space. In two dimensions these positions form a border of the output, and the interior is the product of the interiors of the two axes.
A product with a DiagonalBlock scales rows or columns. Scaling cannot make a zero non-zero, so the support and the parameters are unchanged, while two positions related by the sharing relation lie in different rows, acquire different scale factors, and are no longer constrained to be equal. Multiplying a StencilBlockθ _\theta θ by a DiagonalBlock on either side therefore yields a WindowBlockθ _\theta θ , a product of two diagonals is diagonal, and a product with a DenseBlock is dense. Table 6 collects the rules and cites the result that establishes each.
Table 6. Result types for τ 1 @ τ 2 \tau_1 @ \tau_2 τ 1 @ τ 2 , with τ 1 \tau_1 τ 1 down the side and τ 2 \tau_2 τ 2 across the top. The composite parameters θ ′ ′ \theta'' θ ′′ are those of Equation (8) , and † marks the entry that requires the composition to be unclipped (Lemma A.13 ); without that hypothesis it is WindowBlockθ ′ ′ _{\theta''} θ ′′ . A product of window operators with incompatible channel extents, and any product involving a DenseBlock, is represented as DenseBlock. The preceding lemmas establish the window and diagonal cases.
Table 6 gives the products that the running example forms. A product of two StencilBlock operators is a StencilBlock when the outer operator is unpadded and a WindowBlock otherwise (Lemmas A.12 and A.13 ); a product of a StencilBlock and a WindowBlock is a WindowBlock, since Lemma A.12 supplies the support and the untied operand admits no sharing; and a product of a StencilBlock and a DiagonalBlock is a WindowBlock. The WindowBlock family is required for closure: a certifier whose operands are convolutions and diagonals leaves the StencilBlock family at the first ReLU and remains inside WindowBlock thereafter, so the products it forms along such chains of layers are representable. § A.2.6 proves in addition that the parameter laws of Equation (8) are associative, which allows the composite parameters of a chain of layers to be computed once and reused.
Further Properties of Window Composition
The composition laws above give a result type that contains every possible product. We now examine when the resulting window contains positions that cannot be reached, prove associativity of the parameter laws, and account for boundary clipping.
For k o ≥ 2 k_o \ge2 k o ≥ 2 , the map ( e , d ) ↦ e s i + d (e,d) \mapsto e s_i + d ( e , d ) ↦ e s i + d is injective exactly when k i ≤ s i k_i \le s_i k i ≤ s i ; for k o = 1 k_o = 1 k o = 1 it is injective whatever k i k_i k i and s i s_i s i , and its image is [ k ′ ′ ] [k''] [ k ′′ ] . For k o ≥ 2 k_o \ge2 k o ≥ 2 and k i < s i k_i < s_i k i < s i , the reachable offsets form the union ⋃ e < k o { e s i , … , e s i + k i − 1 } \bigcup_{e<k_o}\{e s_i,\ldots,e s_i+k_i-1\} ⋃ e < k o { e s i , … , e s i + k i − 1 } , that is k o k_o k o runs of length k i k_i k i spaced s i s_i s i apart, which is a proper subset of [ k ′ ′ ] [k''] [ k ′′ ] and is not in general an arithmetic progression: for k i = 2 k_i = 2 k i = 2 , s i = 3 s_i = 3 s i = 3 and k o = 2 k_o = 2 k o = 2 it is { 0 , 1 , 3 , 4 } \{0,1,3,4\} { 0 , 1 , 3 , 4 } . Lemma A.12 is therefore a strict over-approximation in that regime.
Lemma A.14 (Window monoid). The triples ( k , s , p ) (k,s,p) ( k , s , p ) with k , s ∈ Z > 0 k,s \in\mathbb{Z}_{>0} k , s ∈ Z > 0 and p ∈ Z p \in\mathbb{Z} p ∈ Z form a monoid under the composition laws of Equation (8) , with identity ( 1 , 1 , 0 ) (1,1,0) ( 1 , 1 , 0 ) . The composite window extent is therefore associative.
Proof. Read ( k , s , p ) (k,s,p) ( k , s , p ) as the map sending an output index A A A to the interval [ A s − p , A s − p + k − 1 ] [As-p, As-p+k-1] [ A s − p , A s − p + k − 1 ] , and define composition as the bounding interval of the set of input positions reachable from A A A . The inner map is increasing, so the minimum is attained at the first outer tap and the maximum at the last, giving the stated laws. Associativity follows because both bracketings of a triple product describe the bounding interval of the same reachable set, and ( 1 , 1 , 0 ) (1,1,0) ( 1 , 1 , 0 ) sends A A A to [ A , A ] [A,A] [ A , A ] . □
In this reading, which ignores clipping, the bounding interval equals the reachable set when that set is an interval; in particular, this holds when k i ≥ s i k_i \ge s_i k i ≥ s i .
Clipping at the boundary. Let the outer operator have the output extent of its convolution, o = ⌊ ( M + 2 p o − k o ) / s o ⌋ + 1 o = \lfloor(M+2p_o-k_o)/s_o\rfloor+1 o = ⌊( M + 2 p o − k o ) / s o ⌋ + 1 , with p o ≥ 0 p_o \ge0 p o ≥ 0 and at least one output position. Position A A A is interior exactly when A s o ≥ p o As_o \ge p_o A s o ≥ p o and A s o − p o + k o ≤ M As_o-p_o+k_o \le M A s o − p o + k o ≤ M . The first fails for at most ⌈ p o / s o ⌉ \lceil p_o/s_o\rceil ⌈ p o / s o ⌉ positions A < p o / s o A < p_o/s_o A < p o / s o . Writing X = M + p o − k o X=M+p_o-k_o X = M + p o − k o , the second fails for A > X / s o A>X/s_o A > X / s o , and A ≤ o − 1 = ⌊ ( X + p o ) / s o ⌋ A \le o-1=\lfloor(X+p_o)/s_o\rfloor A ≤ o − 1 = ⌊( X + p o ) / s o ⌋ leaves ⌊ ( X + p o ) / s o ⌋ − ⌊ X / s o ⌋ \lfloor(X+p_o)/s_o\rfloor-\lfloor X/s_o\rfloor ⌊( X + p o ) / s o ⌋ − ⌊ X / s o ⌋ such positions. With X = q o + ρ X=q_o+\rho X = q o + ρ and 0 ≤ ρ < s o 0 \le\rho< s_o 0 ≤ ρ < s o , this is ⌊ ( ρ + p o ) / s o ⌋ ≤ ⌈ p o / s o ⌉ \lfloor(\rho+p_o)/s_o\rfloor\le\lceil p_o/s_o\rceil ⌊( ρ + p o ) / s o ⌋ ≤ ⌈ p o / s o ⌉ . At most ⌈ p o / s o ⌉ \lceil p_o/s_o\rceil ⌈ p o / s o ⌉ positions at each end of the axis are therefore not interior, and for p o = 0 p_o=0 p o = 0 none is, so the composition is unclipped exactly when p o = 0 p_o=0 p o = 0 . In two dimensions a position is interior when it is interior along both axes.
The hypothesis cannot be dropped. Take one channel, k i = 3 k_i=3 k i = 3 , s i = 1 s_i=1 s i = 1 , p i = 0 p_i=0 p i = 0 and k o = 2 k_o=2 k o = 2 , s o = 1 s_o=1 s o = 1 , p o = 1 p_o=1 p o = 1 , so k ′ ′ = 4 k''=4 k ′′ = 4 . For interior A A A both middle positions are legal and P ′ ′ [ A , f ] = W o [ 0 ] W i [ f ] + W o [ 1 ] W i [ f − 1 ] P''[A,f]=W_o[0]W_i[f]+W_o[1]W_i[f-1] P ′′ [ A , f ] = W o [ 0 ] W i [ f ] + W o [ 1 ] W i [ f − 1 ] , while for A = 0 A=0 A = 0 the position m ( 0 , 0 ) = − 1 m(0,0)=-1 m ( 0 , 0 ) = − 1 is clipped and P ′ ′ [ 0 , f ] = W o [ 1 ] W i [ f − 1 ] P''[0,f]=W_o[1]W_i[f-1] P ′′ [ 0 , f ] = W o [ 1 ] W i [ f − 1 ] . At f = 1 f=1 f = 1 the two differ by W o [ 0 ] W i [ 1 ] W_o[0]W_i[1] W o [ 0 ] W i [ 1 ] , and the corresponding input indices 0 and 1 are both in range, so the discrepancy appears in the matrix whenever W o [ 0 ] W i [ 1 ] ≠ 0 W_o[0]W_i[1]\ne0 W o [ 0 ] W i [ 1 ] = 0 .
Nor does the weaker condition k i ≤ s i + p i k_i \le s_i+p_i k i ≤ s i + p i suffice. It makes a middle position clipped on the left read only inputs that are themselves out of range, so that clipping is invisible; it says nothing about the right boundary, where a middle position beyond the last is clipped for a different reason. Take input extent 6, inner ( k , s , p ) = ( 3 , 2 , 1 ) (k,s,p)=(3,2,1) ( k , s , p ) = ( 3 , 2 , 1 ) and outer ( k , s , p ) = ( 3 , 1 , 1 ) (k,s,p)=(3,1,1) ( k , s , p ) = ( 3 , 1 , 1 ) , with every weight 1. Here k i = 3 = s i + p i k_i=3=s_i+p_i k i = 3 = s i + p i , so the condition holds, and the middle extent is 3. The last output position reads middle positions 1, 2, 3, of which 3 does not exist. Composite offset 4 then carries coefficient 2 at the first two output positions and 1 at the last, so tying fails. Thus p o = 0 p_o=0 p o = 0 is sufficient for preservation of weight sharing. We do not claim that it is necessary for particular cores.
Correctness and Composition
We prove that executing the recorded numerical calls produces the values prescribed by dense computation. The proof first establishes correctness of the regional block rules and then combines their results for complete tensors. We also relate the result to the reference procedures and extend the argument to a fixed sequence of operations. All computations use exact arithmetic over R ‾ \overline{\mathbb{R}} R , with Boolean operations interpreted over Boolean values. The expressions ∞ − ∞ \infty-\infty ∞ − ∞ , 0 ⋅ ( ± ∞ ) 0\cdot(\pm\infty) 0 ⋅ ( ± ∞ ) , x / 0 x/0 x /0 , and ( ± ∞ ) / ( ± ∞ ) (\pm\infty)/(\pm\infty) ( ± ∞ ) / ( ± ∞ ) are undefined. A dense computation is defined when every scalar operation it requires is defined. We write e ⇓ v e\Downarrow v e ⇓ v for defined, terminating evaluation of e e e to v v v .
Primitive contracts. The structural routines use fixed policies for refinement, ordering, type selection, and fresh names. Their contracts are as follows.
Refine terminates with finitely many ordered, disjoint regions covering every operand block box. Each region records the chosen restriction or materialization plan used by Align. Outside their union, both operands have their background values. After alignment, each region has at least one block operand. The construction in §A.2.3 establishes these properties, including when merging enlarges a region.
Align records a finite sequence that, on a well-formed input payload, terminates with correctly typed cores denoting each operand restricted to the region. An absent-block marker denotes the operand’s constant background. Restriction, reindexing, and materialization preserve these regional values.
Liftr _r r is defined exactly when neither B-Identity nor B-Annihilator applies. It preserves existing blocks and records any calls needed to construct constant blocks for background markers. On well-formed inputs, these calls terminate with correctly typed constant cores. Its outputs denote the same regional arrays.
The selected result type admits every defined dense regional result. Lemmas A.6, A.7, and A.11 establish the support, sharing, and widening properties used in this selection.
Numerical block, conversion, and accumulation routines terminate on well-typed inputs whenever their specified dense operation is defined. They return a compatible core denoting that result through a finite sequence of calls selected by descriptors. These are contracts of the numerical primitives, rather than a verification of their backend implementation.
Recorded assignments bind fresh core names and preserve existing bindings. In particular, alignment calls remain in the recorded program when the subsequent regional rule is B-Identity or B-Annihilator. Correctness of a numerical routine only conditional on its successful execution would not suffice for the termination conclusion below.
Interpreting symbolic blocks. Let v v v assign numerical cores to core names. A symbolic block β = ( τ , u ) \beta=(\tau,u) β = ( τ , u ) is well formed under v v v when v ( u ) v(u) v ( u ) is a compatible core for τ \tau τ . Its regional array is V v ( β ) = [ [ ( τ , v ( u ) ) ] ] V_v(\beta)=[\![ (\tau,v(u)) ]\!] V v ( β ) = [ [( τ , v ( u ))] ] , where ( τ , b ) (\tau,b) ( τ , b ) abbreviates a block of type τ \tau τ and core b b b . For a background marker, V v ( d ) [ l ] = d V_v(d)[l]=d V v ( d ) [ l ] = d throughout the region. Write ⟨ κ , v ⟩ ⇓ v ′ \langle\kappa,v\rangle\Downarrow v' ⟨ κ , v ⟩ ⇓ v ′ for execution of a regional fragment. Such a fragment updates the core-name environment; the return in T-Elementwise subsequently selects its output tuple.
Lemma A.15 (Correctness of the block rules). Suppose β ⃗ ⟹ ⊙ r ( β , κ ) \vec{\beta} \mathrel{\overset{\odot}{\Longrightarrow}_{r}} (\beta,\kappa) β ⟹ ⊙ r ( β , κ ) , the operands are well formed under ν \nu ν , and V ν ( β 1 ) ⊙ V ν ( β 2 ) ⇓ D r V_{\nu}(\beta_1) \mathbin{\odot} V_{\nu}(\beta_2) \Downarrow D_r V ν ( β 1 ) ⊙ V ν ( β 2 ) ⇓ D r . There is an extension ν ′ \nu' ν ′ of ν \nu ν such that ⟨ κ , ν ⟩ ⇓ ν ′ \langle\kappa,\nu\rangle\Downarrow\nu' ⟨ κ , ν ⟩ ⇓ ν ′ and β = ( τ , u ) ⟹ ν ′ ( u ) \beta=(\tau,u) \Longrightarrow\nu'(u) β = ( τ , u ) ⟹ ν ′ ( u ) is compatible with τ ∧ V ν ′ ( β ) = D r \tau\land V_{\nu'}(\beta)=D_r τ ∧ V ν ′ ( β ) = D r , β = ⊥ ⟹ D r [ ι ] = d ′ \beta=\perp\Longrightarrow D_r[\iota]=d' β =⊥⟹ D r [ ι ] = d ′ for every position ι \iota ι in r r r .
Proof. We distinguish the last rule of the derivation.
B-Identity. The missing operand has an identity background on its operand side. Thus the regional operation has the value of the other operand at every position, including its structural zeros. The rule returns that operand’s type and core name and emits ϵ \epsilon ϵ . Taking ν ′ = ν \nu'=\nu ν ′ = ν gives a well-formed block denoting D r D_r D r .
B-Annihilator. The missing operand has an annihilator background d j d_j d j . Every defined scalar result in the region is therefore d j d_j d j . The premise d j = d ′ d_j=d' d j = d ′ ensures that this is exactly the result background, so no result block is required. The emitted fragment is empty and ν ′ = ν \nu'=\nu ν ′ = ν establishes the second conclusion.
B-Compute. The contract of Lift r \operatorname{Lift}_r Lift r gives a finite fragment λ \lambda λ that preserves both regional arrays and produces well-typed block operands. The selected type τ \tau τ admits their dense result D r D_r D r . Since that result is defined, the numerical contract of K ⊙ , τ , τ K_{\odot,\tau,\tau} K ⊙ , τ , τ gives a terminating execution whose core represents D r D_r D r in τ \tau τ . Its fresh output name u u u extends the environment without changing either operand or any earlier result. Executing λ \lambda λ and then this call yields the required ν ′ \nu' ν ′ and output block ( τ , u ) (\tau,u) ( τ , u ) . □
The Reference Procedures
We prove that the operations of the g-BCSR library compute the same result as their dense counterparts. The argument uses the region and type lemmas established above.
The first concerns the cells over which Algorithm 1 iterates. Each cell of the common refinement lies in at most one block of each operand, and the cells cover every index that either operand covers ((Lemma A.9)). For a merged group, the block of an operand is the one that materialization produces over the bounding box, so the property holds for the merge policy as well. A case analysis over an index is therefore exhaustive: either no cell contains the index, or exactly one does, and the contribution of each operand within it is determinate.
The second concerns the restriction and extension of a block to a cell ((Lemma A.11)). Restricting a block of type τ \tau τ on a box r r r to a sub-box r ′ r' r ′ gives a block whose type is the restriction of τ \tau τ to r ′ r' r ′ , and the type that Align assigns to it lies above that restriction. Extending the block to a larger box with a background of 0 0 0 keeps its type, read in the larger index space, and extending it with any other background gives a block that DenseBlock admits.
These two properties establish that the type the algorithms assign to a block admits the tensor that the block must hold. The kernels then compute its core. We take the following as their specification: for blocks β 1 , β 2 \beta_1,\beta_2 β 1 , β 2 on a common box and the type τ \tau τ assigned on line 16 of Algorithm 1, Kernel returns the core b b b for which the block ( τ , b ) (\tau,b) ( τ , b ) denotes ⟦ β 1 ⟧ ⊙ ⟦ β 2 ⟧ \llbracket\beta_1\rrbracket\mathbin{\odot} \llbracket\beta_2\rrbracket [ [ β 1 ] ] ⊙ [ [ β 2 ] ] ; on line 11 of Algorithm 2 it returns the core for which ( τ , b ) (\tau,b) ( τ , b ) denotes [ [ Y 1 ] ] ⊙ [ [ Y 2 ] ] [\![Y_1]\!] \mathbin{\odot} [\![Y_2]\!] [ [ Y 1 ] ] ⊙ [ [ Y 2 ] ] . Such a dense core exists exactly when the tensor lies in [ [ τ ] ] [\![\tau]\!] [ [ τ ] ] , and it is then unique, since a tensor of type τ \tau τ has one value per ≈ \approx ≈ -class.
In the following statement, operations on g-BCSR tensors denote the reference procedures, and operations on arrays denote their dense counterparts. The statement restates the dense correctness property of g-BCSR operations [15 ] under the specified kernel contracts. Removing a redundant result block also preserves these equalities, since its entries already equal the tensor background.
Theorem A.16 (Correctness). Let T 1 , T 2 \mathcal{T}_1,\mathcal{T}_2 T 1 , T 2 be g-BCSR tensors of appropriate shapes, and let ⊙ \odot ⊙ be an element-wise binary operator of §A.2.2. Assume the reference algorithms use kernels that
compute their dense operations in the assigned result types. If every scalar operation in the dense computation of the right-hand side is defined, then
⟦ T 1 ⊙ T 2 ⟧ = ⟦ T 1 ⟧ ⊙ ⟦ T 2 ⟧ , \llbracket\mathcal{T}_1 \odot\mathcal{T}_2 \rrbracket= \llbracket\mathcal{T}_1 \rrbracket\odot\llbracket\mathcal{T}_2 \rrbracket, [ [ T 1 ⊙ T 2 ] ] = [ [ T 1 ] ] ⊙ [ [ T 2 ] ] ,
\llbracket\mathcal{T}_1 @ \mathcal{T}_2 \rrbracket= \llbracket\mathcal{T}_1 \rrbracket@ \llbracket\mathcal{T}_2 \rrbracket.
Proof. Both equalities reduce to pointwise identities under the tensor lookup of § 2 and block denotation of Definition 4.1 . By hypothesis every scalar operation of the dense computation is defined.
Element-wise. Fix i i i . By Lemma A.9 , the cells cover every operand block and are pairwise disjoint. Alignment represents each operand over a cell by one block or its background. In a merged cell, these are the materialized blocks, whose values include the original background outside the original block boxes. The following cases refer to these aligned representations, which preserve the operand values.
No cell contains i i i . Both operands give their backgrounds, and the result gives d 3 d_3 d 3 . The dense result is d 1 ⊙ d 2 d_1 \odot d_2 d 1 ⊙ d 2 , which is defined by hypothesis, so line 2 sets d 3 d_3 d 3 to it.
Only a block B B B of T 1 \mathcal{T}_1 T 1 covers i i i . The second operand gives d 2 d_2 d 2 , and Algorithm 1 distinguishes three sub-cases.
If d 2 = 1 ⊙ R d_2 = 1_{\odot}^{\mathrm{R}} d 2 = 1 ⊙ R the block is copied (line 9), which agrees since x ⊙ 1 ⊙ R = x x \odot1_{\odot}^{\mathrm{R}} = x x ⊙ 1 ⊙ R = x at every position of the cell, including those the index map of B B B omits, where the stored value is 0 0 0 and 0 ⊙ 1 ⊙ R = 0 0 \odot1_{\odot}^{\mathrm{R}} = 0 0 ⊙ 1 ⊙ R = 0 .
If d 2 = 0 ⊙ d_2 = 0_{\odot} d 2 = 0 ⊙ no block is emitted (line 11) and the result reads d 3 d_3 d 3 . The dense result is T 1 [ i ] ⊙ 0 ⊙ = 0 ⊙ \mathcal{T}_1[i] \odot0_{\odot} = 0_{\odot} T 1 [ i ] ⊙ 0 ⊙ = 0 ⊙ , so it remains to show d 3 = 0 ⊙ d_3 = 0_{\odot} d 3 = 0 ⊙ . If d 1 ⊙ 0 ⊙ d_1 \odot0_{\odot} d 1 ⊙ 0 ⊙ is defined it equals 0 ⊙ 0_{\odot} 0 ⊙ . Otherwise ⊙ \odot ⊙ is multiplication, the only operator with an annihilator that is undefined at some arguments, and line 2 sets d 3 = 0 d_3 = 0 d 3 = 0 , which is the annihilator of multiplication.
Otherwise line 13 lifts d 2 d_2 d 2 to a UniformBlock over the cell and the general case applies to the resulting pair of blocks, with B B B on the left. The result can be non-zero at positions outside the support of B B B , where B B B holds 0 0 0 and the result holds 0 ⊙ d 2 0 \odot d_2 0 ⊙ d 2 , so retaining the type of B B B is not sound in general. Taking B B B diagonal, ⊙ \odot ⊙ addition and d 2 = 1 d_2 = 1 d 2 = 1 , the result has 1 1 1 at every off-diagonal position of the cell, while the diagonal index map would report 0 0 0 there. The emitted block is given the type τ ( B ) ⊙ τ U n i f o r m B l o c k \tau(B) \odot^{\tau} \mathrm{UniformBlock} τ ( B ) ⊙ τ UniformBlock of line 16, or a named type above it. For an operator disjunctive at 0 0 0 , Lemma A.6 bounds its support by the union of the two supports, which is the whole cell. For an operator conjunctive at 0 0 0 , it bounds the support by that of B B B ; multiplying a diagonal block by the background 2 2 2 , for instance, gives a diagonal block. In both cases Lemma A.7 gives the sharing. For any other operator, the type is DenseBlock, which admits every tensor. By the specification of the kernels, line 17 computes the core for which every position of the cell, those B B B stores and those it omits alike, reads T 1 [ i ] ⊙ d 2 \mathcal{T}_1[i] \odot d_2 T 1 [ i ] ⊙ d 2 .
Only a block B B B of T 2 \mathcal{T}_2 T 2 covers $i. The first operand gives d 1 d_1 d 1 , and the dense result is d 1 ⊙ T 2 [ i ] d_1 \odot\mathcal{T}_2[i] d 1 ⊙ T 2 [ i ] . The argument is the dual of the previous case with the order reversed: the block is copied only when d 1 = 1 ⊙ L d_1 = 1_{\odot}^{\mathrm{L}} d 1 = 1 ⊙ L , the annihilator case is unchanged, and otherwise d 1 d_1 d 1 is lifted to a UniformBlock on the left of B B B . For subtraction and division the copy does not apply, since they have no left identity, and the cell is computed as d 1 − B d_1 - B d 1 − B or d 1 ÷ B d_1 \div B d 1 ÷ B .
Both cover i i i . The cell containing i i i is contained in both boxes by Definition A.8 , so both contributions are determinate throughout the cell. For an operator disjunctive or conjunctive at 0 0 0 , line 16 assigns the type τ ( β 1 ) ⊙ τ τ ( β 2 ) \tau(\beta_1) \odot^{\tau} \tau(\beta_2) τ ( β 1 ) ⊙ τ τ ( β 2 ) , or a named type above it, which admits ⟦ β 1 ⟧ ⊙ ⟦ β 2 ⟧ \llbracket\beta_1 \rrbracket\odot\llbracket\beta_2 \rrbracket [ [ β 1 ] ] ⊙ [ [ β 2 ] ] by Lemmas A.6 and A.7. Lemma A.6 does not apply to the remaining operators (≤ \leq ≤ , ≥ \geq ≥ , = = = and ÷ \div ÷ ), and line 16 assigns them DenseBlock, which admits every tensor. By the specification of the kernels, line 17 computes the core of that tensor, which reads T 1 [ i ] ⊙ T 2 [ i ] \mathcal{T}_1[i] \odot\mathcal{T}_2[i] T 1 [ i ] ⊙ T 2 [ i ] at i i i .
The cells are disjoint, so the result is well formed, and Lemma A.11 guarantees that the alignment of line 5 gives each operand a type that admits its values on the cell.
Multiplication. The block enumeration visits only pairs of blocks, so it is sound only when indices outside every block contribute nothing, which requires both backgrounds to be 0 0 0 . Lines 1–3 dispatch on this: if either background is non-zero, both operands are materialized densely and multiplied directly, which computes the sum by definition. When both backgrounds are 0, an index uncovered in either operand contributes a product with 0, so only block pairs contribute.
Fix an output index ( i , k ) (i,k) ( i , k ) . If no region of MEET contains it, then no pair of blocks covers both ( i , j ) (i,j) ( i , j ) and ( j , k ) (j,k) ( j , k ) for any j j j , since such a pair would meet on the contracted axis and its output region would contain ( i , k ) (i,k) ( i , k ) . Every term of Equation (7) then has a factor 0, so the dense result is 0, which is the background d 3 d_3 d 3 that the result reads. Otherwise, let r r r be the region of MEET that contains ( i , k ) (i,k) ( i , k ) . Let J ( i , k ) J(i,k) J ( i , k ) be the set of contraction indices j j j at which both ( i , j ) (i,j) ( i , j ) and ( j , k ) (j,k) ( j , k ) are covered. For each j ∈ J j \in J j ∈ J , the covering block pair is unique because each operand’s blocks are disjoint. Its output box contains ( i , k ) (i,k) ( i , k ) and, by the endpoint partition of §A.2.5, contains all of r r r . Thus MEET associates exactly the contributing pairs with r r r , without duplicating any term. For j ∉ J j \notin J j ∈ / J , at least one factor is 0. Line 9 restricts each pair to the rows and columns of r r r and its shared range on the contracted axis, yielding a product over the whole cell. Restricting the free axes of two factors restricts their product to the same rows and columns, so the partial product of line 11 is the product of the two blocks over their shared range, read on r r r . By the specification of the kernels, its core represents that tensor in the type of line 10, which admits it by Lemmas A.12 and A.13 and the rule for DiagonalBlock in §A.2.5. Summing the partial products of r r r on line 12 gives, at ( i , k ) (i,k) ( i , k ) ,
∑ j ∈ J ( i , k ) T 1 [ i , j ] T 2 [ j , k ] = ∑ j T 1 [ i , j ] T 2 [ j , k ] , \sum_{j \in J(i,k)} \mathcal{T}_1[i,j]\mathcal{T}_2[j,k] = \sum_j \mathcal{T}_1[i,j]\mathcal{T}_2[j,k], j ∈ J ( i , k ) ∑ T 1 [ i , j ] T 2 [ j , k ] = j ∑ T 1 [ i , j ] T 2 [ j , k ] ,
which is Equation (7) .
Theorem A.16 covers the two binary operations, together with the restriction and extension that Align performs. The library also provides unary operations, which apply a scalar function f f f to each entry. A block stores 0 at the positions its index map omits, so applying f f f to the core of a block is correct only when f ( 0 ) = 0 f(0)=0 f ( 0 ) = 0 . For other f f f , the library widens the block to represent the values at those positions. We do not prove the unary operations correct here.
Widening the type of a block at any point preserves the conclusion of Theorem A.16 , since the wider type admits the same tensor. It can lose compression and increase the work of the kernels. This is the fallback of §A.1.
Correctness of the Structural Rules.
PROOF OF THEOREM 4.3. First consider an element-wise operation whose dense evaluation yields D D D . The descriptor rules terminate without reading a payload. Refinement produces a finite ordered collection G \mathcal{G} G . Alignment fixes each region’s operand types or background markers and records its calls. There is at least one block operand in every region. If the other operand is absent, its descriptor background selects B-IDENTITY, B-ANNIHILATOR, or constant lifting followed by B-COMPUTE. With two block operands, only B-COMPUTE applies. These mutually exclusive cases exhaust the aligned operand pairs. All type and call choices follow the fixed policies, including fresh-name allocation. Thus the result descriptor and finite numerical fragment depend only on π ⃗ \vec{\pi} π .
For T-ELEMENTWISE, give each input core name the corresponding core of T \mathcal{T} T . Process the regions in refinement order. For each r r r , the contract of alignment gives a terminating execution of α r \alpha_r α r whose symbolic operands denote the original inputs restricted to r r r . Their dense result is D ∣ r D|_r D ∣ r , so Lemma A.15 gives a terminating execution of κ r \kappa_r κ r and a correct block or omission. Fresh bindings preserve all input cores and earlier regional results. Induction over the regions therefore establishes termination of their concatenated fragments. The local return collects the retained core names into a compatible payload ρ ′ \rho' ρ ′ for the descriptor π ′ \pi' π ′ .
Let T ′ = Pack ( π ′ , ρ ′ ) \mathcal{T}' = \operatorname{Pack}(\pi',\rho') T ′ = Pack ( π ′ , ρ ′ ) and consider an arbitrary output position. If it belongs to a retained region, its value in T ′ \mathcal{T}' T ′ equals D D D by the regional lemma. If it belongs to an omitted region, the lemma gives D = d ′ D=d' D = d ′ throughout that region, so the output background is correct. Outside every region, both input arrays have their backgrounds. Since D D D is defined, d 1 ⊙ d 2 d_1 \mathbin{\odot} d_2 d 1 ⊙ d 2 must then be defined and equal to d ′ d' d ′ . If this background combination is undefined, the defined dense computation therefore has no such outside position, and choosing fallback background zero is harmless. These cases cover the domain without overlap, proving ⟦ T ′ ⟧ = D \llbracket\mathcal{T}' \rrbracket= D [ [ T ′ ] ] = D .
For multiplication, a nonzero background selects the dense fallback, whose contract gives a terminating execution and one output DenseBlock. With zero backgrounds, a summand can be nonzero only when both factors lie in blocks. Because each operand’s blocks are disjoint, every such summand belongs to exactly one pair with a common contracted range. Partitioning the pairs’ output boxes assigns its output position to exactly one region. Restricting a pair to that region and its shared contracted range therefore counts every contributing summand once. The other summands have a zero factor, and positions outside all output regions have value zero, the result background. The product rules admit each partial product and the addition rules admit its accumulated result. Definedness of the dense product makes every scalar product defined. A defined finite sum over R R R contains no mixture of + ∞ +\infty + ∞ and − ∞ -\infty − ∞ , so the partial sums and their fixed-order accumulation are also defined. The primitive contracts and induction through this finite order give terminating calls and correctly typed cores. Reconstruction consequently has the dense product’s value. The regions, types, and calls again depend only on descriptors.
It remains to compare with the existing operation f g b f_{\mathrm{gb}} f gb . Lemma A.2 identifies the operand arrays with those given by the original index-map representation. The dense correctness property of g-BCSR operations [15 ] , restated under the numerical contracts in Theorem A.16, gives ⟦ f g b ( T ) ⟧ = f ( ⟦ T ⟧ ) = D \llbracket f_{\mathrm{gb}}(\mathcal{T}) \rrbracket= f(\llbracket\mathcal{T} \rrbracket) = D [ [ f gb ( T ) ] ] = f ( [ [ T ] ] ) = D . Removing a block whose entries equal its background preserves every lookup, so this equality also covers the operation’s redundant-block removal. This comparison establishes the theorem’s final denotational equality; the preceding proof of the structural rules uses only the block model, region properties, and primitive contracts.
Correspondence with the reference procedures. Write f r e f f^{\mathrm{ref}} f ref for Algorithm 1 or Algorithm 2, interpreted in the structural block model with the same fixed policies and with redundant blocks retained. This notation distinguishes their chosen representations from the existing operation f g b f_{\mathrm{gb}} f gb , which may remove redundant blocks. The following equality concerns abstract blocks and quotient-indexed cores; Lemma A.2 relates them to physical index-map storage by denotation.
Lemma A.17 (Reference correspondence). Under the primitive contracts and fixed policies, suppose π ⃗ ⇒ ( π ′ , κ ) \vec{\pi} \Rightarrow(\pi',\kappa) π ⇒ ( π ′ , κ ) , π ( T ) = π ⃗ \pi(\mathcal{T})=\vec{\pi} π ( T ) = π , and f ( ⟦ T ⟧ ) ⇓ D f(\llbracket\mathcal{T}\rrbracket)\Downarrow D f ( [ [ T ] ] ) ⇓ D . For the payload ρ ′ \rho' ρ ′ produced by κ ( ρ ( T ) ) \kappa(\rho(\mathcal{T})) κ ( ρ ( T )) , we have
f r e f ( T ) ⇓ Pack ( π ′ , ρ ′ ) . f^{\mathrm{ref}}(\mathcal{T}) \Downarrow\operatorname{Pack}(\pi',\rho'). f ref ( T ) ⇓ Pack ( π ′ , ρ ′ ) . The reference procedure executes the numerical calls recorded in κ \kappa κ , up to fresh names and output binding. It satisfies Definition 4.4(i)–(iii).
Proof. For an element-wise operation, the rules and reference procedure use the same refinement, alignment, background, and type policies. The algorithm’s identity branch is B-Identity; its annihilator branch is B-Annihilator; and its remaining branch is B-Compute, including any constant lifting. The extra d i = d ′ d_i=d' d i = d ′ premise of B-Annihilator holds for the annihilators of the supported operators (Table 4 ). If the background combination is defined, annihilation gives this equality. Its only undefined case with an annihilator is multiplication, whose annihilator and fallback background are both zero. The branches therefore agree, including their priority. Both constructions retain alignment calls before these branches and retain result blocks without testing their cores. They select the same output positions and types and invoke the same numerical routines in the same order. The calls terminate by Theorem 4.3 ; on the same input payload, they produce the same quotient-indexed cores.
For multiplication, both constructions use the same background test, output regions, restrictions, selected product types, and accumulation order. They therefore select the same output representation and numerical calls. Their calls terminate and return the same cores by the primitive contracts, establishing the displayed equality in both cases. In particular,
π ( f r e f ( T ⃗ ) ) = π ′ , ϱ ( f r e f ( T ⃗ ) ) = κ ( ϱ ( T ⃗ ) ) . \pi(f^{\mathrm{ref}}(\vec{T})) = \pi', \qquad\varrho(f^{\mathrm{ref}}(\vec{T})) = \kappa(\varrho(\vec{T})). π ( f ref ( T )) = π ′ , ϱ ( f ref ( T )) = κ ( ϱ ( T )) .
Theorem 4.3 supplies dense equivalence, and the fixed-policy correspondence supplies descriptor separation and the fixed numerical calls. Thus the reference procedures, equivalently the operations defined by the structural rules, are supported. Equality of their representations does not assert equality with a representation from which f g b f_{\mathrm{gb}} f gb has removed redundant blocks.
Sequences of Operations
Corollary A.18 (Descriptor propagation). Let f 1 , … , f N f_1,\ldots,f_N f 1 , … , f N be a fixed sequence of supported operations, and let the descriptors of the operands it starts from be determined by the DNN architecture and the input and batch shapes. Then the descriptor of every tensor the sequence produces is determined by them as well, independently of the payloads.
Proof. We induct on j j j . The initial descriptors are fixed by hypothesis. Suppose that the descriptors of the first j − 1 j-1 j − 1 results are fixed. The operands of f j f_j f j are inputs or earlier results, so their descriptor tuple π ⃗ j \vec{\pi}_j π j is also fixed. The judgment
π ⃗ j ⇒ f j ( π j , κ j ) \vec{\pi}_j \xRightarrow{f_j} (\pi_j,\kappa_j) π j f j ( π j , κ j )
determines π j \pi_j π j without reading any payload. By condition (ii) of Definition 4.4, this is the descriptor of the actual result. This establishes the induction step.
Correctness of the composed numerical code follows from Lemma B.4 . Its S-Seq case establishes that the result of one generated fragment supplies the correct inputs to the next.
Architecture Specialization: Definitions and Proofs
This appendix gives the definitions and proofs for program specialization in §5: retained redundant blocks, descriptor-determined control, structural traversals, and the generated specialized program. Appendix A establishes correctness of the tensor operations. Here we prove preservation under program composition and correctness of the complete specialized program.
Redundant Blocks
The fragment excludes guards that read payloads, and it excludes one operation of the general implementation. A block all of whose entries equal the background of its tensor is redundant, since dropping it leaves ⟦ T ⟧ \llbracket\mathcal{T}\rrbracket [ [ T ] ] unchanged, and the general implementation drops it. The test reads the core, so the number of blocks in a result, which belongs to the descriptor by Equation (1) , depends on the payload. A specializing implementation therefore omits the step, at the cost of retaining the redundant blocks.
The two implementations then differ. A retained block is invisible to ⟦ ⋅ ⟧ \llbracket\cdot\rrbracket [ [ ⋅ ] ] : every index inside it reads a d d d whether the block is retained or removed, while lookup outside the block is unchanged. Block counts, however, belong to the descriptor, so the two implementations need not produce equal descriptors, and a block count is data that a descriptor-determined guard is permitted to read. In a program with such a guard, the two implementations can take different branches, and from that point they perform different sequences of operations. Theorem A.16 does not close this gap by itself: it states that each operation agrees with the dense operation it replaces, which gives agreement along a fixed sequence and says nothing about two executions that diverge.
Theorem B.6 below is therefore stated about the non-canonicalizing implementation. For the binary operations, its fixed representations are those of the structural rules, equivalently the retained-block reference procedures of Lemma A.17 . For a generated program the gap does not arise. Apart from tensor-library dispatch, the tests in a generated program observe tensors only through their dense entries. The expression replacement of § 5.1 likewise depends on the coefficients, not their block partition. The proof of Theorem 5.3 uses this to relate G σ G_\sigma G σ to the canonicalizing implementation as well.
Structural Execution
We give the definitions and proofs for the structural execution rules of § 5.2 . In its structural environment Γ \Gamma Γ , a tensor binding contains a descriptor, and a structural binding contains a known value. Layer indices, traversal sets, and known masks are structural bindings. Each variable has a fixed tensor or structural classification. Thus a tensor target uses S-Assign, and a structural target uses S-Static. An assignment to a structural variable must be evaluated entirely from these bindings and tensor descriptors. Assigning a numerical tensor entry to a counter does not make that entry structural.
We write ⟦ a ⟧ Γ \llbracket a\rrbracket_\Gamma [ [ a ] ] Γ for the value of a structural expression a a a . This evaluation reads constants, known bindings, and descriptors, and applies the corresponding deterministic operations to them. It neither executes numerical calls nor reads unknown cores. Descriptor queries must refer to the same supported representations as tensor evaluation. For every ordinary environment V V V consistent with Γ \Gamma Γ , evaluating a a a in V V V must therefore give ⟦ a ⟧ Γ \llbracket a\rrbracket_\Gamma [ [ a ] ] Γ . This agreement is also required of structural operation parameters. Values of uniform masks are known only when established by the fixed inputs or known-value computations. The type of a uniform block alone does not establish its value. These requirements make the guard and structural-assignment conditions of Definition 5.2 explicit.
Tensor Expressions
The expression rules of Figure 9 apply the operation semantics to the tensor programs of Neuton. We use V V V for an ordinary execution environment. It assigns tensors to tensor variables and values to structural variables. The structural environment Γ \Gamma Γ contains the descriptors of these tensors and the known structural values. The payload environment R R R contains the cores used by the generated code. The environments V V V and Γ \Gamma Γ have the same live variable domain, partitioned into tensor and structural variables, and R R R has exactly its tensor variables. We write R ∼ ( V , Γ ) R \sim(V,\Gamma) R ∼ ( V , Γ ) when
V ( x ) = Pack ( Γ ( x ) , R ( x ) ) for every tensor variable x , V ( z ) = Γ ( z ) for every structural variable z . \begin{aligned}
V(x) &= \operatorname{Pack}(\Gamma(x),R(x)) && \text{for every tensor variable }x,\\
V(z) &= \Gamma(z) && \text{for every structural variable }z.
\end{aligned} V ( x ) V ( z ) = Pack ( Γ ( x ) , R ( x )) = Γ ( z ) for every tensor variable x , for every structural variable z .
The variable classes are fixed by the program. This relation uses the supported operations’ fixed representations. For the binary operations, these are the retained-block reference representations of Lemma A.17 . It does not identify representations that differ by numerical removal of redundant blocks.
Tensor expressions are variables, tensor constants, and applications of supported operations. The generic notation f ( i ⃗ ) f(\vec{i}) f ( i ) includes tensor operations with their axis, shape, and other structural parameters. The instance f f f replaces those parameters by their values under Γ \Gamma Γ . To insert a known structural value as tensor data, const ( a ) \operatorname{const}(a) const ( a ) permits a structural expression a a a whose value is a tensor in a fixed representation. We write ⟦ a ⟧ Γ \llbracket a\rrbracket_\Gamma [ [ a ] ] Γ for its evaluation using the known bindings and descriptors in Γ \Gamma Γ , as defined above. The rule is
T 0 = ⟦ a ⟧ Γ Γ ⊢ const ( a ) ⇝ ( π ( T 0 ) , ρ ( T 0 ) ) E-CONST. \begin{aligned}
\mathcal{T}_0 &= \llbracket a\rrbracket_\Gamma\\
\Gamma&\vdash\operatorname{const}(a) \leadsto\bigl(\pi(\mathcal{T}_0),\rho(\mathcal{T}_0)\bigr)
\end{aligned}
\qquad\text{E-CONST.} T 0 Γ = [ [ a ] ] Γ ⊢ const ( a ) ⇝ ( π ( T 0 ) , ρ ( T 0 ) ) E-CONST.
A literal tensor is the special case a = T 0 a=\mathcal{T}_0 a = T 0 . The payload in the conclusion is a literal in the generated expression. Thus a mask computed from a traversal set is fixed separately at each occurrence, using that iteration’s environment. A known mask is permitted here only if its entries follow from the fixed inputs or a computation on known structural values. A UniformBlock type specifies sharing but does not determine the value of its core.
The numerical expression κ ( i e ′ ) \kappa(i'_e) κ ( i e ′ ) evaluates its arguments once, in operand order, and binds them to the input cores of κ \kappa κ . It then executes the local numerical calls and returns the result payload. Intermediate names are local and fresh. Structural parameters are constants in this expression, so subsequent updates to Γ \Gamma Γ cannot change an already generated occurrence. Expressions have no effects on program variables. We write R ⊢ i e ′ ⇓ ρ R \vdash i'_e \Downarrow\rho R ⊢ i e ′ ⇓ ρ for this payload evaluation and V ⊢ i e ⇓ T V \vdash i_e \Downarrow T V ⊢ i e ⇓ T for ordinary execution using the supported tensor operations.
Lemma B.1 (Correctness of tensor-expression evaluation). Suppose Γ ⊢ i e ⇝ ( π , i e ′ ) \Gamma\vdash i_e \leadsto(\pi,i'_e) Γ ⊢ i e ⇝ ( π , i e ′ ) , Γ ∼ ( V , R ) \Gamma\sim(V,R) Γ ∼ ( V , R ) , and every operation in i e i_e i e is supported. If V ⊢ i e ⇓ T V \vdash i_e \Downarrow T V ⊢ i e ⇓ T and its direct dense evaluation is defined in exact arithmetic, then there is a payload ρ \rho ρ such that
R ⊢ i e ′ ⇓ ρ , Pack ( π , ρ ) = T , ⟦ T ⟧ = i e d e n s e ( V ) . R \vdash i'_e \Downarrow\rho,\qquad\operatorname{Pack}(\pi,\rho)=T,\qquad\llbracket T\rrbracket=i_e^{\mathrm{dense}}(V). R ⊢ i e ′ ⇓ ρ , Pack ( π , ρ ) = T , [ [ T ] ] = i e dense ( V ) . Here i e d e n s e ( V ) i_e^{\mathrm{dense}}(V) i e dense ( V ) evaluates the tensor expression using the dense values of V V V and the same structural parameters.
Proof. We induct on the structural derivation. For E-Var, the conclusion records Γ ( x ) \Gamma(x) Γ ( x ) and the numerical expression x x x . Its evaluation returns R ( x ) R(x) R ( x ) , and the environment relation reconstructs V ( x ) V(x) V ( x ) . For E-Const, structural-value agreement gives the same T 0 T_0 T 0 in V V V and Γ \Gamma Γ . Its descriptor and literal payload reconstruct that tensor. Both cases also give equality of dense values.
For E-Op, apply the induction hypothesis to each operand. The generated operand expressions return payloads ρ ⃗ \vec{\rho} ρ that, with descriptors π ⃗ \vec{\pi} π , reconstruct the ordinary operand tensors T ⃗ \vec{T} T . The known structural bindings agree in Γ \Gamma Γ and V V V , and every descriptor read returns the same descriptor. Consequently the two evaluations instantiate the same operation f Γ f_\Gamma f Γ . The premise π ⃗ ⇒ f ( π ′ , κ ) \vec{\pi}\xRightarrow{f}(\pi',\kappa) π f ( π ′ , κ ) and supportedness imply that κ ( ρ ⃗ ) \kappa(\vec{\rho}) κ ( ρ ) terminates with the payload of f Γ ( T ⃗ ) f_\Gamma(\vec{T}) f Γ ( T ) , whose descriptor is π ′ \pi' π ′ . This proves exact reconstruction of the supported result. Dense equivalence gives
⟦ Pack ( π ′ , κ ( ρ ⃗ ) ) ⟧ = f Γ ( ⟦ T ⃗ ⟧ ) . \llbracket\operatorname{Pack}(\pi',\kappa(\vec{\rho}))\rrbracket=f_\Gamma(\llbracket\vec{T}\rrbracket). [ [ Pack ( π ′ , κ ( ρ )) ] ] = f Γ ( [ [ T ] ] ) .
The operand induction hypotheses identify this with direct dense expression evaluation. For binary operations these properties follow from Theorem 4.3 and Lemma A.17 . For other operations they are the supportedness contracts. Local bindings in the generated expression preserve the operand order and do not change R R R , completing the induction.
Statements
Definition B.2 (Structural execution). A structural execution of a statement i s i_s i s from Γ \Gamma Γ is a finite derivation of Γ ⊢ i s ⇝ ( Γ ′ , K ) \Gamma\vdash i_s \leadsto(\Gamma',K) Γ ⊢ i s ⇝ ( Γ ′ , K ) using Figure 10 and the rules below. Its result consists of the updated structural environment Γ ′ \Gamma' Γ ′ and the numerical code K K K . A program body has terminating structural execution when such a derivation exists.
A structural execution follows the syntax of the statement. The S-Assign rule uses the tensor-expression judgment to generate a numerical assignment. The right-hand side reads the old payload bindings before the assignment updates its target. Thus successive iterations may assign the same tensor variable without introducing a new program-level name. Fresh names are needed only for local intermediate results inside numerical expressions. The S-Static rule updates a known binding and emits no code. S-Seq concatenates the two generated fragments. The while rules recursively process the body and remaining iterations, testing the guard in the updated environment each time.
Figure 10 gives the assignment, sequence, conditional, and while rules. The empty-statement rule is
\frac{\Gamma\vdash\mathsf{skip} \leadsto(\Gamma,\epsilon)}{\phantom{\Gamma\vdash\mathsf{skip} \leadsto(\Gamma,\epsilon)}}\ \textsc{S-Skip}
The rules for ite are
\frac{\llbracket a\rrbracket_{\Gamma}=\mathrm{true}\qquad\Gamma\vdash is_1\leadsto(\Gamma',K)}
{\Gamma\vdash\mathrm{ite}(a,is_1,is_2)\leadsto(\Gamma',K)}\ \textsc{S-If-T}
\frac{\llbracket a\rrbracket_{\Gamma}=\mathrm{false}\qquad\Gamma\vdash is_2\leadsto(\Gamma',K)}
{\Gamma\vdash\mathrm{ite}(a,is_1,is_2)\leadsto(\Gamma',K)}\ \textsc{S-If-F}
Here ite is a conditional statement. Tensor-valued selection whose condition depends on numerical values remains a numerical operation. The structural rules cannot select a branch using an unknown guard. § 5.1 instead specializes the regions invoked by such runtime decisions.
Ordinary execution and generated code. Let V V V be an environment of tensors and structural values, and R R R a payload environment, as in Appendix § 11 .2.1. Ordinary statement execution is written V ⊢ i s ⇓ V ′ V\vdash is\Downarrow V' V ⊢ i s ⇓ V ′ . It uses Neuton’s assignment, sequence, and while semantics, with the supported tensor operations and the structural helpers of P s P_s P s . Generated-code execution is written R ⊢ K ⇓ n u m R ′ R\vdash K\Downarrow^{\mathrm{num}}R' R ⊢ K ⇓ num R ′ . An empty fragment leaves R R R unchanged. An assignment evaluates its numerical expression and then replaces the target binding. Composition executes the fragments in order. Intermediate names remain local, so they cannot overwrite a live program variable. A numerical execution is defined when every scalar operation in the corresponding dense computation of each executed tensor operation is defined, and its structural expressions are defined. Sparse execution alone is insufficient for this condition, since omitting a zero entry may avoid an undefined operation in the dense counterpart.
Correctness and Reuse
Lemma B.3 (Structural determinacy). For fixed operation policies, the results of a finite structural execution are determined by its input statement and environment. Specifically, if Γ ⊢ i s ⇝ ( Γ 1 , K 1 ) \Gamma\vdash is\leadsto(\Gamma_1,K_1) Γ ⊢ i s ⇝ ( Γ 1 , K 1 ) and Γ ⊢ i s ⇝ ( Γ 2 , K 2 ) \Gamma\vdash is\leadsto(\Gamma_2,K_2) Γ ⊢ i s ⇝ ( Γ 2 , K 2 ) , then Γ 1 = Γ 2 \Gamma_1=\Gamma_2 Γ 1 = Γ 2 and K 1 = K 2 K_1=K_2 K 1 = K 2 up to renaming local intermediate variables. Neither result depends on numerical payloads.
Proof. We induct on the first derivation and compare its final rule with the second derivation. The statement form fixes the assignment or sequence rule. For a conditional or while statement, ⟦ a ⟧ Γ \llbracket a\rrbracket_{\Gamma} [ [ a ] ] Γ fixes which rule applies. Tensor-expression evaluation is deterministic because operand evaluation and the operation policies are fixed. Structural assignments evaluate deterministic expressions over known data. In a sequence, the induction hypothesis gives the same result of the first statement, and hence the same input environment for the second. In a true while case it gives the same environment and code for the body, followed by the same result for the recursive loop. False while and skip cases both return the input environment and empty code. Each rule reads only Γ \Gamma Γ , establishing independence from payloads. This argument proves uniqueness of finite derivations, not that every structural execution terminates.
Lemma B.4 (Execution of generated code). Let Γ ⊢ i s ⇝ ( Γ ′ , K ) \Gamma\vdash is\leadsto(\Gamma',K) Γ ⊢ i s ⇝ ( Γ ′ , K ) be a finite structural execution of a descriptor-determined statement with supported operations. Suppose Γ ∼ ( V , R ) \Gamma\sim(V,R) Γ ∼ ( V , R ) and V ⊢ i s ⇓ V ′ V\vdash is\Downarrow V' V ⊢ i s ⇓ V ′ is defined. Then there is R ′ R' R ′ such that
R ⊢ K ⇓ n u m R ′ , Γ ′ ∼ ( V ′ , R ′ ) . R\vdash K\Downarrow^{\mathrm{num}}R',\qquad\Gamma'\sim(V',R'). R ⊢ K ⇓ num R ′ , Γ ′ ∼ ( V ′ , R ′ ) . In particular, for each tensor variable x x x in the final environment, ⟦ Pack ( Γ ′ ( x ) , R ′ ( x ) ) ⟧ = ⟦ V ′ ( x ) ⟧ \llbracket\operatorname{Pack}(\Gamma'(x),R'(x))\rrbracket=\llbracket V'(x)\rrbracket [ [ Pack ( Γ ′ ( x ) , R ′ ( x )) ] ] = [ [ V ′ ( x ) ] ] .
Proof. We induct on the structural derivation. The relation Γ ∼ ( V , R ) \Gamma\sim(V, R) Γ ∼ ( V , R ) is defined in Appendix § 11 .2.1. It gives exact reconstruction for tensor bindings and equality for known structural bindings. Exact reconstruction concerns the supported representations. Equality with a backend that prunes redundant blocks is established separately through dense values.
For S-Assign, Lemma B.1 gives a payload ρ \rho ρ for the generated right-hand side and a descriptor π \pi π reconstructing the ordinary expression result T T T . The structural rule stores π \pi π at x x x , ordinary execution stores T T T , and the emitted assignment stores ρ \rho ρ . All other bindings are unchanged, so the relation holds for the updated environments. This also covers assignments whose right-hand side reads x x x . Expression evaluation precedes the update in both executions.
For S-Static, the structural expression has the same value v v v in Γ \Gamma Γ and V V V . Both environments update the corresponding structural binding to v v v . The rule emits ϵ \epsilon ϵ , leaving R R R unchanged, which preserves the relation. For S-Seq, apply the induction hypothesis to the first premise to obtain the intermediate payload environment. The resulting consistency relation supplies the hypothesis for the second premise. Executing the concatenated code therefore produces the required final environment.
For S-While-F, guard agreement implies that ordinary execution also exits without executing the body. Both sides preserve their environments. For S-While-T, the ordinary guard is true. Apply the induction hypothesis to the body premise. It yields related updated environments, which give agreement on the next guard and allow the induction hypothesis for the recursive while premise. The two fragments compose to produce the final payload environment. These premises are smaller derivations even though the second premise has the same while syntax. The conditional cases use guard agreement and the induction hypothesis for the selected branch. The skip case preserves all bindings. This completes the induction. □
Corollary B.5 (Architecture dependence). Fix the abstract interpreter, operation policies, and structural constants. If the initial environment of a descriptor-determined program is determined by the DNN architecture and input and batch shapes, its finite structural execution generates the same code for all compatible numerical inputs. At corresponding assignments, the tensor descriptors are the same, while the computed payloads may differ.
Proof. The fixed information gives the same initial Γ \Gamma Γ . Lemma B.3 determines the structural derivation and its output independently of payloads. Lemma B.4 relates each defined numerical execution to this derivation, including the descriptors assigned in its premises. □
Theorem B.6 (Specialized program). Let P = ( i s , o ⃗ ) P=(i_s,\vec{o}) P = ( i s , o ) have body i s i_s i s and returned tensor variables o ⃗ \vec{o} o . Fix specialization inputs σ \sigma σ and initial environment Γ 0 ( σ ) \Gamma_0(\sigma) Γ 0 ( σ ) . Assume supported tensor operations, descriptor-determined control, and a finite derivation
Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) . \Gamma_0(\sigma) \vdash i_s \leadsto(\Gamma_f,K). Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) . Let G σ G_\sigma G σ execute K K K on the input payloads and return Pack ( Γ f ( o ⃗ ) , o ⃗ ) \operatorname{Pack}(\Gamma_f(\vec{o}),\vec{o}) Pack ( Γ f ( o ) , o ) . For every compatible b b b on which P P P has a defined execution,
⟦ G σ ( b ) ⟧ = ⟦ P ( b ) ⟧ . \llbracket G_\sigma(b) \rrbracket= \llbracket P(b) \rrbracket. [ [ G σ ( b ) ] ] = [ [ P ( b ) ] ] . The generated code has a fixed finite sequence of numerical calls and output reconstruction. Its structural parameters are constants determined by σ \sigma σ , and it contains no structural dispatch or host guard inspecting numerical values.
Proof. Fix a compatible numerical input b b b , and let V 0 V_0 V 0 be its ordinary initial environment and R 0 R_0 R 0 its tensor payloads. Compatibility means that Γ 0 ( σ ) ∼ ( V 0 , R 0 ) \Gamma_0(\sigma) \sim(V_0,R_0) Γ 0 ( σ ) ∼ ( V 0 , R 0 ) . By Lemma B.4 , executing K K K gives Γ f \Gamma_f Γ f consistent with V f V_f V f and the ordinary final environment V f V_f V f . Reconstructing the returned variables therefore gives the same tensors and hence the same dense bounds. By Lemma B.3 ,
Algorithm 3 The structural loop of a traverse
Input: The loop-carried expression, whose coefficient tensor is C C C ; the direction d i r dir d i r , the priority function p r i pri p r i , the stopping condition s t o p stop s t o p and the replacement function g g g of the traverse. We write S ‾ \overline{S} S for the set of lanes j j j at which s t o p ( n j ) stop(n_j) s t o p ( n j ) does not hold, and n b r ( Σ ) nbr(\Sigma) nb r ( Σ ) for the set of lanes whose neurons are neighbors, in the direction d i r dir d i r , of the neurons of the lanes of Σ \Sigma Σ .
Output: The expression with which the loop of §5.1 ends (Lemma B.9 ).
B ← { j ∈ S ‾ : a block of C covers lane j } B \gets\{j \in\overline{S} : \text{a block of } C \text{ covers lane } j\} B ← { j ∈ S : a block of C covers lane j } , or B ← S ‾ B \gets\overline{S} B ← S if the background of C C C is not 0
While B ≠ ∅ B \ne\varnothing B = ∅ Do
Σ ← { j ∈ B : p r i ( n j ) = max k ∈ B p r i ( n k ) } \Sigma\gets\{j \in B : pri(n_j) = \max_{k \in B} pri(n_k)\} Σ ← { j ∈ B : p r i ( n j ) = max k ∈ B p r i ( n k )} Select
Replace each term c i , j n j c_{i,j}n_j c i , j n j , j ∈ Σ j \in\Sigma j ∈ Σ , of the expression of every neuron i i i by g ( n j , c i , j ) g(n_j,c_{i,j}) g ( n j , c i , j )
B ← ( B ∖ Σ ) ∪ ( n b r ( Σ ) ∩ S ‾ ) B \gets(B \setminus\Sigma) \cup(nbr(\Sigma) \cap\overline{S}) B ← ( B ∖ Σ ) ∪ ( nb r ( Σ ) ∩ S ) Advance
End While
Return the expression
derivation and K K K are fixed by σ \sigma σ . Each tensor-expression rule emits finite numerical code with fixed structural arguments. Structural assignments and guard evaluations emit no code, and sequence and loop rules only concatenate the fragments of their finite premises. Thus K K K has the claimed form. Numerical choices inside its calls remain permitted. □ \square □
The finite-derivation premise is necessary. A loop whose guard depends only on a shape may still run forever. For the transformed programs P s P_s P s of the main theorem, the fixed layer sequence and the structural traversal termination argument below establish this premise. The proof is relative to the tensor program produced by Neuton. Its existing semantic-preservation theorem supplies the connection to the original ConstraintFlow specification.
Relaxing Descriptor Determinacy for Traversals
Definition B.7 (Descriptor-determined up to traversals). Let P P P be a program that Neuton generates, and let P s P_s P s resolve its fixed layer dispatch, use its non-canonicalizing library, and replace the loop of every traverse by Algorithm 3, whose set B B B is a known binding in the structural environment. P P P is descriptor-determined up to its traversals if P s P_s P s is descriptor-determined (Definition 5.2 ). If P P P already has expanded layer dispatch, contains no traverse, and retains redundant blocks, then P s = P P_s = P P s = P , and the condition is ordinary descriptor determinacy.
Coverage of active terms. A replacement can refer to a neuron beyond an immediate neighbor, as allowed by Definition 5.1 . The set B B B advances along individual edges, so it need not contain every active index at every iteration. We use the following coverage relation to account for these paths. Let U = { j : ¬ s t o p ( n j ) } \mathcal{U} = \{j : \neg stop(n_j)\} U = { j : ¬ s t o p ( n j )} , which is S ‾ \overline{S} S in Algorithm 3. For B ⊆ U B \subseteq\mathcal{U} B ⊆ U , an index j ∈ U j \in\mathcal{U} j ∈ U is covered by B B B if j ∈ B j \in B j ∈ B , or if there is a path j 0 , … , j k = j j_0,\ldots,j_k = j j 0 , … , j k = j , k ≥ 1 k \ge1 k ≥ 1 , with j 0 ∈ B j_0 \in B j 0 ∈ B and j t + 1 ∈ n b r ( { j t } ) j_{t+1} \in nbr(\{j_t\}) j t + 1 ∈ nb r ({ j t }) , such that for every 0 ≤ t < k 0 \le t < k 0 ≤ t < k , j t ∈ U j_t \in\mathcal{U} j t ∈ U and p r i ( n j t ) > p r i ( n j ) pri(n_{j_t}) > pri(n_j) p r i ( n j t ) > p r i ( n j ) . Write Cov ( B ) \operatorname{Cov}(B) Cov ( B ) for the set of covered indices. Thus every index covered has a path to its introduction, including the starting vertex, with strictly greater priority. When j ∈ B j \in B j ∈ B , no path is required.
Lemma B.8 (Coverage). Let B ⊆ U B \subseteq\mathcal{U} B ⊆ U be nonempty, let p = max j ∈ B p r i ( n j ) p = \max_{j \in B} pri(n_j) p = max j ∈ B p r i ( n j ) , and let Σ = { j ∈ B : p r i ( n j ) = p } \Sigma= \{j \in B : pri(n_j) = p\} Σ = { j ∈ B : p r i ( n j ) = p } and B ′ = ( B ∖ Σ ) ∪ ( n b r ( Σ ) ∩ U ) B' = (B \setminus\Sigma) \cup(nbr(\Sigma) \cap\mathcal{U}) B ′ = ( B ∖ Σ ) ∪ ( nb r ( Σ ) ∩ U ) . Then:
(i) If j ∈ Cov ( B ) j \in\operatorname{Cov}(B) j ∈ Cov ( B ) , then p r i ( n j ) ≤ p pri(n_j) \le p p r i ( n j ) ≤ p ; equality implies j ∈ Σ j \in\Sigma j ∈ Σ .
(ii) Cov ( B ) ∖ Σ ⊆ Cov ( B ′ ) \operatorname{Cov}(B) \setminus\Sigma\subseteq\operatorname{Cov}(B') Cov ( B ) ∖ Σ ⊆ Cov ( B ′ ) .
(iii) If g g g follows the DNN and j ∈ Σ j \in\Sigma j ∈ Σ , every unstopped neuron mentioned by g ( n j , c ) g(n_j,c) g ( n j , c ) has its index in Cov ( B ′ ) \operatorname{Cov}(B') Cov ( B ′ ) .
Proof. For (i), an index in B B B has priority at most p p p . A covered index outside B B B has priority strictly smaller than that of the starting vertex of its path, which belongs to B B B . Equality therefore requires membership in B B B and hence in Σ \Sigma Σ .
For (ii), an index in B ∖ Σ B \setminus\Sigma B ∖ Σ remains in B ′ B' B ′ . Otherwise, choose a path witnessing coverage. If its starting vertex is not selected, it remains in B ′ B' B ′ and the same path witnesses coverage. If it is selected, the next vertex belongs to B ′ B' B ′ : it is a neighbor of a selected vertex and is unstopped. That vertex either is the destination, or starts the remaining path, whose vertices still have priority strictly greater than the destination.
For (iii), let m m m be an unstopped neuron mentioned by g ( n j , c ) g(n_j,c) g ( n j , c ) . Definition 5.1 supplies a nonempty path from n j n_j n j to m m m whose intermediate vertices are unstopped and have priority strictly greater than m m m . Its first vertex after n j n_j n j belongs to B ′ B' B ′ . It either is m m m , or starts a path witnessing coverage of m m m by B ′ B' B ′ .
Lemma B.9 (Structural loop). Let g g g satisfy the conditions of § 5.1 . Then Algorithm 3 halts. If, in addition, both the original and structural executions are defined, then it ends with the expression with which the loop of § 5.1 ends.
Proof. The coefficient axis is indexed by the neurons of the DNN, and n j n_j n j is the neuron of lane j j j . Both executions use the same replacement function g g g and the same abstract state, which remains fixed throughout the traversal. For the original loop, E ℓ E^\ell E ℓ is the tuple of expressions after ℓ \ell ℓ iterations, A i ℓ A_i^\ell A i ℓ the active lanes of neuron i i i , π ℓ \pi^\ell π ℓ the largest priority over ⋃ i A i ℓ \bigcup_i A_i^\ell ⋃ i A i ℓ , and Σ ℓ \Sigma^\ell Σ ℓ the selected lanes. Let ℓ ∗ \ell^* ℓ ∗ denote its termination index, whose existence we establish below. For the structural loop, F m F^m F m is the tuple after m m m iterations, B m B^m B m the set of lanes, μ m \mu^m μ m the largest priority over B m B^m B m , and Σ m \Sigma^m Σ m the selected lanes. The update is
B m + 1 = ( B m ∖ Σ m ) ∪ ( nbr ( Σ m ) ∩ U ) . B^{m+1} = (B^m \setminus\Sigma^m) \cup(\operatorname{nbr}(\Sigma^m) \cap\mathcal{U}). B m + 1 = ( B m ∖ Σ m ) ∪ ( nbr ( Σ m ) ∩ U ) .
Termination. Number the neurons in a topological order of the DNN, reversed for forward traversal, so that every neighbor in the traversal direction precedes its source. Let r ( j ) r(j) r ( j ) be the distinct number of n j n_j n j , and let L m = ∑ j ∈ B m 2 r ( j ) L^m = \sum_{j \in B^m} 2^{r(j)} L m = ∑ j ∈ B m 2 r ( j ) . If B m ≠ ∅ B^m \ne\varnothing B m = ∅ , then Σ m ≠ ∅ \Sigma^m \ne\varnothing Σ m = ∅ . Choose j ∗ ∈ Σ m j^* \in\Sigma^m j ∗ ∈ Σ m of greatest number. Every index in nbr ( Σ m ) \operatorname{nbr}(\Sigma^m) nbr ( Σ m ) has number below r ( j ∗ ) r(j^*) r ( j ∗ ) , so j ∗ j^* j ∗ is not added back. The total contribution of newly added indices is at most ∑ k < r ( j ∗ ) 2 k < 2 r ( j ∗ ) \sum_{k<r(j^*)} 2^k < 2^{r(j^*)} ∑ k < r ( j ∗ ) 2 k < 2 r ( j ∗ ) , while removing j ∗ j^* j ∗ subtracts 2 r ( j ∗ ) 2^{r(j^*)} 2 r ( j ∗ ) . Thus L m + 1 < L m L^{m+1} < L^m L m + 1 < L m , proving termination. The same measure on ⋃ i A i ℓ \bigcup_i A_i^\ell ⋃ i A i ℓ proves termination of the original loop: every new active neuron introduced by g g g is reachable in the traversal direction and therefore has smaller number than its source. Stopped neurons do not enter the measure. In particular, ℓ ∗ \ell^* ℓ ∗ exists. This argument does not require priority to decrease along every DNN edge.
Agreement. Call structural iteration m m m effective if F i m F_i^m F i m contains an index whose coefficient in F i m F_i^m F i m is nonzero for some i i i , and a zero-work iteration otherwise. Let λ ( m ) \lambda(m) λ ( m ) count the effective iterations before m m m . We prove by induction that
F m = E λ ( m ) , A i λ ( m ) ⊆ Cov ( B m ) for every i . (9) F^m = E^{\lambda(m)}, \qquad A_i^{\lambda(m)} \subseteq\operatorname{Cov}(B^m) \quad\text{for every } i. \tag*{(9)} F m = E λ ( m ) , A i λ ( m ) ⊆ Cov ( B m ) for every i . (9)
Initially, F 0 = E 0 F^0 = E^0 F 0 = E 0 . A nonzero coefficient lies in a stored block of C C C , or the background is nonzero. Its index therefore belongs to B 0 B^0 B 0 whenever it is unstopped, giving A i 0 ⊆ B 0 ⊆ Cov ( B 0 ) A_i^0 \subseteq B^0 \subseteq\operatorname{Cov}(B^0) A i 0 ⊆ B 0 ⊆ Cov ( B 0 ) . For the induction step, suppose B m ≠ ∅ B^m \ne\varnothing B m = ∅ and write ℓ = λ ( m ) \ell= \lambda(m) ℓ = λ ( m ) , E = F m = E ℓ E = F^m = E^\ell E = F m = E ℓ , and A i = A i ℓ A_i = A_i^\ell A i = A i ℓ .
A zero-work iteration. Every selected coefficient is zero, so its replacement is g ( n j , 0 ) = 0 g(n_j,0)=0 g ( n j , 0 ) = 0 , defined by hypothesis. Thus F m + 1 = E ℓ F^{m+1}=E^\ell F m + 1 = E ℓ and λ ( m + 1 ) = ℓ \lambda(m+1)=\ell λ ( m + 1 ) = ℓ . No active index belongs to Σ m \Sigma^m Σ m , so Lemma B.8 (ii) gives A i ⊆ Cov ( B m + 1 ) A_i \subseteq\operatorname{Cov}(B^{m+1}) A i ⊆ Cov ( B m + 1 ) .
An effective iteration. Choose j ∘ ∈ Σ m j^\circ\in\Sigma^m j ∘ ∈ Σ m whose coefficient is nonzero in some E j ∘ E_{j^\circ} E j ∘ . Since B m ⊂ U B^m \subset\mathcal{U} B m ⊂ U , j ∘ ∈ A i ∘ j^\circ\in A_{i^\circ} j ∘ ∈ A i ∘ , and hence π ℓ ≥ pri ( n j ∘ ) = μ m \pi^\ell\ge\operatorname{pri}(n_{j^\circ}) = \mu^m π ℓ ≥ pri ( n j ∘ ) = μ m . Conversely, coverage and Lemma B.8 (i) imply π ℓ ≤ μ m \pi^\ell\le\mu^m π ℓ ≤ μ m , with every active index of that priority in Σ m \Sigma^m Σ m . Therefore ℓ < ℓ ∗ \ell< \ell^* ℓ < ℓ ∗ and
π ℓ = μ m , Σ i ℓ = A i ∩ Σ m for every i . \pi^\ell= \mu^m,\qquad\Sigma_i^\ell= A_i \cap\Sigma^m \qquad\text{for every } i. π ℓ = μ m , Σ i ℓ = A i ∩ Σ m for every i .
A lane of Σ m ∖ Σ i ℓ \Sigma^m \setminus\Sigma_i^\ell Σ m ∖ Σ i ℓ is unstopped but not active in E i E_i E i , so its coefficient is zero. The additional replacements therefore contribute zero, and the structural update of E i E_i E i equals the original update. Consequently, F m + 1 = E ℓ + 1 F^{m+1}=E^{\ell+1} F m + 1 = E ℓ + 1 and λ ( m + 1 ) = ℓ + 1 \lambda(m+1)=\ell+1 λ ( m + 1 ) = ℓ + 1 . Every active index after the update is either a surviving active index outside Σ m \Sigma^m Σ m , or is introduced by a replacement of a selected term. Lemma B.8 (ii) covers the first case and part (iii) covers the second, preserving the invariant.
Let M M M be the terminating structural iteration. Since B M = ∅ B^M=\varnothing B M = ∅ and Cov ( ∅ ) = ∅ \operatorname{Cov}(\varnothing)=\varnothing Cov ( ∅ ) = ∅ , every A i λ ( M ) A_i^{\lambda(M)} A i λ ( M ) is empty, giving λ ( M ) ≥ ℓ ∗ \lambda(M)\ge\ell^* λ ( M ) ≥ ℓ ∗ . Each effective step starts before original termination, so λ ( M ) ≤ ℓ ∗ \lambda(M)\le\ell^* λ ( M ) ≤ ℓ ∗ . Thus λ ( M ) = ℓ ∗ \lambda(M)=\ell^* λ ( M ) = ℓ ∗ and F M = E ℓ ∗ F^M=E^{\ell^*} F M = E ℓ ∗ , as required. □
Proof of Theorem 5.3 . Let D σ D_\sigma D σ denote the compatible numerical inputs on which both P P P and P s P_s P s have defined dense executions in exact arithmetic.
Structural execution of P s P_s P s . The fixed DNN has finitely many layers. Resolving layer dispatch therefore gives a finite sequence of transformers in the prescribed topological order. The remaining loops are structural traversals. Their known traversal sets evolve as in Algorithm 3, and Lemma B.9 proves that this evolution terminates. All remaining statements are finite sequences, assignments, and conditionals. The descriptor-determinacy premise supplies the values of their structural expressions and guards. Supportedness supplies terminating structural evaluation of every tensor operation. Recursing over these statements and the finite traversal iterations constructs a finite derivation Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) \Gamma_0(\sigma)\vdash i_s\leadsto(\Gamma_f,K) Γ 0 ( σ ) ⊢ i s ⇝ ( Γ f , K ) for the body of P s P_s P s .
A structural traversal performs the tensor body with its selected-layer or selected-lane mask in place of the numerical selection mask. The structural set determines the entries of this mask, so it can be inserted as a known tensor constant. This is distinct from assuming that an unknown uniform block has a known value. Supportedness of the remaining tensor operations is an explicit premise of the theorem. Theorem B.6 now applies to P s P_s P s , and the whole-program rule returns its generated code with fixed output reconstruction. For every b ∈ D σ b\in D_\sigma b ∈ D σ , it gives ⟦ G σ ( b ) ⟧ = ⟦ P s ( b ) ⟧ \llbracket G_\sigma(b)\rrbracket=\llbracket P_s(b)\rrbracket [ [ G σ ( b ) ] ] = [ [ P s ( b ) ] ] .
From P s P_s P s to P P P . Fix b ∈ D σ b\in D_\sigma b ∈ D σ . Resolving layer dispatch and inlining the selected transformers preserves their order and value dependencies. Outside traversal loops, the two programs perform the same tensor operations, each with its specified dense meaning. They therefore reach corresponding traversals with the same dense coefficients and bounds. Within a traversal, the tensor body implements the simultaneous replacements specified in § 5.1 . Its coefficient indices describe tensor entries, rather than separate host executions for individual neurons. Under the traversal hypotheses, Lemma B.9 proves equality of the returned bound expressions. Additional structural iterations replace only zero-coefficient terms. Both numerical executions are defined by the choice of D σ D_\sigma D σ , including these extra replacements. Equality of final expressions alone is not used to establish definedness. Induction over the surrounding statements consequently gives ⟦ P s ( b ) ⟧ = ⟦ P ( b ) ⟧ \llbracket P_s(b)\rrbracket=\llbracket P(b)\rrbracket [ [ P s ( b ) ] ] = [ [ P ( b ) ] ] .
Redundant blocks. The supported implementation used for P s P_s P s retains real blocks that a general implementation of P P P may remove. Dropping a block equal to the background preserves tensor values. Outside tensor-library dispatch, P P P observes tensor entries through their dense values, including the numerical conditions in its traversal control. Thus removing such blocks changes neither its numerical branches nor the bounds it returns. Exact representation agreement in Lemma B.4 is needed only between structural execution and the supported execution of P s P_s P s . Combining the two dense equalities establishes the theorem. □
The Implementation of Scepter
Generating the program. The implementation performs partial evaluation in two passes: it records structural information and then constructs the specialized program. Both passes run before certification. The first executes the generated code on tensors whose blocks carry a shape and an element type but no numerical payload, and keeps the constants that the fixed inputs determine, such as the value of a stopping condition over a layer. This run records the descriptor of every tensor that it produces, the layer sizes that each call receives, and the number of iterations of each traversal loop. Running the generated code itself lets the library evaluate its own descriptor rules, so no separate analyzer has to be kept in agreement with it. Scepter then unrolls the flow over the layers into one call per layer, unrolls each traversal loop to its recorded iteration count, substitutes the recorded sizes as integer literals, and replaces the aggregates that carry the structural data by the tensors they contain. The result is a program whose only operations are tensor operations, and it computes the payloads during certification.
Descriptor data. Part of the data that the run on tensors without data records has a closed form. The window parameters compose along a chain of layers by Equation (8) , which is associative (Lemma A.14 ), so the parameters of an L L L -layer backsubstitution are the fold of Equation (8) over the layers, and output extents and the result types of Table 5 are local rules. The rest depends on the execution: the number of blocks and their boxes after refinement, merging and alignment depend on the current block lists, the shapes that pass through the reshape, permute and contraction nodes of the generated code are below the level of the block algebra, and the counts of symbolic variables accumulate along the flow. The run obtains all of them.
Tests on tensor values. The implementation does not store the set B B B of Algorithm 3. It reads the lanes that may be active from the blocks of the Boolean tensor of active lanes, where, in the run on tensors without data, a block without data counts as active and a UniformBlock with a value known from the fixed inputs counts by that value. The masks of the stopping condition and of the selected lanes consist of UniformBlocks, so a stopped lane, and a selected lane once it has been replaced, lies in a UniformBlock of value false or 0 and does not count. The compiler evaluates a condition that selects the result of a transformer once for the whole layer, which is correct when the condition takes the same value at every neuron of the layer. The run answers such a condition in the same way, from its blocks, and the answer is exact when every block of the condition is a UniformBlock whose value is known from the fixed inputs, as for the conditions of Crown-IBP, ReuseCert and ZID, which test the layer index. A condition that reads a numerical value cannot be resolved by this structural execution: recording the branch taken by a shape-only execution is not sufficient. Such a condition must either be known from the fixed inputs or remain in the surrounding runtime control. The structural traversal also requires each layer priority to be a UniformBlock with a value known from the fixed inputs.
The variant of the structural loop. The loop that the implementation runs selects whole layers, and the lanes that a replacement adds are those of the blocks that it produces, rather than the neighbors of the selected neurons. The proof of Lemma B.9 extends to this variant when it meets the four obligations that the proof uses for Algorithm 3: coverage , every active lane lies in the set of lanes that the variant may select; selection , an iteration that selects any active lane selects exactly the maximum-priority active lanes of the original loop; harmlessness , every further lane that it selects has coefficient 0, so that its replacement leaves the expression unchanged; and progress , the blocks that a replacement produces lie over neurons that precede the selected ones in the order of the proof, so that the loop halts. Under these obligations, the iterations that select an active lane are the iterations of the original loop and the others are extra iterations, as in the proof of the lemma. These obligations be checked for the generated program; observed termination of a structural execution does not by itself establish them. The prototype does not automatically verify them for arbitrary specifications.
Specializing regions. For a region H H H with fixed input descriptors, supported operations, and terminating descriptor-determined control, Theorem B.6 produces a specialized program G H G_H G H satisfying ⟦ G H ( b ) ⟧ = ⟦ H ( b ) ⟧ \llbracket G_H(b)\rrbracket= \llbracket H(b)\rrbracket [ [ G H ( b ) ] ] = [ [ H ( b ) ] ] on their common domain of defined execution. The region interface must preserve all inputs and results observed by the enclosing program. Replacing calls to H H H with calls to G H G_H G H then preserves subsequent numerical decisions: induction over calls shows that each call returns the same values to the enclosing computation. The sequence of region calls may depend on those values at runtime. Fixed input shapes alone are insufficient for specialization; varying numerical inputs must also preserve all intermediate descriptors.
Selective refinement. In BoxPoly, interval bounds select the neurons whose bounds are refined by a polyhedral analysis. For finite, ordered interval bounds, let h b , j h_{b,j} h b , j and h ˉ b , j \bar{h}_{b,j} h ˉ b , j be the interval bounds of ReLU input j j j in batch member b b b . The refinement set is
U = { j : ∃ b , h b , j < 0 < h ˉ b , j } . U = \{j : \exists b,\ h_{b,j} < 0 < \bar{h}_{b,j}\}. U = { j : ∃ b , h b , j < 0 < h ˉ b , j } .
Entries that are non-finite or do not form an ordered interval are also refined. Selection is shared across the batch: selecting j j j refines it for all batch members. Neurons stable for every batch member retain their interval bounds, and the output property is bounded in full. We specialize the refinement region for groups of fixed shape. Each call supplies a tensor of selected row indices as a numerical input: its shape is fixed, but its entries and the number of calls are runtime choices. Row gathering operates on the numerical payload tensors of the specialized program. Its result layouts must be fixed by the region dimensions, so changing the selected indices changes values but not intermediate descriptors. A sparse gather whose block partition depends on these indices would not satisfy this requirement. The region gathers the selected rows, computes their refined bounds, and returns them to their positions. An incomplete group is padded by repeating its last index, and the padded results are discarded. Row independence ensures that these additional rows do not change the retained bounds. This preserves the selective analysis while applying specialization within each region.
Subsequent tensor optimizations. After specialization, the generated program can be optimized by early reductions, compact block layouts, and fusion of sign-split convolutions and affine substitutions before tensor compilation. These transformations operate on the specialized program. Theorem 5.3 proves equivalence of the specialized program before these transformations; it does not establish floating-point identity of the subsequently compiled kernels.
Memory Transformations of the Specialized Program
This appendix describes the semantic requirements of the transformations in § 5.1 . Their allocation estimates guide a choice of transformation; the dependence and lifetime checks justify that choice. We reason about the specialized program supplied to the transformations, using exact arithmetic and defined operations.
Specialized Programs and Region Interfaces
We analyze the specialized program after expanding its numerical routines into tensor statements,
G σ = s 1 ; ⋯ ; s m , s t = x t ← f t ( y ⃗ t ) , G_\sigma= s_1;\cdots;s_m,\qquad s_t = x_t \leftarrow f_t(\vec{y}_t), G σ = s 1 ; ⋯ ; s m , s t = x t ← f t ( y t ) ,
where each f t f_t f t includes its fixed parameters. Each computed value has one definition, and its operands are program inputs or earlier results. Updates are represented by distinct value versions, including dependencies through shared storage. We reason about the resulting operations as pure functions of their operands. The dependence graph determines which statements can be grouped and which values must remain available across groups.
Let H H H be a region of this graph, and let Def ( H ) \operatorname{Def}(H) Def ( H ) and Use ( H ) \operatorname{Use}(H) Use ( H ) be its defined and read variables. For the set O O O of program outputs, the region’s input and output interfaces are
In ( H ) = Use ( H ) ∖ Def ( H ) , \operatorname{In}(H)=\operatorname{Use}(H)\setminus\operatorname{Def}(H), In ( H ) = Use ( H ) ∖ Def ( H ) ,
Out ( H ) = Def ( H ) ∩ ( Use ( G σ ∖ H ) ∪ O ) . \operatorname{Out}(H)=\operatorname{Def}(H)\cap\left(\operatorname{Use}(G_{\sigma}\setminus H)\cup O\right). Out ( H ) = Def ( H ) ∩ ( Use ( G σ ∖ H ) ∪ O ) .
Here G σ ∖ H G_{\sigma}\setminus H G σ ∖ H denotes the statements outside H H H . Every value in Out ( H ) \operatorname{Out}(H) Out ( H ) must be retained or reconstructed by a transformation of H H H . Other intermediate values can be released after their last use. Storage shared by several values remains live until all uses of those values have completed.
The shapes and element types determine storage estimates for materialized results. Let a ^ ( s t ) \widehat{a}(s_t) a ( s t ) estimate the new storage allocated by statement s t s_t s t . A view contributes no new allocation, and shared storage is counted once. We use
A ^ ( H ) = ∑ s t ∈ H a ^ ( s t ) \widehat{A}(H)=\sum_{s_t\in H}\widehat{a}(s_t) A ( H ) = s t ∈ H ∑ a ( s t )
to guide the selection of regions and their sizes. This quantity estimates new allocations; it is not a bound on peak memory, which also includes live inputs, retained outputs, and compiler temporaries.
Restriction of Independent Rows
Consider a region H H H in single-assignment form, with shared inputs W W W and row-indexed inputs C C C . The region’s operations are pure. A view may share storage, but the region does not modify an input through that view. An in-place update must first be represented by its value dependencies, including any dependencies through aliases, before the reasoning below applies.
For each value x x x , the dependence analysis either establishes that x x x is shared, establishes a row axis d x d_x d x , or rejects the candidate region. These are analysis outcomes, not a claim that tensor dimensions alone form an abstract domain for dependence. For a set R R R of row indices, define the projection P R x P_R^x P R x to be the identity on a shared value and restriction to R R R along d x d_x d x on a row-indexed value. A statement x = f ( y 1 , … , y k ) x=f(y_1,\ldots,y_k) x = f ( y 1 , … , y k ) is accepted with a restricted implementation f R f_R f R only if
P R x ( f ( y 1 , … , y k ) ) = f R ( P R y 1 ( y 1 ) , … , P R y k ( y k ) ) . (10) P_R^x\left(f(y_1,\ldots,y_k)\right)=f_R\left(P_R^{y_1}(y_1),\ldots,P_R^{y_k}(y_k)\right). \tag*{(10)} P R x ( f ( y 1 , … , y k ) ) = f R ( P R y 1 ( y 1 ) , … , P R y k ( y k ) ) . (10)
The fixed parameters of f R f_R f R include the group size and the map from group indices to their original row indices. A tensor kept in shared storage can be gathered using this map inside f R f_R f R ; its original storage remains available to all groups. In particular, reading a repeated source requires the original row indices, not just the group size.
The supported cases have direct justifications:
An element-wise operation reads corresponding entries. Operands that vary along the output row axis are restricted; operands broadcast along that axis remain whole.
A reshape is accepted only when it preserves the contiguous set of elements belonging to each row. A reshape that mixes the row and coefficient indices does not satisfy this rule.
A reduction is accepted only when it does not reduce the row axis.
A matrix product or convolution is accepted only when the tracked rows are independent output rows or batches, rather than an axis being contracted. Shared weights are read whole; operands varying with the output row are restricted consistently.
A repeated tensor can be read from its source using the original index map. If its source has period p p p , row i i i is read from row i m o d p i\bmod p i mod p . This gives the same rows as materializing the repetition and then restricting it.
Other operations require their own restriction argument. A matching shape is insufficient to accept them.
Writing H ( C , W ) H(C,W) H ( C , W ) for the region’s exported row-indexed results and H R H_R H R for the computation restricted to group R R R , these operation rules establish
H R ( C ∣ R , W ) = H ( C , W ) ∣ R . (11) H_R(C|_R,W)=H(C,W)|_R. \tag*{(11)} H R ( C ∣ R , W ) = H ( C , W ) ∣ R . (11)
The fixed parameters and neuron indices of H R H_R H R are adjusted to R R R ; shared results are computed once. The following lemma lifts this restriction property to an ordered partition of the neurons.
Lemma C.1 (Independent row groups). Suppose every statement in H H H satisfies Equation (10) , and every result read outside H H H is either a shared result computed once or an exported row-indexed result. Let R 1 , … , R q R_1,\ldots,R_q R 1 , … , R q be an ordered partition of its rows into consecutive ranges. Executing H R j H_{R_j} H R j on each R j R_j R j and concatenating each exported result along its row axis computes the same exported values as H H H .
Proof. Fix R j R_j R j . The supplied operands are the projections of the original inputs. Induction over the statements, using Equation (10) , shows that every restricted intermediate is the projection of its original value. This applies to each exported result. The groups partition the row axis in order, so concatenating those projections reconstructs the original value. Shared results are unchanged. □
The surrounding rewrite treats each group as one unit and orders the units and unmodified statements by their value dependencies. A cycle rejects the rewrite. Every value used outside a unit must be exported, and deallocation follows its last use. Lemma C.1 then establishes equivalence of the rewritten specialized program by induction over this order. To reduce memory, Scepter selects regions with small per-neuron exports; returning all large intermediate coefficient tensors would preserve the values but defeat the purpose of the transformation.
Scepter chooses a group size from estimated storage requirements and a memory budget. Each group computes its exported bounds and releases its large intermediate tensors before the next group starts. The candidate region must include the computations that consume those intermediates: grouping one operation and reconstructing its entire large result would retain that storage cost. The dependence checks above apply to the complete region and its exported values.
Consecutive Regions
Let s 1 ; … ; s m s_1;\ldots;s_m s 1 ; … ; s m be a specialized program with unique definitions. Partition its statements into consecutive nonempty regions H 1 , … , H q H_1,\ldots,H_q H 1 , … , H q . A region receives every value that it reads whose definition lies outside the region, and exports each value that it defines and that a later region or the program’s result reads. An update to shared storage is modeled as a new storage version; its later uses are included when constructing these interfaces.
Writing H j = s t j − 1 + 1 ; … ; s t j H_j=s_{t_{j-1}+1};\ldots;s_{t_j} H j = s t j − 1 + 1 ; … ; s t j for boundaries 0 = t 0 < t 1 < ⋯ < t q = m 0=t_0<t_1<\cdots<t_q=m 0 = t 0 < t 1 < ⋯ < t q = m , define I j = In ( H j ) I_j=\operatorname{In}(H_j) I j = In ( H j ) and O j = Out ( H j ) O_j=\operatorname{Out}(H_j) O j = Out ( H j ) .
Lemma C.2 (Region partitioning). Calling H 1 , … , H q H_1,\ldots,H_q H 1 , … , H q in order with input interfaces I j I_j I j and output interfaces O j O_j O j computes the same outputs as G σ G_\sigma G σ .
Proof. The first region receives the original program inputs. Assume the inputs of H j H_j H j have their original values. Its statements execute in their original order, and therefore compute their original results. Every result needed by a later region is exported. Consequently, the inputs of H j + 1 H_{j+1} H j + 1 have their original values as well. Induction gives the claim for the final outputs. Deleting a value after its last use cannot affect any later statement. □
To choose region boundaries, Scepter scans statements in order and accumulates their estimated new allocations a ^ ( s t ) \hat{a}(s_t) a ^ ( s t ) . It starts a new region when the current region is nonempty and adding the next statement would exceed the allocation budget. A statement remains indivisible: if its estimated allocation alone exceeds the budget, it occupies its own region unless independent row grouping reduces its size. Region boundaries restrict fusion but provide points at which dead storage can be released, subject to the lifetime and alias checks above. Within each specialized program, the boundaries and region call sequence are fixed before certification.
Boundary selection is independent of this equivalence argument. The allocation heuristic counts newly introduced storage, avoiding duplicate counts for aliases. It does not include all storage live on entry to a region or all temporaries chosen by a tensor compiler. Likewise, the chunk-size heuristic need not account for every allocation outside its selected region. The budget is therefore a planning parameter rather than a theorem about peak device memory.
Both transformations preserve outputs in exact arithmetic. Changes to tensor shapes and compilation boundaries can affect floating-point rounding; the transformations do not establish bitwise equality of compiled executions.
The Running Example
This appendix expands the running example of § 3 and Figure 3 . For readability, the coefficient matrices use one spatial dimension and one channel. The network consists of two width-three convolutions separated by a ReLU; its layer widths are 7, 5, 5 and 3.
Operations over Structured Blocks
We consider two kinds of operation over these tensors: element-wise operations, written ⊙ \odot ⊙ , and tensor multiplication, written @ as in the generated code.
Element-wise operations. Let two coefficient tensors be combined by a binary operator. Their blocks need not coincide, so the first step is to partition the index space into regions on which both operands are uniform , meaning that each region is covered throughout by a single block of that operand or lies entirely in its background; only such a region can be passed to one library call. We call such a partition a common refinement of the two block lists. Layer alignment supplies a common refinement at no cost whenever both operands are aligned to the layers of the same network, which is the usual case, and the general construction of §A.2.4 is required only when an earlier operation has changed a block’s extent so that a boundary falls inside a layer.
Two questions remain once the regions are fixed. The first is whether a region requires any computation at all. A region covered by one operand alone meets the other operand’s background, and the algebraic role of that scalar frequently determines the result without reading data: a background of 0 under addition copies the block, a background of 0 under multiplication deletes it, and a background of − ∞ -\infty − ∞ under maximum copies it. The second is the type of the result. The product of a diagonal and a dense tensor is diagonal, since multiplication by zero yields zero, whereas their sum is dense, since addition preserves the off-diagonal entries of the dense operand. §A.2.4 states the rule.
Matrix multiplication. The whole-tensor call L 4 2 @ L L_4^2 @ L L 4 2 @ L that computes L 4 2 L_4^2 L 4 2 in the running example selects the block product L 4 3 @ L 3 2 L_4^3 @ L_3^2 L 4 3 @ L 3 2 , which scales column j j j of L 4 2 L_4^2 L 4 2 by λ j \lambda_j λ j :
L 4 2 = L 4 3 @ L 3 2 = ( w 0 λ 0 w 1 λ 1 w 2 λ 2 w 0 λ 1 w 1 λ 2 w 2 λ 3 w 0 λ 2 w 1 λ 3 w 2 λ 4 ) L_4^2 = L_4^3 @ L_3^2 =
\begin{pmatrix}
w_0\lambda_0 & w_1\lambda_1 & w_2\lambda_2 \\
w_0\lambda_1 & w_1\lambda_2 & w_2\lambda_3 \\
w_0\lambda_2 & w_1\lambda_3 & w_2\lambda_4
\end{pmatrix} L 4 2 = L 4 3 @ L 3 2 = w 0 λ 0 w 0 λ 1 w 0 λ 2 w 1 λ 1 w 1 λ 2 w 1 λ 3 w 2 λ 2 w 2 λ 3 w 2 λ 4
The support is preserved, since scaling a zero yields zero. The sharing is not: row 0 holds w 0 λ 0 w_0\lambda_0 w 0 λ 0 where row 1 holds w 0 λ 1 w_0\lambda_1 w 0 λ 1 , and the two are equal only by coincidence. The product occupies the same positions as L 3 2 L_3^2 L 3 2 but stores nine independent values where L 4 3 L_4^3 L 4 3 stored three; it is a WindowBlock.
Multiplication by the slope matrix L 3 2 L_3^2 L 3 2 therefore preserves the support of L 4 3 L_4^3 L 4 3 and removes its weight sharing. This product arises whenever backsubstitution passes a ReLU between two convolutions.
For the nonnegative weights of the second convolution in the running example, multiplying by L 2 1 L_2^1 L 2 1 and expanding the lower-bound expression y 0 = w 0 λ 0 h 0 + w 1 λ 1 h 1 + w 2 λ 2 h 2 y_0 = w_0\lambda_0h_0+w_1\lambda_1h_1+w_2\lambda_2h_2 y 0 = w 0 λ 0 h 0 + w 1 λ 1 h 1 + w 2 λ 2 h 2 for y 0 y_0 y 0 , with each h j h_j h j substituted, gives
y 0 = w 0 λ 0 v 0 x 0 + ( w 0 λ 0 v 1 + w 1 λ 1 v 0 ) x 1 + ( w 0 λ 0 v 2 + w 1 λ 1 v 1 + w 2 λ 2 v 0 ) x 2 + ( w 1 λ 1 v 2 + w 2 λ 2 v 1 ) x 3 + w 2 λ 2 v 2 x 4 . \begin{aligned}
y_0 &= w_0\lambda_0v_0x_0 + (w_0\lambda_0v_1+w_1\lambda_1v_0)x_1 + (w_0\lambda_0v_2+w_1\lambda_1v_1+w_2\lambda_2v_0)x_2 \\
&\quad+ (w_1\lambda_1v_2+w_2\lambda_2v_1)x_3 + w_2\lambda_2v_2x_4.
\end{aligned} y 0 = w 0 λ 0 v 0 x 0 + ( w 0 λ 0 v 1 + w 1 λ 1 v 0 ) x 1 + ( w 0 λ 0 v 2 + w 1 λ 1 v 1 + w 2 λ 2 v 0 ) x 2 + ( w 1 λ 1 v 2 + w 2 λ 2 v 1 ) x 3 + w 2 λ 2 v 2 x 4 .
Two properties follow. The support has widened from three inputs to five, because the three h j h_j h j that y 0 y_0 y 0 reads each read three of the x i x_i x i and their windows overlap; and the coefficient of x 2 x_2 x 2 is a sum of three products, because three pairs of taps map to the same input offset. §A.2.5 shows that this is general: the product of two convolution-supported operators is convolution-supported, with window width ( k o − 1 ) s i + k i (k_o-1)s_i+k_i ( k o − 1 ) s i + k i , so the family is closed under the products a certifier forms.
Benchmark Inventory
Table 7 . The 44 evaluated networks in plot order. Plot indices 1–28 are small, 29–35 medium, 36–42 large, and 43–44 very large. Source IDs preserve the identifiers in the experimental records. Neuron counts use the source inventory’s ReLU-neuron convention. Training methods are given in parentheses. ϵ \epsilon ϵ is the perturbation radius.
Additional Per-Network Results
Figure 17. Complete BoxPoly and IBP per-network speedups, including configurations where Scepter is slower than a baseline. Bars below 1× indicate slowdowns. Missing bars indicate configurations without a paired result. The network indices and logarithmic spacing follow the main plots.
Figure 18. Per-network speedups for SkipPoly, ReuseCert, and ZID over Neuton. The network order and size-group separators match the main evaluation plots. Indices map to original network identifiers in the inventory. Missing bars indicate configurations without a paired result.
CPU Results
The CPU suite consists of the small, medium, and large networks, plot indices 1–42 in Table 7 ; the two very large networks are not run on the CPU. The final five rows aggregate all completed certifier–network comparisons with each baseline. Only evaluated analysis–baseline combinations are listed.
Memory and CPU–GPU Interaction by Certifier
Table 9. Memory use and execution profiles per baseline and certifier (Table 3 for all analyses). Ratios compare the baseline with Scepter. Memory is over the networks both systems complete; idle time, transfer time, and copies are over the networks profiled with both systems, whose number is in the last column. Each Overall row aggregates all of the baseline’s certifier–network pairs: geometric means for the ratios and medians for the copies. Copies are median device-to-host (D2H) and host-to-device (H2D) copies per batch, baseline / Scepter. GPUPoly is not included in the memory comparison.
GPU Runtime by Configuration
Table 10. GPU time per image (ms/image) and speedup by configuration (the 44 networks of Table 7 ). Each speedup is the baseline runtime divided by Scepter’s runtime for the same configuration, as in Table 2 . Each certifier’s Geomean row summarizes the completed configurations: times use each system’s completed configurations, and speedups use configurations completed by both systems. A dash marks a comparison not included, and NC means a run did not complete.
Table 10. GPU time per image (ms/image) and speedup by configuration (the 44 networks of Table 7 ).
Continued on next page
Table 10 (continued).
Specialization and Tensor Compilation
To separate the effect of specialization from that of torch.compile, we compare Neuton and Scepter, each with and without torch.compile on ten networks. The analyses include IBP, CROWN-IBP, and DeepPoly. All other settings are as in § 6 . Figure 19 shows the time per image of each implementation, together with the baselines that support each analysis.
Figure 19. Time per image, on a log scale, of Neuton’s generic abstract interpreters and Scepter’s specialized abstract interpreters, each with and without torch.compile, along with the baselines. Missing bars indicate baselines that do not support the analysis or did not complete.
Specialization accounts for most of the speedup. Specialization alone makes Neuton’s interpreters 10.1 × 10.1\times 10.1 × , 25.1 × 25.1\times 25.1 × , and 10.6 × 10.6\times 10.6 × faster for IBP, CROWN-IBP, and DeepPoly, respectively. Compiling the specialized code adds only a further 1.15 × 1.15\times 1.15 × , 1.45 × 1.45\times 1.45 × , and 1.80 × 1.80\times 1.80 × .
Scepter outperforms the baselines without torch.compile. Without torch.compile, Scepter is faster than auto_LiRPA, GPUPoly, and IVAN, with geometric-mean speedups of up to 12.6 × 12.6\times 12.6 × , 2.5 × 2.5\times 2.5 × , and 13.6 × 13.6\times 13.6 × , respectively.
torch.compile without specialization is not effective. Compiling Neuton’s generic interpreters with torch.compile makes them at least 2.2 × 2.2\times 2.2 × slower on every configuration. Neuton interleaves structural and numerical computation (§ 2 .x), so torch.compile attempts to trace both. Since the structural decisions are Python control flow, it cannot capture these decisions in a single graph. Hence, it breaks each interpreter into hundreds of small graphs, with 436–1159 graph breaks per network. Specialization makes all structural decisions before verification and provides pure tensor computation (§ 3.3 ), so torch.compile sees the same code for every image and compiles it without any graph breaks.