Files
sunnypilot/openpilot/tools/wgpu
2026-07-25 05:12:47 -04:00
..
2026-07-25 02:41:08 -04:00
2026-07-25 05:12:47 -04:00
2026-07-25 02:41:08 -04:00
2026-07-25 02:41:08 -04:00

Wireless modeld proof of concept

This runs driving modeld on a laptop and returns its cereal outputs to a comma device over the existing Wi-Fi network. It reuses the existing HEVC camera stream, VisionIPC decoder, and cereal ZMQ bridge.

This is for offroad/bench testing only. Wi-Fi has no deterministic latency or availability guarantee. The device restores local modeld when the device-side helper exits, but that is not a seamless onroad failover.

Build

Use the same commit on the laptop and comma device. Build the cereal bridge on the device:

scons -u openpilot/cereal/messaging/bridge

Build and test the normal model on the laptop first:

PATH="$PWD/.venv/bin:$PATH" scons -u

To compile the big external-GPU model for the laptop's local tinygrad backend:

PATH="$PWD/.venv/bin:$PATH" WGPU=1 scons -u \
  openpilot/selfdrive/modeld/models/big_driving_tinygrad.pkl.chunkmanifest

On macOS, the build selects tinygrad's Metal backend when it is available. On an 8-GPU-core M5 MacBook Air, the small model's compiled policy pass measured about 611 ms, while the big model measured about 7981 ms. The latter already misses the 50 ms model cadence before network and codec latency, so start with the small model on that class of laptop.

Run

Find the laptop's LAN IP address that the comma device can reach. While the device is offroad, run:

cd /data/openpilot
python3 -m openpilot.tools.wgpu.device LAPTOP_IP

Keep that terminal open. On the laptop, run:

cd /path/to/openpilot
python3 -m openpilot.tools.wgpu.host COMMA_IP

Add --big-model after COMMA_IP to use the locally compiled big model.

The first remote carParams packet can take up to 50 seconds. Stop either side with Ctrl+C. Stop the device helper before changing branches or rebooting.