ADR-0020 follow-on (task #35). Two-pronged fix: 1. Kernel: ported ADR-0019 Stage 1 diagonal-metric kernel to core-rs/src/vault.rs. Per-versor scoring is now 32 multiplies + 32 adds via the precomputed Cl(4,1) metric, not the 1024-op full geometric_product the prior path computed. Bit-identity preserved by serial fold order matching Python. 2. Zero-copy marshalling: replaced Vec<&PyAny> + extract-per- versor with PyReadonlyArray2<f32> via the numpy Rust crate. The Rust binding now reads a slice view directly into the numpy buffer — no Python→Rust copy, no Vec<[f32;32]> re-chunk. Python caller passes the (N, 32) ndarray as-is (ascontiguousarray ensures C-contiguous f32). Result: N python rust speedup 1k 0.20ms 0.26ms 0.77x (Python wins on fixed overhead) 10k 1.62ms 1.45ms 1.12x 100k 19.22ms 12.93ms 1.49x 1M 251.50ms 131.36ms 1.91x Parity bit-identical (raw f32 bytes) at every scale across the parameterised test in tests/test_vault_recall_rust_parity.py. Both ADR-0020 first-surface gates now pass: parity AND performance at the scales where Rust is meant to win. Python remains the default per CLAUDE.md sequencing rule 5; CORE_BACKEND=rust is now a legitimate opt-in acceleration. Smoke 27/27, algebra 70/70, runtime 19/19 all green.
28 lines
506 B
TOML
28 lines
506 B
TOML
[package]
|
|
name = "core-rs"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[lib]
|
|
name = "core_rs"
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[dependencies]
|
|
pyo3 = { version = "0.21" }
|
|
numpy = "0.21"
|
|
rayon = "1.10"
|
|
nalgebra = "0.33"
|
|
ndarray = { version = "0.16", features = ["rayon"] }
|
|
ndarray-rand = "0.15"
|
|
bytemuck = { version = "1.16", features = ["derive"] }
|
|
thiserror = "1.0"
|
|
|
|
[features]
|
|
default = []
|
|
extension-module = ["pyo3/extension-module"]
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = true
|
|
codegen-units = 1
|
|
panic = "abort"
|