Repository navigation
[Backport] PR #8240 to release/3.0.0 - #8531
Conversation
`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 `done` mask 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 - Bug fix (non-breaking change which fixes an issue) - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` Revalidated after merging `develop` at `5afb1f7949e8ab02d9b97253caf2e71b5aabfd45` on 2026-10-09. The fixture now uses the current `launch_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 commit `5ea82eef6f7911388025a8df6ccdb172e2fed286`. - CPU-output regression cases against the original wrapper: **2 failed**. Both failures were the expected CUDA/CPU mismatch. - Complete `source/isaaclab_rl/test/test_wrappers.py`, with the `test`, `torchrl`, `rl-games`, `sb3` and `skrl` extras: **10 passed**, no skips. Command: `uv run --frozen --no-sync python -m pytest source/isaaclab_rl/test/test_wrappers.py -q` (`--no-sync` uses the already prepared locked environment). Official Cartpole assets were cached without modification via `ISAACSIM_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. - [x] Read the contribution guidelines and applied the test-audit criteria. - [x] Ran `pre-commit` through `isaaclab --format` (all applicable hooks passed). - [x] Existing `device` documentation describes the restored behavior; no API change. - [x] Validated the changed behavior and adjacent wrappers with real GPU simulation. - [x] Added an `isaaclab_rl` changelog fragment. - [x] Added the contributor name to `CONTRIBUTORS.md`. (cherry picked from commit bbcbab6)
|
run-ci |
|
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Style consistency (1). Other reviewed categories look good.
- PR description: Body covers backport provenance but not the defect or validation; state the cross-device failure, corrected behavior, test command/result, and how the claimed deterministic comparison was performed, with no performance evidence needed.
- Design and architecture: Architecture looks good.
- 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: The lone
doneconversion is intentionally asymmetric but unexplained, making it look redundant beside TensorDict’s later coercion; add a brief comment that_terminal_observationsrequires an observation-device mask. - Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| terminated |= truncated | ||
| truncated.zero_() | ||
| done = terminated | truncated | ||
| done = (terminated | truncated).to(self.device) |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Unexplained asymmetric device coercion
Only done is moved to self.device; reward/terminated/truncated rely on TensorDict coercion, so a later reader may delete the .to() as redundant. Add a brief comment stating done must match the observation device for _terminal_observations masking.
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.
bbcbab6b64d5538c1e6800646d57b462389c141084e10dbfef3c449be2b1d21eb30f8b0fd179596258eebd7fdb191cf0ea7e2a9ffe93544e362e9d3a