Repository navigation
[Release 3.0] Fix MJWarp resets with sparse state imports - #8852
kellyguo11 merged 3 commits into
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR keeps authored joint state from being lost when MJWarp skips periodic imports.
No actionable issues were found. Tests were not run during this review. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Asset writes joint state] --> B[Flag affected worlds]
B --> C[Forward or physics-step boundary]
C --> D[Clear flagged solver history]
D --> E{Sparse or disabled imports?}
E -->|Yes| F[Import authored joint state]
E -->|No| G[Use normal per-substep import]
F --> H[Refresh body poses and clear masks]
G --> H
H --> I[Next solver step or graph replay]
Reviews (1) · Last reviewed commit: "Fix MJWarp resets with sparse state impo..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (1). Other reviewed categories look good.
- PR description: Title and body match the five-file diff; remove the scratch-document note and report sparse-import baseline/candidate steps/s with revisions, command, GPU, backend, environment count, and warmup.
- Design and architecture: The reset hook calls Newton-private
_update_mjc_dataand duplicates backend dispatch; expose a public masked import on the solver and call that instead. - Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Implementation looks good.
- Style consistency: Style consistency looks good.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
|
Addressed the PR-description requests from the review summary: removed the local scratch-document note and recorded the sparse-import baseline/candidate measurement, revisions, command, GPU/backend, world count, and warmup in the description. The solver-boundary microbenchmark measured median throughput of 6,389 versus 6,404 control steps/s on an RTX 5090 with 4096 unactuated worlds, MJWarp CUDA graph replay, empty reset masks, The private-API finding is answered in its inline thread. Current local validation is six focused cases and 119 tests in the full manager file, plus formatting, changelog checks, and a clean documentation build; all passed. |
# Description MJWarp could discard authored reset state when the next solver substep skipped its periodic Newton-state import. With `update_data_interval=2` and an odd number of solver steps per control step, CUDA graph replay could repeatedly restore the old MuJoCo state and leave terminated robots in place. Synchronize authored joint state in `MJWarpSolver.reset` for flagged worlds at forward and physics-step boundaries when periodic imports are sparse or disabled. Preserve native MuJoCo's template-world state when another world is reset. Updated the configuration docs and added a changelog fragment. This is the `main` counterpart of release PR #8852, implemented in the Newton solver adapter selected by `MJWarpSolverCfg`. It adds no dependencies. The pinned Newton version exposes no public masked state import. With sleeping disabled, `reset(state, world_mask, flags=0)` preserves authored coordinates but skips importing them. The adapter therefore reuses Newton's coordinate conversion through one private call until the solver's public reset contract supports this case; this constraint is documented beside the call and tracked in [Newton #4949](newton-physics/newton#4949). ## Type of change - Bug fix (non-breaking change which fixes an issue) - Documentation update ## Validation - One 39-line parameterized reset-contract test in `test_newton_solvers.py` covers native MuJoCo on CPU and MuJoCo-Warp under CUDA graph replay. It changes authored joint state and the selected world, then checks actual MuJoCo qpos/qvel buffers for selected imports and unselected-state preservation. - Against main `86a648ed05`, the complete `test_newton_solvers.py` file passed on the CPU device mask: 34 passed, 1 skipped. The retired `test_newton_manager_abstraction.py` file is removed as intended by main's test reorganization. - The unchanged CUDA variant previously passed before the workstation's CUDA driver became unavailable; GPU checks could not be rerun after moving the test file. - Negative checks previously caught missing synchronization and the incorrect native-world guard on CPU. A real CPU-backed MuJoCo-Warp probe also caught an import that ignored the world mask. - `uv run isaaclab --format` and the changelog gate passed. - Clean Sphinx HTML build passed with base `bfcf3ca2e5`; the PR documentation changes are unchanged. ## Checklist - [x] I have read and understood the contribution guidelines. - [x] I have run the pre-commit checks with `uv run isaaclab --format`. - [x] I have made corresponding changes to the documentation. - [x] My changes generate no new warnings. - [x] I have validated the changed behavior with focused coverage and applied the test-audit criteria. - [x] I have added a changelog fragment for the touched source package. - [x] My name already exists in `CONTRIBUTORS.md`.
|
run-ci |
Description
MJWarp could discard an environment reset when the next solver substep skipped its periodic Newton-state import. With
update_data_interval=2and an odd number of solver steps per control step, CUDA graph replay could repeatedly restore the old MuJoCo state, leaving terminated robots in place.Synchronize authored joint state for flagged worlds at forward and physics-step boundaries when periodic imports are sparse or disabled. Preserve native MuJoCo's single template-world state when another world is reset. Updated the configuration docs and added a changelog fragment.
This PR targets
release/3.0.0, matching the affected checkout, and adds no dependencies.Newton currently exposes no public masked state import. With sleeping disabled,
reset(state, world_mask, flags=0)preserves authored coordinates but skips importing them. The manager therefore reuses Newton's coordinate conversion through one private call until the solver's public reset contract supports this case; this constraint is documented beside the call.Type of change
Validation
forward()respects the import mask; normal periodic imports remain allowed during stepping.test_newton_manager_abstraction.py: 119 passed, with existing model-fixture warnings.uv run isaaclab --formatand the changelog gate passed.Solver-boundary microbenchmark: baseline
1117519054versus candidate935641f42d, pinned Newton 1.6.1 / Warp 1.17.0, MJWarp CUDA graph on RTX 5090, 4096 unactuated revolute worlds without contacts, empty reset masks,update_data_interval=2,decimation=1,num_substeps=1. Median throughput was 6,389 versus 6,404 control steps/s over five alternating 1000-step samples after 200 warmup replays per graph. Each replay runs the reset hook and one off-cadence solver step. Command:UV_PROJECT_ENVIRONMENT=/tmp/mjwarp-pr-venv WARP_CACHE_PATH=/tmp/codex-warp-cache uv run --no-sync python /tmp/bench_mjwarp_reset_sync.py.Checklist
uv run isaaclab --format.CONTRIBUTORS.md.