R4 SIMD128 Schnorr experiment — 2026-10-26

This file preserves the R4 source design, native proof stages and installed experiment receipts. The current implementation also includes paired-wide carries, indexed gather/scatter, finite-mask paths, public-only radix-32 GLV preparation and density-gated checked affine-pair scheduling. See the current API and architecture and measured choices. The evidence and counts below describe their named historical artifacts.

This feature-gated experiment changes the public BIP340 MSM backend to four independent Jacobian lanes using the existing IC Wasm SIMD128 instruction set. It changes no IC, PocketIC, SDK, runtime, enabled-instruction support, secret arithmetic, signature, hint-validation, transcript or coefficient policy. Enable the batch crate's wasm-msm-simd feature. The pinned SDK target profile already enables +simd128; native tests execute the checked scalar-lane model.

The field foundation is the separate ECDSA lane's ffe6a334 primitive (local cherry-pick 7dc2cbc2). Its exact radix-26 multiplication/carry schedule widens the pinned k256 0.13.4 scalar field into low/high pairs of u64x2 accumulators. The point layer applies the existing scalar dbl-2009-l, madd-2004-hmv and add-1998-cmo-2 equations to four independent points. Identity, equal and opposite cases are selected per lane. It retains X<=6,Y<=3,Z<=2 and every field multiply/square input remains within the original magnitude-eight bound.

Pippenger first assigns each empty bucket without a full addition. Subsequent updates to four distinct targets share one point4 mixed addition; a repeated pending target flushes the group before reuse. Packing and scatter use opaque single-lane radix-26 coordinates, preserving lazy magnitudes without repeated byte conversion. Affine coordinates and GLV images are constructed fresh within the call. These caches are temporary derived arithmetic scratch. Every supplied hint is checked against its original x, and the original public key, message and signature bytes retain the same complete transcript.

Bucket reduction uses four interleaved running sums. Lane r stores R_r=sum_q B_(4q+r) and S_r=sum_q (q+1)B_(4q+r), r=1..4. The exact window sum is sum_r(4*S_r-(4-r)*R_r). This keeps the long bucket scans independent across lanes. Horizontal combination and the final Horner accumulator use the same exact point formulas; no affine inversion is needed to decide acceptance.

The native 100-person fixture produced 402 freshly prepared GLV affine slots, 19 windows, 1,150 first assignments, 1,789 vector mixed calls over 6,285 useful lanes, 389 collision flushes and 289 bucket blocks. These are scheduling counts for that exact synthetic corpus, not IC instruction, latency or page estimates. Packing, masks, unfilled lanes, coordinate conversion, temporary storage and cleanup all belong inside measured verification.

For N=100/W7/GLV, Wasm backing includes 201 ordinary terms, 402 scalar encodings, 402 radix-26 affine slots and 64 radix-26 buckets. Relative to the qualified scalar backend, the fresh affine/GLV scratch adds 33,768 bytes. Native backing sizes cannot predict page placement; the actual full incoming Wire results below include region access and dirty fees.

Primary design references:

The actual compiled IC catalog prices each unsigned low/high 32-to64 widening multiply at one unit, so four exact lane products cost two versus four scalar products. The measurements below include Wasm64 loads/stores, shuffles, spills, carry operations and page fees. Pinned catalog SHA256 is bc0db6fdf63d0a2e237f57f7505f845d83e23f203eaaffbcb498be3142b34229; matching instrumentation source SHA256 is da5f8f0637fe34d611755b5d89d6497458846aa15f8f9f148fa28318592c02da.

The private canister adapter is enabled with wasm-schnorr-msm-simd. Existing fresh_verify_schnorr request/response schemas are unchanged. Backend 6 selects SIMD GLV/W7, backend 7 SIMD GLV/W8, and backend 8 SIMD nonGLV/W6. Backends 0..5 keep the qualified scalar controls. A Wasm build lacking the existing simd128 target feature is rejected at compile time for this adapter; there is no runtime feature probe or CPU/AVX dispatch. The parent host maps these IDs to simd-jacobian-glv-w7, simd-jacobian-glv-w8 and simd-jacobian-w6.

The adapter borrows incoming records, allocates ordinary terms, encoded scalars, radix-26 affine/GLV scratch and buckets inside the body, and drops every buffer before the parent's ending counter. It reports their combined backing bytes. Any aggregate false/error runs the existing exact individual verifier over all records, preserving hint errors and verdicts. Native adapter checks cover 100 different incoming keys in all three hint modes, invalid/mixed cohorts, combined bad-hint/bad-scalar errors, complete fallback and the unchanged 500-record Wire visitor budget.

Before IC measurements, the native suites passed 26 batch tests, 43 secp tests, five SIMD adapter tests and three default adapter controls. They include all 19 official BIP340 vectors, full-width weighted-MSM comparisons, point edge cases, batch sizes through 500 and multiple distinct 100-person cohorts. An independent read-only review also checked per-lane exceptional cases, signed bucket reductions and collision-heavy schedules without finding a defect.

Actual Wasm64 qualification on 2026-10-26 used the parent's canonical r4-ec-simd-firstwave-r2-20261025 artifact. Every primary call receives 100 different, previously unknown public keys, 100 signatures and 100 messages of 32 bytes. Public-Y and nonce-Y hints, when selected, arrive in the same packet. Parsing, checked point lifting, complete standard transcript coefficients, GLV splits, every temporary workspace and its destruction are inside the measured call. prior_call_preparation is false. The exact saved corpus is independently verified with Noble 1.9.7 and reused unchanged for the scalar control.

With both Y hints, SIMD GLV/W8 reduces authoritative whole-message instructions by 20.8145% against scalar GLV/W7 in the same artifact. Its body reduction is 21.7432%. Each row has three identical successful samples; these are exact metered counts, without subtracting controls or page charges.

N100 backend, P+R Y Whole instructions Body instructions Included page instructions Reported workspace bytes
Scalar GLV/W7 98,758,429 94,540,942 880,000 45,322
SIMD GLV/W7 81,516,637 77,299,150 1,040,000 79,090
SIMD GLV/W8 78,202,308 73,984,752 1,040,000 87,026
SIMD nonGLV/W6 90,688,065 86,470,578 1,040,000 51,605

The winning W8 configuration allocates 201 ordinary terms, 402 scalar encodings, 402 fresh affine/GLV slots and 128 buckets. Reported backing excludes stack frames; whole-message charging includes their actual accesses. The higher SIMD page fee is already included in the comparison. Incoming packets contain 19,503 bytes with both hints, 16,303 with public-Y only and 13,103 without hints. All three hint modes retain the same acceptance and full coefficient policy.

N100 valid hint mode Scalar GLV/W7 whole / body SIMD GLV/W8 whole / body
Public-Y and nonce-Y 98,758,429 / 94,540,942 78,202,308 / 73,984,752
Public-Y 113,944,681 / 110,346,242 93,388,560 / 89,790,052
None 129,118,439 / 125,978,821 108,561,679 / 105,421,992

All invalid and mixed N100 calls attempt the aggregate, then recheck all 100 signatures independently. The invalid corpus returns zero valid rows and the mixed corpus 50. Each entry below has three identical samples. Page charges remain 880,000 for scalar and 1,040,000 for SIMD in every hint mode; the archived packet receipts also retain their unmodified body counters.

N100 hint mode Scalar invalid / mixed whole SIMD invalid / mixed whole
Public-Y and nonce-Y 294,551,086 / 294,585,860 274,115,631 / 273,951,697
Public-Y 325,111,788 / 325,147,732 304,676,333 / 304,513,569
None 356,040,846 / 356,091,506 335,604,752 / 335,456,704

Actual IC correctness checks additionally cover odd tails N1,3,5,7,31,33,99 with all three SIMD backends, valid/invalid/mixed patterns, wrong public/nonce Y and out-of-range S. N100 diagnostics check wrong, odd and noncanonical Y hints. Twenty further N100 calls cover noncanonical and off-curve public/nonce x and canonical S=0, using SIMD W8 and scalar W7 with both hints and without hints. Each changes only row 37, rechecks all 100 and preserves the other 99 valid rows. S=0 remains a canonical admitted scalar; this particular signature fails its equation with no scalar-format error. The odd-size calls establish correctness; the performance comparison applies to the measured N100 workload.

Across the four successful qualification directories, offline audits verify 271 update packets and traces, 16,159 logical records including controls and 10,682 exact fallback single-verifier invocations. Every packet is reconstructed from the saved corpus and independently checked; module hashes, source archives, physical attempts, reply verdicts, fallback counters and page charges match. No execution trace is truncated, no attempt is discarded and all owned servers exit cleanly. Failed host-audit attempts in the msm-04 and msm-05 result directories remain archived: they encountered JSON counter typing and a host accounting-property name, respectively, after the first reply assertions passed. They are excluded from successful qualification counts.

The W8 verification profile reconciles exactly: 72,929,334 static + 4,199,071 dynamic + 33,903 API + 1,040,000 page instructions = 78,202,308, with zero unexplained instructions and zero observer delta. The control ledger also reconciles with zero observer delta. Source attribution finds archived lines at 529 of 558 queried verification points and 400 of 408 control points. stackDetailsTruncated=true in both profiles; dynamic stack coverage is incomplete even though total instruction accounting reconciles.

Read-only disassembly of the exact canonical artifact confirms real field vector arithmetic: PublicField4::mul contains 200 unsigned low/high i64x2.extmul_*_i32x4_u operations and square 110. Their static v128 load/store counts are 20/10 and 10/10. The point mixed-add contains 192 loads and 114 stores; full-add 190 and 60. These counts expose packing/spill costs and are not dynamic instruction estimates. Static stack reservations are 4,048 bytes for the MSM driver, 1,984 for flush, 2,544 for mixed-add, 1,120 for double, 2,976 for bucket reduction and 2,576 for full-add. Field multiply/square have no own linear-stack reservation. These frame sizes cannot be summed into a peak-memory claim.

The artifact is pinned by SHA256 5d408bc0280fe4bba1ae9b3b0052b31a42b46c1855369cd45a089a301a91dfa4; its manifest is 3ac08d9fa84ef09d24aa0c4935a523d5009bfe6865e1bfc8af8dc7b296bcd1c7. The corpus SHA256 is 7ea88074ad0d67ec08049d27323a629f208d46a8b4514637eb2d15b1bafe2e42. PocketIC 16.1.0 binary SHA256 is 6a9a75ad9b4551d2b0f4a0d954ffb8bd5bbd0ebc44ac00290679b06ad0b2f8e6. The canonical build uses wasm64-unknown-unknown, nightly-2026-10-15, +simd128, opt-level 3, thin LTO and one codegen unit. The SDK commit remains 33f54b62b46a6693ff6e193a752e052eaa124884.

Relevant compiled source SHA256 pins are recorded below; the manifest and each audit retain the complete source set and original artifact verification.

Compiled source SHA256
batch/src/simd_msm.rs abf898a3d4d9f02822bf2a01b39273e811e1613eef3e05e838d75a7aa4660a99
simd4/field.rs e737de297854231782d6159f984325963379dfd8f6bc00bed34c92f73c1f872a
simd4/lanes.rs 9bd2c93188e625a25ffdcfe1e8a93c70c6cd88882ca114c0f4761152595e5b5b
simd4/msm_points.rs 9611284664f073a8dd653ad1368df2c3ef0a9f3916fd204628148084fe621a73
canister/src/fresh_schnorr.rs d87bb1ba7fd33769804e9ed7f5529895c6b3247569750477faa465cdaf99091f
canister/src/fresh_schnorr_simd.rs ff30d202e299b24df0ab117f23ffefbf8ce8484a8023f35b8af59946a7f0297a

The following historical raw receipts are unavailable; their recorded hashes are retained:

Audit SHA256 of audit.json
N100 P+R backend comparison 75f902f5c548f1a9f3e06da52f1cafbf8159cc38a115d9688e8bb97873976a07
N100 hint/failure matrix and profiles 9e54bb58944102f6ef0427b36158422a3808d8fc9f48894f27327cf1ca1a9784
Odd tails and fallback diagnostics 931e5c65b76060eceb319a8573487918c14865dbdd17fa16f3c7982290d10bc6
N100 malformed points and canonical zero S b01171ec45bbf42941ff1ea71e01bad8fb3019c6411c7a786a9b192aeef3004c

The exact-artifact disassembly receipt has SHA256 1abf21a4253ba8d974dbeac8633c05e8c91f230b6272b86c945b42b5b410c344. Its initial unsuccessful demangled-symbol selection is preserved separately. The successful verification and control source-profile SHA256 values are 8ed1488ec29f103f46dc89ac9ed9d1aefbb5d4832b63a471d83d1b6d8e4a281f and 3a2295125acaf0262a5b2ca476d28f062a307a53dcd9465f08b5c39b52748320.