-
Notifications
You must be signed in to change notification settings - Fork 219
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
Profile Nargo's high memory usage during compilation and determine optimization opportunities #6550
Comments
I have investigated Heaptrack and Tracy: HeaptrackHeaptrack is straightforward to use. You can install it with: The summary contains the following information: Heaptrack could be added to the CI in order to keep track of the peak heap memory consumption. TracyTracy is more involved and cannot really be integrated with CI. Although Tracy is dedicated for profiling C++ applications, there are several Rust adapters.
Fortunately, each step is not too difficult to setup and at the end, you get a very powerful profiler. InstallationOn the mainframe, Tracy needs to be compiled from source: git clone https://github.com/wolfpld/tracy
git checkout tags/v0.11.0
sudo apt-get install -y libdbus-1-dev libdbus-glib-1-dev libtbb-dev libfreetype-dev ;
cmake -B capture/build -S capture -DCMAKE_BUILD_TYPE=Release
cmake --build capture/build --config Release --parallel Tracy is very sensitive to versioning, the client/server versions must be identical, which can be an issue due to the rust wrapper for the client. I found that version 0.11.0 works, but in order to get it to compile, I had to add the following line inside capture/CMakelist.txt: The profiler must be installed locally. For instance, on MacOS you'd simply do InstrumentationNargo needs to be modified in order to emit trace data. For this I use tracy-client which support memory profiling. and then you start tracy client in main(): ProfilingOnce Nargo is instrumented, you can profile it by running: You can now run Nargo as usual (from another terminal, but on the same machine) and you should see that it connects to tracy. I profiled the poseidonsponge_x5_254 test case and it shows that memory usage peaks at 380 MB during the mem2reg pass. Tracy could be used to help debugging a specific memory issue. |
I profiled the peak memory usage of the test programs, and they are all around 80MB, except for a few below:
|
We're currently getting very high memory usage when compiling the protocol circuits in aztec-packages so we should put in some work in order to determine where this memory is going.
There's a couple of potential tools which can help with this:
I don't know which option is best here so some exploration on how the various tools work and which is best would be very useful
Ideal outcomes:
The text was updated successfully, but these errors were encountered: