Skip to main content

bb_ir/
syscall_ids.rs

1//! Syscall identifier string constants — the IR-level contract
2//! between compiler (gate emission) and runtime (dispatch).
3
4/// Framework reverse-DNS root.
5pub const FRAMEWORK_DOMAIN: &str = "ai.bytesandbrains";
6
7/// Domain for every framework-emitted syscall (compiler gates,
8/// `pass_through`, `gate_dispatch`).
9pub const SYSCALL_DOMAIN: &str = "ai.bytesandbrains.syscall";
10
11/// Framework syscall opset version. Bumps on dispatch-shape changes
12/// downstream nodes cannot satisfy.
13pub const SYSCALL_OPSET_VERSION: i64 = 1;
14
15/// Domain for the wire opset (Send + Recv).
16pub const WIRE_DOMAIN: &str = "ai.bytesandbrains.wire";
17
18/// Wire opset version.
19pub const WIRE_OPSET_VERSION: i64 = 1;
20
21/// Domain for `service` / `module` lowering ops.
22pub const SERVICE_DOMAIN: &str = "ai.bytesandbrains.service";
23
24/// Service opset version.
25pub const SERVICE_OPSET_VERSION: i64 = 1;
26
27/// Domain for peer-sampling + gossip-substrate ops. Distinct from
28/// [`WIRE_DOMAIN`].
29pub const NETWORK_DOMAIN: &str = "ai.bytesandbrains.network";
30
31/// Network opset version.
32pub const NETWORK_OPSET_VERSION: i64 = 1;
33
34// --- DSL-side syscall op_types ------------------------------------
35
36/// Structural identity — threads a value through a partition.
37pub const OP_PASS_THROUGH: &str = "PassThrough";
38
39/// Wire send.
40pub const OP_WIRE_SEND: &str = "Send";
41
42/// Wire recv. Paired with `Send` by `WIRE_ID_KEY`.
43pub const OP_WIRE_RECV: &str = "Recv";
44
45/// Multi-edge synchronization barrier.
46pub const OP_GATE_DISPATCH: &str = "GateDispatch";
47
48/// Fan a single input to N outputs via `SlotValue::clone_boxed`.
49pub const OP_TEE: &str = "Tee";
50
51/// Emit a literal from a `TensorProto` / `BytesProto` attribute.
52pub const OP_CONSTANT: &str = "Constant";
53
54/// `i64` deadline in nanoseconds (reference-clock epoch).
55pub const ATTR_DEADLINE_NS: &str = "deadline_ns";
56
57/// `PeerId`-typed value name. Used by backoff + peer-health gates.
58pub const ATTR_PEER: &str = "peer";
59
60// --- Coordination -------------------------------------------------
61
62/// Deadline gate on the protected op's first input.
63pub const OP_DEADLINE_CHECK: &str = "DeadlineCheck";
64
65// --- Gates --------------------------------------------------------
66
67/// Receive-side backoff gate upstream of high-volume Recvs.
68pub const OP_BACKOFF_GATE_RX: &str = "BackoffGateRx";
69
70/// Send-side backoff gate.
71pub const OP_BACKOFF_GATE_TX: &str = "BackoffGateTx";
72
73/// Drop duplicate-arrival Recv envelopes.
74pub const OP_DEDUP_GATE_RX: &str = "DedupGateRx";
75
76/// Fast-fail inbound envelopes from unhealthy peers (φ-accrual).
77pub const OP_PEER_HEALTH_GATE_RX: &str = "PeerHealthGateRx";
78
79/// Fast-fail outbound envelopes to unhealthy peers (φ-accrual).
80pub const OP_PEER_HEALTH_GATE_TX: &str = "PeerHealthGateTx";
81
82/// Default per-hop budget (100 ms) for sizing async wire-Send
83/// deadlines. `derive_wire_deadlines` multiplies static
84/// `chain_depth` by this; `NodeConfig` can override per-Node.
85pub const DEFAULT_PER_HOP_BUDGET_NS: u64 = 100_000_000;