Paper VIIIReading edition

Packetwise mixed precision

Reading tools
Reading libraryFind statementsInspect Lean
Switch work

Saved reading

Read side by side

Start reading

Resources & source

Original TeX with line links · Download TeX

The wording and mathematics follow the retained manuscript. This reading format does not add a proof review or extend Lean coverage.

Skip contents and start reading

8 Packetwise mixed precision

8.1 One operator

Theorem 8.1: Packet perturbation certificate

Let

\[ A= \sum_{e\in E}A_e, \qquad \widehat A = \sum_{e\in E}(A_e+E_e), \]

where edge \(e\) starts at packet \(\alpha(e)\), and assume

\[ A_e=A_eP_{\alpha(e)}, \qquad E_e=E_eP_{\alpha(e)}. \]

Then

\[ \boxed{ {\left\lVert(\widehat A-A)x\right\rVert} \leq \sum_{e\in E} {\left\lVert E_e\right\rVert} {\left\lVert P_{\alpha(e)}x\right\rVert}. } \]

If

\[ {\left\lVert E_e\right\rVert} \leq {\varepsilon}_e{\left\lVert A_e\right\rVert}, \]

then

\[ \boxed{ {\left\lVert(\widehat A-A)x\right\rVert} \leq \sum_{e\in E} {\varepsilon}_e{\left\lVert A_e\right\rVert} {\left\lVert P_{\alpha(e)}x\right\rVert}. } \]

Proof of Theorem 8.1

Exact packet evaluation gives

\[ (\widehat A-A)x = \sum_eE_eP_{\alpha(e)}x. \]

Apply the triangle inequality and the operator norm bound to each term.

Standard fact 8.2: Floating point matrix product model

For real \(A\in{\mathbb R}^{m\times p}\) and \(B\in{\mathbb R}^{p\times n}\), consider ordinary dot-product matrix multiplication in uniform precision with unit roundoff \(u\), no overflow or underflow, and \(pu<1\). Its computed output \(\widehat C\) satisfies the componentwise forward-error bound

\[ |\widehat C-AB|\le\gamma_p|A||B|, \qquad\gamma_p=\frac{pu}{1-pu}. \]

Absolute values and the inequality are entrywise. Complex arithmetic, fused kernels, mixed accumulation, and tensor kernels require their own stated constants. This fact does not assert one common small input perturbation for every column, and an input-dependent rounded action is not automatically a fixed linear operator.

Detailed forms and their hypotheses are given in [Higham2002], [HighamMary2021]. For a fixed computed matrix, the bound can certify its error matrix. A rounded application to varying inputs needs a separately justified uniform certificate before it can be used as one fixed operator error in Theorem 8.1.

8.2 Several operators

Corollary 8.3: Mixed precision product chain

If each fixed linear factor \(A_j\) is replaced by a fixed packetwise linear approximation \(\widehat A_j\), write \(E_j=\widehat A_j-A_j=\sum_e\Delta_{j,e}P_{\alpha(j,e)}\). A uniform certificate is

\[ \|E_j\|\le\delta_j:=\sum_e\|\Delta_{j,e}\|\,\|P_{\alpha(j,e)}\|. \]

For orthogonal packet projectors, \(\delta_j\le\sum_e\|\Delta_{j,e}\|\). The final operator error is bounded by Theorem 5.8 with these uniform \(\delta_j\). The corresponding vector error is this operator bound multiplied by the input norm.

Proof of Corollary 8.3

Take the supremum over unit inputs in Theorem 8.1, using \(\|P_{\alpha}x\|\le\|P_{\alpha}\|\|x\|\). Substitute the resulting uniform operator error bounds into Theorem 5.8; the action estimate follows from submultiplicativity.

8.3 Continuous allocation

Theorem 8.4: Continuous precision allocation

Let \(E\) be a finite nonempty edge set, let \(s_e>0\) be sensitivities and \(c_e>0\) be costs, and let \(\tau>0\). Consider

\[ \min_{{\varepsilon}_e>0} \sum_e c_e\log\frac1{{\varepsilon}_e} \]

subject to

\[ \sum_es_e{\varepsilon}_e=\tau. \]

The unique minimizer is

\[ \boxed{ {\varepsilon}_e = \frac{\tau c_e}{s_e\sum_fc_f}. } \]

Proof of Theorem 8.4

The Lagrangian derivative gives

\[ -\frac{c_e}{{\varepsilon}_e}+\lambda s_e=0. \]

Thus

\[ {\varepsilon}_e=\frac{c_e}{\lambda s_e}. \]

The constraint gives

\[ \lambda=\frac{\sum_fc_f}{\tau}. \]

The objective is strictly convex on the positive orthant, so the stationary point is the unique minimizer.

Theorem 8.5: Clipped precision allocation

Retain the finite nonempty edge set, strictly positive sensitivities and costs, and add strictly positive caps \(m_e>0\) with upper bounds

\[ 0<{\varepsilon}_e\leq m_e. \]

Assume

\[ 0<\tau\leq\sum_es_em_e. \]

There is a unique \(\lambda>0\), except at the maximal tolerance endpoint, such that

\[ \boxed{ {\varepsilon}_e = \min\left\{ m_e, \frac{c_e}{\lambda s_e} \right\} } \]

and

\[ \sum_es_e{\varepsilon}_e=\tau. \]

This vector minimizes the same objective over the clipped feasible set.

Proof of Theorem 8.5

The Karush Kuhn Tucker conditions give the unconstrained form on every nonactive coordinate and equality with \(m_e\) on every active upper bound. The weighted sum

\[ \phi(\lambda) = \sum_es_e \min\left\{ m_e, \frac{c_e}{\lambda s_e} \right\} \]

is continuous and nonincreasing. It decreases from the maximal feasible value to zero. For a strictly submaximal budget, once any coordinate is unsaturated, \(\phi\) is strictly decreasing, which gives a unique multiplier. At maximal budget the only feasible vector is \((m_e)_e\) and every \(0<\lambda\le\min_e c_e/(s_em_e)\) produces it. Thus the minimizing vector is unique at this endpoint while its multiplier need not be. Strict convexity gives uniqueness of the minimizer in every case.

More sensitive packet edges receive tighter continuous tolerances.
More sensitive packet edges receive tighter continuous tolerances.

View full-size figure (new tab)

8.4 Discrete data types

Definition 8.6: Discrete precision option

For edge \(e\), a discrete precision option \(k\) has a measured or modeled cost \(c_{e,k}\) and a nonnegative integer error weight \(w_{e,k}\). Exactly one option must be selected on every edge.

Theorem 8.7: Exact discrete precision program

Let the total integer error budget be \(B\). Define

\[ F_j(b) \]

as the minimum cost for assigning precisions to the first \(j\) edges with total weight exactly \(b\). Then

\[ F_0(0)=0, \qquad F_0(b)=+\infty \quad\text{for }b\neq0. \]

Set \(F_{j-1}(u)=+\infty\) whenever \(u<0\) or the state is unreachable. Then

\[ \boxed{ F_j(b) = \min_k \left\{ F_{j-1}(b-w_{j,k})+c_{j,k} \right\}. } \]

The minimum of \(F_m(b)\) over \(0\leq b\leq B\) is the exact minimum cost for the quantized model.

Proof of Theorem 8.7

Every feasible assignment for the first \(j\) edges ends with one option \(k\) on edge \(j\). Removing it leaves an optimal or suboptimal assignment for the first \(j-1\) edges with residual weight \(b-w_{j,k}\). Replacing a suboptimal prefix by an optimal one can only lower cost. The recurrence therefore has optimal substructure. Induction on \(j\) proves the result.

Remark 8.8

The discrete program is exact only for the supplied options and quantized error weights. Real kernels also depend on accumulation type, scaling, overflow, underflow, tensor core availability, and shape restrictions. Mixed precision iterative refinement has its own conditioning requirements [CarsonHigham2018].

Source and conversion record

Source SHA-256: ef616bca9291ac766d492b88f3166be4bc2b39f9ba6034dea3a4bcf2d2bf5d7f

Unsupported prose commands stop the build. The mathematical expression sequence is checked against the source, with manuscript macros expanded for display.

Conversion records

Notation in Paper VIII

Look up a symbol without leaving this chapter. Select text before opening help to search for it.

Search this work’s notation.

    Symbols can have different meanings in different passages. Read each result in its own context.

    Open the full notation index