@@ -542,48 +542,6 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> TowerProver<CpuBacke
542542impl < E : ExtensionField , PCS : PolynomialCommitmentScheme < E > > MainSumcheckProver < CpuBackend < E , PCS > >
543543 for CpuProver < CpuBackend < E , PCS > >
544544{
545- #[ allow( clippy:: type_complexity) ]
546- #[ tracing:: instrument( skip_all, name = "table_witness" , fields( profiling_3) , level = "trace" ) ]
547- fn table_witness < ' a > (
548- & self ,
549- input : & ProofInput < ' a , CpuBackend < <CpuBackend < E , PCS > as ProverBackend >:: E , PCS > > ,
550- cs : & ConstraintSystem < <CpuBackend < E , PCS > as ProverBackend >:: E > ,
551- challenges : & [ <CpuBackend < E , PCS > as ProverBackend >:: E ] ,
552- ) -> Vec < Arc < <CpuBackend < E , PCS > as ProverBackend >:: MultilinearPoly < ' a > > > {
553- // main constraint: lookup denominator and numerator record witness inference
554- let record_span = entered_span ! ( "record" ) ;
555- let records: Vec < ArcMultilinearExtension < ' _ , E > > = cs
556- . r_table_expressions
557- . par_iter ( )
558- . map ( |r| & r. expr )
559- . chain ( cs. r_expressions . par_iter ( ) )
560- . chain ( cs. w_table_expressions . par_iter ( ) . map ( |w| & w. expr ) )
561- . chain ( cs. w_expressions . par_iter ( ) )
562- . chain (
563- cs. lk_table_expressions
564- . par_iter ( )
565- . map ( |lk| & lk. multiplicity ) ,
566- )
567- . chain ( cs. lk_table_expressions . par_iter ( ) . map ( |lk| & lk. values ) )
568- . chain ( cs. lk_expressions . par_iter ( ) )
569- . map ( |expr| {
570- wit_infer_by_expr (
571- expr,
572- cs. num_witin ,
573- cs. num_structural_witin ,
574- cs. num_fixed as WitnessId ,
575- & input. fixed ,
576- & input. witness ,
577- & input. structural_witness ,
578- & input. public_input ,
579- challenges,
580- )
581- } )
582- . collect ( ) ;
583- exit_span ! ( record_span) ;
584- records
585- }
586-
587545 #[ allow( clippy:: type_complexity) ]
588546 #[ tracing:: instrument(
589547 skip_all,
@@ -619,42 +577,15 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> MainSumcheckProver<C
619577 let num_var_with_rotation = log2_num_instances + composed_cs. rotation_vars ( ) . unwrap_or ( 0 ) ;
620578
621579 if let Some ( gkr_circuit) = gkr_circuit {
622- // let pub_io_evals = // get public io evaluations
623- // cs.instance_openings
624- // .keys()
625- // .sorted()
626- // .map(|Instance(inst_id)| {
627- // let mle = &input.public_input[*inst_id];
628- // assert_eq!(
629- // mle.evaluations.len(),
630- // 1,
631- // "doesnt support instance with evaluation length > 1"
632- // );
633- // match mle.evaluations() {
634- // FieldType::Base(smart_slice) => E::from(smart_slice[0]),
635- // FieldType::Ext(smart_slice) => smart_slice[0],
636- // _ => unreachable!(),
637- // }
638- // })
639- // .collect_vec();
640- let pub_io_evals = // get public io evaluations
641- input. public_input
642- . iter ( ) . map ( |mle| {
643- match mle. evaluations ( ) {
644- FieldType :: Base ( smart_slice) => E :: from ( smart_slice[ 0 ] ) ,
645- FieldType :: Ext ( smart_slice) => smart_slice[ 0 ] ,
646- _ => unreachable ! ( ) ,
647- }
648- } )
649- . collect_vec ( ) ;
650- let filtered_pub_io_mle = cs
580+ let pub_io_mles = cs
651581 . instance_openings
652582 . iter ( )
653- . map ( |( id , _ ) | input. public_input [ id . 0 ] . clone ( ) )
583+ . map ( |instance | input. public_input [ instance . 0 ] . clone ( ) )
654584 . collect_vec ( ) ;
655585 let GKRProverOutput {
656586 gkr_proof,
657587 opening_evaluations,
588+ mut rt,
658589 } = gkr_circuit. prove :: < CpuBackend < E , PCS > , CpuProver < _ > > (
659590 num_threads,
660591 num_var_with_rotation,
@@ -664,21 +595,26 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> MainSumcheckProver<C
664595 & input. witness,
665596 & input. structural_witness,
666597 & input. fixed,
667- & filtered_pub_io_mle ,
598+ & pub_io_mles ,
668599 )
669600 . cloned( )
670601 . collect_vec( ) ,
671602 ) ] ,
672603 } ,
673604 // eval value doesnt matter as it wont be used by prover
674605 & vec ! [ PointAndEval :: new( rt_tower, E :: ZERO ) ; gkr_circuit. final_out_evals. len( ) ] ,
675- & pub_io_evals,
606+ & input
607+ . pub_io_evals
608+ . iter ( )
609+ . map ( |v| v. map_either ( E :: from, |v| v) . into_inner ( ) )
610+ . collect_vec ( ) ,
676611 challenges,
677612 transcript,
678613 num_instances,
679614 ) ?;
615+ assert_eq ! ( rt. len( ) , 1 , "TODO support multi-layer gkr iop" ) ;
680616 Ok ( (
681- opening_evaluations [ 0 ] . point . clone ( ) ,
617+ rt . remove ( 0 ) ,
682618 MainSumcheckEvals {
683619 wits_in_evals : opening_evaluations
684620 . iter ( )
@@ -688,7 +624,7 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> MainSumcheckProver<C
688624 . collect_vec ( ) ,
689625 fixed_in_evals : opening_evaluations
690626 . iter ( )
691- . skip ( ( cs. num_witin + cs . num_structural_witin ) as usize )
627+ . skip ( cs. num_witin as usize )
692628 . take ( cs. num_fixed )
693629 . map ( |Evaluation { value, .. } | value)
694630 . copied ( )
0 commit comments