Skip to content

fix(inference): build the RoboLab observation video on the GPU - #461

Open
jpohl-nv wants to merge 1 commit into
NVIDIA:mainfrom
jpohl-nv:fix/robolab-server-observation-video-on-gpu
Open

jpohl-nv wants to merge 1 commit into
NVIDIA:mainfrom
jpohl-nv:fix/robolab-server-observation-video-on-gpu

Conversation

@jpohl-nv

@jpohl-nv jpohl-nv commented Dec 4, 2026

Copy link
Copy Markdown

Summary

RobolabPolicyService._build_sample returns a uint8 [C,T,H,W] observation video on the CPU: the camera image in frame 0 and zero placeholder frames after it, 33 frames at 544×736 for the DROID policy. The model then copies the whole clip, about 40 MB per request, from pageable host memory to the GPU and converts it to float there, although the VAE encodes only frame 0.

This PR builds the same video on the model's device: if the video is a 4-D uint8 CPU tensor with at least 2 frames and every frame after the first is zero, it allocates the zeros on the device and copies only frame 0. The values are identical, so the normalization that follows gives the same result, now on the GPU. Videos that don't match keep the previous path. The device is the model's own tensor_kwargs["device"], so each rank under --cfg-parallel uses its own GPU.

Impact

Measured with nvidia/Cosmos3-Edge-Policy-DROID and the RoboLab server's settings on an RTX PRO 6000 Blackwell, compiled bf16, BananaInBowlTask, interleaved runs in one session:

  • Whole policy call: 276.0 → 252.2 ms per call (mean of 2 runs each).
  • Sampler and data preparation, where the copy and the conversion happen: 38.6 → 12.6 ms.

Testing

  • New CPU tests in action_policy_server_robolab_test.py:
    • a clip with zero placeholder frames is rebuilt from frame 0 alone, with identical values; a spy on Tensor.to checks that only frame 0 is copied;
    • a clip with a non-zero later frame is returned unchanged.
  • The existing _build_sample test passes with the device set to the CPU.
  • A mutation check (copying frame 1 instead of frame 0) makes the new test fail.
  • On 301 recorded RoboLab requests across 5 tasks, the policy's actions are bit-identical to the unchanged server (uncompiled bf16, recorded seeds).
  • ruff check and ruff format are clean on the changed files.

The RoboLab server built its uint8 [C,T,H,W] observation video on the
CPU: the camera image in frame 0 and zero placeholder frames after it.
The model then copied all of it, about 40 MB per request, from pageable
memory to the GPU, although the VAE encodes only frame 0. Build the same
video on the model device instead: allocate the zeros there and copy
only frame 0. Videos with non-zero later frames keep the previous path.

Signed-off-by: John Pohl <jpohl@nvidia.com>
@jpohl-nv
jpohl-nv marked this pull request as ready for review December 4, 2026 14:47

This branch has not been deployed

No deployments
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