Skip to content

[Newton] Redesign Newton Manager [2c-ii/N] - #8870

Merged
StafaH merged 15 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2cii-tests-masks
Nov 2, 2026
Merged

StafaH merged 15 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2cii-tests-masks

Conversation

@StafaH

@StafaH StafaH commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 2c-ii of the Newton manager redesign (overview).
Follows [2c/N] #8735 (merged). The test overhaul is [2c-iii/N] #8884.

Reset and FK flags are mask-only

NewtonBackend.invalidate_fk(env_mask, articulation_ids, *, articulation_mask, consume_mask) and
invalidate_body_state(env_mask, *, consume_mask) select worlds and articulations with boolean masks only. The flag
kernels run one thread per world and take no index selectors, so their launch shape is fixed and any write made
through a _mask writer can be recorded into a CUDA graph. Resets still call the _index writers until mask-based
environment resets land. The FK flag kernel is specialized per view with wp.static on its articulation count
and on whether an articulation mask is given, so it handles no optional arrays at run time. The id-indexed kernels and
their dtype dispatch are removed.

  • Breaking: NewtonManager.invalidate_fk and invalidate_body_state (and the backend methods) no longer take
    env_ids. Pass a boolean env_mask, and articulation_mask to select view-local articulations.

Index writes convert ids at the asset boundary

Asset *_index writes (articulation root and joint state, rigid object root state, rigid object collection body state,
cable segments) flag their ids into a per-asset scratch mask with one small kernel and pass that mask on. The backend
clears each entry as it reads it (consume_mask=True), so the mask starts empty for the next write without a memset.
Writes over all environments pass the asset's all-true mask. Collections also flag body_ids into a scratch object
mask, zeroed after the call when a subset of objects was written. The assets share one mask_from_ids helper.

Asset state writes

  • Rigid object collection writes use separate index and mask kernels. The mask kernels take only masks and full data,
    so the index path can later be removed without touching them.
  • Asset writers flag the backend once per write. The data classes' _reset_pose / _reset_velocity invalidate only
    derived caches.
  • Obtaining write destinations no longer refreshes derived state.

Deprecated joint-state index writer

Articulation.write_joint_state_to_sim_index (Newton, PhysX, OVPhysX) emits a DeprecationWarning. Use
write_joint_state_to_sim_mask, or write_joint_position_to_sim_index and write_joint_velocity_to_sim_index. The
lift, locomotion, Franka pour, Rizon coffee and UR10 particle-push resets move to the position and velocity writers.

Performance

RTX PRO 6000 Blackwell, Warp 1.17.0, main at c498443e0. Environment throughput from
isaaclab benchmark runtime --task <task> --num_envs 4096 --num_steps 1000 --warmup_steps 100 --visualizer none physics=newton_mjwarp, two alternating sequential rounds after a warm-up run (steps/s):

Task main this PR change
Cartpole (reset-heavy) 2.67M 2.63M −1.4%
Flat ANYmal-D 254.3k 254.7k +0.2%

Per-call cost of articulation writes, 4096 envs, CUDA, three alternating rounds (host-bound; µs):

Write main this PR
write_joint_state_to_sim_index 61.6 57.9
write_joint_position_to_sim_index 59.1 55.0
write_root_link_pose_to_sim_index 71.3 78.8
write_root_link_pose_to_sim_mask 52.5 52.8
write_joint_state_to_sim_mask 42.6 33.6

The ids→mask launch adds about 5.5 µs to each _index write; root pose index writes are about 7.5 µs slower than on
main, and reset-heavy Cartpole, which makes four _index writes per reset, is 1.4% slower. Mask-based environment
resets (a later stage) move resets onto the _mask writers.

Testing

Targeted tests pass, run file by file: Newton manager abstraction, two backends, visualization state, articulation and
rigid object contracts (all backends), articulation, rigid object and collections, cable, joint coordinates, Newton
actuators, MDP events, lift environment config and Warp event capture safety.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added changelog fragments

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team infrastructure labels Oct 28, 2026
@StafaH
StafaH force-pushed the newton/redesign-2cii-tests-masks branch from 348a9ef to 2235731 Compare October 30, 2026 06:01
@StafaH StafaH mentioned this pull request Oct 30, 2026
4 tasks done
@StafaH
StafaH force-pushed the newton/redesign-2cii-tests-masks branch from 2235731 to b3f7106 Compare October 30, 2026 19:27
@StafaH
StafaH marked this pull request as ready for review November 2, 2026 19:53
@StafaH
StafaH requested a review from a team November 2, 2026 19:53
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes reach Newton asset writes and common joint-reset workflows.

The PR appears safe to merge, with a non-blocking fix recommended for collection writes retried after a shape error.

Findings

  1. P2 Retries can change extra objects ▶

Summary

The PR makes Newton reset and FK selection mask-only.

  • Newton reset calls select worlds and articulations with masks.
  • Newton asset writes turn selected IDs into masks before scheduling backend work.
  • Collection writes update only masked objects and flag their matching FK work.
  • Joint reset events write positions and velocities in one call.

One non-blocking issue remains: a failed collection mask write can leave a body selection behind and affect a later retry.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Asset state write] --> B{Selection}
  B -->|Indices| C[Flag scratch masks]
  B -->|Masks| D[Use supplied masks]
  C --> E[Schedule reset and FK]
  D --> E
  E --> F[Clear scratch selections]
  E --> G[Next forward or step]
  G --> H[Reset solver and run selected FK]
  H --> I[Clear pending flags]
Loading

Reviews (1) · Last reviewed commit: "Stub the joint-state writer in the joint..." · Reviewed by Greptile

Comment on lines +470 to +471
body_mask = self._resolve_body_mask(body_mask, body_ids)
self.assert_shape_and_dtype(body_poses, (self.num_instances, self.num_bodies), wp.transformf, "body_poses")

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.

P2 Retries can change extra objects

_resolve_body_mask() flags body_ids before the shape check, but _index_body_mask is cleared only after a successful write. If a caller catches a shape error for body 0 and retries with valid data for body 1, the next call writes both bodies.

Check the input before flagging the scratch mask, or clear it when the call fails. The same ordering appears in all four collection mask writers.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, the mask is flagged after the shape check.

@StafaH

StafaH commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@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 Nov 2, 2026

@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: Scope and over-engineering (2), API (1), Compatibility and deprecation (1), Style consistency (1). Other reviewed categories look good.

  • PR description: The body overstates graph capture because reset callers still use index writers; correct that claim and add benchmark commands, hardware, exact revisions, and warmup details to the supplied backend, workload, environment-count, and metric results.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: extend NewtonBackend, shared asset kernels, existing asset writers, MDP events, and Cartpole; collapse duplicated asset-local ID-to-mask helpers and collection cleanup branches, then keep mask flagging, authoritative writes, cache invalidation, and fused resets. No source modules were added. Scope is cohesive; no split recommended.
  • API: NewtonBackend.invalidate_fk permits articulation_ids with env_mask=None, then launches a kernel that dereferences the missing mask; require env_mask for scoped invalidation or preserve the previous flag-all fallback.
  • Compatibility and deprecation: Breaking changes: NewtonManager and NewtonBackend remove env_ids and reorder positional parameters without a functional bridge; retain old calls with targeted deprecation warnings, migration guidance, and transition coverage.
  • Implementation: Implementation looks good.
  • Style consistency: The new body COM kernel docstring incorrectly says it writes root link poses; describe the collection body link poses actually produced.
  • Test quality: Test quality looks good.

Significant concerns. Posted 5 inline findings.

Automated review; human maintainers own approval decisions.

def invalidate_fk(
self,
env_mask: wp.array | None = None,
env_ids: wp.array | None = None,

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.

🔴 Critical · Compatibility — Public invalidation APIs drop env_ids

invalidate_fk and invalidate_body_state remove env_ids and reorder positional parameters on both NewtonManager and NewtonBackend. Keep env_ids accepted with a DeprecationWarning and ids-to-mask translation for the prescribed removal window.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Intentional, marked Breaking.

if self.num_spatial_tendons > 0:
raise NotImplementedError("Spatial tendons are not supported yet.")

def _invalidate_fk_index(self, env_ids: wp.array | torch.Tensor) -> None:

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 · Scope Complexity — Duplicate ids-to-mask invalidation helpers

_invalidate_fk_index is byte-identical in RigidObject, has variants in CableObject and RigidObjectCollection, and duplicates _env_ids_to_mask. Extract one shared helper beside the shared kernels instead of four copies.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Shared mask_from_ids now.

This kernel writes body COM poses from the input array to the output buffers,
computes the corresponding link poses from the COM poses, and optionally updates
the corresponding state vectors, for each body in each environment.
Convert selected COM poses to authoritative root link poses. Derived COM

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 — Body COM docstring says root

set_body_com_pose_to_sim writes collection body link poses, but the new summary says "authoritative root link poses", copied from the root-pose kernel. Name the body abstraction it actually writes.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

self.data._reset_pose()
self._invalidate_fk_mask(env_mask, body_mask)
elif body_mask is self._index_body_mask:
body_mask.zero_()

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 · Scope Complexity — Scratch body-mask cleanup repeated per writer

The elif body_mask is self._index_body_mask: body_mask.zero_() branch is duplicated in all four mask writers; a future writer omitting it leaks flagged bodies. Give the launch/invalidate/cleanup tail one owner.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, _invalidate_fk_mask owns it.

self.world_mask[: self.model.world_count].fill_(True)
self.fk_mask.fill_(True)
return
wp.launch(

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 · Api — env_mask default cannot be launched

env_mask defaults to None but is dereferenced by the kernel whenever articulation_ids is given; that combination previously flagged every world. Make env_mask required here or restore the flag-all fallback.

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Restored, None flags everything.

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As a human this looks good to me!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure if we should default to the state variant of the writers. These should be deprecated by now?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess this was done to make things faster?

@StafaH StafaH Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, for speed. Reverted to pos + vel writers and deprecated write_joint_state_to_sim_index.

@StafaH

StafaH commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@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 Nov 2, 2026
@StafaH
StafaH merged commit 2d48d3c into isaac-sim:main Nov 2, 2026
71 of 95 checks passed
StafaH added a commit that referenced this pull request Nov 2, 2026
# Description

Part 2c-iii of the Newton manager redesign
([overview](#8218 (comment))).
Follows [2c-ii/N] #8870 (merged). Test-only.

## Tests

The 1.5k-line `test_newton_manager_abstraction.py` mixed solver configs,
builder preparation, the manager lifecycle
and the step. It is split by owner, and duplicated or restating tests
are removed:

| File | Covers |
|---|---|
| `physics/test_newton_solvers.py` | solver configs and the Isaac Lab
solvers: MJWarp, Kamino, MPM, VBD, builder schema, USD joint-property
precedence (no simulation) |
| `physics/test_newton_manager.py` | `NewtonCfg`, the manager lifecycle,
and the backend: step order, capture, collision decimation, model
changes, contacts, reset masks, independent backends, BVH refit |

- Simulation round-trips that only exercised one hook are now direct
unit tests: collision decimation, model-change
notification, `collision_cfg` rejection, MPM projection and history, VBD
BVH rebuild.
- Removed: restated capability flags, duplicate parametrizations (e.g.
both deterministic modes on MuJoCo CPU, both
sensor attributes, four graph-capture cases that covered two paths), and
a second schema-precedence test now merged
  into the real replication-path test.
- `test_two_backends.py` folds into the manager file; two asset tests
move to `assets/test_articulation.py`.
- The Newton warp-cache warm job lists the new file name.

Per-file `pytest` time on a warm Warp cache: 43.7 s → 32.3 s, 119 → 88
tests (plus 5 cases moved), 1.7k → 1.3k lines.

The manager file also covers 2c-ii's mask-only reset flags: environment
and articulation masks, a consumed mask
cleared as it is read, a caller mask left unchanged, and selections
accumulating in one backend only.

## Testing

`test_newton_manager.py`, `test_newton_solvers.py`, `test_vbd_core.py`
and `assets/test_articulation.py` pass, run file
by file. New unit tests fail under one-line mutations of the code they
guard.

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] My changes generate no new warnings
- [x] I have added changelog fragments
@StafaH StafaH mentioned this pull request Nov 4, 2026
6 tasks done
StafaH added a commit that referenced this pull request Nov 10, 2026
# Description

Part 4 of the Newton manager redesign
([overview](#8218 (comment))).
Builds on [2c-ii/N] #8870 (merged), which made the backend reset flags
mask-only. The env/MDP layer is [5/N] #8927.

Everything below the managers resets from a boolean device mask. A
masked reset changes only the selected
environments and does not synchronize the device, so [5/N] can reset on
the reset mask every step.

## Assets and scene

- `AssetBase.reset(env_ids=None, env_mask=None)` matches the sensor
signature on `main`. Every asset honors
`env_mask` (a `wp.bool` array of shape `(num_envs,)`), and it takes
precedence over `env_ids`.
- `InteractiveScene.reset(env_ids=None, env_mask=None)` passes both to
every asset and sensor.
- Fixed: on `main`, a reset with only `env_mask` reset the actuator
state of every environment (Newton, PhysX, OV
articulations), and the external wrenches of every environment (Newton
and PhysX rigid objects and collections).
- **Breaking:** `SurfaceGripper.reset` takes `env_ids` and `env_mask`
instead of `indices`.
- **Breaking:** `InteractiveSceneWarp` is removed. The base scene now
resets every entity from the mask, and the
  override passed indices to the sensors.

## Actuators

- `ActuatorBase.reset(env_ids=None, env_mask=None)`;
`ActuatorCollection.reset` forwards the mask to every group
  and to the backend-native actuators.
- `DelayedPDActuator` draws a delay for every environment and keeps the
selected ones; the actuator nets clear the
  masked history.
- `NewtonActuatorAdapter.reset(env_mask=...)` builds the per-DOF masks
of stateful actuators into preallocated
  arrays and skips stateless ones.
- Contrib `Thruster` and `Multirotor` resample and reset the masked
environments.

## Buffers and processors

- `DelayBuffer.reset` takes a boolean mask and redraws sampled lags with
`torch.where`.
- `TensorProcessor.reset`, `DigitalFilter`, `Integrator`, `NoiseModel`
and `NoiseModelWithAdditiveBias` take
  `env_mask`.
- Ray-caster drift resampling selects environments with the resolved
reset mask instead of `nonzero()`.

**Breaking:** custom subclasses of `AssetBase`, `ActuatorBase`,
`TensorProcessor` and `NoiseModel` must accept
`env_mask` and leave unselected environments unchanged.

## Testing

Targeted tests pass, run file by file: actuator collection and Newton
adapter (masked reset; the collection test
runs under `torch.cuda.set_sync_debug_mode("error")`), delay buffer,
tensor processors, noise, Newton
articulation, rigid object, cable, Newton actuators, Newton ray caster,
articulation and rigid object contracts
(`-k newton`), and the experimental frontend. Kit-only tests not run
locally: interactive scene, ray caster
sensor, sensor base, thruster, PhysX/OV assets.

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added changelog fragments
hujc7 added a commit that referenced this pull request Nov 13, 2026
…rs (#8821)

## Review Map

- A number is one feature and its letters are that feature's PRs, in
merge order; an arrow points from a PR to the PRs that build on it.
- A stacked PR's page shows the cumulative diff of its dependency chain;
the "Exact changes" link opens that PR's Files changed page on its own
changes (parent head to PR head). #6646's head merges `main` for one
conflict, so its link also shows `main`'s #8928.
- #8783 and #6607 are no longer part of the series.

| PR | Status | Depends on | Exact changes |
|---|---|---|---|
| 📌 #8821 Part 1a/8: shared id and mask helpers, mask writers without
host sync |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8821?label=)
| — | — |
| #8824 Part 1b/8: PhysX tendon mask setters through the masks |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8824?label=)
| 1a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8824/changes/84470f4c0c5dfe1905dd1b5d822f6faf50832d4d..2fbbcc5a98a91f34c129f1ce65b227201ec50f60)
|
| #6646 Part 2a/8: reset only the masked environments |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/6646?label=)
| 1a |
[link](https://github.com/isaac-sim/IsaacLab/pull/6646/changes/84470f4c0c5dfe1905dd1b5d822f6faf50832d4d..41ed0c0775175ad2f76db6bb9c31202d80e1519b)
|
| #8997 Part 2b/8: actuator networks reset by mask |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8997?label=)
| 2a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8997/changes/41ed0c0775175ad2f76db6bb9c31202d80e1519b..cb14223b1d957f7fd8ac232ea50605618ce53de3)
|
| #8856 Part 3a/8: env origins as a ProxyArray, `SceneEntityCfg` Warp
selections |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8856?label=)
| 2a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8856/changes/41ed0c0775175ad2f76db6bb9c31202d80e1519b..f8944ad680d2bb4b09b13d2adb4b740eafe7b363)
|
| #8228 Part 3b/8: ray caster camera frames as a ProxyArray, Rough
velocity tasks (re-cut not pushed yet) |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8228?label=)
| 3a | — |
| #8998 Part 4a/8: recording utilities, lazy buffers correct under
recording |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8998?label=)
| 2b, 3a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8998/changes/9d74ad2de08a152312833dbe3ad9260b02f683b0..0e2a77d842051fb3946feb988f2e14d010aac3fb)
|
| Parts 4b-4h/8: the Warp frontend on the stable managers (not opened) |
— | 4a | — |
| Part 5/8: OVPhysX on the Warp frontend (not opened) | — | 4h | — |
| Part 6/8: Warp noise model with an additive bias (not opened) | — | 4h
| — |
| #7012 Part 7/8: `--video` on the Warp frontend (re-cut not pushed yet)
|
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/7012?label=)
| 4h | — |
| Part 8a/8: Direct Warp environment step (not opened) | — | 5, 7 | — |
| #6582 Part 8b/8: Shadow Hand Warp twin, Allegro twin fix (re-cut not
pushed yet) |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/6582?label=)
| 8a | — |
| #8861 [DO-NOT-MERGE] all parts combined for review |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8861?label=)
| ALL | — |

```mermaid
---
config:
  look: neo
  flowchart:
    curve: basis
---
flowchart TD
  A1("📌 <b>#8821</b> · 1a<br/>id/mask helpers")
  B1("<b>#8824</b> · 1b<br/>PhysX tendon masks")
  A2("<b>#6646</b> · 2a<br/>masked resets")
  B2("<b>#8997</b> · 2b<br/>actuator net reset")
  A3("<b>#8856</b> · 3a<br/>env origins, Warp selections")
  B3("<b>#8228</b> · 3b<br/>Rough velocity")
  A4("<b>#8998</b> · 4a<br/>recording utilities")
  P4("4b-4h<br/>Warp frontend on the stable managers")
  P5("5<br/>OVPhysX")
  P6("6<br/>noise model")
  P7("<b>#7012</b> · 7<br/>--video")
  A8("8a<br/>Direct env step")
  B8("<b>#6582</b> · 8b<br/>Shadow twin")
  A1 --> B1
  A1 --> A2
  A2 --> B2
  A2 --> A3
  A3 --> B3
  B2 --> A4
  A3 --> A4
  A4 --> P4
  P4 --> P5
  P4 --> P6
  P4 --> P7
  P5 --> A8
  P7 --> A8
  A8 --> B8
  style A1 stroke-width:3px
```

## Summary

Id and mask selections in the Newton, OVPhysX and PhysX assets, the
camera and the wrench composer resolve through main's `resolve_1d_mask`
and a new `resolve_ids`, both in `isaaclab.utils.warp.memory`, instead
of hand-written copies (−907 / +410 source lines). Newton mask writers
that converted masks to ids now write through the mask: the fixed-tendon
setters are 2.7-5.4x faster.

# Description

**Update (2026-11-12):** a Newton model-property write recorded into a
graph capture now refreshes the solver on every replay, not only the
first (`NewtonManager.add_model_change` records the refresh inside a
capture); merged main `616f517707d`.

**Update (2026-11-10):** a mask longer than its destination raises
instead of being written past the end (the Newton fixed-tendon writer
launches over the mask), and the PhysX and rigid-object selection
docstrings say ids come first, as `resolve_ids` does. The
`all_ids=slice(None)` form of `resolve_ids` leaves this PR for the part
that first uses it.

## 1. Changes

1. **Helpers** (`isaaclab/utils/warp/memory.py`, next to main's
`resolve_1d_mask`): new `resolve_ids` (ids or a boolean mask → ids on
the device of the caller's all-ids array; callers that need contiguous
int32 ids pass the result through main's `resolve_1d_indices`, as main's
indexed writers do). `resolve_1d_mask` takes `scratch_mask` as optional
again: a mask passed without one is used as given when it is not longer
than the destination, so a shorter mask writes only the rows it covers,
as main's Newton mask writers do; a longer mask raises with or without a
scratch mask. New `write_2d_with_mask` writes a scalar or a 2-D array
into a buffer where an env mask and an item mask are both true,
launching main's masked copy and fill kernels over the mask lengths on
the output's device (torch vector data with strided components goes
through scalar views, without a copy); the Newton articulation and
collection mask writers use it.
2. **All assets, `Camera` and `WrenchComposer` use them**, so every
selection accepts the same inputs: integer sequences, negative-step
slices, ids on another device. A `ProxyArray` raises `TypeError`.
3. **Newton writes without a host sync:** the fixed-tendon mask setters
write through the masks; joint-coordinate writes reuse a scratch mask.
The `RigidObjectCollection` mask writers (main's, since #8870) launch
over the mask lengths like the other Newton mask writers, so a mask
shorter than the asset dimension writes only the rows it covers.
4. **Fixes:** the deformable `write_nodal_*_to_sim_mask` writers raised
whenever `env_mask` was given (OVPhysX, PhysX); the Newton fixed-tendon
mask setters accepted data of the wrong shape; a Newton model-property
write recorded into a graph capture (such as the fixed-tendon mask
writer, now capturable) left the solver on the first replay's values,
because `NewtonManager.add_model_change` only queued the refresh on the
host.

## 2. Performance (MEASURED)

8gpu L40, Newton contract mocks, 4096 envs, host µs per call including
the GPU wait, main `299af193136` against this PR
at `b75b5a81585` (same source as the head but for main's #8971), 3
alternated runs per arm.

| Write | main | this PR | |
|---|---|---|---|
| Fixed-tendon stiffness mask, half envs, 2 tendons | 455 | 84 | 5.4x |
| Fixed-tendon position limit mask, all | 216 | 80 | 2.7x |
| Fixed-tendon position limit mask, half envs, 2 tendons | 393 | 84 |
4.7x |
| `write_fixed_tendon_properties_to_sim_mask`, all | 373 | 124 | 3.0x |
| `write_fixed_tendon_properties_to_sim_mask`, half envs, 2 tendons |
573 | 127 | 4.5x |
| Joint position index write, half envs | 290 | 249 | 1.17x |
| Joint state index write, half envs | 321 | 281 | 1.14x |
| Joint position mask write; collection pose and velocity mask writes |
| | within ±1% |

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Screenshots

Not applicable.

## Checklist

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab --format`
- [ ] 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](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md)
to any test changes
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants