skip to content
[readonly]

Pipes between programs: push into a connected inbox, pop your own

sh
$ sexc add @ajax/mesh-abi-pipe
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 01:45v/# 1 version
  • drwxr-xr-x-Oct 27 01:45files/# the files of 0.1.0
latest
0.1.0, published Oct 27 01:45 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-abi-base ^0.1.0, @ajax/mesh-abi-header ^0.1.0, @ajax/mesh-abi-program-table ^0.1.0, @ajax/mesh-abi-pipe-table ^0.1.0, @ajax/mesh-abi-pipe-ring ^0.1.0, @ajax/mesh-abi-words ^0.1.0, @ajax/mesh-abi-pipe-hash ^0.1.0, @ajax/mesh-abi-view-heap ^0.1.0, @ajax/mesh-check ^0.1.0
dependents
@ajax/mesh-abi, @ajax/mesh-exec-wasm-imports, @ajax/mesh-lease, @ajax/mesh-prog-pipesink, @ajax/mesh-prog-pipesrc-n, @ajax/mesh-rt-ctx, @ajax/mesh-rt-wasm, @ajax/mesh-worker-ctx
keywords
mesh alphaos abi gpu pipe
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-abi-pipe
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-abi-pipe
2
3Pipes between programs: push into a connected inbox, pop your own.
4
5Part of the mesh contract: the memory, control, snapshot and peer protocols shared by meshd, its GPU
6programs (CUDA kernels, wasm lanes, native workers) and the tools. Every side compiles the same
7definitions, so an offset can never disagree.
8
9```c
10#include "mesh/abi/pipe.h"
11```
12
13## Ported from
14
15[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT): crates/mesh-abi/src/v2/pipe.rs (PipeErr, codes, read_block, target, flight_begin/end, push, pop).
16
17Names: Rust's `NAME` is `MESH_NAME`; a constant of a Rust module `m` is `MESH_M_NAME` (unless it already starts with `M_`); a function `f` is `mesh_f` (`mesh_m_f`). Offsets that are `usize` in the Rust are plain integer constants or `size_t` results, `u32` constants carry a `u` suffix, `u64` use `UINT64_C`.
18
19## Device code
20
21The header is freestanding (`<stdint.h>`, `<stddef.h>`, `<stdbool.h>` only): it compiles for the host, `nvptx64-nvidia-cuda` and `wasm32`. Functions the Rust marks `const fn` are `static inline` here.
22
23## Tests
24
25- `tests/constants.c`: every constant against the value the Rust prints (5 checks)
26- `tests/pipe.c`: the Rust's table-level pipe tests, one for one (host_push_pop_through_the_tables, hold_and_flight), plus every result's code, over an 8 MiB mailbox of C11 atomics
27
28## Differences
29
30Rust's `Result<bool, PipeErr>` is an int: 1 = Ok(true), 0 = Ok(false), -e = Err(e), with `mesh_pipe_err` numbered so that -NOT_CONNECTED, -SIZE and -GONE are the runtimes' PIPE_* codes. `Option` results are a bool plus an out parameter. Records are (pointer, length) instead of slices.
31
32## Licence
33
34MIT. See the repository's LICENSE.