@@ -18,19 +18,18 @@ use std::sync::Arc;
1818use criterion:: { black_box, criterion_group, criterion_main, BatchSize , BenchmarkId , Criterion } ;
1919use rand:: { rngs:: StdRng , Rng , SeedableRng } ;
2020use slop_challenger:: { FieldChallenger , IopCtx } ;
21- use slop_multilinear:: { MultilinearPcsChallenger , Point } ;
21+ use slop_multilinear:: Point ;
2222use sp1_core_machine:: riscv:: RiscvAir ;
23- use sp1_gpu_cudart:: { DevicePoint , TaskScope } ;
23+ use sp1_gpu_cudart:: TaskScope ;
2424use sp1_gpu_jagged_tracegen:: test_utils:: bench_utils:: {
2525 with_trace_source, FullKind , RealTraceData ,
2626} ;
2727use sp1_gpu_jagged_tracegen:: test_utils:: tracegen_setup:: CORE_MAX_LOG_ROW_COUNT ;
28- use sp1_gpu_logup_gkr:: {
29- generate_gkr_circuit, prove_gkr_circuit, CudaLogUpGkrOptions , Interactions ,
30- } ;
28+ use sp1_gpu_logup_gkr:: { generate_gkr_circuit, prove_logup_gkr, CudaLogUpGkrOptions , Interactions } ;
3129use sp1_gpu_utils:: { Ext , Felt , TestGC } ;
3230use sp1_hypercube:: air:: MachineAir ;
3331use sp1_hypercube:: Chip ;
32+ use sp1_primitives:: SP1GlobalContext ;
3433
3534/// `prove_gkr_circuit` flag: when true, the prover recomputes the first layer on demand from
3635/// the raw trace each time it walks back to the leaves; when false, it caches the materialized
@@ -125,66 +124,23 @@ fn run_prove<R: Rng>(
125124) {
126125 let RealTraceData { machine : _, cluster, public_values : _, device_mle } = data;
127126 let interactions = build_interactions ( & cluster, scope) ;
128- let beta_dim = beta_seed_dim ( & cluster) ;
129-
130- // initial_number_of_variables = num_interaction_variables + 1, where
131- // num_interaction_variables is `log2(num_total_interactions).next_power_of_two()`.
132- let num_interactions: usize =
133- cluster. iter ( ) . map ( |chip| chip. sends ( ) . len ( ) + chip. receives ( ) . len ( ) ) . sum ( ) ;
134- let initial_number_of_variables = num_interactions. next_power_of_two ( ) . trailing_zeros ( ) + 1 ;
135127
136128 let mut group = c. benchmark_group ( "prove" ) ;
137129 group. sample_size ( 10 ) ;
138130 group. bench_with_input ( id, & ( ) , |b, _| {
139131 b. iter_batched (
140132 || {
141- // Per-iteration setup. Mirrors `prove_logup_gkr` lines 198-244 but skips the
142- // observe-output-claims step (which only affects challenger state, not the
143- // prove call's runtime). We still build the circuit and compute the initial
144- // numerator/denominator evaluations because `prove_gkr_circuit` consumes both.
145- let mut challenger = TestGC :: default_challenger ( ) ;
146- let alpha: Ext = challenger. sample_ext_element ( ) ;
147- let beta_seed: Point < Ext > =
148- ( 0 ..beta_dim) . map ( |_| challenger. sample_ext_element :: < Ext > ( ) ) . collect ( ) ;
149-
150- let ( output, circuit) = generate_gkr_circuit (
133+ let challenger = TestGC :: default_challenger ( ) ;
134+ scope. synchronize_blocking ( ) . unwrap ( ) ;
135+ ( interactions. clone ( ) , challenger)
136+ } ,
137+ |( interactions, mut challenger) | {
138+ let result = prove_logup_gkr :: < SP1GlobalContext , _ > (
151139 & cluster,
152- interactions. clone ( ) ,
140+ interactions,
153141 & device_mle,
154- alpha,
155- beta_seed,
156142 GKR_OPTIONS ,
157- scope. clone ( ) ,
158- ) ;
159-
160- let first_eval_point = challenger. sample_point :: < Ext > ( initial_number_of_variables) ;
161- let first_point =
162- DevicePoint :: from_host ( & first_eval_point, output. numerator . backend ( ) )
163- . unwrap ( )
164- . into_inner ( ) ;
165- let first_point_eq = DevicePoint :: new ( first_point) . partial_lagrange ( ) ;
166- let first_numerator_eval =
167- output. numerator . eval_at_eq ( & first_point_eq) . to_host_vec ( ) . unwrap ( ) [ 0 ] ;
168- let first_denominator_eval =
169- output. denominator . eval_at_eq ( & first_point_eq) . to_host_vec ( ) . unwrap ( ) [ 0 ] ;
170-
171- scope. synchronize_blocking ( ) . unwrap ( ) ;
172- (
173- first_numerator_eval,
174- first_denominator_eval,
175- first_eval_point,
176- circuit,
177- challenger,
178- )
179- } ,
180- |( num_eval, den_eval, eval_point, circuit, mut challenger) | {
181- let result = prove_gkr_circuit (
182- num_eval,
183- den_eval,
184- eval_point,
185- circuit,
186143 & mut challenger,
187- RECOMPUTE_FIRST_LAYER ,
188144 ) ;
189145 scope. synchronize_blocking ( ) . unwrap ( ) ;
190146 black_box ( result)
0 commit comments