Skip to content

Articulation Reordering Part 9: Cache read launches#6479

Draft
AntoineRichard wants to merge 26 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/articulation-reordering-p9
Draft

Articulation Reordering Part 9: Cache read launches#6479
AntoineRichard wants to merge 26 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/articulation-reordering-p9

Conversation

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Description

Caches recorded Warp commands for articulation ordering read kernels in the PhysX and Newton backends. This avoids repeated Warp launch setup while preserving CPU behavior and Newton CUDA graph capture. Cached commands are discarded when articulation data is rebound so their array arguments cannot become stale.

This is stacked after #6341.

Type of change

  • New feature (non-breaking change which adds functionality)

Validation

  • ./isaaclab.sh -f
  • Added focused PhysX coverage for command reuse and reset invalidation.
  • Added focused Newton coverage for command reuse, reset invalidation, and graph-capture fallback.
  • Performance measurements are documented in the articulation ordering investigation report.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh -f
  • My changes generate no new warnings
  • I have added tests that cover the feature
  • I have added changelog fragments for isaaclab_physx and isaaclab_newton
  • My name already exists in CONTRIBUTORS.md

Documentation screenshots are not applicable.

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Jul 13, 2026
@AntoineRichard
AntoineRichard force-pushed the antoiner/articulation-reordering-p9 branch 5 times, most recently from a6f34ae to bad26cc Compare July 15, 2026 09:27
Move the articulation interface test factories into a shared utility
module mirroring the rigid object extraction, with ordering-aware
construction hooks used by the later cross-backend ordering tests.
Part 5 of the articulation reordering series.
The ordering core deleted the _cache_ordering_maps guard machinery;
mock articulation factories now configure backend staging directly,
matching the backend initialization paths.
@AntoineRichard
AntoineRichard force-pushed the antoiner/articulation-reordering-p9 branch from 20c1277 to fea9ba3 Compare July 17, 2026 16:43
Extract common test bootstrapping and ordering assertions so backend tests share one implementation. Guard optional PhysX setup and make unsupported mock ordering explicit.
Apply repository formatting and import ordering after the new helper files became tracked.
@AntoineRichard
AntoineRichard force-pushed the antoiner/articulation-reordering-p9 branch from fea9ba3 to dc61d08 Compare July 17, 2026 17:12
Cover the isaaclab_newton and isaaclab_physx test changes so the changelog gate recognizes every package touched by P5.
@AntoineRichard
AntoineRichard force-pushed the antoiner/articulation-reordering-p9 branch from dc61d08 to 685637a Compare July 20, 2026 07:43
Match the established rigid-object test helper conventions for the mock backend label and private test access. Add a regression check that keeps the three interface utilities consistent.
Translate between public and backend order on the OVPhysX read and
write paths: fused user-and-backend writes with persistent target
staging separated from transient applied-torque scratch, forward
kinematics aware body state refresh, and a fused ordered joint
acceleration kernel. Part 6 of the articulation reordering series.
The ordering core rework single-homed the joint and body ordering maps
on ArticulationData and removed the mirrored `_has_*` flags and
`_*_user_to_backend` maps, the `_cache_ordering_maps` machinery, the
`ArticulationNameMap` identity/name fields, and the dtype-suffixed
write-kernel overloads.

Repoint the OVPhysX articulation and data classes to the new contracts:

- Read ordering presence via `data.joint_ordering` / `data.body_ordering`
  is-not-None checks; conditional sites dereference the map directly,
  while always-launch sites use the new `_*_user_to_backend_map()`
  helpers so publish, wrench, and telemetry gathers keep a valid map.
- Configure backend staging through `_ordering_configure_backend_staging`
  and, now that `_install_ordering_flags` is gone, recover the previous
  per-axis ordering from the persistent backend staging buffers so a
  cleared ordering still releases its buffers on rebind.
- Replace the dtype-suffixed overload launches with the
  `write_*_user_to_backend_*` launch wrappers, passing the dtype the old
  suffix implied and dropping the explicit launch dim.

Adapt the OVPhysX asset tests to assert through the single-homed ordering
maps, since a non-None map now always denotes a real permutation.
Add the shared interface test suite that exercises ordering allocation,
write parity, partial writes, and property reordering uniformly across
the PhysX, OVPhysX, and Newton backends through their mock views. Lands
after all three backend parts because present-but-unwired backends
error rather than skip. Part 7 of the articulation reordering series.
The ordering core now keeps a single source of truth for public
ordering. Identity orderings resolve to None rather than an identity
map, so a non-None map always denotes a real permutation. The mirror
flags (_has_joint_ordering / _has_body_ordering on both the asset and
data), the _cache_ordering_maps / _ordering_maps_cached guard, and the
data _install_ordering_flags helper were all deleted; backends now stage
through _ordering_configure_backend_staging().

Adapt the mocked cross-backend interface tests to match:

- Re-stage installed orderings via _ordering_configure_backend_staging
  instead of the removed _cache_ordering_maps guard dance.
- Delete the reinvocation-guard test; with one home there is no mirror
  state left to protect.
- Assert ordering presence as (ordering is not None) against the single
  source instead of the removed mirror flags, keeping one dedicated
  assert that the asset property delegates to data.
- Drop the now-redundant not-is_identity assert halves, since a non-None
  map already guarantees a permutation.
Keep the backend import-semantics regression with the shared interface utility tests introduced in P5.
Route event terms through the asset's public index mapping, fix
consumers that mixed public-order indices with backend-order view
arrays, apply the factory inertia offsets through the asset API, and
document the feature: the sim-to-sim transfer guide, the API reference
entries, and the changelog fragments for the touched task packages.
Part 8 of the articulation reordering series.
A 10-seed paired benchmark measured the feature at 1.06-1.55% lower
native training FPS than develop, attributed to write_data_to_sim
launching the joint-target gather unconditionally with an identity
map. This reverses the unification from 470b4b7 on the strength
of that measurement: both actuator branches now branch once in Python
and take develop's exact direct-assign path when no joint ordering is
configured, and the external-wrench path selects the reorder-free
shared kernel when body ordering is identity instead of threading a
flag through the ordered kernel every step.

Also fuse the post-step publish hook from four reorder launches into
two: one kernel gathers joint position and velocity together, one
gathers body pose and velocity together.
The ordering rework removed six public kernels without a prior
deprecation release: write_joint_state_data and write_joint_vel_data
on PhysX, and the four write_joint_state_data and write_joint_vel_data
index/mask variants on Newton. No ordering-aware replacement is
signature compatible, so each is restored verbatim from develop as a
deprecated shim for one release, with the replacement APIs named in
the docstrings and changelog. Raw warp kernels cannot emit a runtime
warning without breaking wp.launch, so the deprecation is documented
rather than raised.
Resolution errors told users to configure env.scene.robot, which is
wrong for direct-workflow tasks. Point at the ArticulationCfg fields
instead, which are layout independent.
Drop the two map micro-tests that duplicate the gather-branch coverage
of the permutation tests in the same file and the name-map construction
coverage in the core ordering suite. The four remaining map tests are
the only coverage of the public map_body_ids_to_backend and
map_joint_ids_to_backend application paths and stay.
Replace the 108-case partial-write cartesian with a deterministic
12-row all-pairs covering array, verified to cover every parameter
pair and seeded on all backend, ordering, and selector triples so
each backend still drives both writer kinds under both orderings.
Drop the identity value from the shadow-allocation axes, covered by
the per-backend identity-matches-none tests, and remove the internal
buffer-shape assertions whose behavioral observables are covered by
the shared-backend-read and allocation tests. 233 collected cases
become 131 with no loss of distinct-branch coverage.
Application coverage of map_body_ids_to_backend and
map_joint_ids_to_backend now lives beside the name-map construction
tests in the core ordering suite.
In the ordered Lab-actuator branch of write_data_to_sim, the fused target
reorder passed the effort buffer as both the effort output (index 0) and the
unused joint-act output (index 3). Because write_joint_act is off, index 3 is
never written, but the alias creates a false output dependency on the effort
buffer under CUDA graph capture. Point index 3 at the dedicated
_sim_bind_joint_act buffer, matching the newton-actuator branch.
sync_torque_telemetry mixed the user-space loop index j with the
backend-space backend_j. Rename the user-space index to user_j so each
index only subscripts arrays of its own order: user-order targets, gains,
limits, and outputs at [i, user_j]; backend-order live state and sim-bound
effort buffers at [i, backend_j]. The kernel signature is unchanged, so
call sites are unaffected.
Document that register_post_step_callback's hook fires exactly once per
step() call, reflecting state after all decimation iterations and their
solver substeps complete -- not once per substep or per decimation iteration.
The remaining public-order presence re-derivations in write_data_to_sim
tested the raw ordering map (self.data.joint_ordering is None). Replace
them with the has_joint_ordering property so presence checks read
uniformly across the ordering paths. Genuine map-object uses and
articulation-level ordering reads are left untouched. No behavior change.
Record stable PhysX ordering reads once and replay their Warp commands. Avoid nested recording during Newton CUDA graph capture, and discard cached commands when articulations reset or ordering buffers are rebound.
Cache stable PhysX and Newton articulation read kernels so repeated property refreshes avoid Python and Warp launch setup. Preserve eager execution for dynamic scalar inputs and invalidate commands only when their captured buffers can change.
Warp returns no recorded command for zero-sized launch dimensions. Treat that result as a completed no-op so fixed and zero-DOF articulations can initialize with read caching enabled.
@AntoineRichard
AntoineRichard force-pushed the antoiner/articulation-reordering-p9 branch from 685637a to 7ddbc40 Compare July 20, 2026 08:01
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 isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant