Skip to content

Add opt-in MJX solver scan loop - #3408

Open
devshahofficial wants to merge 1 commit into
google-deepmind:mainfrom
devshahofficial:agent/pr3264-mjx-solver-scan
Open

Add opt-in MJX solver scan loop#3408
devshahofficial wants to merge 1 commit into
google-deepmind:mainfrom
devshahofficial:agent/pr3264-mjx-solver-scan

Conversation

@devshahofficial

Copy link
Copy Markdown
Contributor

Draft follow-up for #3264 / #2259, based on the original reverse-mode autodiff fix from @ingyukoh.

The maintainer review concern on #3264 was avoiding a default solver performance change. This version keeps the scan loop opt-in through OptionJAX.solver_scan and leaves the existing jax.lax.while_loop path as the default.

Changes:

  • adds OptionJAX.solver_scan, defaulting to False in _put_option
  • uses _while_loop_scan for the outer solver loop only when opted in
  • adds a reverse-mode gradient regression test that enables the flag explicitly

Local validation:

  • python3 -m py_compile mjx/mujoco/mjx/_src/types.py mjx/mujoco/mjx/_src/io.py mjx/mujoco/mjx/_src/solver.py mjx/mujoco/mjx/_src/solver_test.py
  • git diff --check

Could not run the focused MJX runtime test locally because this base Python is missing jax, jaxlib, absl-py, and mujoco.

Opening as draft to avoid superseding the existing approved PR unless maintainers prefer this rebased/tested version.

@devshahofficial
devshahofficial force-pushed the agent/pr3264-mjx-solver-scan branch from f1692d2 to 284b98e Compare July 16, 2026 22:10
@devshahofficial
devshahofficial marked this pull request as ready for review July 20, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant