Repository navigation
Fix stale same-step RTX captures with PhysX-owned pose writes - #7138
StriverAlex wants to merge 1 commit into
Conversation
Greptile SummaryThis PR adds a step-stamped PhysX tensor-pose synchronization barrier so same-step pose writes are propagated before the next Kit/RTX frame without adding work to normal physics or clean rendering paths.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; both previously reported stale-frame paths now check pending backend work and perform synchronization before producing or sampling the next Kit frame. Important Files Changed
Sequence DiagramsequenceDiagram
participant Writer as Tensor pose writer
participant PhysX as PhysxManager
participant Owner as Renderer / KitVisualizer
participant Fabric as Fabric
participant Kit as Kit app
Writer->>PhysX: notify_tensor_pose_write()
PhysX->>PhysX: Record current public-step token
Owner->>PhysX: has_pending_kit_app_update()
PhysX-->>Owner: true
Owner->>PhysX: before_kit_app_update()
PhysX->>PhysX: update_simulation()
PhysX-->>Owner: requires re-forward
Owner->>Fabric: forward()
Owner->>Kit: app.update()
Kit-->>Owner: RTX frame with updated pose
Reviews (3): Last reviewed commit: "Keep post-pump pose writes visible to Ki..." | Re-trigger Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Reviewed the step-stamped PhysX tensor-pose write barrier, including all six writer notification paths, token coalescing and lifecycle, and consumption at Kit/RTX frame boundaries. The proposed concern that update_simulation(dt, 0.0) advances physics is not established by the patch: the public step count remains unchanged, and native callback emission alone does not demonstrate simulation advancement or rendered/headless divergence.
- Design and architecture: The backend-specific synchronization obligation remains private to
PhysxManager, while the additive backend-neutral hook lets frame owners request synchronization without burdening normal physics steps or clean rendering paths. The renderer utility and Kit visualizer both consume the hook at an actual app-update boundary. - API:
PhysicsManager.before_kit_app_update() -> boolis an additive, documented default-no-op API. Both consumers honor its boolean re-forward contract, existing tensor writer signatures remain unchanged, and package changelog coverage is present. - Implementation: The six PhysX tensor pose implementations notify only after their native transform write, writes coalesce by public physics-step epoch, stale tokens are dropped after a real step, failed synchronization is requeued, and lifecycle resets clear pending state. Kit playback state is restored with
try/finally. Native pre/post callback emission during the synchronization is an observable tradeoff covered by tests, but the supplied finding does not establish that it advances simulation state or identify a broken callback consumer; using zero elapsed time is likewise not shown to preserve the required propagation.
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.
pbarejko
left a comment
There was a problem hiding this comment.
There are a few things I don’t like about this PR:
-
Kit-specific concepts have leaked into the backend-neutral PhysicsManager interface. Methods such as
before_kit_app_update()andhas_pending_kit_app_update()belong to the concrete PhysX/Kit integration, not the common physics contract. I thinkPhysxManager.forward()should conditionally perform the required synchronization and hide this complexity from its callers. -
The current API requires callers to understand the synchronization sequence: check for pending work, call
before_kit_app_update(),conditionally callforward(), and finally update Kit. This leaks implementation details and is fragile because every frame-producing caller must reproduce the sequence correctly. -
The pairing of
self.root_view.set_transforms(...)with a separatenotify_tensor_pose_write()call suggests a missing abstraction. Correctness currently depends on every existing and future writer remembering to issue the notification after a successful mutation. These operations should be coupled by construction, for example:
class PhysxArticulationView:
def set_root_transforms(self, transforms, indices):
self._native_view.set_root_transforms(transforms, indices)
self._manager.mark_render_state_dirty()Ideally, callers should perform a single mutation through the PhysX abstraction. The abstraction should automatically track whether synchronization is required, and PhysxManager.forward() should consume that state. Neither asset writers nor Kit frame owners should need to understand or maintain this synchronization protocol.
|
@StriverAlex please respond to the PhysX ownership review and update the design. Dirty tracking and synchronization should live behind the PhysX view/manager, without caller-managed Kit sequencing. Rebase and restore CI so we can finish this PR. |
Pair successful pose and joint-position mutations with invalidation inside PhysxManager, preserving native views and main's deferred publication path. Reuse a successfully rendered Fabric revision only while it is current. Constraint: Keep PhysicsManager and PhysxManager forward/step/pre_render unchanged. Rejected: Caller-managed Kit hooks and update_simulation barriers | Leak ownership and add steady-state synchronization cost. Scope-risk: moderate Confidence: high Directive: Invalidate only after successful native writes; do not wrap or replace native tensor views. Tested: 78 unit checks; 20 native-runtime checks; CUDA/RTX negative control; Kit and quiet main/candidate/main synchronized benchmarks; full pre-commit. Not-tested: Full repository suite and multi-GPU matrix; remote Docker CI follows local performance gates.
79be514 to
497a3d2
Compare
|
Addressed the PhysX ownership review in 497a3d2, rebased onto main at 3e7e613. Successful pose/joint-position writes and invalidation are now paired inside PhysxManager. Native view identity and main's deferred publication are preserved; PhysicsManager and PhysxManager.forward/step/pre_render are unchanged. The old caller-managed Kit hooks and native synchronization barrier are gone. The remaining reproduced bug on main is same-step frame reuse, rather than its already-supported reset publication. Local gates passed before requesting CI: 78 unit checks plus 20 native-runtime checks, a real CUDA/RTX negative control (main fails the same-step silhouette check at IoU=0.000; candidate passes), and full pre-commit. The 20 native-runtime checks include 9 bookkeeping checks with native boundaries mocked, as detailed in the PR description. For synchronized 4096-environment Cartpole A/B/A, Kit is -0.0669% versus the endpoint mean. Quiet's first 20k triplet was borderline at +0.9779%, so it was retained and followed by a predeclared 50k confirmation (-0.9004%); pooling both quiet triplets gives -0.3660%. The description includes all measurements, the interrupted baseline/retry, commands, thresholds, and verification limits. No reproducible slowdown above the preselected 1% gate was observed in these workloads; this is not an all-task or multi-GPU guarantee. Ready for re-review. Requesting remote CI only after these local functional, performance, and independent evidence gates passed. |
|
run-ci |
Description
Reworks #7138 onto the pinned
mainsnapshot3e7e6137089d1db8823f3011941ab1ee73cc9954, addressing the PhysX ownership review. Follow-up to #6661; related to #6394.Current main already publishes PhysX state through its scene-data backend. The remaining reproduced bug is frame reuse: a pose written after an RTX/Kit frame has been pumped can be hidden by same-step capture deduplication. This revision fixes that missing behavior without reinstating the old native synchronization barrier.
Ownership and implementation
root_viewobjects retain their identity and type. No view proxy, conversion, immediate FK, or additional native barrier is introduced. Direct raw native view writes retain main's explicit invalidation/forward contract.PhysicsManager,PhysxManager.forward(),step(),pre_render(), and the generic RenderContext are unchanged from main. Existing PhysX publication owns deferred FK and native-to-Fabric synchronization.pending -> before_kit_app_update -> forward -> Kit updatesequence or generic Kit hooks remain.Reviewer requirement mapping
For the ownership review and the follow-up:
forward()/pre_render()/ scene-data backend paths. Reusing that implementation avoids another synchronization protocol or barrier.Regression validation
On the locked main stack: Python 3.12, Isaac Sim pip 6.2.0.0, Torch 2.11.0+cu130, Warp 1.17.0, and main's exact Newton revision
3f428bf1a7183d3d9a10cc17241e8a9eac3841eb.0.000, required>0.9. The textured-frame case passes on main.git diff --checkpassed.Performance: main / candidate / main
Used the unmodified upstream
isaaclab benchmark runtimeevaluator,Isaac-Cartpole-Direct, explicitphysics=isaacsim_physx, 4096 environments, seed 42,--measure_sync_step, and schema output. All processes ran sequentially using the same interpreter/runtime/GPU. Production source paths and the candidate diff hash were checked for each run. Online extension resolution was disabled before sampling; no system governor or clock settings were changed.Mean synchronized environment-step latency (lower is better):
Kit B differs from the endpoints by -0.2041% / +0.0707%; the old +11% rendered-workload regression was not observed. The first quiet triplet was borderline: B was +1.0077% / +0.9481% versus its two stable baselines. This was not dismissed as noise or used alone to clear CI.
Before collecting confirmation data, all three quiet samples were extended identically to 5000 warmup / 50000 measured steps, retaining the first triplet. Confirmation B is -0.6792% / -1.1207% versus the two endpoints. Pooling both final-base quiet triplets by measured step count gives B -0.3660% versus the pooled endpoint mean (70,000 candidate measured steps, 140,000 baseline steps). These meet the predeclared confirmation gates: <=3% baseline drift, <=1% candidate slowdown versus both confirmation endpoints, and <=1% pooled slowdown. This is a bounded performance check, not a statistical proof of zero overhead.
Confirmation A2 was interrupted by SIGTERM before producing a report (cause unestablished). Its log is retained and excluded as incomplete; only A2 was rerun with identical parameters in a separate session. The completed A1/B samples were not reselected. No source or machine-setting changes were made during sampling. All completed final-base measurements, the interrupted log, JUnit, schema JSON and evaluator source-identity records are retained locally. Earlier pre-rebase measurements are archived separately and not used to clear this final snapshot.
Across the repeated samples, no reproducible slowdown exceeding the preselected 1% threshold was observed for the measured single-GPU Cartpole workloads. This is not a universal zero-cost guarantee or evidence of statistically significant speedup. CPU governor: powersave; GPU: RTX 4090 D, driver 580.178.04.
The benchmark commands use the official runtime entrypoint, for example:
Run each command against main, candidate, then main sequentially in the same locked environment; visible Kit requires a working display. The local harness explicitly verifies the imported checkout rather than relying on editable-package defaults.
Remote CI and review status
Published head:
497a3d2dc7d72003f57c8661c2e978b5ff097b50. The CI request workflow succeeded, but Docker + Tests for that head reportsaction_requiredwith zero jobs started. Remote tests have not passed or failed; maintainer action is required to allow CI to run. The existingCHANGES_REQUESTEDreview also still requires maintainer re-review. Local verification does not substitute for either gate.Checklist