every line of math · no_std · zero CUDA dependencies
The adapters may not contain arithmetic. Kernels are declared
once in a shared row list, and both backends expand the same row.
shannon-kernels→ PTX
Expands the kernel rows to PTX through cuda-oxide's rustc codegen
backend. Runs on the GPU.
shannon-cpu→ rayon
Expands the same rows over rayon. Runs on the CPU, from the
identical source.
raymarch · 2048 × 1024 SDF · same source, either backend
$cargo oxide run --bin affine
✓forward: GPU == CPU == analytic (1024 elements)
✓backward: GPU == CPU == 2 (analytic)
✓gradcheck: confirmed by finite differences
✅ AFFINE ACCEPTANCE PASSED
Ray-march parity between the two backends
99.88 % of pixels within 1e-4 · a demo that “mostly works” is a demo that fails
02 A launch is a function call
GPU launch overhead20,000 launches/cell · dim = 1 · median of 3 · k0 direct
shannon-autogradnative dispatch17.87 µs
Warpbaseline45.3 µs
Faster in 11 of 12 measured cells, by 1.1–3.0×.cargo oxide run --bin launch_bench
CPU dispatchlog scale — the bars would not otherwise fit on one row
shannon-autograda direct call1.3 – 23 ns
Warpinterpreted path6.5 – 19 µs
1 ns100 ns10 µs
Nanoseconds against microseconds — three orders of magnitude.
No interpreter, and no per-argument marshalling.
03 …and it is differentiable
Tape of launchesrecording
1upload params
2bvh_refit
3closest_point
traversal stack · early exit
4chamfer_loss
5reduce → loss
The kernel being differentiated is imperative — a BVH descent with a
traversal stack and an early exit. Systems built on whole-array primitives
cannot express that shape directly; a tape of launches differentiates it as-is.
shape_fit · iter 0
0.0
orders of loss decrease
Stage 1, SGD oracle: 8.9 orders, matching the (1−lr)² theorem.
Stage 2, Chamfer + Adam: 3.5 orders, GPU gradients matching the CPU
backend at rel 1e-3. Full acceptance run: 1.08 s wall.
A DIFFERENTIABLE GPU COMPUTING SDK IN RUST
eight crates · ~9,200 lines · research prototype
A traversal stack, an early exit, and a gradient anyway.
One Rust kernel source compiled to PTX and to rayon, reverse-mode
autodiff over a tape of launches, and gradients that flow through BVH closest-point
queries by the envelope theorem.
Motion is reduced in your system settings, so the reel doesn't start on its own.