Repository navigation
Fix TorchRL stepping across simulation and output devices - #8240
Conversation
|
run-ci |
|
There was a problem hiding this comment.
Isaac Lab Review Bot
The patch correctly moves the combined TorchRL done mask to the wrapper output device before terminal-observation selection. The change is minimal, non-breaking, documented in the package changelog, and covered by focused mixed-device regression cases.
- Design and architecture: The transfer remains at the wrapper boundary that owns
self.device._terminal_observationsconsumes observations and its selection mask on the same device, without introducing new state, helpers, or competing device ownership. - API: No public signatures, keywords, import paths, task IDs, CLI flags, or serialized forms changed.
IsaacLabTorchRLWrapper(env, device=...)retains the same returned keys, shapes, and dtypes; the previously failing mixed simulation/output-device path now works. - Compatibility and deprecation: Breaking changes: none identified. The compatibility ledger is unchanged, and moving
donewith.to(self.device)is a no-op for the existing same-device path. No deprecation bridge is needed. - Implementation: Tracing
_stepthrough_terminal_observationsconfirms thatdoneis used to index the output-device observation TensorDict, so moving the mask before that call fixes the concrete mismatch at the correct boundary. Reset, close, spec construction, and unrelated wrapper paths are unchanged. The requiredisaaclab_rlchangelog fragment is present. - Style consistency: The one-line implementation follows surrounding naming and formatting conventions. The changelog entry is concise, and the CONTRIBUTORS entry is placed consistently. No redundant or misleading added prose requires cleanup.
- Test quality: The changed integration test extends the existing owner-boundary wrapper matrix. It preserves the default TorchRL path and adds distinct CPU-output cases for captured terminal observations and the NaN fallback. These cases exercise separate terminal-observation branches and directly validate the mixed-device regression; no unsupported duplication or junk-pattern test was identified.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
|
run-ci |
Backports #8240 to `release/3.0.0`. The original cherry-pick conflicted. An NVIDIA inference model proposed this resolution, and deterministic validation confirmed that it changes no paths outside the original PR. Because conflict resolution cannot be certified as an exact patch replay, this PR is intentionally a draft and requires release-maintainer review. | Field | Commit | |---|---| | Original merged change | `bbcbab6b64d5538c1e6800646d57b462389c1410` | | Release base used | `84e10dbfef3c449be2b1d21eb30f8b0fd1795962` | | Proposed backport | `58eebd7fdb191cf0ea7e2a9ffe93544e362e9d3a` | Co-authored-by: cyanseek <[email protected]>
Description
IsaacLabTorchRLWrapper(env, device="cpu")could reset a CUDA environment but crashed on the first step: observations had moved to the wrapper device while the terminal-selection mask remained on CUDA.Move the combined
donemask to the wrapper device before selecting terminal observations. Extend the existing wrapper test matrix to exercise CPU output with captured terminal observations and the NaN fallback, while retaining the default same-device path. The current training CLI defaults are unchanged.Fixes #8239
Type of change
Release backport
developValidation
Revalidated after merging
developat5afb1f7949e8ab02d9b97253caf2e71b5aabfd45on 2026-10-09. The fixture now uses the currentlaunch_simulation(cfg)interface.Real Newton/MJWarp Cartpole simulation on an RTX 4090, Ubuntu 24.04.3, driver 580.126.09, Python 3.12.13, PyTorch 2.11.0+cu130, Warp 1.17.0, TorchRL 0.14.0 and TensorDict 0.14.2; seed 42. Dependencies used the versions in
uv.lock, including Newton commit5ea82eef6f7911388025a8df6ccdb172e2fed286.source/isaaclab_rl/test/test_wrappers.py, with thetest,torchrl,rl-games,sb3andskrlextras: 10 passed, no skips.Command:
uv run --frozen --no-sync python -m pytest source/isaaclab_rl/test/test_wrappers.py -q(--no-syncuses the already prepared locked environment). Official Cartpole assets were cached without modification viaISAACSIM_ASSET_ROOT.This verifies wrapper correctness, not training throughput. PhysX, multi-GPU transfers, and rendering were not tested. The test run reports existing dependency/backend warnings; it is not warning-free.
Checklist
pre-committhroughisaaclab --format(all applicable hooks passed).devicedocumentation describes the restored behavior; no API change.isaaclab_rlchangelog fragment.CONTRIBUTORS.md.