==> README.md <==1# @ajax/mesh-rt-ctx
2
3`mesh_ctx`, what a mesh program's init and task see: ids (node, warp, lane, thread, leader), block
4collectives, shared memory, scratch, the own view, peer views (gated by `reads`, read under the slot's
5seqlock), the program table (`find`, `prog_state`, `prog_name`, `request_run`), the input queue, pipes
6(`push_with`, `pop_with`, `pipe_free`, `pipe_len` over @ajax/mesh-abi-pipe with device atomics), the
7request window and `respond`, the lockstep exchange page, counters, the ticket, the system and group.
8
9| Rust | C |
10|---|---|
11| `ctx.view_u32(off)` | `mesh_ctx_view_u32(ctx, off)` |
12| `ctx.peer_view(s) -> Option<View>` | `bool mesh_ctx_peer_view(ctx, s, &view)` |
13| `ctx.find(b"train") -> Option<u32>` | `bool mesh_ctx_find(ctx, "train", 5, &slot)` |
14| `ctx.input_pop() -> Option<u8>` | `bool mesh_ctx_input_pop(ctx, &byte)` |
15| `ctx.push_with(s, \|v\| ..)` | `mesh_ctx_push_with(ctx, s, fill_fn, user)` |
16| `ctx.shared::<f32>(off, len)` | `bool mesh_ctx_shared(ctx, off, len, 4, &shared)` |
17| `ctx.for_strided(n, \|i\| ..)` | `MESH_CTX_FOR_STRIDED(ctx, n, i) { .. }` |
18| `ctx.group() -> Option<(u32, u32)>` | `bool mesh_ctx_group(ctx, &rank, &n)` |
19
20- **Ported from:** alpha-rust-mesh `crates/mesh-rt/src/ctx.rs`.
21- **Tests:** through the programs' simulator tests (views, peer views, input, pipes, requests, counters).