Skip to content

perf(managers): 纯 NumPy 临时数组消除(out=/in-place)(#1292 杠杆 4) #1296

Description

@TATP-233

Parent: #1292("更优先的杠杆"第 4 条)

背景

manager 数值层(obs/reward/event terms 及 motion tracking 的 task-owned terms,如 src/unilab/tasks/motion_tracking/common/manager_terms.py)存在可消除的临时数组分配:缺 out= 的逐 elementwise 运算、可 in-place 的累加等。8192 envs 下每个临时数组都是一次分配 + 一次额外内存往返。

目标

纯 NumPy 临时数组消除:out=、in-place 累加、预分配 buffer 复用。无新依赖、无 parity 负担(数值结果 bit 级或容差内一致)。

范围

  • 热点 term 的选取以 profiling 结果为准(见 parent 杠杆 1 的 sub-issue);在其结论出来前,可先处理代码审查即可确认的低风险点(如 reward 累加、obs clip/scale 链路)。
  • 不改 term 数学语义、不改 TERM_ORDER、不引入 Numba 或其他执行路径。
  • 与"削减 isfinite 扫描"的 sub-issue 可能触碰同一批 manager 文件,提交前需协调 diff 范围。

验收

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