-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add gate profiler for noir circuits (#7004)
This PR: - Modifies acir format to track constraint => original opcode and to store gates per opcode (only gates, no lookups ATM) when building a circuit - Modifies the gates command to return this information along with the totals - Adds a new profiler binary in noir tooling with a command generate a gates flamegraph - Adds a small script in noir-projects to extract a private function as a regular noir artifact, to make it usable by the profiler. This is needed because transpiling makes our artifacts unreadable by noir tooling. Example result: (altough github breaks the zoom/search functionality when uploading the svg) ![transfer](https://github.com/AztecProtocol/aztec-packages/assets/5372114/1b489182-bd4b-445d-81bd-45651753300f) Usage: ``` ./target/release/noir_profiler gates-flamegraph --artifact-path PATH_TO_THE_ARTIFACT_JSON --backend-path BB_PATH --output OUTPUT_FOLDER ``` Example: ``` ./target/release/noir_profiler gates-flamegraph --artifact-path ~/aztec-packages/noir-projects/noir-contracts/target/token_contract-Token-transfer.json --backend-path ~/aztec-packages/barretenberg/cpp/build/bin/bb --output . ``` Or you can run it from the code in `noir/noir-repo/tooling/profiler` via `cargo run` instead of directly calling the built binary. To use the small tool to extract private functions: ``` node extractFunctionAsNoirArtifact.js PATH_TO_CONTRACT_ARTIFACT FUNCTION_NAME ``` Example: ``` node extractFunctionAsNoirArtifact.js ./target/token_contract-Token.json transfer ``` --------- Co-authored-by: Leila Wang <LeilaWang@users.noreply.github.com> Co-authored-by: Michael Connor <iAmMichaelConnor@users.noreply.github.com> Co-authored-by: iAmMichaelConnor <mike@aztecprotocol.com> Co-authored-by: ludamad <adam.domurad@gmail.com>
- Loading branch information
1 parent
12af650
commit a2f6876
Showing
29 changed files
with
1,574 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
191 changes: 153 additions & 38 deletions
191
barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.