Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): Touch up profiler docs #7524

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

Savio-Sou
Copy link
Collaborator

@Savio-Sou Savio-Sou commented Feb 25, 2025

Description

Summary*

  • Fix execution-opcodes flag names documented
  • Update sidebar positioning
  • Move execution section up to before proving backend section
  • Touch up formatting, wording, and readability

Additional Context

Docusaurus seems to support inlining SVGs, might be worth exploring as a future endeavor.

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@Savio-Sou Savio-Sou added documentation Improvements or additions to documentation profiler The Noir profiler labels Feb 25, 2025
Copy link
Contributor

github-actions bot commented Feb 25, 2025

@Savio-Sou Savio-Sou marked this pull request as ready for review February 26, 2025 00:13
@Savio-Sou Savio-Sou requested a review from vezenovm February 26, 2025 00:13
Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits. My main request is that we keep the order of ACIR profiling -> Backend gates profiling as I think it is the natural flow most developers will take.


### Generating an ACIR opcode flamegraph
#### Flamegraphing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add this word to cspell


:::

### Profiling execution traces (unconstrained)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do greatly prefer to keep the flow of ACIR opcodes -> backend gates -> Brillig flamegraphs.

I foresee most devs using the ACIR/backend gates profiling to reduce their circuit proving speeds over witness generation speeds. Backend gates also do not yet require introducing a Prover.toml, and unconstrained. Due to these reasons, I feel the backend gates section naturally follows the ACIR profiling section.

Copy link
Collaborator Author

@Savio-Sou Savio-Sou Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating if that's the right change as well.

I agree that devs' interests lie primarily with profiling backend gates; if anything, backend gates > execution > ACIR opcodes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question + my assumption that drove the change though was:

Do we intend to maintain backend gates profiling within noir-lang, and extend support for different backends?

I naively assumed no; but now that I think of it, maybe it's just a simple interface where backends will do the heavy lifting?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we intend to maintain backend gates profiling within noir-lang, and extend support for different backends?

Backends do the heavy lifting. The profiler simply accepts a path to a backend binary, the name of the their gates command, and allows to pass optional arguments (we do not document this here as it is not relevant for bb). Backends just need to follow our gates API if they want to integrate with the profiler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely! I will update the ordering to Backend Gates > Brillig > ACIR in that case 👍 lmk if you have concerns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still prefer the ordering ACIR > Backend gates > Brillig as mentioned in the original comment. I think it flows better to keep the circuit flamegraphs together, as the backend flamegraph essentially builds upon the acir flamegraph (we still display acir opcodes in our backend flamegraph, just the sample count associated with those opcodes has now changed).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is profiling ACIR alone useful for devs?

If not, maybe we can also consider merging the ACIR and Backend Gates sections; wdyt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is profiling ACIR alone useful for devs?

Not sure what you mean by "merging" the sections. Do you mean removing the ACIR section? I do think they warrant separate sections as profiling ACIR is useful. Plus it is Noir's compilation target, so I think it should be documented how to profile it.

It provides additional context as ACIR opcodes counts do not tie directly to backend gate counts. e.g. in this guide's example code backend gates from range opcodes take up most of the program, but it doesn't give us a full picture.
If we wanted to optimize witness generation we would need to look at the ACIR as well. Looking at the backend gates provides optimizations for proving speed. I realize this is why you wanted to go Backend Gates > Brillig > ACIR, but I think we should still go ACIR > Backend gates > Brillig for the reasons mentioned above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also hover over "all" to show the total gates in this image?

![Brillig Trace "Optimized"](@site/static/img/tooling/profiler/brillig-trace-opt-32.png)
Flamegraph of the demonstrative project generated with bb v0.76.4:

![Gates Flamegraph Optimized](@site/static/img/tooling/profiler/gates-flamegraph-optimized.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we show the unoptimized one before this?

Copy link
Collaborator Author

@Savio-Sou Savio-Sou Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped the optimized flamegraph as this reads after the optimizing section.

Happy to reposition according to any reordering of sections as a result of the parallel discussion above.

Copy link
Contributor

FYI @noir-lang/developerrelations on Noir doc changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation profiler The Noir profiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants