10
10
#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp"
11
11
#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
12
12
#include "barretenberg/honk/proof_system/logderivative_library.hpp"
13
+ #include "barretenberg/vm/stats.hpp"
13
14
14
15
namespace bb {
15
16
@@ -18,26 +19,40 @@ namespace bb {
18
19
ProverPolynomials polys;
19
20
20
21
// Allocate mem for each column
21
-
22
- for (auto& poly : polys.get_to_be_shifted()) {
23
- poly = Polynomial::shiftable(num_rows);
24
- }
22
+ AVM_TRACK_TIME("circuit_builder/init_polys_to_be_shifted", ({
23
+ for (auto& poly : polys.get_to_be_shifted()) {
24
+ poly = Polynomial{ /*memory size*/ num_rows - 1,
25
+ /*largest possible index*/ num_rows,
26
+ /*make shiftable with offset*/ 1 };
27
+ }
28
+ }));
25
29
// catch-all with fully formed polynomials
26
- for (auto& poly : polys.get_unshifted()) {
27
- if (poly.is_empty()) {
28
- poly = Polynomial{ num_rows };
29
- }
30
- }
31
-
32
- for (size_t i = 0; i < rows.size(); i++) {
30
+ AVM_TRACK_TIME("circuit_builder/init_polys_unshifted", ({
31
+ auto unshifted = polys.get_unshifted();
32
+ bb::parallel_for(unshifted.size(), [& ](size_t i) {
33
+ auto& poly = unshifted[i];
34
+ if (poly.is_empty()) {
35
+ // Not set above
36
+ poly = Polynomial{ /*memory size*/ num_rows, /*largest possible index*/ num_rows };
37
+ }
38
+ });
39
+ }));
40
+
41
+ AVM_TRACK_TIME(
42
+ "circuit_builder/set_polys_unshifted", ({
43
+ bb::parallel_for(rows.size(), [& ](size_t i) {
33
44
{{ #each all_cols_without_inverses as |poly |}}
34
45
polys.{{ poly }} .set_if_valid_index(i, rows[i].{{ poly }} );
35
46
{{ /each }}
36
- }
47
+ });
48
+ }));
37
49
38
- for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) {
39
- shifted = to_be_shifted.shifted();
40
- }
50
+ AVM_TRACK_TIME(
51
+ "circuit_builder/set_polys_shifted", ({
52
+ for (auto [shifted, to_be_shifted] : zip_view(polys.get_shifted(), polys.get_to_be_shifted())) {
53
+ shifted = to_be_shifted.shifted();
54
+ }
55
+ }));
41
56
42
57
return polys;
43
58
}
0 commit comments