Repository navigation
Configure native MuJoCo Warp determinism before model constants - #4632
huster-wgm wants to merge 4 commits into
Conversation
Set the per-model native option before constants are initialized. Let the backend select deterministic kernels and bounds, while keeping the legacy module configuration for older releases.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change configures native MuJoCo Warp determinism before model constants are computed and keeps the legacy behavior for older backends. No concrete merge-blocking defect was identified in the supplied context. The native API depends on an upstream release, which the PR already tracks. Pre-merge checks |
|
Description
Configure MuJoCo Warp's native determinism option before Newton computes derived model constants. With an API-capable backend,
SolverMuJoCo(deterministic=RUN_TO_RUN)currently leaves that option disabled. Setting it after construction cannot repair constants already computed through nondeterministic reductions.Closes #4631. Related: #2479 and google-deepmind/mujoco_warp#1775.
This draft adapts the existing Newton argument to the upcoming backend API. It sets the per-model flag immediately after
put_model, delegates kernel selection and scatter bounds to the native backend, and keeps Newton conversion kernels under the requested Warp mode. Older backends retain the existing module configuration and generated-kernel invalidation path. The global Warp configuration is restored after each scoped operation. StrongerGPU_TO_GPUrequests are rejected rather than silently mapped toRUN_TO_RUN.No new public parameter, USD schema, dependency-range change, or production-environment upgrade is introduced. The API-capable integration reports
mujoco-warp==3.15.0, outside the current~=3.14.0dependency range; its warning remains visible. Keep this draft pending the upstream native API and compatible dependency release.Checklist
Test plan
a6e1649, the new construction-time regression fails with CRB observations[0, 0]; it passes after the fix. The observer invokes the real CRB calculation.uv run --frozen python -m unittest newton.tests.test_mujoco_version_check newton.tests.test_mujoco_native_determinism— 9 passed, 2 skipped because the native API is unavailable.python -m unittest newton.tests.test_mujoco_native_determinism— CPU and RTX PRO 6000 CUDA, 4 passed. Covers flags during constant computation, finite and equal per-world constants, independent enabled/disabled solvers, model-property updates, restored global settings, repeated contact rollouts, and eager/CUDA Graph equality with zero overflow.7460a2c(runtime;91c0ac8adds documentation). The graph regression exercises the default conditional solver graph on Warp 1.18.0.uvx pre-commit run -a,git diff --check, and Towncrier draft preview pass. New test functions have docstrings and use portable unittest/NumPy/Warp APIs.Bug fix
Steps to reproduce:
SolverMuJoCo(..., deterministic=wp.DeterministicMode.RUN_TO_RUN).model.opt.deterministic == NONEduring the constructor's CRB calls. The full timing reproduction is in the linked issue and the regression test.Minimal reproduction:
Summary by CodeRabbit