Skip to content

Crate vyrn cut

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-cut

Path: crates/engine/vyrn-cut · Layer 1 (11 §1.4) · Pinned: yes (11 §1.3)

Purpose

vyrn-cut holds every cross-core primitive of the engine: the lane counters, the cut publication (two half-cut lines, one per cut core), the snapshot seqlock, LaneCut, the SPSC and multi-reader rings, and the pool primitives. Everything except the pool read-modify-writes goes through a Visibility backend: Hw uses atomics, and Sim adds seeded delays so vyrn-sim sees stale cuts and snapshots. Each primitive's doc names its writer, its readers, its memory orderings and its spec section. Every line that one core writes and another reads is aligned to SHARED_ALIGN = 128 bytes.

Spec sections it implements

  • 11 §1.3 (crate scope), 11 §3.6 (BLD_SHARED_ALIGN), 11 §6.4 (Sim visibility), 11 §6.1 (loom models)
  • 01 §14.3: two half-cut lines, cut core A (core 1) and B (core 6)
  • 01 §14.5: per-lane order rings, lane → stream core
  • 01 §14.15: pool primitives (PoolTok CAS, steal locks, sibling-segment fetch_and)
  • 05 §4.6 (Segment16.mask), §4.12 and §4.15 (ring entry lines), §4.13 and §7.1 (cut publication), §6.9 (pool), §16 (ring capacities)

Main public types

Type Role
Ring<T, N, C, V>, Producer, Consumer Ring of N entries with C ≥ 1 consumers; one writer of slots and tail, each consumer the only writer of its head
FwdRing, FillRing, OsRing, StepLog, TxRing Aliases for lane → BBO, BBO → lane, lane → stream core, BBO → stream and TX cores (5 readers), BBO → one fill TX core
HalfCut, CutWriter CutPub[h], one per half, read by the BBO; the cut core's private publication state
CounterLine, SnapshotLine, LaneCut, BboFloor Published single-writer lines (lane counter, BBO snapshot, per-lane cut, floor)
PubRing, Published Seqlocked publication ring and single-line publication
PoolTok, StealLock, SegMask Pooled-account token (CAS), RX-queue consumer lock, Segment16.mask word
Visibility, Hw, Sim Store-visibility backend trait; hardware atomics; the simulator's seeded backend

Status on main (a9f0d61)

Implemented. Version 0.1.0 from the workspace; publish = false. The crate docs name no missing piece or follow-up. ring is the only module allowed to contain unsafe (listed in UNSAFE.toml); the rest of the crate is #![deny(unsafe_code)].

Tests: tests/conformance.rs (11 #[test]), tests/props.rs (9, proptest), tests/ring.rs (5), tests/loom.rs (7), and unit tests in src/pool.rs (5). Total: 37 #[test] functions. The loom file is #![cfg(loom)]: its 7 models (ring, seqlock, cut publication, pool primitives, preemption bound 3) run only with RUSTFLAGS="--cfg loom" cargo test -p vyrn-cut --test loom --release. build.rs only declares the loom cfg. vyrn-cut is the only crate with loom as a dev-dependency.

Depends on

Workspace: vyrn-types. Dev: loom, proptest. This matches 11 §1.4 (layer 1 → vyrn-types).

Links

Clone this wiki locally