grippo 0.2.2

Parse, match and scrub data faster and more efficiently.
Documentation
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
// Project:   grippo
// File:      src/kernel/base64.rs
// Purpose:   Base64 decoded 16, 32 or 64 symbols a step, and by a table loop
// Language:  Rust
//
// License:   Apache-2.0
// Copyright: (c) 2026 HYPERI PTY LIMITED

//! Base64 text to bytes.
//!
//! A vector step follows Mula and Lemire's decoder ("Faster Base64 Encoding
//! and Decoding Using AVX2 Instructions", 2018), the one simdutf ships. Two
//! nibble lookups test every symbol, a third gives the offset that turns it
//! into its 6-bit value, and multiply-adds pack four values into three bytes.
//! SSSE3 takes 16 symbols a step and AVX2 32, picked at run time. NEON takes
//! 64, split four ways by `vld4q_u8` and joined by `vst3q_u8`. A 256-entry
//! table takes the last block, the padding, a block with a byte outside the
//! alphabet, and every CPU with no vector tier.
//!
//! Padding is optional, and bits left over in the last symbol must be zero,
//! as the `base64` crate decodes with `DecodePaddingMode::Indifferent`.

use super::ByteClass;

/// A byte outside the alphabet, in [`Alphabet::decode`].
const OUTSIDE: u8 = 0xFF;

/// One base64 alphabet: its 64 symbols and the tables each tier reads.
#[derive(Debug)]
pub struct Alphabet {
    /// Each byte's 6-bit value, or [`OUTSIDE`].
    decode: [u8; 256],
    /// The vector tiers' membership test, as [`ByteClass`] keeps it.
    low: [u8; 16],
    /// The offset that turns a symbol into its value, by its high nibble, or
    /// by its high nibble plus 8 for [`Self::odd`].
    roll: [u8; 16],
    /// The one symbol whose offset differs from the rest of its high nibble.
    odd: u8,
}

/// The standard alphabet, RFC 4648 section 4.
pub static STANDARD: Alphabet = Alphabet::new(
    b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
    b'/',
);

/// The URL and file name safe alphabet, RFC 4648 section 5.
pub static URL_SAFE: Alphabet = Alphabet::new(
    b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
    b'_',
);

impl Alphabet {
    /// The tables for `symbols`, value 0 first. `odd` is the symbol that
    /// shares its high nibble with symbols of another offset.
    #[allow(clippy::cast_possible_truncation, reason = "a value is below 64")]
    const fn new(symbols: &[u8; 64], odd: u8) -> Self {
        let mut decode = [OUTSIDE; 256];
        let mut roll = [0_u8; 16];
        let mut ascii = 0_u128;
        let mut value = 0;
        while value < 64 {
            let symbol = symbols[value];
            decode[symbol as usize] = value as u8;
            ascii |= 1 << symbol;
            let slot = if symbol == odd {
                symbol >> 4 | 8
            } else {
                symbol >> 4
            };
            roll[slot as usize] = (value as u8).wrapping_sub(symbol);
            value += 1;
        }
        Self {
            decode,
            low: ByteClass::new(ascii).low,
            roll,
            odd,
        }
    }
}

/// Why base64 text didn't decode.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Failure {
    /// The text breaks the encoding at `offset`.
    Malformed {
        /// Byte offset into the text.
        offset: usize,
        /// What is wrong there.
        reason: &'static str,
    },
    /// The decoded bytes would pass the cap.
    Limit,
}

const fn bad(offset: usize, reason: &'static str) -> Failure {
    Failure::Malformed { offset, reason }
}

/// ASCII whitespace, as the WHATWG forgiving decode skips it.
const fn is_space(byte: u8) -> bool {
    matches!(byte, b' ' | b'\t' | b'\n' | b'\r' | 0x0C)
}

/// Appends `text` decoded to `out`. Fails when it isn't base64 in
/// `alphabet`, or when `out` would grow by more than `cap` bytes, and then
/// leaves `out` as it was. With `skip_space`, ASCII whitespace anywhere in
/// the text is passed over, by the table loop alone.
///
/// # Errors
///
/// [`Failure`] as above.
pub fn decode(
    alphabet: &Alphabet,
    text: &[u8],
    skip_space: bool,
    out: &mut Vec<u8>,
    cap: usize,
) -> Result<(), Failure> {
    let start = out.len();
    let limit = start.saturating_add(cap);
    let result = if skip_space {
        by_table(alphabet, text, true, 0, out, limit)
    } else {
        by_vector_then_table(alphabet, text, out, cap, limit)
    };
    if result.is_err() {
        out.truncate(start);
    }
    result
}

fn by_vector_then_table(
    alphabet: &Alphabet,
    text: &[u8],
    out: &mut Vec<u8>,
    cap: usize,
    limit: usize,
) -> Result<(), Failure> {
    let padding = text
        .iter()
        .rev()
        .take(2)
        .take_while(|&&b| b == b'=')
        .count();
    let symbols = &text[..text.len() - padding];
    // Exact for text that decodes: 4 symbols to 3 bytes, a tail of 2 to 1 and of 3 to 2.
    let decoded = symbols.len() / 4 * 3 + symbols.len() % 4 * 3 / 4;
    if decoded > cap {
        return Err(Failure::Limit);
    }
    out.reserve(decoded + SLACK);
    let done = vector_steps(alphabet, symbols, out);
    by_table(alphabet, &text[done..], false, done, out, limit)
}

/// What a vector step may write past its 12 or 24 bytes.
const SLACK: usize = 8;

/// The table loop over `text`, which starts `base` bytes into the caller's
/// text, appending to `out` up to `limit` bytes in all.
pub(super) fn by_table(
    alphabet: &Alphabet,
    text: &[u8],
    skip_space: bool,
    base: usize,
    out: &mut Vec<u8>,
    limit: usize,
) -> Result<(), Failure> {
    let mut held = 0_u32;
    let mut count = 0_usize;
    let mut padding = 0_usize;
    let mut last = 0_usize;
    for (i, &byte) in text.iter().enumerate() {
        let at = base + i;
        if skip_space && is_space(byte) {
            continue;
        }
        if byte == b'=' {
            padding += 1;
            if padding > 2 {
                return Err(bad(at, "more than two padding bytes"));
            }
            continue;
        }
        if padding > 0 {
            return Err(bad(at, "a symbol after the padding"));
        }
        let value = alphabet.decode[usize::from(byte)];
        if value == OUTSIDE {
            return Err(bad(at, "not a base64 symbol"));
        }
        held = held << 6 | u32::from(value);
        count += 1;
        last = at;
        if count == 4 {
            if out.len() + 3 > limit {
                return Err(Failure::Limit);
            }
            let [_, a, b, c] = held.to_be_bytes();
            out.extend_from_slice(&[a, b, c]);
            held = 0;
            count = 0;
        }
    }
    let end = base + text.len();
    let tail = match (count, padding) {
        (0, 0) => return Ok(()),
        (0, _) => return Err(bad(end, "padding after a whole group")),
        (1, _) => return Err(bad(last, "one symbol left over")),
        // The last symbol's low 4 or 2 bits are left over, and must be zero.
        (2, _) if held.trailing_zeros() >= 4 => &(held >> 4).to_be_bytes()[3..],
        (3, 0 | 1) if held.trailing_zeros() >= 2 => &(held >> 2).to_be_bytes()[2..],
        (2, _) | (3, 0 | 1) => return Err(bad(last, "bits left over in the last symbol")),
        _ => return Err(bad(end, "more padding than the group lacks")),
    };
    if out.len() + tail.len() > limit {
        return Err(Failure::Limit);
    }
    out.extend_from_slice(tail);
    Ok(())
}

/// Decodes whole vector steps of `symbols` onto `out`, which has room
/// reserved for every byte and [`SLACK`]. Returns how many symbols it took:
/// it stops at a step with a byte outside the alphabet. 0 on a CPU with no
/// tier.
fn vector_steps(alphabet: &Alphabet, symbols: &[u8], out: &mut Vec<u8>) -> usize {
    #[cfg(target_arch = "x86_64")]
    {
        x86::steps(alphabet, symbols, out)
    }
    #[cfg(all(
        target_arch = "aarch64",
        target_endian = "little",
        target_feature = "neon"
    ))]
    {
        neon::steps(alphabet, symbols, out)
    }
    #[cfg(not(any(
        target_arch = "x86_64",
        all(
            target_arch = "aarch64",
            target_endian = "little",
            target_feature = "neon"
        )
    )))]
    {
        let _ = (alphabet, symbols, out);
        0
    }
}

/// Runs `step` over each whole `IN`-symbol block of `symbols`, writing `OUT`
/// bytes a block onto `out`: the first `IN / 4 * 3` decoded, the rest for the
/// next block to overwrite. Returns the symbols taken, with `out` holding
/// just their bytes. Inlined, so `step` inlines into the vector tier's loop.
#[cfg(any(
    target_arch = "x86_64",
    all(
        target_arch = "aarch64",
        target_endian = "little",
        target_feature = "neon"
    )
))]
#[allow(
    clippy::inline_always,
    reason = "a step can inline only into a caller that has its target features"
)]
#[inline(always)]
fn blocks<const IN: usize, const OUT: usize>(
    symbols: &[u8],
    out: &mut Vec<u8>,
    mut step: impl FnMut(&[u8; IN], &mut [u8; OUT]) -> bool,
) -> usize {
    let base = out.len();
    let room = symbols.len() / IN * (IN / 4 * 3) + (OUT - IN / 4 * 3);
    out.resize(base + room, 0);
    let mut taken = 0;
    let mut wrote = 0;
    while let Some(block) = symbols.get(taken..).and_then(<[u8]>::first_chunk::<IN>)
        && let Some(dst) = out
            .get_mut(base + wrote..)
            .and_then(<[u8]>::first_chunk_mut::<OUT>)
        && step(block, dst)
    {
        taken += IN;
        wrote += IN / 4 * 3;
    }
    out.truncate(base + wrote);
    taken
}

#[cfg(target_arch = "x86_64")]
pub(super) mod x86 {
    use std::arch::x86_64::{
        __m128i, __m256i, _mm_add_epi8, _mm_and_si128, _mm_cmpeq_epi8, _mm_madd_epi16,
        _mm_maddubs_epi16, _mm_movemask_epi8, _mm_or_si128, _mm_set1_epi8, _mm_set1_epi32,
        _mm_setr_epi8, _mm_setzero_si128, _mm_shuffle_epi8, _mm_srli_epi16, _mm_storeu_si128,
        _mm256_add_epi8, _mm256_and_si256, _mm256_broadcastsi128_si256, _mm256_cmpeq_epi8,
        _mm256_madd_epi16, _mm256_maddubs_epi16, _mm256_movemask_epi8, _mm256_or_si256,
        _mm256_permutevar8x32_epi32, _mm256_set1_epi8, _mm256_set1_epi32, _mm256_setr_epi8,
        _mm256_setr_epi32, _mm256_setzero_si256, _mm256_shuffle_epi8, _mm256_srli_epi16,
        _mm256_storeu_si256,
    };

    use super::{Alphabet, blocks};
    use crate::kernel::x86::{HIGH, load16, load32};

    /// The AVX2 or SSSE3 steps, whichever this CPU has.
    #[allow(
        unsafe_code,
        reason = "a #[target_feature] function is called only after its feature is detected"
    )]
    pub(in crate::kernel) fn steps(
        alphabet: &Alphabet,
        symbols: &[u8],
        out: &mut Vec<u8>,
    ) -> usize {
        if is_x86_feature_detected!("avx2") {
            // SAFETY: this CPU has AVX2, by the check on the line above.
            return unsafe { avx2(alphabet, symbols, out) };
        }
        if is_x86_feature_detected!("ssse3") {
            // SAFETY: this CPU has SSSE3, by the check on the line above.
            return unsafe { ssse3(alphabet, symbols, out) };
        }
        0
    }

    /// 32 symbols to 24 bytes a step, then 16 to 12.
    #[target_feature(enable = "avx2")]
    pub(in crate::kernel) fn avx2(alphabet: &Alphabet, symbols: &[u8], out: &mut Vec<u8>) -> usize {
        let low = _mm256_broadcastsi128_si256(load16(&alphabet.low));
        let high = _mm256_broadcastsi128_si256(load16(&HIGH));
        let roll = _mm256_broadcastsi128_si256(load16(&alphabet.roll));
        let odd = _mm256_set1_epi8(alphabet.odd.cast_signed());
        let nibble = _mm256_set1_epi8(0x0F);
        let eight = _mm256_set1_epi8(8);
        let pairs = _mm256_set1_epi32(0x0140_0140);
        let quads = _mm256_set1_epi32(0x0001_1000);
        let order = _mm256_setr_epi8(
            2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1, 2, 1, 0, 6, 5, 4, 10, 9, 8, 14,
            13, 12, -1, -1, -1, -1,
        );
        let join = _mm256_setr_epi32(0, 1, 2, 4, 5, 6, 3, 7);
        let taken = blocks::<32, 32>(symbols, out, |block, dst| {
            let text = load32(block);
            let hi = _mm256_and_si256(_mm256_srli_epi16(text, 4), nibble);
            let lo = _mm256_and_si256(text, nibble);
            let member =
                _mm256_and_si256(_mm256_shuffle_epi8(low, lo), _mm256_shuffle_epi8(high, hi));
            if _mm256_movemask_epi8(_mm256_cmpeq_epi8(member, _mm256_setzero_si256())) != 0 {
                return false;
            }
            let odd_slot = _mm256_and_si256(_mm256_cmpeq_epi8(text, odd), eight);
            let values = _mm256_add_epi8(
                text,
                _mm256_shuffle_epi8(roll, _mm256_or_si256(hi, odd_slot)),
            );
            // Each pair of values to 12 bits, each pair of those to 24 bits in a
            // 32-bit lane, then each lane's three bytes in text order.
            let packed = _mm256_madd_epi16(_mm256_maddubs_epi16(values, pairs), quads);
            let bytes = _mm256_permutevar8x32_epi32(_mm256_shuffle_epi8(packed, order), join);
            store32(dst, bytes);
            true
        });
        let rest = symbols.get(taken..).unwrap_or_default();
        taken + ssse3(alphabet, rest, out)
    }

    /// 16 symbols to 12 bytes a step.
    #[target_feature(enable = "ssse3")]
    pub(in crate::kernel) fn ssse3(
        alphabet: &Alphabet,
        symbols: &[u8],
        out: &mut Vec<u8>,
    ) -> usize {
        let low = load16(&alphabet.low);
        let high = load16(&HIGH);
        let roll = load16(&alphabet.roll);
        let odd = _mm_set1_epi8(alphabet.odd.cast_signed());
        let nibble = _mm_set1_epi8(0x0F);
        let eight = _mm_set1_epi8(8);
        let pairs = _mm_set1_epi32(0x0140_0140);
        let quads = _mm_set1_epi32(0x0001_1000);
        let order = _mm_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
        blocks::<16, 16>(symbols, out, |block, dst| {
            let text = load16(block);
            let hi = _mm_and_si128(_mm_srli_epi16(text, 4), nibble);
            let lo = _mm_and_si128(text, nibble);
            let member = _mm_and_si128(_mm_shuffle_epi8(low, lo), _mm_shuffle_epi8(high, hi));
            if _mm_movemask_epi8(_mm_cmpeq_epi8(member, _mm_setzero_si128())) != 0 {
                return false;
            }
            let odd_slot = _mm_and_si128(_mm_cmpeq_epi8(text, odd), eight);
            let values = _mm_add_epi8(text, _mm_shuffle_epi8(roll, _mm_or_si128(hi, odd_slot)));
            let packed = _mm_madd_epi16(_mm_maddubs_epi16(values, pairs), quads);
            store16(dst, _mm_shuffle_epi8(packed, order));
            true
        })
    }

    #[allow(
        unsafe_code,
        reason = "an unaligned vector store has no safe form that compiles to one store"
    )]
    #[inline]
    #[target_feature(enable = "sse2")]
    fn store16(dst: &mut [u8; 16], bytes: __m128i) {
        // SAFETY: `dst` is 16 writable bytes, and this store needs no
        // alignment.
        unsafe { _mm_storeu_si128(std::ptr::from_mut(dst).cast(), bytes) }
    }

    #[allow(
        unsafe_code,
        reason = "an unaligned vector store has no safe form that compiles to one store"
    )]
    #[inline]
    #[target_feature(enable = "avx")]
    fn store32(dst: &mut [u8; 32], bytes: __m256i) {
        // SAFETY: `dst` is 32 writable bytes, and this store needs no
        // alignment.
        unsafe { _mm256_storeu_si256(std::ptr::from_mut(dst).cast(), bytes) }
    }

    /// One tier's steps, for the tests.
    #[cfg(test)]
    pub(in crate::kernel) type Tier = fn(&Alphabet, &[u8], &mut Vec<u8>) -> usize;

    /// Each vector tier this CPU can run, by name, for the tests.
    #[cfg(test)]
    #[allow(
        unsafe_code,
        reason = "a #[target_feature] function is called only after its feature is detected"
    )]
    pub(in crate::kernel) fn tiers() -> Vec<(&'static str, Tier)> {
        let mut tiers: Vec<(&'static str, Tier)> = Vec::new();
        if is_x86_feature_detected!("avx2") {
            // SAFETY: this CPU has AVX2, by the check on the line above.
            tiers.push(("avx2", |a, s, o| unsafe { avx2(a, s, o) }));
        }
        if is_x86_feature_detected!("ssse3") {
            // SAFETY: this CPU has SSSE3, by the check on the line above.
            tiers.push(("ssse3", |a, s, o| unsafe { ssse3(a, s, o) }));
        }
        tiers
    }
}

/// The same steps on aarch64, where NEON is part of the base instruction set.
#[cfg(all(
    target_arch = "aarch64",
    target_endian = "little",
    target_feature = "neon"
))]
pub(super) mod neon {
    use std::arch::aarch64::{
        uint8x16_t, uint8x16x3_t, uint8x16x4_t, vaddq_u8, vandq_u8, vceqq_u8, vceqzq_u8,
        vdupq_n_u8, vld4q_u8, vmaxvq_u8, vorrq_u8, vqtbl1q_u8, vshlq_n_u8, vshrq_n_u8, vst3q_u8,
    };

    use super::{Alphabet, blocks};
    use crate::kernel::neon::{HIGH, load16};

    /// [`whole_steps`], from a caller that has NEON only by this build's
    /// `cfg`.
    #[allow(
        unsafe_code,
        reason = "a #[target_feature] function is called only where its feature is compiled in"
    )]
    pub(in crate::kernel) fn steps(
        alphabet: &Alphabet,
        symbols: &[u8],
        out: &mut Vec<u8>,
    ) -> usize {
        // SAFETY: this module builds only with `target_feature = "neon"`, so
        // every CPU this binary runs on has NEON.
        unsafe { whole_steps(alphabet, symbols, out) }
    }

    /// 64 symbols to 48 bytes a step.
    #[target_feature(enable = "neon")]
    fn whole_steps(alphabet: &Alphabet, symbols: &[u8], out: &mut Vec<u8>) -> usize {
        let low = load16(&alphabet.low);
        let high = load16(&HIGH);
        let roll = load16(&alphabet.roll);
        let odd = vdupq_n_u8(alphabet.odd);
        let nibble = vdupq_n_u8(0x0F);
        let eight = vdupq_n_u8(8);
        // A lane's value, and 0xFF in each lane whose byte is outside the alphabet.
        let value = |text: uint8x16_t| {
            let hi = vshrq_n_u8::<4>(text);
            let member = vandq_u8(
                vqtbl1q_u8(low, vandq_u8(text, nibble)),
                vqtbl1q_u8(high, hi),
            );
            let slot = vorrq_u8(hi, vandq_u8(vceqq_u8(text, odd), eight));
            (vaddq_u8(text, vqtbl1q_u8(roll, slot)), vceqzq_u8(member))
        };
        blocks::<64, 48>(symbols, out, |block, dst| {
            let text = load4(block);
            let (a, a_out) = value(text.0);
            let (b, b_out) = value(text.1);
            let (c, c_out) = value(text.2);
            let (d, d_out) = value(text.3);
            if vmaxvq_u8(vorrq_u8(vorrq_u8(a_out, b_out), vorrq_u8(c_out, d_out))) != 0 {
                return false;
            }
            let bytes = uint8x16x3_t(
                vorrq_u8(vshlq_n_u8::<2>(a), vshrq_n_u8::<4>(b)),
                vorrq_u8(vshlq_n_u8::<4>(b), vshrq_n_u8::<2>(c)),
                vorrq_u8(vshlq_n_u8::<6>(c), d),
            );
            store3(dst, bytes);
            true
        })
    }

    #[allow(
        unsafe_code,
        reason = "a vector load from a pointer has no safe form that compiles to one load"
    )]
    #[inline]
    #[target_feature(enable = "neon")]
    fn load4(bytes: &[u8; 64]) -> uint8x16x4_t {
        // SAFETY: `bytes` is 64 readable bytes, and this load needs no
        // alignment.
        unsafe { vld4q_u8(bytes.as_ptr()) }
    }

    #[allow(
        unsafe_code,
        reason = "a vector store to a pointer has no safe form that compiles to one store"
    )]
    #[inline]
    #[target_feature(enable = "neon")]
    fn store3(dst: &mut [u8; 48], bytes: uint8x16x3_t) {
        // SAFETY: `dst` is 48 writable bytes, and this store needs no
        // alignment.
        unsafe { vst3q_u8(dst.as_mut_ptr(), bytes) }
    }

    /// One tier's steps, for the tests.
    #[cfg(test)]
    pub(in crate::kernel) type Tier = fn(&Alphabet, &[u8], &mut Vec<u8>) -> usize;

    /// The vector tier, by name, for the tests.
    #[cfg(test)]
    pub(in crate::kernel) fn tiers() -> Vec<(&'static str, Tier)> {
        vec![("neon", steps)]
    }
}