Skip to content

perf: 限定 MotionCommand partial-reset 的全量重计算范围 #1261

Description

@TATP-233

Parent: #1259

Depends on: #1255
Parallel with: #1256 and the MuJoCo BatchEnvPool capability investigation

一句话问题

MBA 的 G1 motion tracking partial reset 只重置约 251/8192 个 env,却在 reset 后通过 MotionCommand 再做一次全 batch command/relative-state 计算,单步耗时 34.7–41.4 ms,占 reset_done 的 66%–67%。

为什么现在做

最小交付结果

让 MotionCommand 在 partial reset 后只更新必要的 reset 行,或复用本 control step 已有效的非 reset 状态;保持现有 Manager-Based lifecycle、motion sampling、metrics、observation、termination 和随机数语义。

In scope

  • 落点限于 src/unilab/managers/command_manager.py 与 task-owned motion command term;仅在现有私有调用边界内传递/缓存 reset ids。
  • 拆清 _update_metrics、motion refresh、robot-state refresh 和 relative transform 中哪些可复用、哪些必须重算。
  • 为 reset rows 与 untouched rows 分别补状态、metrics、command 和 observation parity 测试。
  • 排查:MBA reset / event manager 路径开销定位(reset_done 慢 5-6 倍) #1255mba_reset_command_compute_ms 在 MuJoCo/Motrix 做同 commit before/after。

Non-goals

  • 不改 ObservationManager partial-reset 计算;该方向由后续独立 child 决定。
  • 不优化正常 update_state 的 observation/reward/getter 管线。
  • 不改公共 CommandTerm lifecycle、NpEnv reset contract、backend contract 或 motion/reward 配置。

Owner 与预计改动

Acceptance criteria

  • reset/untouched rows 的 command、metrics、motion reference、termination 与 reset observation 在容差内等价。
  • 两 backend 的 mba_reset_command_compute_ms 相对同 commit baseline 至少下降 50%;若达不到,报告分解并停止扩张。
  • collector 吞吐有可重复改善,其他 Benchmark: 测量 go2_joystick_flat / g1_walk_flat / g1_motion_tracking 的 collector 吞吐 #1253 case 无超出重复运行噪声的退化。
  • focused tests、make test-all 和适用 PR gate 通过。

Stop conditions

  • 需要修改公共 CommandTerm.compute/post_compute 签名或 manager lifecycle。
  • 需要新增 row-aware ObservationManager、SimBackend 方法或 task-specific env 分支。
  • 数值/RNG parity 只能通过改变 motion sampling、metrics 或 reset observation 语义维持。
  • 达到 15 文件、800 行或一个 PR 上限。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions