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

refactor: avoid creating intermediate vectors during commit #365

Conversation

jacobtrombetta
Copy link
Contributor

@jacobtrombetta jacobtrombetta commented Feb 18, 2025

Rationale for this change

This PR refactors the commit function in the hyperkzg and pedersen modules to improve space performance by eliminating the creation of intermediate scalars and bases vectors. Instead, it directly constructs the required slices for the vartime_multiscalar_mul function call and adds the binding factor in a separate step, reducing memory allocations.

Criterion benchmark results

Benchmarks were completed on an Azure VM: Standard NC24ads A100 v4 (24 vcpus, AMD EPYC 7V13 (Milan) [x86-64], and 220 GiB memory)

The compressed-snark criterion benchmarks show that no change in performance was detected or, in one case, within the noise threshold. Gray relates to the main branch, blue relates to the updates in this PR..

  • CompressedSNARK-StepCircuitSize-0/Prove
    image

  • CompressedSNARK-StepCircuitSize-6399/Prove
    image

  • CompressedSNARK-StepCircuitSize-22783/Prove
    image

  • CompressedSNARK-StepCircuitSize-55551/Prove
    image

  • CompressedSNARK-StepCircuitSize-121087/Prove
    image

  • CompressedSNARK-StepCircuitSize-252159/Prove
    image

  • CompressedSNARK-StepCircuitSize-514303/Prove
    image

  • CompressedSNARK-StepCircuitSize-1038591/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-0/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-6399/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-22783/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-55551/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-121087/Prove
    image

  • CompressedSNARK-Commitments-StepCircuitSize-252159/Prove
    image

jacobtrombetta added a commit to jacobtrombetta/Nova that referenced this pull request Feb 18, 2025
Copy link
Collaborator

@srinathsetty srinathsetty left a comment

Choose a reason for hiding this comment

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

Looks good!

@srinathsetty srinathsetty merged commit b3d8cd4 into microsoft:main Feb 18, 2025
7 checks passed
@jacobtrombetta jacobtrombetta deleted the refactor/avoid-intermediate-vectors-in-commitment branch February 21, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants