The MXFP4, Q8_0, int8 and int4 kernels, the Q8_0 quantizer and the half conversions are now Rust (cpu-sys/src/simd.rs), written operation for operation after the C versions. The C code stays only behind the test-only feature c-reference, and tests/rust_vs_c.rs checks bit-identical results at the portable, AVX2 and AVX-VNNI levels. A runtime build compiles no C. Paired decode on gpt-oss-20b (40 tokens, 10 threads, 5 alternating rounds): median 98 ms per token for both builds, identical tokens and first-step log-probabilities. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
32 lines
1.3 KiB
TOML
32 lines
1.3 KiB
TOML
[package]
|
|
name = "leleka-cpu-sys"
|
|
version = "0.1.0"
|
|
description = "AVX2 and AVX-VNNI kernels of the Leleka CPU runtime behind checked safe functions (the only unsafe code of that runtime)"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
build = "build.rs"
|
|
|
|
[dependencies]
|
|
|
|
[build-dependencies]
|
|
cc = "1"
|
|
|
|
[features]
|
|
# Test-only: compile the pinned ggml reference quantizers (vendored in control-plane/third_party/ggml,
|
|
# MIT) and expose them in `oracle`, so kernels can be checked against llama.cpp's own definitions.
|
|
ggml-oracle = []
|
|
|
|
# Test-only: also build the original C kernels (csrc/) and expose them as c_reference, so the Rust
|
|
# kernels can be compared with them bit for bit (tests/rust_vs_c.rs). The runtime never enables it.
|
|
c-reference = []
|
|
|
|
# Deliberately NO `[lints] workspace = true`: this crate holds SIMD intrinsics, the file mapping and the optional C FFI, and therefore needs unsafe code.
|
|
# Recorded exception (architecture decision STRA-199 v2, D3): owner Pavlo Ratushnyi, review date
|
|
# 2026-12-14 or when a safe binding exists, whichever is first. Every other crate keeps
|
|
# unsafe_code = "forbid" and reaches the kernels only through this crate's safe functions.
|
|
|
|
[[test]]
|
|
name = "rust_vs_c"
|
|
required-features = ["c-reference"]
|