Skip to content

perf: optimize issue 673 reset_done paths#674

Merged
TATP-233 merged 6 commits into
mainfrom
fix/issue-673-reset-done-profile
Jul 5, 2026
Merged

perf: optimize issue 673 reset_done paths#674
TATP-233 merged 6 commits into
mainfrom
fix/issue-673-reset-done-profile

Conversation

@TATP-233

@TATP-233 TATP-233 commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #673.

  • Use get_body_pose_w_rows(env_ids, body_ids) in G1 motion-tracking reset observation so reset only reads the sparse rows being reset instead of materializing full-batch body pose.
  • Reuse the Motrix SceneData reset slice when refreshing link-pose cache, avoiding a second self._data[mask] in the reset path.
  • Use contiguous qpos slices for Motrix reset actuator ctrl when joint indices are contiguous, with existing fancy-index fallback for non-contiguous layouts.
  • Remove the temporary reset attribution/profile scaffolding before PR; final file diff only keeps the owner-layer optimizations and regression test.

Performance Notes

The detailed report was posted to #673: #673 (comment)

Same-process A/B attribution before removing the temporary harness showed:

Path Backend Metric Old New Speedup
Body pose reset obs Motrix body_pose_ms 1.596 ms 0.064 ms 24.76x
Body pose reset obs MuJoCo-uni body_pose_ms 1.446 ms 0.111 ms 13.01x
Motrix set_state Motrix set_state_ms 2.320 ms 1.794 ms 1.29x
Motrix set_state Motrix refresh_cache_ms 0.638 ms 0.135 ms 4.71x

Overall collector throughput is intentionally not claimed as a PR result because backend_physics_ms drifted between baseline and optimized runs. The supported claim is limited to the local reset paths above.

Validation

  • uv run ruff check src/unilab/base/backend/motrix/backend.py src/unilab/envs/motion_tracking/g1/tracking.py tests/envs/test_env_configs.py tests/dr/test_manager.py benchmark/benchmark_offpolicy_collector_active.py
  • uv run pytest tests/envs/test_env_configs.py::test_g1_motion_tracking_reset_observation_uses_sparse_body_pose_rows tests/base/test_motrix_backend_options.py tests/dr/test_manager.py tests/benchmark/test_offpolicy_collector_active_benchmark.py -q
  • git diff --check
  • make test-all

@TATP-233 TATP-233 requested a review from caozx1110 as a code owner July 5, 2026 10:19
@TATP-233 TATP-233 merged commit 10db3c2 into main Jul 5, 2026
6 checks passed
@TATP-233 TATP-233 deleted the fix/issue-673-reset-done-profile branch July 5, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: 拆解 reset_done 瓶颈 — motion_tracking full-batch body-pose getter (已坐实) + walk_flat set_state (待实测)

1 participant