# CusADi2: Latency-Optimized Batch Computation of Robot Kinematics, Jacobians, and Hessians on the GPU

Robotics.world

> Provides a released GPU library that cuts batch kinematics, Jacobian and Hessian latency, making online trajectory optimization and sampling controllers feasible at control rates.

**arXiv**: 2610.25476 · Preprint · not peer-reviewed

**Published**: 2026-10-18

**Authors**: John Viljoen, Lasse Peters, Masayoshi Tomizuka, Negar Mehr

## In plain words

Robotics algorithms such as sampling-based and gradient-based trajectory optimization repeatedly evaluate model-derived functions — forward kinematics and their Jacobians and Hessians — for many candidate trajectories or time steps at once.

## AI summary

## Overview

**Research area:** Robotics — GPU-accelerated computation of robot dynamics, kinematics, and their derivatives for online optimal control and planning.

**Technical level:** Advanced. The paper formalizes DAG scheduling and assumes familiarity with trajectory optimization, automatic differentiation, and GPU execution models, though the core idea (parallelize *inside* each rollout, not just *across* rollouts) is intuitive.

**Scope:** A software library, CusADi2, that generates low-latency GPU kernels for batched forward kinematics, Jacobians, and Hessians, benchmarked against five existing tools on all 67 MuJoCo Menagerie robots.

## What This Paper Is About

Robotics algorithms such as sampling-based and gradient-based trajectory optimization repeatedly evaluate model-derived functions — forward kinematics and their Jacobians and Hessians — for many candidate trajectories or time steps at once. Existing GPU frameworks make these batches fast in *total throughput* (useful for offline reinforcement learning) but not fast in *wall-clock latency per batch*, which is what online control actually needs. The authors build CusADi2, which additionally parallelizes the computation *within* each individual batch instance so that every batch finishes sooner.

## Key Contributions

1. **A latency-oriented formulation.** The paper casts minimum-time evaluation of a single batch instance as a DAG-scheduling problem — assigning each atomic operation a time step subject to topological-order and compute-unit-saturation constraints — and shows that batch latency is governed by per-instance latency rather than by parallelism across instances.
2. **A scheduling method with two regimes.** In the unsaturated regime (enough compute units that the width constraint never binds), the "level schedule" is computed in a single pass and is optimal by the result of [23]. In the saturated regime, where optimal scheduling is NP-hard [22], the authors propose a *windowed level schedule* heuristic that cuts the sequential order into windows of K vertices and level-schedules within each window.
3. **Hardware-aware execution optimizations.** Two additional optimizations are described: reusing one schedule across trajectory stages, and grouping same-type operations, which GPUs execute more efficiently. The paper notes these address GPU heterogeneity (e.g., warps, thread blocks) that the abstract scheduling model ignores.
4. **A broad benchmark and a control demo.** Evaluation covers forward kinematics, Jacobians, and Hessians for all 67 MuJoCo Menagerie robots (arms, hands, quadrupeds, humanoids, biomechanical models) against MuJoCo XLA, MuJoCo Warp, frax, CusADi, and CasADi, plus a 50 Hz safe sampling-based planner for a Franka Panda arm with a Higher-Order Control Barrier Function safety filter per sampled trajectory. Code is open-source.

## Main Findings

- **Latency advantage at moderate batch sizes:** CusADi2 achieves lower latency than all baselines at batch sizes of 64 to 4096, while matching them at larger batch sizes (no throughput loss beyond that range).
- **Concrete forward-kinematics numbers:** For 256 forward-kinematics evaluations (B = 256 rollouts of 8 time steps), existing GPU frameworks need at least 100 μs on nearly every MuJoCo Menagerie robot, whereas CusADi2 needs under 40 μs on common platforms.
- **Best on nearly every robot:** CusADi2 is fastest on all but two low-DOF robots across the Menagerie, spanning models from dexterous hands to humanoids, with DAGs of up to 429,773 operations.
- **Saturation is rare in practice:** On a consumer-grade GPU (RTX 4080), across all 67 robots, forward kinematics and Jacobians never saturate the compute units, and Hessians saturate for only 4 robots (6.0%) — meaning the optimal level schedule applies almost always.
- **Derivatives come for free:** Because CasADi differentiates symbolically, Jacobians and Hessians are themselves CasADi functions with their own DAGs, so the method applies to them without modification, and it inherits CasADi's sparse symbolic differentiation rather than treating Jacobians and Hessians as dense.
- **Demonstrated in closed loop:** A 50 Hz sampling-based planner with a per-trajectory HOCBF safety filter is shown for a Franka Panda arm. (The truncated content does not report quantitative tracking or constraint-satisfaction results for this demo.)

## Methodology in Plain English

The authors never write GPU code by hand. Instead, they take the symbolic expression graph that CasADi already produces for a robot function and treat it as a recipe: a list of tiny operations (sine, cosine, multiply, add) with dependencies between them. Operations that don't depend on each other can run at the same moment on different GPU cores.

So the problem becomes: assign every operation to a "time step" so that (a) nothing runs before the things it needs, and (b) no more operations are scheduled at any step than the GPU has compute units. This schedule is computed once at compile time and reused for every evaluation, since it doesn't depend on the input values.

If the GPU has enough compute units — which the authors find is essentially always the case for kinematics and Jacobians — the greedy "schedule each operation one step after its latest dependency" (the level schedule) is provably optimal. When there aren't enough units, they chop the operation list into fixed-size windows and run the greedy schedule within each window, accepting a feasible but possibly suboptimal answer.

Two extra tricks reuse a single schedule across the stages of a trajectory and batch same-type operations together, because real GPU hardware executes identical instructions on neighboring cores more efficiently than mixed ones. Finally, they benchmark this generated code against five existing tools on every robot in a standard model zoo, and run a closed-loop planning demo.

## Why This Matters

Online robot control is latency-bound, not throughput-bound: a planner that needs 100 μs per batch simply cannot run at the same rate as one that needs 40 μs. This work reframes GPU robot computation around that constraint and shows that a substantial latency reduction is available essentially for free by exploiting structure that existing tools leave on the table.

**Real-world applications:**

- **Safe sampling-based control:** Sampling hundreds of candidate action sequences per control tick and filtering each with a control barrier function — the paper's Franka Panda demo.
- **Legged and humanoid locomotion:** Whole-body controllers that need forward kinematics and Jacobians for many contact hypotheses within a single control period.
- **Dexterous manipulation:** Hands and arms with many degrees of freedom, where kinematic chains and their derivatives are evaluated repeatedly for grasp or finger-gait optimization.
- **Gradient-based MPC:** Second-order methods that need Hessians along a trajectory at every iteration, where multiple initial guesses are evaluated in parallel.
- **Biomechanical modeling and simulation**, given the Menagerie's inclusion of biomechanical models.

**Industry relevance:** The result is a drop-in library (open-source) for teams already using MuJoCo, CasADi, or JAX-based simulators who need their model evaluations to fit inside a real-time control budget rather than merely train fast.

## Future Directions

- **Modeling heterogeneous operation costs.** The paper explicitly leaves this to future work: it assumes every atomic operation takes one time step, but real operations differ in cost, so a time step's duration is set by its slowest operation.
- **Batch-level optimal scheduling.** The authors note that when more than one round is needed (B × maxwidth > N), per-instance optimality does not guarantee per-batch optimality — a narrower but deeper per-instance schedule might fit more instances per round. They state that solving this is beyond the paper's scope.
- **Closing the gap for the saturated cases.** Hessians saturated the compute units for 4 of 67 robots; improving the windowed heuristic (including choosing the window size K) is a natural next target, particularly for very high-DOF models.
- **Broader function classes and hardware.** Extending beyond kinematics, Jacobians, and Hessians to full dynamics (mass matrices, inverse dynamics) and validating the schedule generation on GPU architectures other than the consumer RTX 4080 used here.

## Target Audience

Roboticists implementing online model-based control — sampling-based MPC, gradient-based trajectory optimization, and safety-filtered planners — who are comfortable with CasADi or MuJoCo and want their model evaluations to fit real-time budgets. It is also relevant to GPU systems researchers interested in DAG scheduling for fine-grained scalar workloads, and to practitioners in legged locomotion, manipulation, and humanoid control who need batched kinematics and derivatives at kilohertz-scale latency. Readers without background in trajectory optimization or automatic differentiation will find the formal scheduling sections dense, though the central insight is accessible.

## Authors’ abstract

Trajectory optimization methods, from sampling-based zero-order to gradient-based first- and second-order approaches, require many evaluations of dynamical system functions, i.e., functions derived from a robot's dynamical model, such as forward kinematics and their Jacobians and Hessians. These evaluations are largely independent, e.g., across sampled trajectories or time steps, and can thus be evaluated in parallel as a batch. When used to make decisions online, these…

[The full abstract on arXiv](https://arxiv.org/abs/2610.25476)

[Read the original paper](https://arxiv.org/abs/2610.25476)

## Related papers

- [Residual Denoising Enables Sample-Efficient Multi-Agent Coordination on Demand](https://robotics.world/paper/residual-denoising-enables-sample-efficient-multi-agent-coordination-on-2609.32129) 2026-09-26 · cs.RO · Also by Lasse Peters, Negar Mehr
- [What Matters in Quality-Aware VLA Pretraining: A Benchmark and Empirical Study](https://robotics.world/paper/what-matters-in-quality-aware-vla-pretraining-a-benchmark-and-empirical-2610.18869) 2026-10-13 · cs.RO · Also by Masayoshi Tomizuka
- [MagCilia: A Compact Magnetociliary Tactile Sensor with 3D Force Sensing for Robotic Contact Perception and Grasping Feedback](https://robotics.world/paper/magcilia-a-compact-magnetociliary-tactile-sensor-with-3d-force-sensing-2610.09536) 2026-10-07 · cs.RO · Also by Masayoshi Tomizuka
- [Ctrl-F: Force as an Interface for Humanoid Loco-Manipulation](https://robotics.world/paper/ctrl-f-force-as-an-interface-for-humanoid-loco-manipulation-2611.05507) 2026-11-03 · cs.RO · Also by Masayoshi Tomizuka
- [Latent RL Priors for Data-Efficient Dexterous Manipulation](https://robotics.world/paper/latent-rl-priors-for-data-efficient-dexterous-manipulation-2611.08458) 2026-11-05 · cs.RO · Also by Masayoshi Tomizuka

---

Canonical: https://robotics.world/paper/cusadi2-latency-optimized-batch-computation-of-robot-kinematics-2610.25476
