Alternatives considered

Other GPU backends we tried, and why we didn't use them.

5 min read

Bullet3's OpenCL GPU pipeline was built, measured and rejected. Stock, its restitution is hard-coded to 0 (no bounce; 143–3,483 uu error); patched, it was still 2.4–134 uu off. It ran 0.16–0.75 M ball-ticks/s, 6–30× slower than one RocketSim CPU thread, was non-deterministic (three runs, three results), cost ~1.15 MB per arena and had quadratic setup. The details, and the conditions under which it would be worth revisiting, are below. The chosen backend is in Roadmap → Backend choice.

Bullet3's experimental GPU mode was built and measured too, not just read about.

The three main options#

(1) Custom kernels that reimplement RocketSim's Bullet-2 semantics (Warp)(2) Bullet3 OpenCL GPU pipeline as the backend(3) Hybrid: custom kernels that borrow Bullet3 GPU algorithms
Ball physics fidelity (measured)Plane-only float32 model of the same semantics is bit-exact against RocketSim on 8 of 9 checked scenarios. The 9th has 1-ulp transients; the 10th diverges where it meets meshes the model leaves out. Mesh path not yet run (at decision time; it has since run bit-exact on all 51 B1 scenarios)Stock: no bounce. Restitution is hard-coded to 0 (b3ConvertConstraint4.h:101); max error 143–3,483 uu. Patched (bounce, friction, damping, drag constants): 2.4–134 uu max error; resting height 91.24 vs 93.15 uu (no speculative contact); 101–131 uu on the side-wall lobSame as (1). Only algorithms are borrowed, not semantics
Contact semanticsCan port exactly: one-sided triangles, 1.905 uu speculative margin, persistent 4-point manifolds, internal-edge correction, one averaged synthetic rowTwo-sided triangles, contacts only after penetration, no manifold persistence, no edge correction, different solver (4 iterations, no carry-over)As (1)
Many independent arenasNative: one thread per arena, all reading one shared read-only meshOne shared world. Each arena needs its own mesh copy (offset sharing failed: the ball fell to z = −779). About 1.15 MB per arena; quadratic setup (64 arenas took 314 s, 0.26 s with reservation); 4,096 arenas took 30 s to set upAs (1)
Throughput (measured)Toy physics: 36 M ball-ticks/s at 4k envs, 471 M at 65k0.16–0.75 M ball-ticks/s, i.e. 6–30× slower than one CPU thread of RocketSim. 34–45 host syncs, about 15 device→host copies and 50–256 launches per stepAs (1); the BVH traversal could be faster
CarsRaycasts against the mesh BVH (wp.mesh_query_ray), custom suspension, callbacksNo raycasts against meshes or planes; no contact callbacks or per-pair materials; stale world inertiaAs (1)
PyTorchZero-copy, same streamOpenCL buffers would need a host copyAs (1)
DeterminismOne thread per arena with no cross-arena atomics, so it should be deterministic for a fixed build and device (to be verified, Floating point and determinism)Not deterministic with 4,096 balls in one world (three runs gave three results)As (1)
MaintenanceWarp is actively released by NVIDIA and pinned hereLast real solver changes 2017–2018; README still says "experimental"—
Setup costuv syncCMake + MSVC; OpenCL demos only build with premake and need a GUI; a headless harness had to be written; must choose the NVIDIA platform by hand (Intel iGPU is platform 0); face-buffer overflow fails silently in Release—

Decision: (1), with (3) used as a quarry for ideas. Bullet3 GPU loses on every axis that matters here: fidelity, independent arenas, throughput, car support and torch interop. Its failure modes (restitution hard-coded to 0, silent contact loss on buffer overflow) are exactly the "silent approximation" the project rules out. Making it faithful would mean rewriting its solver and contact kernels, which is the same work as (1) without the clean starting point.

What to borrow from Bullet3 (no code copied without a licence check; Bullet is zlib):

  • the GPU sphere–triangle test (Bullet3Collision/NarrowPhaseCollision/shared/b3…Sphere…), made one-sided with a margin;

  • the stackless quantised-BVH traversal, if Warp's BVH turns out to be the bottleneck;

  • graph-coloured contact batching, as a reference for stage C5 (car–car contacts) if a per-arena serial solver is too slow.

Revisit (2) or (3) if any of these happen:

  • Bullet3 upstream gains restitution, per-pair materials and callbacks in the GPU solver, plus multi-world or instancing support;

  • Warp's BVH or its launch model becomes the measured bottleneck and Bullet3's traversal beats it by more than 2× in an apples-to-apples kernel;

  • the project drops the "match RocketSim" requirement in favour of a different reference.

Other options probed#

OptionFindingVerdict
Rust + cudarc 0.19.10Same kernel speed as Warp (12.0 G body-ticks/s). Needs nvrtc64_130_0.dll, which the driver does not ship (it is on PyPI). Launches need unsafe (the workspace forbids unsafe_code). No BVH; no zero-copy torchFallback if Python overhead ever dominates. Not for the prototype
Rust + wgpu 30Not run. No BVH primitives, no f64 in core WGSL, no torch interopRejected for now
Pure PyTorchBrute-force sphere against 8,020 triangles: 0.05 M queries/s, about 10⁴× slower than a BVH. triton had no Windows wheels (triton-windows now exists and is the root project's optional compile extra; the verdict is unchanged)Rejected
JAXNo CUDA wheels on WindowsRejected
mujoco-warp 3.16, newton-physics 1.0Built on Warp; would likely install. Different contact models (soft/convex)Architecture references only
tiny-differentiable-simulator, PyBulletNo triangle-mesh contact with RocketSim semantics; PyBullet runs on CPU onlyRejected