Skip to content

[Backport] PR #8240 to release/3.0.0 - #8531

Merged
kellyguo11 merged 1 commit into
release/3.0.0from
backport/release/3.0.0/pr-8240
Oct 13, 2026
Merged

kellyguo11 merged 1 commit into
release/3.0.0from
backport/release/3.0.0/pr-8240

Conversation

@isaaclab-bot

@isaaclab-bot isaaclab-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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

`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)
@isaaclab-bot

isaaclab-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

run-ci

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Oct 13, 2026
@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 13, 2026
@kellyguo11
kellyguo11 marked this pull request as ready for review October 13, 2026 18:51
@kellyguo11
kellyguo11 requested a review from a team October 13, 2026 18:51
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Fixes TorchRL stepping when the wrapper returns tensors on a different device from the simulation.

  • TorchRL steps work when outputs use a different device.

Reviews (1) · Last reviewed commit: "Fix TorchRL stepping across simulation a..." · Reviewed by Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 done conversion is intentionally asymmetric but unexplained, making it look redundant beside TensorDict’s later coercion; add a brief comment that _terminal_observations requires 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

@kellyguo11
kellyguo11 merged commit b88f56a into release/3.0.0 Oct 13, 2026
58 checks passed
@kellyguo11
kellyguo11 deleted the backport/release/3.0.0/pr-8240 branch October 13, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants