Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ECCVM witness generation optimisation (#5211)
This PR modifies the witness generation code for the ECCVM circuit builder. In our ivc benchmarks, the overall proportion of work performed by ECCVM::create_prover has reduced from 10% to less than 1%. Key changes are multithreading witness generation, as well as removing a substantial number of field inversions that we were unnecessarily performing. The inversions are now more effectively performed via calling `field_t::batch_invert` ``` Benchmarking lock created at ~/BENCHMARK_IN_PROGRESS. client_ivc_bench 100% 15MB 47.2MB/s 00:00 2024-03-18T10:50:07+00:00 Running ./client_ivc_bench Run on (16 X 3631.57 MHz CPU s) CPU Caches: L1 Data 32 KiB (x8) L1 Instruction 32 KiB (x8) L2 Unified 1024 KiB (x8) L3 Unified 36608 KiB (x1) Load Average: 1.16, 0.82, 0.33 -------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... -------------------------------------------------------------------------------- ClientIVCBench/Full/6 23697 ms 18934 ms 1 Decider::construct_proof=1 Decider::construct_proof(t)=755.044M ECCVMComposer::compute_commitment_key=1 ECCVMComposer::compute_commitment_key(t)=3.77177M ECCVMComposer::compute_witness=1 ECCVMComposer::compute_witness(t)=129.434M ECCVMComposer::create_prover=1 ECCVMComposer::create_prover(t)=149.26M ECCVMComposer::create_proving_key=1 ECCVMComposer::create_proving_key(t)=15.833M ECCVMProver::construct_proof=1 ECCVMProver::construct_proof(t)=1.78177G Goblin::merge=11 Goblin::merge(t)=128.554M GoblinTranslatorCircuitBuilder::constructor=1 GoblinTranslatorCircuitBuilder::constructor(t)=58.2017M GoblinTranslatorComposer::create_prover=1 GoblinTranslatorComposer::create_prover(t)=121.617M GoblinTranslatorProver::construct_proof=1 GoblinTranslatorProver::construct_proof(t)=928.122M ProtoGalaxyProver_::accumulator_update_round=10 ProtoGalaxyProver_::accumulator_update_round(t)=727.574M ProtoGalaxyProver_::combiner_quotient_round=10 ProtoGalaxyProver_::combiner_quotient_round(t)=7.29332G ProtoGalaxyProver_::perturbator_round=10 ProtoGalaxyProver_::perturbator_round(t)=1.32753G ProtoGalaxyProver_::preparation_round=10 ProtoGalaxyProver_::preparation_round(t)=4.16456G ProtogalaxyProver::fold_instances=10 ProtogalaxyProver::fold_instances(t)=13.513G ProverInstance(Circuit&)=11 ProverInstance(Circuit&)(t)=1.96494G batch_mul_with_endomorphism=30 batch_mul_with_endomorphism(t)=567.025M commit=425 commit(t)=4.03553G compute_combiner=10 compute_combiner(t)=7.29114G compute_perturbator=9 compute_perturbator(t)=1.32717G compute_univariate=48 compute_univariate(t)=1.43152G construct_circuits=6 construct_circuits(t)=4.27911G Benchmarking lock deleted. client_ivc_bench.json 100% 4027 130.8KB/s 00:00 function ms % sum construct_circuits(t) 4279 18.12% ProverInstance(Circuit&)(t) 1965 8.32% ProtogalaxyProver::fold_instances(t) 13513 57.21% Decider::construct_proof(t) 755 3.20% ECCVMComposer::create_prover(t) 149 0.63% GoblinTranslatorComposer::create_prover(t) 122 0.51% ECCVMProver::construct_proof(t) 1782 7.54% GoblinTranslatorProver::construct_proof(t) 928 3.93% Goblin::merge(t) 129 0.54% Total time accounted for: 23621ms/23697ms = 99.68% Major contributors: function ms % sum commit(t) 4036 17.08% compute_combiner(t) 7291 30.87% compute_perturbator(t) 1327 5.62% compute_univariate(t) 1432 6.06% Breakdown of ECCVMProver::create_prover: ECCVMComposer::compute_witness(t) 129 86.72% ECCVMComposer::create_proving_key(t) 16 10.61% Breakdown of ProtogalaxyProver::fold_instances: ProtoGalaxyProver_::preparation_round(t) 4165 30.82% ProtoGalaxyProver_::perturbator_round(t) 1328 9.82% ProtoGalaxyProver_::combiner_quotient_round(t) 7293 53.97% ProtoGalaxyProver_::accumulator_update_round(t) 728 5.38% ```
- Loading branch information