Repository navigation
Silent OT: Turbo SPIN 0.4.2, VAES GGM expansion and hash, bit-vector choice transpose - #205
Merged
Merged
Conversation
Silent OT's SPIN profile is now Turbo SPIN (spin::Parameters::PacketRs8T64), pinned to spin_codes main 584a7fb6 (SPIN 0.3). Under uniform setup its minimum distance exceeds N/10 at K=2^14, 2^16, ..., 2^26 (Lean-certified). Requests up to 2^14 use K=2^14; larger requests round up to a multiple of 128. Stationary noise keeps the banked heuristic refresh, now over a Turbo bank. Turbo has no generic-element transpose. Separate choice bytes therefore travel in the low byte of a block through the native transpose (exact: the binary map acts on each bit lane independently); packed choice bits are unchanged. SpinCode rejects non-128-bit element types. Tests: Spin_Integration_Test (native GF2/GF128 agreement, lifted choice bytes in both noise modes, generic-type rejection, sizes) and the OtExt_Silent tests pass on Peach; -spinOtBench -check passes for regular and stationary noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turbo runs at every natural size (a positive multiple of 128). Requests round up to the next one, with the previous 8192 floor so the noise configuration has room for its partitions; the floor is not related to the distance certificates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SPIN 0.4 drops the generic coefficient transpose, so SpinCode accepts only native 128-bit block records and rejects other element types. The package lookups and docs ask for 0.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Sender hash: build each (r, r^Delta) pair in one YMM register and store the hashed pair straight to the output; no stack batch or copy. - RegularPprf: VAES helpers for internal levels (YMM, sums in registers) and the leaf level (both keys interleaved, 8 AES chains in flight), used by sender and receiver. Non-VAES builds keep the scalar loops. - spinOtBench -check prints a fixed-seed output digest so builds can be compared bit for bit. Digests match the previous code at logN 13/18/20, regular and stationary. K=2^18 sender on a Ryzen 9 7950X core: 1.651 -> 1.373 ms with -nt, 2.152 -> 1.483 ms with cached stores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With ENABLE_AVX512 the internal and leaf levels run on ZMM, two parents per step: the same AES work in half the instructions, leaving the scheduler room for the stores, sums and feed-forward. AVX2-only VAES builds keep the 256-bit path. Output digests match at logN 13/18/20, regular and stationary; tests pass. K=2^18 sender expansion 0.560 -> 0.502 ms (Ryzen 9 7950X core). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The correlated-OT receiver's choice bytes now go through SPIN 0.4.1's transpose_bits instead of widening each byte to a block for a second full record transpose. Each byte is eight bit lanes of the binary map; only the bit planes present are transposed (one for 0/1 choices), packed with pext/pdep where BMI2 is available. Outputs are unchanged. Requires SPIN 0.4.1 (pinned to spin_codes cf75e9ec). spinOtBench -choices times both paths in one binary: K=2^18 0.645 -> 0.214 ms, K=2^20 4.35 -> 0.87 ms. Spin, SilentOt and Pprf tests pass; random-OT digests match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilds - SpinCode is the only SPIN glue: messageSize, prepare (reseed or rebuild), block and choice-byte transposes, encoder(). SpinOt.h/.cpp removed. - SpinConfigure moves to ConfigureCode.cpp (avoids an include cycle). - mSpin is std::optional<SpinCode>; the choice-bit workspace is lazy. - Choice bytes must be 0/1; portable multiply packing (no BMI2). - Drop -spinOtBench -choices; fix the installed-package consumer check; remove the AVX2 test skips and cover stationary noise. - Require and pin SPIN 0.4.2 (34a03e96): AArch64 NEON, portable fallback, MSVC. Docs: K >= 8192, platforms, ENABLE_VAES. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves Silent OT's SPIN profile to Turbo SPIN (SPIN 0.4.2), consolidates libOTe's SPIN glue into one header, and speeds up the sender's GGM expansion and hash.
Changes
Turbo SPIN. Silent OT uses
spin::Parameters::PacketRs8T64.thirdparty/getSpin.cmakepins spin_codes34a03e96(SPIN 0.4.2), andfind_package/find_dependencyrequire 0.4.2. The code size is no longer tied to the certified lengths: K is the request rounded up to a multiple of 128, with a floor of 8192 so the noise configuration has room for its partitions.Platforms. SPIN 0.4.2 runs on every little-endian CPU: AVX-512, AVX2+GFNI or AVX2 kernels on x86-64, NEON on AArch64 (including Apple silicon), and a portable C++ kernel elsewhere, all computing the same map.
SPIN_PORTABLE=ONbuilds SPIN with no intrinsics at all. SPIN also builds with MSVC now. The SPIN tests no longer skip without AVX2.One header,
libOTe/Tools/Spin/SpinCode.h.SpinOt.h/SpinOt.cppare removed.SpinCodeprovides:messageSize(requested);prepare(std::optional<SpinCode>&, ...), which reseeds in place when the size and noise match and rebuilds otherwise;encoder().SpinConfigurelives inConfigureCode.cppnext to the other codes, becauseSpinCode.hincludesConfigureCode.h. The sender and receiver holdstd::optional<SpinCode> mSpin, which can be emplaced afterconfigure()to take preparation off the critical path.GGM expansion (
RegularPprf.h). VAES kernels for master's per-tree expansion:ENABLE_AVX512is on.expandGgm8/hashGgmLeaves8. Each kernel keeps per-lane sums and XOR-folds them into the tree's level sum.Sender hash. Each
(r, r ^ Delta)pair is built in one YMM register, hashed, and stored straight to the output, with no stack batch or copy.Correlated-OT choice bits. Choice bits go through SPIN's bit-vector
transpose_bitsinstead of being widened to blocks for the record transpose. Choice bytes must be 0 or 1. Packing uses a portable multiply, so it needs no BMI2. The bit workspace is created on first use, so the sender never builds it.Benchmark.
-spinOtBench -checkprints a fixed-seed output digest, so two builds can be compared bit for bit.Consumer check. The installed-package test checks that the block and choice-byte transposes agree in both noise modes across reseeds.
The GGM and hash changes don't change any output. The PPRF tree, the leaf hash and the OT hash compute the same values.
Validation
Ryzen 9 7950X, Linux, GCC 15. Fresh clone of this branch, with SPIN fetched from the pinned GitHub commit. There are three builds of the same source:
ENABLE_AVX512=OFF: the 256-bit kernels;ENABLE_VAES=OFF: master's scalar GGM and hash.In all three builds, the
-u Spin,-u SilentOtand-u Pprftests pass.-spinOtBench -checkoutput digests are identical across all three builds at logN 13 and 18, for both regular and stationary noise. After theSpinCodeconsolidation, the full build passes the tests and the consumer check, and its digests and sender timing are unchanged.SPIN 0.4.2 test suite. Passes on:
SPIN_PORTABLE;SPIN_PORTABLE;SPIN_PORTABLE, and Clang 18 with NEON;Not tested on real Apple hardware, MSVC ARM64 or 32-bit targets.
Sender at K = 2^18, regular noise, non-temporal stores, one core. The baseline is master plus Turbo SPIN only, with VAES on in both builds:
Correlated-OT choice bits at K = 2^18: 0.653 → 0.213 ms (the old block-widening path against
transpose_bits), with outputs equal.Notes
ENABLE_VAESOFF, and then none of the VAES code runs. Pass-DENABLE_VAES=ONon VAES hardware.🤖 Generated with Claude Code