From bf09b8eea46e68655fdd16fe83fc129f4bd9b450 Mon Sep 17 00:00:00 2001 From: Zeph Leggett Date: Mon, 26 Oct 2026 19:04:05 -0500 Subject: [PATCH] Jetlink e0257f4 warp.make_coherent is public, for an adapter's own warp: it moves a QCOM output to memory the CPU reads cached, as Jetlink's warp does. CREDITS.md and JETLINK.md name the new revision. --- CREDITS.md | 2 +- jetlink_repo/jetlink/openpilot/interface.py | 4 +++- jetlink_repo/jetlink/openpilot/warp.py | 14 +++++++++----- openpilot/starpilot/models/JETLINK.md | 14 +++++++------- upstream-sync.json | 4 ++-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index dfafa3b953..a4ba47e719 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -2,7 +2,7 @@ ## Jetlink external inference -The comma-side Jetlink client and USB transport in `jetlink_repo` are by Zeph Leggett and the [Jetlink contributors](https://github.com/zoompilot/jetlink). They are vendored from revision `0605e34b87c56bcaea6b05c757a6889beebf1422` under the MIT license, retained in [jetlink_repo/LICENSE](jetlink_repo/LICENSE). StarPilot's adapter (`openpilot/starpilot/models/jetlink_adapter.py`) builds on Jetlink's openpilot layer and owns its param names, Always On Lateral rule, model runner reset, settings and alerts. Companion applications and inference servers remain distributed by Jetlink. +The comma-side Jetlink client and USB transport in `jetlink_repo` are by Zeph Leggett and the [Jetlink contributors](https://github.com/zoompilot/jetlink). They are vendored from revision `e0257f46d6a50bdb16f47b946850fc919047aa82` under the MIT license, retained in [jetlink_repo/LICENSE](jetlink_repo/LICENSE). StarPilot's adapter (`openpilot/starpilot/models/jetlink_adapter.py`) builds on Jetlink's openpilot layer and owns its param names, Always On Lateral rule, model runner reset, settings and alerts. Companion applications and inference servers remain distributed by Jetlink. ## MRR35 Hyundai angle and radar diff --git a/jetlink_repo/jetlink/openpilot/interface.py b/jetlink_repo/jetlink/openpilot/interface.py index abde48aa06..e46ef5daac 100644 --- a/jetlink_repo/jetlink/openpilot/interface.py +++ b/jetlink_repo/jetlink/openpilot/interface.py @@ -211,7 +211,9 @@ class JoinedModel(Protocol): class FrameWarp(Protocol): """What an adapter's model_warp returns, warp.Warp's shape, run on modeld's frame thread. Only one of the small and the large model runs a frame, so a - warp that shares the small model's JIT and buffers is never in use by both.""" + warp that shares the small model's JIT and buffers is never in use by both. + On a comma, warp.make_coherent lets the CPU read a GPU output cached: 0.22 + ms for the frame where tinygrad's own mapping takes 2.9.""" output: Any # the warped frame, (2, 6, model_h/2, model_w/2) uint8 as bytes: read after wait(), until the next start() def start(self, frame: int, big_frame: int, tfm: Any, big_tfm: Any) -> None: diff --git a/jetlink_repo/jetlink/openpilot/warp.py b/jetlink_repo/jetlink/openpilot/warp.py index b6ab84f6f8..8631c41787 100644 --- a/jetlink_repo/jetlink/openpilot/warp.py +++ b/jetlink_repo/jetlink/openpilot/warp.py @@ -161,7 +161,7 @@ class Warp: out = jit.captured.ret.uop.base.buffer self._device = out.device if self._device.startswith('QCOM'): - _make_coherent(out) + make_coherent(out) # the two buffers every frame passes, written in place by start() self._tensors = {name: Tensor(np.zeros(shape, dtype=dtype), device=device).realize() for name, (shape, dtype, device) in specs.items()} @@ -191,10 +191,14 @@ class Warp: self._replay(self._inputs, {}) -def _make_coherent(out) -> None: - """Move a QCOM buffer to KGSL memory flagged IOCOHERENT and write-back. - Raises if the kernel keeps either flag back (the allocation's record holds - its answer): write-back memory that is not coherent reads stale frames.""" +def make_coherent(out) -> None: + """Move a QCOM buffer to KGSL memory flagged IOCOHERENT and write-back, so + the CPU reads it through its cache once the GPU is done (see Warp). Raises + if the kernel keeps either flag back (the allocation's record holds its + answer): write-back memory that is not coherent reads stale frames. + + For an adapter's model_warp too. A JIT links its buffers' addresses on its + first call, so move one before that, or have the JIT link again after.""" from tinygrad.device import Device dev = Device[out.device] mem = dev._gpu_alloc(out.nbytes, flags=COHERENT_WRITEBACK) diff --git a/openpilot/starpilot/models/JETLINK.md b/openpilot/starpilot/models/JETLINK.md index 76d3ecd1da..aa4b92bbda 100644 --- a/openpilot/starpilot/models/JETLINK.md +++ b/openpilot/starpilot/models/JETLINK.md @@ -28,14 +28,14 @@ release still needs a successful compatible handshake and device validation. ### Jetson and Linux PC -On a supported NVIDIA host, review and run the [upstream installer](https://github.com/zoompilot/jetlink/blob/0605e34/install.sh). +On a supported NVIDIA host, review and run the [upstream installer](https://github.com/zoompilot/jetlink/blob/e0257f4/install.sh). The upstream Jetson guide specifies an Orin Nano Super 8 GB and JetPack 7.2.1; the Linux guide specifies an RTX 20-series or newer GPU with driver 580 or newer. Keep the computer powered, cool, and awake. Connect its USB-A port to the comma's USB-C port. Use `jetlink status` to check the host and `jetlink logs` to inspect problems. Host power, sleep, and driver setup details remain in the credited -[Jetson](https://github.com/zoompilot/jetlink/blob/0605e34/docs/jetson.md) and -[Linux](https://github.com/zoompilot/jetlink/blob/0605e34/docs/linux-pc.md) references; +[Jetson](https://github.com/zoompilot/jetlink/blob/e0257f4/docs/jetson.md) and +[Linux](https://github.com/zoompilot/jetlink/blob/e0257f4/docs/linux-pc.md) references; their comma-side ZoomPilot instructions are replaced by **Set up StarPilot** above. ### Mac @@ -45,7 +45,7 @@ Use an Apple silicon Mac with macOS 15 or newer. Get the Jetlink DMG from in Applications, and start it. Keep it awake and connect by USB 3. Use **USB computer** in StarPilot's Galaxy, rather than following the comma-side ZoomPilot installation instructions in the credited -[Mac host reference](https://github.com/zoompilot/jetlink/blob/0605e34/docs/macos-app.md). +[Mac host reference](https://github.com/zoompilot/jetlink/blob/e0257f4/docs/macos-app.md). ### iPhone and iPad @@ -54,7 +54,7 @@ It requires a USB-C device supporting USB 3 and iOS/iPadOS 26.1 or newer. Choose **iPhone / iPad** in StarPilot, allow the host app's Local Network access, connect by USB 3, and keep the app open and the device unlocked. Check sustained thermal performance with the app's benchmark; that benchmark excludes cable latency. -The [credited Apple host reference](https://github.com/zoompilot/jetlink/blob/0605e34/docs/iphone-app.md) +The [credited Apple host reference](https://github.com/zoompilot/jetlink/blob/e0257f4/docs/iphone-app.md) contains hardware details. StarPilot supplies the comma-side instructions above. ### Android @@ -64,7 +64,7 @@ upstream Jetlink Android APK from [its releases](https://github.com/zoompilot/je Use a recent USB 3-capable Android 12+ phone, a powered USB 3 hub, and separate comma power. Choose **USB computer** in StarPilot. Follow the host's USB permission prompt and benchmark sustained performance before use. -[Credited Android host reference](https://github.com/zoompilot/jetlink/blob/0605e34/docs/android-app.md). +[Credited Android host reference](https://github.com/zoompilot/jetlink/blob/e0257f4/docs/android-app.md). ## Use and recovery @@ -89,7 +89,7 @@ and defaults off. ## Attribution and license This StarPilot guide adapts the host setup structure from -[ZoomPilot / Jetlink at 0605e34](https://github.com/zoompilot/jetlink/tree/0605e34/docs). +[ZoomPilot / Jetlink at e0257f4](https://github.com/zoompilot/jetlink/tree/e0257f4/docs). Jetlink is copyright (c) 2026 Zeph Leggett and licensed under the [MIT license](../../../jetlink_repo/LICENSE), whose full text is preserved. ZoomPilot source links, project names, authorship, and history are attribution; diff --git a/upstream-sync.json b/upstream-sync.json index 8db985efab..84921cd04b 100644 --- a/upstream-sync.json +++ b/upstream-sync.json @@ -65,8 +65,8 @@ { "path": "jetlink_repo", "url": "https://github.com/zoompilot/jetlink.git", - "commit": "0605e34b87c56bcaea6b05c757a6889beebf1422", - "tree": "fcd6e2cb694def9f0417c192018a1debbfebcfc0", + "commit": "e0257f46d6a50bdb16f47b946850fc919047aa82", + "tree": "921ec9157a6b607f7f0f81c69cd411b5d23cf872", "include": [ "jetlink", "LICENSE",