pub enum AccelX4 {
NeonI8mm,
Avx2,
Portable,
}Expand description
Which ×4 GEMM kernel this host runs, resolved once instead of once
per call.
The gemm_*_group_x4 entry points are called once per (row-group ×
activation-quad) pair, which on a pp512 projection is 10^4 to 10^5
calls per GEMM. Each one used to re-run is_aarch64_feature_detected!,
whose relaxed atomic load LLVM cannot hoist out of the caller’s loop.
Callers now probe once per matmul and pass the answer down through the
_on variants; [gemm_q4_kx8_group_x4] and its siblings stay as
probe-per-call wrappers so existing callers and tests are unchanged.
This is a dispatch decision only. Every arm computes the same values,
to within f32 rounding order; the portable arm is bit-identical to the
per-activation GEMV, which is what the
*_x4_portable_is_bit_exact_vs_scalar_gemv tests assert. Forcing
AccelX4::Portable on an accelerated host is therefore a valid
(slow) way to run, and the tests use it that way.
Variants§
NeonI8mm
ARM i8mm SMMLA kernels in super::neon.
Avx2
x86_64 AVX2 + FMA kernels in super::avx2.
Portable
The portable scalar reference.
Implementations§
Source§impl AccelX4
impl AccelX4
Sourcepub fn detect() -> Self
pub fn detect() -> Self
The fastest kernel available on this host.
Resolved once per process. The feature probe underneath is a
sysctlbyname walk on Apple platforms, and below macOS 15 /
iOS 18 there is no hw.optional.arm.caps fast path, so it is
~20 sysctls rather than one bit test. That is cheap once and not
cheap per matmul, and preferred_interleave and
interleaved_gemm_is_accelerated both call this on paths that
run per matrix.