1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! The 32-bit word's long dot product path (the bounded unchecked AVX2 sum
//! behind `Storage::dot_acc_fast`) and the stagnation constant of the
//! iterative decompositions. Everything else that lived here is generic
//! over the format in `kernels` since the width design.
/// Below this length the per-term check is cheaper than the bound pass
/// (measured: the two cross between 16 and 32 elements). The length test
/// is made inline by `Storage::dot_acc_fast`; only longer vectors reach the
/// out-of-line [`long_dot_acc_i32`].
pub const BOUNDED_DOT_MIN_LEN: usize = 32;
/// The 32-bit word's fast dot accumulator for `BOUNDED_DOT_MIN_LEN` or more
/// elements: the bounded unchecked AVX2 sum where AVX2 is present and the
/// bound holds, `None` otherwise (the generic checked loop then runs; it
/// panics where the sum really overflows). Out of line, so the short-vector
/// path of the callers stays as small as it was.
pub
/// Largest magnitude in a slice (`|i32::MIN|` is `2^31`, hence unsigned).
pub unsafe
/// `sum a_i * b_i` in i64 with no per-term check, for inputs whose bound
/// `len * max|a| * max|b| < 2^63` proves that no partial sum can leave i64 in
/// any order of summation: the same integer as the checked loop, in a form
/// the compiler vectorises. `None` when the bound does not hold (the caller
/// then takes the checked loop, which panics where the sum really overflows).
unsafe
/// `sum a_i * b_i` in i64, wrapping adds: the caller has proven the bound.
pub unsafe
/// Consecutive non-improving iterations after which an iterative decomposition
/// is taken to sit at its precision floor.
pub const STAGNATION_SWEEPS: usize = 5;