Concepts#
The core concepts behind GRiD’s generated code: the design principles, the codegen architecture, the shared-memory resource-tier system, the input/output ABI, and the parallelism patterns.
- Algorithm Design Principles & Best Practices
- The one-paragraph version
- 1. Smart inners, thin wrappers
- 2. The inner owns its memory placement (the central rule)
- 3. Memory-hierarchy design
- 4. The spill ladder and per-tier picks
- 5. Recipe: adding or modifying an algorithm
- 6. Validation discipline
- 7. Anti-patterns to avoid (each one bit us once)
- Go deeper
- Input / Output ABI (
h_q_qd_u) - Library-safe initialization and cleanup
- Runtime contexts
- Operand validation
- Parallelism Patterns (the in-block fan-out toolkit)
- P1 — Depth / BFS-level batching of tree recursions
- P2 — Parallel independent columns (gradients / Jacobians / Hessians)
- P3 — Loop-invariant hoist → store temps → batch-parallel after
- P4 — Offline memory layout: sparse compaction, coalesced distribution, topology-helper indirection
- The audit (a standing requirement)
- Algorithms
- inverse_dynamics (RNEA / Recursive Newton-Euler Algorithm)
- ABA (Articulated Body Algorithm)
- CRBA (Composite Rigid Body Algorithm)
- Minv (Direct Mass-Matrix Inverse)
- Frame Jacobian (general-frame geometric Jacobian)
- IDSVA / IDSVA-SO (Inverse Dynamics, Second-Order)
- FDSVA-SO (Forward Dynamics, Second-Order)
- Kinematics (end-effector pose, Jacobian, Hessian)
- Bias terms, centroidal quantities and energy
- Integrators and the plant layer
- Algorithm Overview
- Codegen Architecture
- The MuJoCo (mjx) output convention
- cuBLASDx Removal & Any-Thread-Count Library Functions
- Resource-Tier System (v2.0)
- Resource-Tier Design Notes
- Resource-Tier Changelog