Commit 398a5e6
authored
feat(bb): faster create_circuit — arithmetic, tiled gate storage, containers, cold assert paths (#537)
* feat(bb): faster create_circuit — wide arithmetic, tiled (AoSoA) gate storage, size hints
Barrett fast paths for scalar-field divmod, native Montgomery + safegcd
bigfield division, constexpr folding for small field literals, gate storage
as 8-gate tiles with contiguous per-selector arrays (single append_gate
surface, bulk copy_into extraction), and builder size hints from ACIR.
* feat(bb): container and allocation optimizations (polynomial backing, copy cycles, builder reserves)
Lazy zero-initialized (anonymous mmap) polynomial backing memory, CSR copy
cycles in trace population, and reserved per-variable bookkeeping vectors in
the ACIR builder path.
* feat(bb): compile BB_BENCH instrumentation out of shipped wasm
Sets ENABLE_WASM_BENCH=OFF in the wasm-threads preset so the released
wasm no longer carries op-counting overhead. Wasm bench runs keep
wall-clock and peak-memory measurements; hierarchical breakdowns and
memory profiles are native-only, and the CI breakdown upload is skipped
for wasm. Configure with -DENABLE_WASM_BENCH=ON to get wasm op counts
for dev runs.
* refactor(bb): review feedback — name magic numbers, drop stale comment, GateRowT alias
- databus selector array sized by NUM_BUS_COLUMNS instead of a literal 7
- named constants for the ACIR block size hints and variable reserve
- remove orphaned doc block for the deleted check_selector_length_consistency
- replace 19 'typename std::decay_t<decltype(...)>::Row' sites with the existing GateRowT alias
* refactor(bb): single NON_GATE_SELECTORS table drives gate-storage selector wiring
The non-gate selector list (q_m, q_c, q_1..q_5) was duplicated across GateRow,
GateTile, append_gate's copies, the columns_ wiring, and a literal 7. A single
constexpr member-pointer table now defines the list and its order; the count,
append_gate, and column construction derive from it. Also: GATE_TILE_SHIFT
derived from GATE_TILE_SIZE (power-of-two asserted), tile-size comment expressed
in terms of sizeof(FF), and shared gate_selector_or_zero read helper.1 parent 5e9fe41 commit 398a5e6
22 files changed
Lines changed: 1175 additions & 832 deletions
File tree
- barretenberg
- .claude/skills/benchmark-chonk
- cpp
- scripts
- src/barretenberg
- benchmark/ultra_bench
- circuit_checker
- dsl/acir_format
- honk
- composer
- execution_trace
- op_queue
- stdlib_circuit_builders
- stdlib/primitives/bigfield
- trace_to_polynomials
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
199 | | - | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
265 | | - | |
| 267 | + | |
| 268 | + | |
266 | 269 | | |
267 | 270 | | |
268 | 271 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
| 179 | + | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| 192 | + | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
Lines changed: 13 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
556 | 555 | | |
557 | 556 | | |
558 | 557 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
569 | 562 | | |
570 | 563 | | |
571 | 564 | | |
| |||
0 commit comments