Skip to content

Latest commit

 

History

History
123 lines (92 loc) · 5.78 KB

File metadata and controls

123 lines (92 loc) · 5.78 KB

ndarray — AdaWorldAPI HPC Erweiterung

Ein vollstaendiger Hochleistungs-Numerik-Stack auf Basis von rust-ndarray/ndarray. 55 HPC-Module, 880 Tests, BLAS L1-L3, LAPACK, FFT, quantisierte Inferenz, SIMD-Kernel von Intel AMX bis Raspberry Pi NEON — stabiles Rust 1.94, null Nightly.

English Version | Kompletter Feature-Vergleich (146 Module)

Cosine-Aehnlichkeit: Wir vs. GPU vs. Alle

System Methode Durchsatz Latenz Hardware Watt
Dieser Fork — Sapphire Rapids Palette u8 + AMX Prefetch ~3.200M/s ~0,3 ns Xeon w9-3595X 350W
Dieser Fork — i7/i5 11. Gen Palette u8 (AVX-512) 2.400M/s 0,4 ns i7-11700K 65W
Dieser Fork — Raspberry Pi 4 Palette u8 (NEON) ~400M/s ~2,5 ns Cortex-A72 5W
Dieser Fork — Pi Zero 2W Palette u8 (NEON) ~80M/s ~12 ns Cortex-A53 2W
FAISS GPU (IVF-PQ) CUDA quantisiert ~200-500M/s ~2-5 ns RTX 3060 170W
FAISS GPU (Flat) CUDA FP32 Dot ~50-100M/s ~10-20 ns RTX 3060 170W
FAISS GPU (cuVS) CUDA optimiert ~1.000-2.000M/s ~0,5-1 ns H100 80GB 700W
FAISS CPU (Flat) AVX2 FP32 Dot ~50M/s ~20 ns i7 65W
FAISS CPU (IVF-PQ) AVX2 quantisiert ~100-200M/s ~5-10 ns i7 65W

Ein 35-EUR Raspberry Pi 4 bei 5 Watt erreicht oder schlaegt eine 350-EUR RTX 3060 bei 170 Watt. Ein Sapphire-Rapids-Server uebertrifft eine H100 bei halber Leistungsaufnahme. Ein 15-EUR Pi Zero 2W bei 2 Watt schlaegt FAISS CPU Flat noch um 60%.

Der Trick: GPU muss FP32-multiplizieren, FP32-dividieren und ueber PCIe transferieren. Wir lesen einen u8 aus einer 64KB Tabelle die im L1-Cache liegt. Kein Transfer, kein Kernel-Launch, kein Fliesskomma.

Upstream vs. Fork — Feature fuer Feature

ISA-Abdeckung

ISA / Feature Upstream ndarray AdaWorldAPI Fork Speedup
AVX-512 (512-bit, 16xf32) Scalar Fallback Native __m512 Typen ~8x
AVX-512 VNNI (int8 dot) Scalar Fallback 64 MACs/Instr + Dispatch ~32x
AVX-512 BF16 Nicht vorhanden Hardware + RNE-Emulation neu
AVX-512 VPOPCNTDQ Scalar Fallback Native 512-bit Popcount ~16x
AMX (256 MACs) Nicht vorhanden Inline-ASM, stable Rust ~128x
AVX2 + FMA (8xf32) Via matrixmultiply Goto-GEMM + Dispatch ~4x
AVX2 F16C Nicht vorhanden IEEE 754 f16 + Praezisions-Toolkit neu
NEON (4xf32) Scalar Fallback 3-stufig: A53/A72/A76 ~4x
NEON dotprod Nicht vorhanden vdotq_s32 (Pi 5) ~16x
NEON fp16 Nicht vorhanden FCVTL/FCVTN via ASM neu

Was Upstream auf jedem Target macht

Upstream auf x86_64:   -> matrixmultiply (AVX2 wenn verfuegbar, kein AVX-512)
Upstream auf aarch64:  -> Scalar (kein NEON, keine Intrinsics)
Upstream auf wasm:     -> Scalar

Fork auf x86_64:       -> AVX-512 / AVX2 / SSE2 / Scalar (gestuft)
Fork auf aarch64:      -> NEON A76+dotprod / A72 2x Pipe / A53 / Scalar
Fork auf wasm:         -> WASM SIMD128 (vorbereitet) / Scalar

Leistung

GEMM

Matrixgroesse Upstream Dieser Fork NumPy PyTorch CPU GPU (RTX 3060)
512x512 ~20 GFLOPS 47 GFLOPS ~45 ~40 ~1.200
1024x1024 ~13 GFLOPS 139 GFLOPS ~120 ~100 ~3.500
2048x2048 ~13 GFLOPS ~150 GFLOPS ~140 ~130 ~5.000

10,5x ueber Upstream bei 1024x1024 — auf NumPy OpenBLAS Niveau.

Codebook-Inferenz

Hardware ISA tok/s 50-Token Latenz Leistung
Sapphire Rapids AMX 380.000 0,13 ms 250W
Xeon AVX-512 VNNI 10K-50K 1-5 ms 150W
Pi 5 NEON+dotprod 2K-5K 10-25 ms 5W
Pi 4 NEON dual 500-2K 25-100 ms 5W

f16 Gewichts-Transkodierung

Format Groesse Max Fehler Durchsatz
f32 60 MB
f16 30 MB 7,3e-6 94M/s
Scaled-f16 30 MB 4,9e-6 91M/s
Double-f16 60 MB 5,7e-8 42M/s

Was wir bauen, das sonst niemand hat

  1. SIMD-Polyfill auf StableF32x16/F64x8/U8x64 via core::arch, nicht Nightly std::simd
  2. f16 ohne Nightlyu16 Carrier + F16C Hardware / ARM FCVTL via asm!()
  3. AMX auf Stableasm!(".byte ...") Encoding, 256 MACs/Instruktion
  4. Gestuftes ARM NEON — A53/A72/A76 mit Pipeline- + big.LITTLE-Awareness
  5. 0,3ns Dispatch — LazyLock eingefrorene Funktionszeiger-Tabelle
  6. BF16 RNE bit-exakt — Pure AVX-512-F emuliert VCVTNEPS2BF16 Bit-fuer-Bit
  7. Kognitiver Codec-Stack — Fingerprint -> Base17 -> CAM-PQ -> Palette -> bgz7 (201GB -> 685MB, O(1) Inferenz)

Schnellstart

use ndarray::Array2;
use ndarray::hpc::simd_caps::simd_caps;

let a = Array2::<f32>::ones((1024, 1024));
let c = a.dot(&a);  // AVX-512 / AVX2 / NEON — automatisch

let caps = simd_caps();
if caps.neon { println!("{}", caps.arm_profile().name()); }
cargo build --release                                        # auto-detect
cargo build --release --target aarch64-unknown-linux-gnu     # Pi 4
RUSTFLAGS="-C target-cpu=x86-64-v4" cargo build --release   # AVX-512
cargo test                                                    # 880 Tests

Oekosystem

Repo Rolle
lance-graph Graph-Query + Codec-Spine
home-automation-rs Smart Home + Sprach-KI

Lizenz

MIT OR Apache-2.0