Skip to content

Commit 4017643

Browse files
authored
feat: merge-train/barretenberg (#20641)
BEGIN_COMMIT_OVERRIDE chore: chonk rec ver 0 (#20506) fix: allocate non-gate selectors at trace-active size instead of dyadic size (#20600) chore: numeric audit 0 (#20491) chore: prepare barretenberg-rs for crates.io publishing (#20496) chore: add build_bench to ci-barretenberg-full (#20650) chore: add component graphs for app-proving benchmarks (#20649) END_COMMIT_OVERRIDE
2 parents 883769a + bbcbc64 commit 4017643

40 files changed

+1255
-881
lines changed

barretenberg/cpp/scripts/audit/audit_scopes/numeric_audit_scope.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ Note: Paths relative to `aztec-packages/barretenberg/cpp/src/barretenberg`
1212
3. `numeric/bitop/keep_n_lsb.hpp`
1313
4. `numeric/bitop/pow.hpp`
1414
5. `numeric/bitop/rotate.hpp`
15+
6. `numeric/bitop/sparse_form.hpp`
1516

1617
### Random Number Generation
17-
6. `numeric/random/engine.cpp`
18-
7. `numeric/random/engine.hpp`
18+
7. `numeric/random/engine.cpp`
19+
8. `numeric/random/engine.hpp`
1920

2021
### Unsigned Integer Types
21-
8. `numeric/uint128/uint128.hpp`
22-
9. `numeric/uint128/uint128_impl.hpp`
23-
10. `numeric/uint256/uint256.hpp`
24-
11. `numeric/uint256/uint256_impl.hpp`
25-
12. `numeric/uintx/uintx.cpp`
26-
13. `numeric/uintx/uintx.hpp`
27-
14. `numeric/uintx/uintx_impl.hpp`
22+
9. `numeric/uint128/uint128.hpp`
23+
10. `numeric/uint128/uint128_impl.hpp`
24+
11. `numeric/uint256/uint256.hpp`
25+
12. `numeric/uint256/uint256_impl.hpp`
26+
13. `numeric/uintx/uintx.cpp`
27+
14. `numeric/uintx/uintx.hpp`
28+
15. `numeric/uintx/uintx_impl.hpp`
2829

2930
### General Utilities
30-
15. `numeric/general/general.hpp`
31+
16. `numeric/general/general.hpp`
3132

3233
## Summary of Module
3334

barretenberg/cpp/scripts/ci_benchmark_ivc_flows.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ function chonk_flow {
120120
}
121121
]
122122
EOF
123+
124+
# Extract component timings from hierarchical breakdown if available
125+
if [[ -f "$output/benchmark_breakdown.json" ]]; then
126+
echo "Extracting component timings from hierarchical breakdown..."
127+
python3 scripts/extract_component_benchmarks.py "$output" "$name_path"
128+
fi
123129
}
124130

125131
export -f verify_ivc_flow run_bb_cli_bench

barretenberg/cpp/scripts/ci_benchmark_ultrahonk_circuits.sh

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -129,52 +129,7 @@ EOF
129129
# Extract component timings from hierarchical breakdown if available
130130
if [[ -f "$output/benchmark_breakdown.json" ]]; then
131131
echo "Extracting component timings from hierarchical breakdown..."
132-
133-
# Use Python to extract key component timings
134-
# The breakdown JSON format is: { "operation_name": [{"parent": "...", "time": nanoseconds, ...}], ... }
135-
python3 << PYTHON_SCRIPT
136-
import json
137-
import sys
138-
139-
try:
140-
with open("$output/benchmark_breakdown.json", "r") as f:
141-
data = json.load(f)
142-
143-
benchmarks = []
144-
145-
# Key components to track (case-insensitive matching)
146-
key_components = ["sumcheck", "pcs", "pippenger", "commitment", "circuit", "oink", "compute"]
147-
148-
for op_name, entries in data.items():
149-
# Check if this is a key component we want to track
150-
if any(comp.lower() in op_name.lower() for comp in key_components):
151-
# Sum up all timings for this operation (there may be multiple entries with different parents)
152-
total_time_ns = sum(entry.get("time", 0) for entry in entries)
153-
time_ms = total_time_ns / 1_000_000
154-
155-
# Create a safe benchmark name (replace special chars)
156-
safe_name = op_name.replace("::", "_").replace(" ", "_")
157-
158-
benchmarks.append({
159-
"name": f"$name_path/{safe_name}_ms",
160-
"unit": "ms",
161-
"value": round(time_ms, 2),
162-
"extra": f"stacked:$name_path/components"
163-
})
164-
165-
# Append to existing benchmarks file
166-
with open("$output/benchmarks.bench.json", "r") as f:
167-
existing = json.load(f)
168-
169-
existing.extend(benchmarks)
170-
171-
with open("$output/benchmarks.bench.json", "w") as f:
172-
json.dump(existing, f, indent=2)
173-
174-
print(f"Extracted {len(benchmarks)} component timings")
175-
except Exception as e:
176-
print(f"Warning: Could not extract component timings: {e}", file=sys.stderr)
177-
PYTHON_SCRIPT
132+
python3 scripts/extract_component_benchmarks.py "$output" "$name_path"
178133
fi
179134

180135
echo "Benchmark complete. Results in $output/"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env python3
2+
"""Extracts component timings from a hierarchical benchmark breakdown and appends
3+
them to the benchmark JSON file as stacked chart entries.
4+
5+
Usage: extract_component_benchmarks.py <output_dir> <name_path>
6+
7+
The output_dir must contain:
8+
- benchmark_breakdown.json (hierarchical timing data from bb --bench_out_hierarchical)
9+
- benchmarks.bench.json (existing benchmark results to append to)
10+
11+
The breakdown JSON format is:
12+
{ "operation_name": [{"parent": "...", "time": nanoseconds, ...}], ... }
13+
14+
Component entries are added with extra: "stacked:<name_path>/components" so the
15+
benchmark dashboard renders them as a single multi-line chart.
16+
"""
17+
import json
18+
import sys
19+
20+
if len(sys.argv) != 3:
21+
print(f"Usage: {sys.argv[0]} <output_dir> <name_path>", file=sys.stderr)
22+
sys.exit(1)
23+
24+
output_dir = sys.argv[1]
25+
name_path = sys.argv[2]
26+
27+
try:
28+
with open(f"{output_dir}/benchmark_breakdown.json", "r") as f:
29+
data = json.load(f)
30+
31+
benchmarks = []
32+
33+
# Key components to track (case-insensitive matching)
34+
key_components = ["sumcheck", "pcs", "pippenger", "commitment", "circuit", "oink", "compute"]
35+
36+
for op_name, entries in data.items():
37+
# Check if this is a key component we want to track
38+
if any(comp.lower() in op_name.lower() for comp in key_components):
39+
# Sum up all timings for this operation (there may be multiple entries with different parents)
40+
total_time_ns = sum(entry.get("time", 0) for entry in entries)
41+
time_ms = total_time_ns / 1_000_000
42+
43+
# Create a safe benchmark name (replace special chars)
44+
safe_name = op_name.replace("::", "_").replace(" ", "_")
45+
46+
benchmarks.append({
47+
"name": f"{name_path}/{safe_name}_ms",
48+
"unit": "ms",
49+
"value": round(time_ms, 2),
50+
"extra": f"stacked:{name_path}/components"
51+
})
52+
53+
# Append to existing benchmarks file
54+
with open(f"{output_dir}/benchmarks.bench.json", "r") as f:
55+
existing = json.load(f)
56+
57+
existing.extend(benchmarks)
58+
59+
with open(f"{output_dir}/benchmarks.bench.json", "w") as f:
60+
json.dump(existing, f, indent=2)
61+
62+
print(f"Extracted {len(benchmarks)} component timings")
63+
except Exception as e:
64+
print(f"Warning: Could not extract component timings: {e}", file=sys.stderr)

barretenberg/cpp/src/barretenberg/commitment_schemes/small_subgroup_ipa/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ A curve-agnostic zero-knowledge protocol for proving inner products of small vec
44

55
## Overview
66

7-
SmallSubgroupIPA enables proving statements of the form $ \langle F, G \rangle = s$ where:
8-
- $ G$ is a witness polynomial (prover's secret)
9-
- $ F$ is a challenge polynomial (derived from public challenges)
10-
- $ s$ is the claimed inner product
7+
SmallSubgroupIPA enables proving statements of the form $\langle F, G \rangle = s$ where:
8+
- $G$ is a witness polynomial (prover's secret)
9+
- $F$ is a challenge polynomial (derived from public challenges)
10+
- $s$ is the claimed inner product
1111

1212
This protocol is used in two contexts:
1313
1. **ZK-Sumcheck**: Proving correct evaluation of Libra masking polynomials

barretenberg/cpp/src/barretenberg/commitment_schemes/small_subgroup_ipa/small_subgroup_ipa.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ template <typename Curve> class SmallSubgroupIPAVerifier {
341341
*/
342342
static void handle_edge_cases(const FF& vanishing_poly_eval)
343343
{
344-
345-
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1194). Handle edge cases in PCS
346-
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1186). Insecure pattern.
347344
bool evaluation_challenge_in_small_subgroup = false;
348345
if constexpr (Curve::is_stdlib_type) {
349346
evaluation_challenge_in_small_subgroup = (vanishing_poly_eval.get_value() == FF(0).get_value());

barretenberg/cpp/src/barretenberg/flavor/prover_polynomials.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ProverPolynomialsBase : public AllEntitiesBase {
3131
ProverPolynomialsBase(ProverPolynomialsBase&& o) noexcept = default;
3232
ProverPolynomialsBase& operator=(ProverPolynomialsBase&& o) noexcept = default;
3333
~ProverPolynomialsBase() = default;
34-
[[nodiscard]] size_t get_polynomial_size() const { return this->q_c.size(); }
34+
[[nodiscard]] size_t get_polynomial_size() const { return this->q_c.virtual_size(); }
3535
[[nodiscard]] AllValuesType get_row(size_t row_idx) const
3636
{
3737
AllValuesType result;

0 commit comments

Comments
 (0)