Skip to content

wave-18: import ring-091 Stochastic Rounding -- SR primitives + SplitMix64 PRNG #723

Closed

Description

@gHashTag

Wave 18 -- ring-091 Stochastic Rounding (SR primitives)

Continues the honest Wave-11 import series. Wave 15 landed ring-088 (GF16 MAC), Wave 16 landed ring-089 (TNN ISA), Wave 17 landed ring-090 (Simulator). Wave 18 lands ring-091.

Scope

Real, executable Rust crate at rings/ring-091-rust/ implementing stochastic rounding as a universal numeric primitive:

  • SplitMix64 -- a deterministic, seedable, branch-free PRNG (Vigna 2014). Zero external deps, #![no_std].
  • RoundingMode enum (Nearest, Stochastic).
  • sr_round_f32_to_i32(x, rng) -> i32 -- floor with probability 1 - frac(x), ceil with probability frac(x).
  • sr_quantize_f32(x, step, rng) -> f32 -- generic SR quantization at a uniform grid step.
  • sr_quantize_batch(input, output, step, rng) -- streaming, allocation-free batch quantization.
  • Statistical invariant: over N independent SR roundings of the same x, the empirical mean converges to x (no bias). Exercised in tests with N = 10_000.
  • identity_witness() returning phi^2 + 1/phi^2 == 3 to f64 1e-15.

#![no_std] (test cfg pulls std), #![forbid(unsafe_code)], #![deny(missing_docs)], zero external dependencies.

Honest scope (R5-HONEST)

  • No spec change. This ring introduces a universal numerics primitive that does not appear in the existing .t27 source. SplitMix64 is a textbook PRNG (Vigna 2014, "Further Scramblings of Marsaglia's Xorshift Generators"). The SR algorithm is textbook (Hopkins et al. 2020, "Stochastic Rounding"). No new file under specs/, coq/, proofs/, bootstrap/, gen/.
  • No GF16-specific encoding. SR over GF16 is a natural next step but adds a path-dependency on ring-088's quantizer; out of scope for this wave.
  • No hardware integration. SR-aware MAC, FPGA cell, accelerator wiring: out of scope.
  • The Wave-11 narrative quoted 409 LOC for ring-091. Honest measurement will be reported in the PR body.

Constitutional compliance

  • L1 TRACEABILITY -- Closes #723
  • L2 GENERATION -- no edits under gen/, coq/, specs/, etc.
  • L3 PURITY -- ASCII, English doc-comments
  • L4 TESTABILITY -- statistical + edge-case tests
  • L5 IDENTITY -- phi^2 + 1/phi^2 = 3 exercised
  • L6 CEILING -- no spec change; SR is a textbook universal algorithm
  • L7 UNITY -- no new *.sh

Anchor: phi^2 + 1/phi^2 = 3

Activity

  1. added a commit that references this issue on May 22, 2026
    8581137
  2. added 2 commits that reference this issue on Jun 1, 2026
    9a446a9
    647bd3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions