A GPU kernel that trusts a caller-supplied buffer length is one undersized allocation away from reading past the end of device memory. TensorLogic 0.1.2 closes that gap — and drops the last C dependency out of its SQLite backend while it’s at it.
Today we released TensorLogic 0.1.2 — a hardening-and-sovereignty release. The headline: tensorlogic-oxicuda-sparse’s SpMV/SpMM now validate buffer shapes before they ever reach the GPU. Alongside it, tensorlogic-adapters replaces rusqlite’s bundled C SQLite with the pure-Rust OxiSQL backend, and tensorlogic-oxirs-bridge moves its RDF/Turtle stack off upstream Oxigraph onto COOLJAPAN’s own OxiXML. It builds on 0.1.1 (released 2026-06-09); if you’re already running TensorLogic, this post is about what changed under the hood.
No C. No Fortran. No FFI shims. TensorLogic 0.1.2 is Pure Rust end to end: the SciRS2 backend (now 0.6.5) executes the einsum graphs, the OxiCUDA backend (0.5.5) runs the GPU path, OxiXML (oxixml-model / oxixml-turtle, 0.1.2) parses RDF/Turtle, and OxiSQL (oxisql-core / oxisql-sqlite-compat, 0.4.1) is the new SQLite-compatible storage layer. It ships as a single static binary, with Python bindings (pytensorlogic) via PyO3. Rust 1.90+, Apache-2.0.
Why 0.1.2 matters
0.1.2 isn’t a features release — it’s a hardening and sovereignty release. Three things changed that matter regardless of which TensorLogic crate you touch:
- A real out-of-bounds risk, closed.
tensorlogic-oxicuda-sparse’sspmv/spmmdispatched straight to device kernels using caller-supplied buffer lengths. A GPU kernel receives a bare device pointer — an undersizedxorybuffer meant the kernel would happily read (or write) past the end of allocated memory. Both entry points now validate shapes up front and returnSparseError::ShapeMismatchinstead. - The last C dependency in
tensorlogic-adaptersis gone. Itssqlitefeature depended onrusqlite, which bundles its own C SQLite build. It’s replaced byoxisql-core+oxisql-sqlite-compat— COOLJAPAN’s pure-Rust, SQLite-wire-compatible storage layer. - RDF/Turtle moves in-house.
tensorlogic-oxirs-bridgeused to aliasoxrdf/oxttlto the upstream Oxigraph project’s crates. They now alias to COOLJAPAN’s ownoxixml-model/oxixml-turtleinstead, and the deadoxirs-ttldependency is gone.
TensorLogic’s suite stands at 7,178 tests, 100% pass rate, across ~325K lines of Rust (1,108 source files).
Technical Deep Dive
The GPU bounds check. tensorlogic-oxicuda-sparse::spmv computes y = alpha * A * x + beta * y for a sparse CSR matrix A; spmm does the dense-matrix equivalent. Both now open with a validation call — check_spmv_shapes(a, x.len(), y.len()) and check_spmm_shapes(a, b.len(), b_cols, c.len()) — before the GPU path is even considered. The fix’s own doc comment states the reasoning plainly: “the GPU kernel receives bare device pointers and would happily read past the end of an undersized x.” Get the shapes wrong now and you get SparseError::ShapeMismatch, not memory corruption.
The SQLite migration. tensorlogic-adapters’ SQLite-backed schema store is rebuilt on oxisql_core::Connection and oxisql_sqlite_compat::SqliteConnection. Parameter binding changes with it — OxiSQL uses positional $1, $2, … placeholders instead of rusqlite’s ? — and reads/writes now run through a dedicated Tokio runtime, with a new map_oxi helper mapping OxiSQL errors into AdapterError. initialize_schema also drops its &mut self requirement. A new count_for_schema(&self, table: &str, schema_id: i64) -> Result<usize, AdapterError> helper backs the schema store’s domain/predicate/variable counts.
The RDF migration. In tensorlogic-oxirs-bridge’s Cargo.toml, oxrdf and oxttl are no longer the upstream crates — they’re workspace aliases (package = "oxixml-model" / package = "oxixml-turtle") pointing at COOLJAPAN’s own OxiXML project. Call sites across schema/inference.rs, schema/metadata.rs, schema/nquads.rs, schema/ntriples.rs, and shacl/mod.rs were updated for OxiXML’s borrowed-reference iterator API.
Getting Started
cargo add tensorlogic-oxicuda-sparse
The shape guard runs automatically on every call — no new API to learn, just a safer failure mode when buffers don’t line up:
use tensorlogic_oxicuda_sparse::{spmv, SparseError};
// `a` is a 4x4 sparse CSR matrix; deliberately pass a 3-element `x`
// instead of the 4 elements `spmv` requires.
let x = vec![1.0_f32; 3];
let mut y = vec![0.0_f32; 4];
match spmv(&a, &x, 1.0, 0.0, &mut y) {
Err(SparseError::ShapeMismatch(msg)) => {
println!("caught before it reached the device: {msg}");
}
Ok(()) => unreachable!("a shape mismatch should never dispatch"),
Err(e) => panic!("unexpected error: {e}"),
}
What’s New in 0.1.2
Added
- GPU sparse shape validation (
tensorlogic-oxicuda-sparse):check_spmv_shapes/check_spmm_shapesguards ahead of every SpMV/SpMM dispatch, returningSparseError::ShapeMismatchinstead of risking an out-of-bounds device read/write. count_for_schema(tensorlogic-adapters): row-count helper for the SQLite-backed schema store.
Changed
- SQLite backend migrated from
rusqliteto OxiSQL (tensorlogic-adapters) — see above. - RDF/Turtle stack migrated from
oxrdf/oxttlto OxiXML (tensorlogic-oxirs-bridge) — see above. - Dependency upgrades: SciRS2 family 0.5.0 → 0.6.5; OxiCUDA family 0.1.8 → 0.5.5; ToRSh 0.1.2 → 0.2.0; SkleaRS 0.1.1 → 0.2.0; QuantRS2 0.2.0 → 0.2.1; OxiRS 0.3.1 → 0.4.1; oxicode → 0.2.6; oxiarc-deflate 0.3.3 → 0.4.1; tabled 0.20 → 0.21; new
oxisql-core/oxisql-sqlite-compatat 0.4.1.
Fixed
- The GPU sparse SpMV/SpMM out-of-bounds risk — see above.
Tips
- Using
tensorlogic-oxicuda-sparsedirectly? Any code callingspmv/spmm/spmv_f64/spmm_f64with buffers it doesn’t fully trust now gets aSparseError::ShapeMismatchinstead of undefined behavior on the device — make sure your error handling covers it. - Migrating your own OxiSQL-backed code? Swap
?placeholders for numbered$1, $2, …, and noteinitialize_schemano longer needs&mut self. - Touching
oxrdf/oxttltypes through TensorLogic? You’re now getting COOLJAPAN’soxixml-model/oxixml-turtle, not upstream Oxigraph — the borrowed-reference iterator API differs slightly if you interact with these types directly instead of going through the bridge. - Bumping dependencies? This release moves in lockstep with SciRS2 0.6.5, OxiCUDA 0.5.5, ToRSh 0.2.0, SkleaRS 0.2.0, QuantRS2 0.2.1, and OxiRS 0.4.1 — bump the whole set together to avoid version-skew surprises.
The neurosymbolic foundation
0.1.2 keeps TensorLogic’s role as the neurosymbolic glue of the COOLJAPAN stack while quietly tightening its foundations. Logic still compiles down to SciRS2 tensors (now 0.6.5). The OxiCUDA backend (0.5.5) runs the GPU path — with its sparse kernels now shape-checked before every dispatch. OxiXML (0.1.2) is the pure-Rust RDF/Turtle engine behind the OxiRS bridge. OxiSQL (0.4.1) is the new SQLite-compatible storage layer for adapters. And the wider stack — ToRSh (0.2.0), SkleaRS (0.2.0), QuantRS2 (0.2.1), OxiRS (0.4.1) — moves forward alongside it. All Pure Rust. All in one tensor graph.
Repository: https://github.com/cool-japan/tensorlogic
Star the repo if you want a neurosymbolic runtime that treats an undersized GPU buffer as a bug to catch, not a risk to ship.
The era of a “pure Rust” crate quietly bundling a C library is over, one dependency at a time. TensorLogic 0.1.2 is sovereign a little further down the stack.
— KitaSan at COOLJAPAN OÜ August 31, 2026