> A compiler from an OCaml array DSL to fused CUDA kernels — with reverse-mode autodiff and NVRTC JIT — verified against a reference interpreter.
// compiler pipeline
Compiles tensor graphs (map, reduce, scan, matmul) from an OCaml array DSL down to CUDA C++ through a typed DAG IR, graph-to-graph passes, and lowering — fusing 5 chained element-wise ops into 1 kernel with no intermediate buffers.
Implements reverse-mode AD as a graph-to-graph pass, so gradients fuse and run on the GPU like any other graph — computing 4 Black–Scholes Greeks in one 25-kernel backward pass (0.7 ms on an A100, ~4.2M paths).
Fusion, lowering, and AD are all driven from one stable DFS topological sort of the DAG, materializing only shared and barrier nodes, so the emitted code is deterministic.
Every GPU result is checked against a pure-OCaml reference interpreter — 230+ unit and 38 system tests passing on two GPU platforms. Exposed through a 6-command CLI (emit, run, check, dot, list, info) and a multi-GPU runtime with async streams.