Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a954ca0
Remove cython in visionipc
mpurnell1 Dec 10, 2025
dad9849
Add tests and improve destructor logic
mpurnell1 Dec 10, 2025
8ce326e
Implement fix from PR #658
mpurnell1 Dec 11, 2025
feaf997
Remove cython for ipc
mpurnell1 Dec 11, 2025
8d07b62
Add more tests
mpurnell1 Dec 11, 2025
15ccf45
Remove unused cython file
mpurnell1 Dec 11, 2025
48a931a
Remove cython as a dependency
mpurnell1 Dec 11, 2025
fcd7b64
Switch back to program to fix mac builds
mpurnell1 Dec 11, 2025
5c7c9a6
Better logging
mpurnell1 Dec 11, 2025
0fff473
Bring in other cython removal
mpurnell1 Dec 11, 2025
fafe7f5
Mac fixes
mpurnell1 Dec 11, 2025
b5c606e
Other mac fix
mpurnell1 Dec 11, 2025
7a03ed0
Add full apple support for Event using pipe
mpurnell1 Dec 11, 2025
fdb1c6b
Properly skip test on mac
mpurnell1 Dec 11, 2025
8de867d
Remove test
mpurnell1 Dec 11, 2025
dd557c7
Bring back test but skip on mac
mpurnell1 Dec 11, 2025
056d922
Restore accidentally removed comment
mpurnell1 Dec 11, 2025
2bef9ce
Skip another test
mpurnell1 Dec 11, 2025
5a53ab8
Skip remaining tests on mac
mpurnell1 Dec 11, 2025
3f079b3
Convert to python instead of cc
mpurnell1 Dec 12, 2025
b0fd3d5
mac
mpurnell1 Dec 12, 2025
9c35c99
Cleanup
mpurnell1 Dec 12, 2025
5203af5
Revert debug logs
mpurnell1 Dec 12, 2025
2834d14
Remove remaining C++ and replace with python
mpurnell1 Dec 12, 2025
5644fc3
Fix failing CI
mpurnell1 Dec 12, 2025
f318365
guess who's mac? mac again
mpurnell1 Dec 12, 2025
8632662
cleanup
mpurnell1 Dec 12, 2025
93afa44
please
mpurnell1 Dec 12, 2025
cdbaf92
Revert "please"
mpurnell1 Dec 15, 2025
8f53684
Fix CI timing out
mpurnell1 Dec 16, 2025
74ce3cd
Remove accidentally committed change
mpurnell1 Dec 16, 2025
eb67afd
Revert previous changes and try another fix
mpurnell1 Dec 16, 2025
f0adbad
Revert previous changes and try a diffferent fix
mpurnell1 Dec 16, 2025
9a12ff5
Fix visionipc test failures
mpurnell1 Dec 16, 2025
eb070f3
Unskip tests on mac
mpurnell1 Dec 16, 2025
97f2b60
lint
mpurnell1 Dec 16, 2025
1b5e76c
Skip only messaging tests
mpurnell1 Dec 16, 2025
380f735
Fix failing test
mpurnell1 Dec 16, 2025
5ef354b
Remove unneeded change
mpurnell1 Dec 16, 2025
401898f
Reduce duplication
mpurnell1 Dec 16, 2025
3f8d305
Revert unneeded changes
mpurnell1 Dec 16, 2025
5ec191f
Add accidentally removed ION fuunctionality
mpurnell1 Dec 16, 2025
a7edc66
Add ION unit test
mpurnell1 Dec 16, 2025
1c31b65
Cleanup
mpurnell1 Dec 16, 2025
bda9b1e
More cleanup
mpurnell1 Dec 16, 2025
6710eec
Python is slower than C
mpurnell1 Dec 16, 2025
8c65575
Final(?) cleanup
mpurnell1 Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,9 @@ msgq_objects = env.SharedObject([
'msgq/msgq.cc',
])
msgq = env.Library('msgq', msgq_objects)
msgq_python = envCython.Program('msgq/ipc_pyx.so', 'msgq/ipc_pyx.pyx', LIBS=envCython["LIBS"]+[msgq, "zmq", common])

# Build Vision IPC
vipc_files = ['visionipc.cc', 'visionipc_server.cc', 'visionipc_client.cc', 'visionbuf.cc']
vipc_sources = [f'{visionipc_dir.abspath}/{f}' for f in vipc_files]

if arch == "larch64":
vipc_sources += [f'{visionipc_dir.abspath}/visionbuf_ion.cc']
else:
vipc_sources += [f'{visionipc_dir.abspath}/visionbuf_cl.cc']

vipc_objects = env.SharedObject(vipc_sources)
visionipc = env.Library('visionipc', vipc_objects)


vipc_frameworks = []
vipc_libs = envCython["LIBS"] + [visionipc, msgq, common, "zmq"]
if arch == "Darwin":
vipc_frameworks.append('OpenCL')
else:
vipc_libs.append('OpenCL')
envCython.Program(f'{visionipc_dir.abspath}/visionipc_pyx.so', f'{visionipc_dir.abspath}/visionipc_pyx.pyx',
LIBS=vipc_libs, FRAMEWORKS=vipc_frameworks)
msgq_c = env.Program('msgq/libmsgq_c.so', ['msgq/ipc_capi.cc'], LIBS=[msgq, "zmq", common], LINKFLAGS=['-shared'])

if GetOption('extras'):
env.Program('msgq/test_runner', ['msgq/test_runner.cc', 'msgq/msgq_tests.cc'], LIBS=[msgq, common])
env.Program(f'{visionipc_dir.abspath}/test_runner',
[f'{visionipc_dir.abspath}/test_runner.cc', f'{visionipc_dir.abspath}/visionipc_tests.cc'],
LIBS=['pthread'] + vipc_libs, FRAMEWORKS=vipc_frameworks)

Export('visionipc', 'msgq', 'msgq_python')
Export('msgq', 'msgq_c')
74 changes: 13 additions & 61 deletions msgq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,13 @@
# must be built with scons
from msgq.ipc_pyx import Context, Poller, SubSocket, PubSocket, SocketEventHandle, toggle_fake_events, \
set_fake_prefix, get_fake_prefix, delete_fake_prefix, wait_for_one_event
from msgq.ipc_pyx import MultiplePublishersError, IpcError

from typing import Optional, List

assert MultiplePublishersError
assert IpcError
assert toggle_fake_events
assert set_fake_prefix
assert get_fake_prefix
assert delete_fake_prefix
assert wait_for_one_event

NO_TRAVERSAL_LIMIT = 2**64-1

context = Context()


def fake_event_handle(endpoint: str, identifier: Optional[str] = None, override: bool = True, enable: bool = False) -> SocketEventHandle:
identifier = identifier or get_fake_prefix()
handle = SocketEventHandle(endpoint, identifier, override)
if override:
handle.enabled = enable

return handle

def pub_sock(endpoint: str) -> PubSocket:
sock = PubSocket()
sock.connect(context, endpoint)
return sock


def sub_sock(endpoint: str, poller: Optional[Poller] = None, addr: str = "127.0.0.1",
conflate: bool = False, timeout: Optional[int] = None) -> SubSocket:
sock = SubSocket()
sock.connect(context, endpoint, addr.encode('utf8'), conflate)

if timeout is not None:
sock.setTimeout(timeout)

if poller is not None:
poller.registerSocket(sock)
return sock

def drain_sock_raw(sock: SubSocket, wait_for_one: bool = False) -> List[bytes]:
"""Receive all message currently available on the queue"""
ret: List[bytes] = []
while 1:
if wait_for_one and len(ret) == 0:
dat = sock.receive()
else:
dat = sock.receive(non_blocking=True)

if dat is None:
break

ret.append(dat)

return ret
from .ipc import (
Context, SubSocket, PubSocket, Poller, Event, SocketEventHandle,
IpcError, MultiplePublishersError,
toggle_fake_events, set_fake_prefix, get_fake_prefix, delete_fake_prefix,
wait_for_one_event, fake_event_handle, pub_sock, sub_sock, drain_sock_raw,
)

__all__ = [
"Context", "SubSocket", "PubSocket", "Poller", "Event", "SocketEventHandle",
"IpcError", "MultiplePublishersError",
"toggle_fake_events", "set_fake_prefix", "get_fake_prefix", "delete_fake_prefix",
"wait_for_one_event", "fake_event_handle", "pub_sock", "sub_sock", "drain_sock_raw",
]
68 changes: 0 additions & 68 deletions msgq/ipc.pxd

This file was deleted.

Loading
Loading