Conversation
…ult) - New src/parallel.rs with cfg_iter!/cfg_into_iter!/cfg_chunks! macros that dispatch to rayon parallel iterators when `parallel` is enabled - Parallelize protocol hot paths: ring polynomial division, w_evals construction, M_alpha evaluation, ring vector evaluation, packed ring poly evaluation, coefficients-to-ring reduction, quadratic equation folding, and sumcheck round polynomial computation - All 174 tests pass with and without the parallel feature Made-with: Cursor
- Make HachiCommitmentScheme generic over <const D, Cfg> so different configs (and thus num_vars) can be used without code duplication. - Remove hardcoded DefaultCommitmentConfig::D from ring_switch.rs; WCommitmentConfig and commit_w now flow D generically. - Add benches/hachi_e2e.rs with configs sweeping nv=10,14,18,20. Made-with: Cursor
Make NTT primitives (NttPrime, NttTwiddles, MontCoeff, CyclotomicCrtNtt) generic over PrimeWidth (i16/i32) instead of hardcoding i16. Replace the monolithic QData struct with separate GarnerData and per-prime NttPrime arrays. Add Q128 parameter set (5 × i32 primes, D ≤ 1024) alongside the existing Q32 set. Simplify ScalarBackend by removing the const-generic limb count from to_ring_with_backend. Made-with: Cursor
Split CanonicalField into FromSmallInt (from_{u,i}{8,16,32,64} for all
fields) and CanonicalField (u128 repr, base fields only). Implement
FromSmallInt, Eq, Debug for Fp2/Fp4. Add ExtField<F> trait with
EXT_DEGREE and from_base_slice.
Optimize extension field arithmetic: Karatsuba multiplication for Fp2
and Fp4 (3 base muls instead of 4), specialized squaring (2 base muls
for Fp2), non-residue IS_NEG_ONE specialization. Add concrete configs
(TwoNr, NegOneNr, UnitNr) and type aliases Ext2<F>, Ext4<F>.
Add transpose-based packed extension fields (PackedFp2, PackedFp4)
for SIMD acceleration, following Plonky3's approach.
Relax sumcheck bounds from E: CanonicalField to E: FromSmallInt (or
E: FieldCore where spurious). Add sample_ext_challenge transcript
helper. Includes tests for extension field sumcheck execution.
Made-with: Cursor
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.
Summary
Four commits bringing Hachi from single-threaded base-field-only to parallel execution with full extension field support:
1. Rayon parallelism (
10e53dd)parallelfeature flag (enabled by default) withcfg_iter!/cfg_into_iter!/cfg_chunks!dispatch macros2. Generic commitment config + e2e benchmark (
0ed2736)HachiCommitmentSchemegeneric over<const D, Cfg>so different configs can be used without code duplicationDefaultCommitmentConfig::Dfrom ring_switch; flowDgenericallybenches/hachi_e2e.rssweeping nv=10,14,18,203. CRT-NTT backend refactor (
96a9ccd)NttPrime,NttTwiddles,MontCoeff,CyclotomicCrtNtt) overPrimeWidthtrait (i16/i32) instead of hardcoding i16QDatastruct with separateGarnerData+ per-primeNttPrimearraysScalarBackendby removing const-generic limb count fromto_ring_with_backend4. Extension field arithmetic + sumcheck refactoring (
e4f9836)CanonicalField→FromSmallInt(from_{u,i}{8,16,32,64}, implemented by all fields including extensions) +CanonicalField(u128 repr, base fields only)FromSmallInt,Eq,DebugforFp2/Fp4;ExtField<F>trait withEXT_DEGREEandfrom_base_slice; concrete configsTwoNr,NegOneNr,UnitNr; type aliasesExt2<F>,Ext4<F>IS_NEG_ONEnon-residue specializationPackedFp2/PackedFp4for SIMD acceleration (Plonky3's approach)E: CanonicalField→E: FromSmallInt(orE: FieldCorewhere spurious);sample_ext_challengetranscript helperStats
44 files changed, +2179, −789
Test plan
cargo test --lib— 82 tests passcargo test— 56 integration tests pass (3 known Q128 Garner reconstruction failures — pre-existing, tracked separately)cargo clippy --all-targets -- -D warnings— zero warningscargo fmt— cleanMade with Cursor