Repository navigation
Fix OVPhysX re-reading static joint and body properties every step - #7800
Conversation
OVPhysX joint gains, limits, armature, friction and body mass/inertia are CPU-only bindings, and their public getters were gated on the simulation timestamp, so every physics step that touched them paid a blocking host round-trip whose cost scales linearly with the environment count. The native Newton actuator path reads stiffness, damping and effort limits on every physics step for its telemetry sync, which made AnymalD on OVPhysX several times slower than the Isaac Lab actuator path once #7713 enabled that path by default (5.4x at 16384 envs on an L40; 1.6x at 1024 envs on a laptop, with the three reads accounting for the whole gap). Read these static properties once after explicit invalidation instead. The write_*/set_* setters already update the buffers in place before pushing to the wheel, so no per-step refresh is needed; body state buffers keep the per-step refresh. With the change the native actuator path on OVPhysX matches the Isaac Lab path at 1024 envs (14 ms vs 14 ms per env step).
|
There was a problem hiding this comment.
Isaac Lab Review Bot
The change consistently applies the existing static-binding cache policy to OVPhysX joint properties and body mass/inertia, avoiding simulation-step-triggered rereads while preserving per-step refreshes for dynamic body state. The focused regression test covers identity ordering, reordered joints, explicit invalidation, and dynamic-state refresh behavior.
- Design and architecture: The static-versus-dynamic distinction remains contained within the OVPhysX articulation data layer through the existing
_read_static_binding_into_bufabstraction and a keyword-only flag on a private body-buffer helper. Limiting this change to CPU-backed joint and body properties while leaving tendon properties unchanged is a proportionate scope choice. - API: Public property signatures, return types, shapes, and units are unchanged. The helper parameter is private, and the package includes an appropriately scoped changelog fragment describing the user-visible performance fix.
- Implementation: The identity-order and reordered-buffer paths both use the static read gate where intended, while reordered paths continue to gather from backend order and propagate timestamps to public buffers. Dynamic pose and velocity paths retain simulation-timestamp refreshes. The principal maintenance dependency is that explicit invalidation and setters continue to keep public and backend staging buffers coherent, matching the caching contract already used elsewhere in this class.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
|
run-ci |
marcodiiga
left a comment
There was a problem hiding this comment.
The static-property read optimization passes the three focused cache/ordering tests, and the new regression test fails against the parent implementation as expected. I found one additional cache-invalidation regression in a runtime readback check: COM orientation writes leave the newly static inertia cache stale. Details inline.
| """ | ||
| self._refresh_reordered_body_buffer( | ||
| self._body_inertia, self._body_inertia_backend, TT.BODY_INERTIA, component_count=9 | ||
| self._body_inertia, self._body_inertia_backend, TT.BODY_INERTIA, component_count=9, static=True |
There was a problem hiding this comment.
[P2] Invalidate inertia caches after COM orientation writes
body_inertia can change through set_coms_index() / set_coms_mask(), not only through set_inertias_*(): rotating the COM frame changes the inertia tensor returned by BODY_INERTIA for a body with unequal principal moments. _set_coms() calls _reset_body_com_pose_b_dependents(), but that invalidates neither _body_inertia nor _body_inertia_backend. With static=True, subsequent simulation steps no longer recover the correct value.
Reproduced with ovphysx 0.5.11 on CPU: set inertia to diag(1, 2, 3), prime data.body_inertia, rotate the COM 90 degrees about Z through set_coms_index(), then step and update. The direct BODY_INERTIA read returns approximately diag(2, 1, 3), while data.body_inertia still returns diag(1, 2, 3). The parent getter returns the correct value after the same step; explicitly invalidating the inertia cache also restores the correct readback.
Please include both inertia buffers in the COM-write invalidation path and extend the COM-cache regression test to cover a rotated COM with unequal principal moments, including non-identity body ordering.
|
run-ci |
Description
Fixes the AnymalD / OVPhysX env-step regression introduced when #7713 made the native Newton actuator path the default (perf team repro: 16384 envs, 47 → 256 ms per env step, GPU utilization 65% → 12%; bisected to
cdb244d1).Root cause.
PhysxActuatorRuntime._run_native_actuator_kernelslaunchessync_torque_telemetrywithdata.joint_stiffness,data.joint_dampinganddata.joint_effort_limitsevery physics step. On OVPhysX those are CPU-only bindings whose getters were gated on the simulation timestamp, so each access was a blockingTensorBinding.readinto pinned host staging plus an H2D copy — three host round-trips per physics step, re-fired every step becauseupdate()bumps the timestamp, with cost linear in the environment count (measured 0.35 ms at 256 envs, 1.07 ms at 1024; extrapolates to ~15 ms per physics step at 16384). PhysX returns cached views and the Isaac Lab actuator path only reads gains for implicit actuators, which is why only OVPhysX × native regressed.The LSTM itself is on the GPU throughout (
DriveNeuralLSTMreportswarp_device=cuda:0 torch_device=cuda:0); the regression is host-side.Fix. Joint properties (gains, limits, armature, friction) and body mass/inertia are static under stepping, and their
write_*/set_*setters already update the data buffers in place before pushing to the wheel. They are now read through the existing_read_static_binding_into_bufgate — once after explicit invalidation — instead of once per step. Body state buffers (poses, velocities, accelerations) keep the per-step refresh. Tendon properties are left unchanged (GPU-resident; separate writers) and can follow in a later PR.Measured (laptop RTX 5000 Ada,
isaaclab benchmark runtime,Isaac-Velocity-Flat-AnymalD,physics=ovphysx, 1024 envs, 100 steps):Regression test
test_static_property_reads_are_not_invalidated_by_simulation_stepsasserts one binding read across several steps for joint and body properties, one more after explicit invalidation, per-step refresh for state buffers, and the joint-ordering gather path. It fails ondevelop(assert 3 == 1) and passes with this change.Fixes # (perf team regression report; no issue filed yet)
Type of change
Release backport
developChecklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there