Repository navigation
[Warp] Part 1a/8: Resolve id and mask selections through shared helpers - #8821
Conversation
|
run-ci |
|
run-ci |
…pers resolve_ids resolves ids or a boolean mask to ids on a device, as resolve_1d_mask does to a mask. resolve_1d_mask takes an optional scratch mask, copies a Warp mask on another device, and accepts a boolean torch mask on its device inside a graph capture. The experimental package now re-exports it instead of keeping a copy.
…red helpers SensorBase, Camera and WrenchComposer resolve env_ids, env_mask and body_ids through resolve_ids and resolve_1d_mask instead of their own copies. The test doubles that build these objects without their initializer get the env masks a real sensor creates.
The nodal mask writers of BaseDeformableObject, which the OVPhysX deformable object inherits, and of the PhysX deformable object called wp.nonzero on a Warp array, which raised a RuntimeError. They now resolve the mask to ids with resolve_ids and call the index writers.
…sk writers through masks The Newton assets resolve ids and masks through resolve_ids and resolve_1d_mask. The RigidObjectCollection mask writers and the fixed-tendon mask setters write through the masks instead of converting them to ids, which waited for the GPU on every call; the joint-coordinate writes reuse a scratch mask; one generic masked 2-D write kernel replaces two copies.
The OVPhysX assets resolve env, body, joint and tendon selections through resolve_ids and resolve_1d_mask instead of their own copies.
The PhysX assets resolve env, body, joint and tendon selections through resolve_ids and resolve_1d_mask instead of their own copies. The sensor test doubles get the env masks a real sensor creates.
|
run-ci |
87c34b8 to
3d3661f
Compare
…-native isaac-sim#8821 owns the Newton mask writers: the collection write_body_*_to_sim_mask methods, the fixed-tendon mask setters and their shared masked-copy kernel. This branch takes its version of those and keeps only the reset-mask plumbing and the tendon-target capture fix in the shared files.
|
run-ci |
|
run-ci |
…l_ids to its first user resolve_1d_mask now rejects a boolean mask longer than all_mask with or without a scratch_mask, so the Newton fixed-tendon writer, which launches over the mask length, can no longer write past its rows; shorter masks stay allowed without a scratch mask. resolve_ids drops the all_ids=slice(None) form, which nothing in this part calls. The PhysX selection helpers and resolve_1d_mask describe the behaviour they have.
|
run-ci |
| # the solver keeps its own copy of the tendon properties and only re-reads them when notified | ||
| self._backend_manager.add_model_change(ModelFlags.TENDON_PROPERTIES) |
There was a problem hiding this comment.
Record the solver refresh on every replay. add_model_change() only updates a Python set during capture. The first eager step flushes and clears it.
Reproduced with pinned Newton and physics steps between replays: replay1 updates bound/solver stiffness to12; replay2 updates the bound value to25 but the MuJoCo solver stays at12. Capturing the owning refresh fixes it.
Make this notification replay-aware. Add two write-graph replays separated by physics steps; check solver.mjw_model, not only the bound array.
There was a problem hiding this comment.
Fixed in e6e178c: inside a graph capture, add_model_change now records the solver refresh for that change, so every replay applies it. test_fixed_tendon_mask_writer_reaches_solver_on_every_replay replays the write twice with physics steps in between and checks solver.mjw_model (fails on the previous head: 12 vs 34).
add_model_change only queued the change on the host, so a write recorded into a graph capture refreshed the solver once: the first step after the capture flushed the queue and later replays left the solver on the old values. Inside a capture it now records the refresh of that change, and changes queued before the capture stay queued for the next step.
|
run-ci |
…ks (#8824) ## 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). - #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 |  | — | — | | 📌 #8824 Part 1b/8: PhysX tendon mask setters through the masks |  | 1a | — | | #8997 Part 2b/8: actuator networks reset by mask |  | 1a | — | | #8856 Part 3a/8: env origins as a ProxyArray, `SceneEntityCfg` Warp selections |  | 2b | [link](https://github.com/isaac-sim/IsaacLab/pull/8856/changes/1a3ef00daac107596034140a6a36633fec2a5f65..401b0191f04f6480c1ed03deffdd966f9f469009) | | #8228 Part 3b/8: ray caster camera frames as a ProxyArray, Rough velocity tasks (re-cut not pushed yet) |  | 3a | — | | #8998 Part 4a/8: recording utilities, lazy buffers correct under recording |  | 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) |  | 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) |  | 8a | — | | #8861 [DO-NOT-MERGE] all parts combined for review |  | 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") 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 --> B2 B2 --> A3 A3 --> B3 A3 --> A4 A4 --> P4 P4 --> P5 P4 --> P6 P4 --> P7 P5 --> A8 P7 --> A8 A8 --> B8 style B1 stroke-width:3px ``` ## Summary The 11 PhysX tendon `set_*_mask` setters no longer turn their masks into ids with a GPU→host wait: they fill the tendon buffers through the masks, 83-91 → 18.5 µs per call (5x) with half the environments selected. # Description The setters only fill Isaac Lab's tendon buffers; the push to PhysX stays index based in `write_*_tendon_properties_to_sim_*`. Each setter now resolves its masks, checks the shape and launches a masked kernel, as the Newton setters do. - MEASURED (desk RTX PRO 6000, PhysX, 4096 envs, half selected): 5x for stiffness, damping, limit stiffness, rest length and offset; 4.5x for position limit and target; unchanged with all environments selected. - No task calls these setters per step, so task FPS does not change. ## Type of change - 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
Summary
Id and mask selections in the Newton, OVPhysX and PhysX assets, the camera and the wrench composer resolve through main's
resolve_1d_maskand a newresolve_ids, both inisaaclab.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_changerecords the refresh inside a capture); merged main616f517707d.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_idsdoes. Theall_ids=slice(None)form ofresolve_idsleaves this PR for the part that first uses it.1. Changes
isaaclab/utils/warp/memory.py, next to main'sresolve_1d_mask): newresolve_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'sresolve_1d_indices, as main's indexed writers do).resolve_1d_masktakesscratch_maskas 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. Newwrite_2d_with_maskwrites 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.CameraandWrenchComposeruse them, so every selection accepts the same inputs: integer sequences, negative-step slices, ids on another device. AProxyArrayraisesTypeError.RigidObjectCollectionmask writers (main's, since [Newton] Redesign Newton Manager [2c-ii/N] #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.write_nodal_*_to_sim_maskwriters raised wheneverenv_maskwas 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, becauseNewtonManager.add_model_changeonly 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
299af193136against this PRat
b75b5a81585(same source as the head but for main's #8971), 3 alternated runs per arm.write_fixed_tendon_properties_to_sim_mask, allwrite_fixed_tendon_properties_to_sim_mask, half envs, 2 tendonsType of change
Screenshots
Not applicable.
Checklist
Docker and GPU tests run on demand. Push the commits you want tested, then
comment
run-cion the pull request.pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there