Skip to content

Pool a batch of camera frames once, a chunk at a time - #46

Merged
CSSFrancis merged 2 commits into
mainfrom
perf/pool-once
Nov 22, 2026
Merged

CSSFrancis merged 2 commits into
mainfrom
perf/pool-once

Conversation

@CSSFrancis

Copy link
Copy Markdown
Member

What

  • DynamicalIndexer.pooled(frames): the batch pooled to the refine shape on the device. Hand the result to observe and index in place of the frames. They index the same, bit for bit (test_pooled_frames_index_as_the_frames), and the batch is converted and pooled once instead of by each.
  • LiveIndexer.pooled converts integer frames to float POOL_CHUNK (128) at a time, so a batch is never held at full resolution as float. 1,024 frames of 512 x 512 would otherwise be a gigabyte.

Why

At 512 x 512, Autopilot's live indexing spent a quarter of its time converting each batch twice. The ring overflowed, and the replayed scans showed dropped rows (black bars). With the batch pooled once, the 512 x 512 replay indexed 65,536 frames with none dropped.

Tests

  • New: test_integer_frames_are_pooled_a_chunk_at_a_time_as_a_whole (chunked integer pooling equals the whole batch pooled as float).
  • tests/index/test_live.py: 43 passed on CUDA. ruff check and ruff format --check are clean.

DynamicalIndexer.pooled gives observe and index the same pooled batch, so a batch is converted and pooled once rather than by each; LiveIndexer.pooled converts integer frames 128 at a time, so a batch of 1,024 frames of 512 x 512 is never a gigabyte of floats.
@CSSFrancis
CSSFrancis merged commit 49967c7 into main Nov 22, 2026
4 checks passed
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