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

Instrument field operations #743

Open
WizardOfMenlo opened this issue Dec 28, 2023 · 3 comments
Open

Instrument field operations #743

WizardOfMenlo opened this issue Dec 28, 2023 · 3 comments
Labels
D-medium Difficulty: medium T-feature Type: new features

Comments

@WizardOfMenlo
Copy link

Especially when prototyping a new protocol, having a accurate field operation counts is very important.
My proposal would be to add this behind a feature flag, adding a globally accessible stats counter that is then updated.
Ideally, by turning on the instrumentation flag, the user would be able to transparently instrument their code with no changes required.

@burdges
Copy link
Contributor

burdges commented Dec 29, 2023

You'd typically count curve operations plus FFTs.

You could've curve+field forks or wrapper types, which achieved this. If you only want curve operations, then you could check out https://github.com/paritytech/arkworks-extensions

If you opnly want curve operations, then you could integrate this approch with different benchmarking tools.

@WizardOfMenlo
Copy link
Author

For my particular use-case, curve operations and FFTs are not too relevant. I really would just want to be able to count the number of field additions, multiplications and divisions.
I assume that, once that is done the common infrastructure could be extended to other functionalities.
Possibly we could decorate methods which should (optionally) be instrumented with some derive_macro which writes to a common (global, thread safe, possibly slow) counter. Then, on the counter itself we can implement some aggregation for better user functionality.

@burdges
Copy link
Contributor

burdges commented Dec 30, 2023

Above, we targeted the expensive operations above, without changing the fields, but..

It's likely easier to just count field operations, either cargo patch in your fork of ark-ff, or else simply fork the curve with one commit that sustitutes your ark-ff.

@mmagician mmagician added T-feature Type: new features D-medium Difficulty: medium labels Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-medium Difficulty: medium T-feature Type: new features
Projects
None yet
Development

No branches or pull requests

3 participants