Skip to content

perf(env): remove redundant state finite reduction - #1833

Merged
TATP-233 merged 1 commit into
dev/issue-1811-tensor-managerfrom
perf/torchenv-state-finite
Oct 1, 2026
Merged

TATP-233 merged 1 commit into
dev/issue-1811-tensor-managerfrom
perf/torchenv-state-finite

Conversation

@TATP-233

@TATP-233 TATP-233 commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Profiling the whole env.step() on the gait owner showed several dominant device-synchronizing roots from TorchEnv._validate_state: aten::is_nonzero, aten::all, and aten::isfinite.
  • perf(managers): batch reset and state validation boundaries #1787 tried to batch those checks by stacking per-output isfinite(...).all() reductions, then reducing the stacked scalars. That creates one reduction and host conversion per output plus a second stacked reduction and conversion, exactly the multi-sync pattern it intended to remove.
  • Restore the straightforward per-output isfinite(...).all() check. Each output still has one guarded boundary, but the extra stack/reduction and host conversion are gone.

Validation

  • UNILAB_LOCAL_UNISIM=../unisim uv run pytest -q — 1844 passed, 26 skipped, 624 deselected
  • UNILAB_LOCAL_UNISIM=../unisim uv run pytest -q -m slow tests/base/test_mjwarp_backend.py::test_g1_walk_flat_owner_one_step tests/envs/test_env_configs.py::test_flashsac_g1_motion_mjwarp_tensor_anchor_observations_roll_out — 3 passed
  • uv run ruff check ., uv run ruff format --check ., uv run mypy src/unilab, git diff --check — pass

Part of #1811.

@TATP-233
TATP-233 merged commit 465445d into dev/issue-1811-tensor-manager Oct 1, 2026
@TATP-233
TATP-233 deleted the perf/torchenv-state-finite branch October 2, 2026 03:29
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.

1 participant