1
1
use powdr_ast:: analyzed:: Analyzed ;
2
+ use powdr_linker:: { DegreeMode , LinkerMode , LinkerParams } ;
2
3
use powdr_number:: {
3
4
BabyBearField , BigInt , Bn254Field , FieldElement , GoldilocksField , KoalaBearField ,
4
5
} ;
@@ -22,9 +23,17 @@ pub fn resolve_test_file(file_name: &str) -> PathBuf {
22
23
/// Makes a new pipeline for the given file. All steps until witness generation are
23
24
/// already computed, so that the test can branch off from there, without having to re-compute
24
25
/// these steps.
25
- pub fn make_simple_prepared_pipeline < T : FieldElement > ( file_name : & str ) -> Pipeline < T > {
26
+ pub fn make_simple_prepared_pipeline < T : FieldElement > (
27
+ file_name : & str ,
28
+ linker_mode : LinkerMode ,
29
+ ) -> Pipeline < T > {
30
+ let linker_params = LinkerParams {
31
+ mode : linker_mode,
32
+ degree_mode : DegreeMode :: Vadcop ,
33
+ } ;
26
34
let mut pipeline = Pipeline :: default ( )
27
35
. with_tmp_output ( )
36
+ . with_linker_params ( linker_params)
28
37
. from_file ( resolve_test_file ( file_name) ) ;
29
38
pipeline. compute_witness ( ) . unwrap ( ) ;
30
39
pipeline
@@ -37,9 +46,15 @@ pub fn make_prepared_pipeline<T: FieldElement>(
37
46
file_name : & str ,
38
47
inputs : Vec < T > ,
39
48
external_witness_values : Vec < ( String , Vec < T > ) > ,
49
+ linker_mode : LinkerMode ,
40
50
) -> Pipeline < T > {
51
+ let linker_params = LinkerParams {
52
+ mode : linker_mode,
53
+ degree_mode : DegreeMode :: Vadcop ,
54
+ } ;
41
55
let mut pipeline = Pipeline :: default ( )
42
56
. with_tmp_output ( )
57
+ . with_linker_params ( linker_params)
43
58
. from_file ( resolve_test_file ( file_name) )
44
59
. with_prover_inputs ( inputs)
45
60
. add_external_witness_values ( external_witness_values) ;
@@ -62,27 +77,37 @@ pub fn regular_test_small_field(file_name: &str, inputs: &[i32]) {
62
77
/// Tests witness generation, mock prover, pilcom and plonky3 with BabyBear.
63
78
pub fn regular_test_bb ( file_name : & str , inputs : & [ i32 ] ) {
64
79
let inputs_bb = inputs. iter ( ) . map ( |x| BabyBearField :: from ( * x) ) . collect ( ) ;
65
- let pipeline_bb = make_prepared_pipeline ( file_name, inputs_bb, vec ! [ ] ) ;
80
+ // LinkerMode::Native because the bus is not implemented for small fields
81
+ let pipeline_bb = make_prepared_pipeline ( file_name, inputs_bb, vec ! [ ] , LinkerMode :: Native ) ;
66
82
test_mock_backend ( pipeline_bb. clone ( ) ) ;
67
83
test_plonky3_pipeline ( pipeline_bb) ;
68
84
}
69
85
70
86
/// Tests witness generation, mock prover, pilcom and plonky3 with BabyBear and KoalaBear.
71
87
pub fn regular_test_kb ( file_name : & str , inputs : & [ i32 ] ) {
72
88
let inputs_kb = inputs. iter ( ) . map ( |x| KoalaBearField :: from ( * x) ) . collect ( ) ;
73
- let pipeline_kb = make_prepared_pipeline ( file_name, inputs_kb, vec ! [ ] ) ;
89
+ // LinkerMode::Native because the bus is not implemented for small fields
90
+ let pipeline_kb = make_prepared_pipeline ( file_name, inputs_kb, vec ! [ ] , LinkerMode :: Native ) ;
74
91
test_mock_backend ( pipeline_kb. clone ( ) ) ;
75
92
test_plonky3_pipeline ( pipeline_kb) ;
76
93
}
77
94
78
95
/// Tests witness generation, mock prover, pilcom and plonky3 with Goldilocks.
79
96
pub fn regular_test_gl ( file_name : & str , inputs : & [ i32 ] ) {
80
- let inputs_gl = inputs. iter ( ) . map ( |x| GoldilocksField :: from ( * x) ) . collect ( ) ;
81
- let pipeline_gl = make_prepared_pipeline ( file_name, inputs_gl, vec ! [ ] ) ;
82
-
83
- test_mock_backend ( pipeline_gl. clone ( ) ) ;
84
- run_pilcom_with_backend_variant ( pipeline_gl. clone ( ) , BackendVariant :: Composite ) . unwrap ( ) ;
85
- test_plonky3_pipeline ( pipeline_gl) ;
97
+ let inputs_gl = inputs
98
+ . iter ( )
99
+ . map ( |x| GoldilocksField :: from ( * x) )
100
+ . collect :: < Vec < _ > > ( ) ;
101
+
102
+ let pipeline_gl_native =
103
+ make_prepared_pipeline ( file_name, inputs_gl. clone ( ) , vec ! [ ] , LinkerMode :: Native ) ;
104
+ test_mock_backend ( pipeline_gl_native. clone ( ) ) ;
105
+ run_pilcom_with_backend_variant ( pipeline_gl_native, BackendVariant :: Composite ) . unwrap ( ) ;
106
+
107
+ let pipeline_gl_bus =
108
+ make_prepared_pipeline ( file_name, inputs_gl. clone ( ) , vec ! [ ] , LinkerMode :: Bus ) ;
109
+ test_mock_backend ( pipeline_gl_bus. clone ( ) ) ;
110
+ test_plonky3_pipeline ( pipeline_gl_bus) ;
86
111
}
87
112
88
113
pub fn test_pilcom ( pipeline : Pipeline < GoldilocksField > ) {
0 commit comments