Repository navigation
Share render-state publication across active visual consumers - #667
Conversation
|
|
Both review findings are addressed in All 446 local checks pass. Real Newton/MJWarp CUDA + FastRT validation covers the native window, offscreen cameras, recording, Viser and paused direct pose edits. With G1 and 4,096 environments, both backends complete five PPO updates each. All ten revised rollouts make zero explicit render publications; checkpoint reload and finite policy/optimizer tensor checks pass. One confirmed boundary remains: on the default GPU backend, a direct rigid-body pose write while paused updates the physics readback, but FastRT render transforms and images retain the previous pose. This reproduces on both the previous PR head and the revision and remains unfixed. Newton window synchronization and combined offscreen consumption pass the current checks; paused direct pose edits on the default backend remain an unaccepted case. The full documentation build passed on implementation commit |
Description
Headless state-only RL was publishing the full Newton physics scene to the renderer even without visual consumers. This PR removes that work and gives windows, cameras, recording and Viser a shared publication phase. With
NewtonPhysicsCfg(sync_to_renderer=False), an open native window now receives current state continuously; combined consumers publish once per frame instead of two or three times.SimulationManager.render_frame()is a read-only consumption context. Gym defers rendering of the last physics substep until interval events finish, then obtains camera observations inside the context; due recording and Viser captures consume the same state on exit. Reset finishes its state writes before opening a new frame. Viser checks whether a frame is due before requesting publication. Manager-owned Newton stepping suppresses DexSim's automatic publication and honors an explicitsync_to_renderer=Truerequest within the shared phase. Raw DexSimWorld.update()keeps its existing policy.Publication is never cached across frames or independent reads. Direct edits inside a frame require an explicit
sync_render_state()call, which remains unconditional. Independent callers can combineupdate(render_final_step=False)withrender_frame()to share camera/recording/Viser publication. Render-thread recording consumes already-published state and never invokes the blocking bridge from that thread. A failed frame clears its publication flag; failed observations retain pending recording time.This addresses both review findings: the missing continuous window publication and repeated publication by combined consumers. Dependencies, physics/PPO parameters and DexSim source are unchanged. API usage, configuration semantics and agent context are updated. No associated issue.
Validation of implementation
2033b804(PR head4d9a9eec)The follow-up commits
02afa235and4d9a9eeccomplete the profiler and Warp-log test fixtures for backend-owned stepping. Runtime implementation is unchanged. The final configuration/profiler validation passes all 37 tests.83e396a7and pass with this revision. Coverage includes all three Newton synchronization policies, window/headless modes, consumer combinations, interval-event edits, paused edits, explicit publication and failed-frame retry.2033b804in CI. The current-head CI run passes tests, Test gate, build, lint and documentation checks.Versions remain pinned to DexSim
c8e8bc11, Newton 1.6.0, MuJoCo/MJWarp 3.12.0, Warp 1.17.0 and Torch 2.10.0+cu128. Source paths and 145 task/configuration files are verified. Revised runtime checks used the local source changes subsequently committed as2033b804; original provenance retains the pre-commit head and diff.Existing default-backend boundary
A separate FastRT/default-GPU probe reproduces a paused rigid-body pose discrepancy on both
83e396a7and this revision: the physics readback reflects a direct pose write, while the render transform and image retain the prior pose. A subsequent physics step in that probe does not resolve the discrepancy. Ordinary stepping without that direct edit passes the camera/recording/Viser check. This PR fixes publication scheduling; it does not add a missing native default-backend pose-publication implementation. Paused direct edits on that backend are not marked accepted.Earlier performance and server evidence
The original fix at
83e396a7already completed the isolated Pro5000 GPU1 batch: Go2, Go1, G1 and H1_2 × both backends, eight 100-update training/evaluation/FastRT-video runs and six independent performance repeats. G1/Newton three-rollout median fell from 102.743 s to 3.402 s (30.2×), with zero explicit publications across 800 training rollouts. That evidence supports removal of the original headless bottleneck; it is not server validation of2033b804. The revised implementation at02afa235completed Pro5000 GPU1 revalidation: all eight combinations of four robots and two backends passed smoke checks, 100-update training, FastRT evaluation and video generation. All 800 rollouts recorded zero explicit render publications; 32 checkpoints passed reload/finite-value checks and all eight videos decoded completely. The planned six additional performance repeats did not run because the performance preflight still pinned the earlier source revision. Current head4d9a9eechas the same runtime code as this completed batch. Policy convergence and manual keyboard play remain outside these short-run acceptance results.Type of change
Screenshots
Local reports retain horizontal publication-count and training-resource charts, raw measurements, pose images and FastRT recordings. The publication matrix changes from 0 to 1 for an open window with automatic synchronization disabled, 2 to 1 for recording + camera or recording + Viser, and 3 to 1 for all three. State-only headless frames remain at zero.
Checklist