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
//! NEON kernel wrappers (aarch64, `feature = "simd"`).
//!
//! Mirrors [`super::avx2`] — Phase 20 establishes the dispatch
//! framework with byte-for-byte scalar parity. NEON is mandatory on
//! ARMv8 aarch64, so `dispatch::current()` unconditionally selects this
//! path on aarch64 targets when `feature = "simd"` is enabled.
//!
//! The wrappers currently forward to [`super::scalar`]; when real NEON
//! intrinsic implementations land, the `#[target_feature(enable =
//! "neon")]` annotation will ensure the generated code uses the NEON
//! instruction set.
use scalar;
use crateCodecError;
/// Quantize `values` into `indices` via the NEON kernel path.
///
/// # Safety
///
/// Caller must ensure the target CPU supports NEON. On aarch64 this is
/// guaranteed by the base ARMv8 instruction set, so
/// [`crate::codec::dispatch::current()`] may pick this path
/// unconditionally.
///
/// # Errors
///
/// Propagates errors from [`super::scalar::quantize_into`].
pub unsafe
/// Dequantize `indices` into `values` via the NEON kernel path.
///
/// # Safety
///
/// See [`quantize_into`] for the NEON availability contract.
///
/// # Errors
///
/// Propagates errors from [`super::scalar::dequantize_into`].
pub unsafe
/// Cosine similarity via the NEON kernel path.
///
/// # Safety
///
/// See [`quantize_into`] for the NEON availability contract.
pub unsafe
/// Compute a fp16 residual buffer via the NEON kernel path.
///
/// # Safety
///
/// See [`quantize_into`] for the NEON availability contract.
pub unsafe
/// Decode and apply an fp16 residual via the NEON kernel path.
///
/// # Safety
///
/// See [`quantize_into`] for the NEON availability contract.
///
/// # Errors
///
/// Propagates errors from [`super::scalar::apply_residual_into`].
pub unsafe