skip to content
==> include/mesh/abi/host_members.h <==
1/* @ajax/mesh-abi-host-members: Member records (M_*): each cluster member as this meshd sees it.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_HOST_MEMBERS_H
5#define MESH_ABI_HOST_MEMBERS_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10#include "mesh/abi/fields.h"
11
12#define MESH_S_MEMBERS 0x240
13#define MESH_MEMBER_BYTES 0x80
14/* Member record fields (offsets within it). */
15#define MESH_M_STATE 0x00 /* u32 MS_* */
16#define MESH_M_CC 0x04 /* u32 major * 10 + minor */
17#define MESH_M_SMS 0x08 /* u32 SMs its meshd runs programs on */
18#define MESH_M_SMS_TOTAL 0x0c /* u32 */
19#define MESH_M_BLOCKS_PER_SM 0x10 /* u32 */
20#define MESH_M_RTT_US 0x14 /* f32 exchange round trip to it, last second */
21/* f32 mean wait per exchange round, last second: how long after this
22 * system published round n the member's round n arrived (0 if it was first).
23 * The slowest member is the one everyone else waits for. */
24#define MESH_M_WAIT_US 0x18
25#define MESH_M_ROUNDS 0x1c /* u32 its rounds received in the last second */
26#define MESH_M_ROUND 0x20 /* u64 its round counter as last mirrored here */
27#define MESH_M_GPU 0x28 /* 32 bytes NUL padded */
28#define MESH_M_ARCH 0x48 /* 16 bytes */
29#define MESH_M_HOST 0x58 /* 32 bytes (its hostname) */
30/* u32 its H_BACKEND word (F_JOIN's eighth word; 0 = CUDA from a peer that predates it). */
31#define MESH_M_BACKEND 0x78
32#define MESH_MS_ABSENT 0u
33#define MESH_MS_LINKED 1u /* TCP link up and JOINed */
34#define MESH_MS_UP 2u /* linked and beating: a member of the fleet's view */
35/* Up, but silent for over a third of the dead time (a link blip or a stalled
36 * member; it goes absent at the dead time). */
37#define MESH_MS_SUSPECT 3u
38#define MESH_MEMBER_STATES_LEN 4
39extern const char *const MESH_MEMBER_STATES[4];
40#define MESH_MEMBER_FIELDS_LEN 13
41extern const mesh_field MESH_MEMBER_FIELDS[13];
42
43/* Member k's record. */
44static inline size_t mesh_member(uint32_t k) { return MESH_S_MEMBERS + MESH_MEMBER_BYTES * (size_t)k; }
45
46/* The Rust const asserts that only involve this package. */
47_Static_assert((MESH_M_ROUND % 8 == 0), "M_ROUND.is_multiple_of(8)");
48_Static_assert(MESH_M_GPU + 32 <= MESH_M_ARCH, "M_GPU + 32 <= M_ARCH");
49_Static_assert(MESH_M_ARCH + 16 <= MESH_M_HOST, "M_ARCH + 16 <= M_HOST");
50_Static_assert(MESH_M_HOST + 32 <= MESH_MEMBER_BYTES, "M_HOST + 32 <= MEMBER_BYTES");
51
52#endif