Calculate non-APC LogUp columns for PGO (#2960)

Need to first merge https://github.com/powdr-labs/stark-backend/pull/11.
And then merge https://github.com/powdr-labs/openvm/pull/32.

Original comment by @Schaeff:
```
so here's my suspicion:

to get the number of columns of an air, we use executor.air().width(), in fully qualified syntax openvm_stark_backend::p3_air::BaseAir::width(&executor.air())
this is the number of main trace columns, which does not include interaction columns
in order to get the full number of columns, we need to do what we already do for get_constraints but additionally call InteractionPhaseAirBuilder::finalize_interactions on the symbolic builder to materialize the interactions. Sadly InteractionPhaseAirBuilder is pub(crate) so it seems we need to change stark-backend
```

This PR follows the comment above, but has additional changes:
1. Instead of using `finalize_interactions`, call lower level functions
for greater efficiency.
2. Refactored `AirMetrics` related functions, so we always show the
number of main constraint vs bus interaction columns.

Next step:
1. We should calculate log up columns for APCs as well during PGO.

---------

Co-authored-by: Thibaut Schaeffer <schaeffer.thibaut@gmail.com>
This commit is contained in:
Steve Wang
2025-07-04 15:33:31 +08:00
committed by GitHub
parent 6d6c811939
commit 5ae915d7fd
4 changed files with 126 additions and 61 deletions

View File

@@ -83,47 +83,47 @@ powdr-autoprecompiles = { path = "./autoprecompiles", version = "0.1.4" }
powdr-openvm = { path = "./openvm", version = "0.1.4" }
# openvm
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-build = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-rv32im-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-rv32im-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-rv32im-guest = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be", default-features = false }
openvm-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-circuit-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-circuit-primitives = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-circuit-primitives-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-instructions = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-instructions-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-sdk = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be", default-features = false, features = [
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-build = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-rv32im-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-rv32im-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-rv32im-guest = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36", default-features = false }
openvm-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-circuit-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-circuit-primitives = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-circuit-primitives-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-instructions = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-instructions-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-sdk = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36", default-features = false, features = [
"parallel",
"jemalloc",
"nightly-features",
"bench-metrics",
] }
openvm-ecc-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-ecc-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-keccak256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-keccak256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-sha256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-sha256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-algebra-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-algebra-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-bigint-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-bigint-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-pairing-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-pairing-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be" }
openvm-native-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be", default-features = false }
openvm-native-recursion = { git = "https://github.com/powdr-labs/openvm.git", rev = "26bb25be", default-features = false }
openvm-ecc-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-ecc-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-keccak256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-keccak256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-sha256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-sha256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-algebra-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-algebra-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-bigint-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-bigint-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-pairing-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-pairing-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36" }
openvm-native-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36", default-features = false }
openvm-native-recursion = { git = "https://github.com/powdr-labs/openvm.git", rev = "d730a36", default-features = false }
# stark-backend
openvm-stark-sdk = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "c33fda6", default-features = false, features = [
openvm-stark-sdk = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "ee4e22b", default-features = false, features = [
"parallel",
"jemalloc",
"nightly-features",
"bench-metrics",
] }
openvm-stark-backend = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "c33fda6", default-features = false, features = [
openvm-stark-backend = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "ee4e22b", default-features = false, features = [
"parallel",
"jemalloc",
"bench-metrics",