COOLJAPAN
← All posts

OxiONNX 0.1.7 Released — A 40-Op CUDA Backend, 17x Batched MatMul, and a Silent Two-Stream Race That Returned Wrong Answers

OxiONNX 0.1.7 grows oxionnx-cuda from 25 to 40 accelerated ops with real Conv support, session-lifetime weight/buffer residency, and batched MatMul up to 17x faster — plus a fix for a two-stream race that silently returned wrong GEMM results on real hardware. 3,595 tests passing. The sovereign Pure Rust ONNX layer for COOLJAPAN.

release oxionnx onnx inference cuda gpu machine-learning ai pure-rust

A GPU kernel that silently returns the wrong number is worse than one that doesn’t run at all — the second one at least fails loudly.

Today we released OxiONNX 0.1.7 — the release where oxionnx-cuda grows from a working-but-partial 25-op backend into a 40-op one, and where we found and fixed the exact kind of bug GPU-accelerated inference should be most afraid of: a kernel that looked correct and quietly returned the wrong answer.

No C. No C++. No ONNX Runtime binaries. No cuDNN, no cuBLAS, no external protobuf — the CUDA backend talks to the driver through COOLJAPAN’s own Pure Rust oxicuda stack.
No unsafe code outside a handful of documented, audited call sites.
Just memory-safe ONNX model execution that compiles to a single static binary (or WASM) and runs everywhere — from laptops to browsers to edge devices to GPUs.

Why OxiONNX 0.1.7 is a game changer

A partial GPU backend fails in the boring way — it just falls back to CPU. A wrong GPU backend fails in the dangerous way — it keeps running and hands you a number that looks fine:

OxiONNX 0.1.7 ends all of that.

Technical Deep Dive: four layers that make the CUDA path honest

  1. The buffer/weight/module residency stack (oxionnx-cuda/src/residency.rs, new, 1,537 lines) — a size-classed device-buffer free list (DevicePool, 512 MiB budget), an initializer-keyed weight cache (ResidentWeights, identity checked against the cached entry’s recorded host address and length on every lookup, not trusted), and a per-context compiled-PTX cache for the elementwise/softmax kernels the crate JIT-generates itself.
  2. Real Conv dispatch (oxionnx-cuda/src/conv.rs, 110 → 1,168 lines) — conv::cuda_conv picks ImplicitGemmConv, Conv1x1, or DepthwiseConv per shape, deliberately bypassing oxicuda_dnn’s own auto-selector (which can route into a separately-gated Winograd path), and declines to CPU rather than guess on asymmetric pads or group/channel mismatches.
  3. A shared, backend-generic activation-residency trait (src/session/gpu_activations.rs) — RunActivations is now generic over DeviceActivation, with GpuActivations/CudaActivations as the two instantiations. CUDA uses a more permissive keep policy than wgpu’s: a value stays resident if any capable consumer can bind it in place, because a value that must still be read back for one CPU-only consumer costs one read-back either way.
  4. Device- and shape-aware dispatch tuning (oxionnx-gpu/src/context/tuning.rs, new, 868 lines) — GpuTuning replaces seven flat threshold constants; for Gemm it gates on arithmetic intensity (I = 2mkn/(mk+kn+mn)) instead of raw FLOP count, and a software adapter (lavapipe, WARP) now declines every size outright since it is the CPU it would be racing.

Getting Started

cargo add oxionnx --features cuda

The core inference API is unchanged in 0.1.7:

use oxionnx::{Session, Tensor};
use std::collections::HashMap;

let session = Session::from_file("model.onnx".as_ref())?;

let mut inputs = HashMap::new();
inputs.insert("input", Tensor::new(vec![1.0, 2.0, 3.0], vec![1, 3]));

let outputs = session.run(&inputs)?;
println!("{:?}", outputs);

Checking for a CUDA device directly (needs OXIONNX_CUDA=1 and the cuda feature):

use oxionnx_cuda::CudaContext;

// Returns None unless OXIONNX_CUDA=1 is set, and also None with no CUDA
// device present. No panic, no unwrap required either way.
if let Some(ctx) = CudaContext::try_new() {
    println!("CUDA device ready: {:?}", ctx.driver_context());
}

In practice you don’t need to touch oxionnx-cuda directly — Session dispatches to CUDA automatically once the cuda feature is on, OXIONNX_CUDA=1 is set, and a compatible GPU is present.

What’s New in 0.1.7

Tips

This is the foundation

OxiONNX is the ONNX inference backend across the COOLJAPAN stack — all bumped to oxionnx = "0.1.7" as part of this release:

Repository: https://github.com/cool-japan/oxionnx

Star the repo if you want a CUDA backend that catches its own wrong answers instead of shipping them.

The era of “GPU accelerated” meaning “trust the kernel” is over.

Pure Rust ONNX inference — verified against its own CPU oracle, not just fast — is here.

KitaSan at COOLJAPAN OÜ August 14, 2026

↑ Back to all posts