Skip to content

ZKCuda-No-Oversubscribe - #177

Merged
zhiyong1997 merged 63 commits into
masterfrom
zf/zkcuda_optim
Jul 29, 2025
Merged

zhiyong1997 merged 63 commits into
masterfrom
zf/zkcuda_optim

Conversation

@zhiyong1997

@zhiyong1997 zhiyong1997 commented Jun 26, 2025 •

Copy link
Copy Markdown
Contributor

Benchmark of PCS Batching

The testing kernel contains a sumcheck of $2^{19}$, and the actual length is $2^{19} \times$ parallelism. The task is distributed to parallelism number of cores. The field used is BN254. There are 3 pcs commit and opening.

On 7950X3D with 16 physical cores:

No PCS Batching

Parallelism Commit (ms) GKR Prove(ms) PCS Opening(ms) Verify(ms)
4 30 262 562 109
8 35 340 628 108
16 42 571 824 115

PCS Batching

Parallelism Commit (ms) GKR Prove(ms) PCS Opening(ms) Verify(ms)
4 57 254 623 84
8 61 324 685 90
16 81 563 845 110

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary of Changes

Hello @zhiyong1997, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've focused this pull request on enhancing performance observability within the expander_compiler by integrating timing measurements for critical operations in the deferred PCS proving system. I've also extended the test suite to include benchmarks for a new proving system configuration.

Highlights

  • Performance Measurement: I've introduced Timer instances to measure the execution time of key phases within the deferred PCS proving process, specifically for commitment, kernel proving, and batch PCS opening.
  • New Configuration Testing: I've added new test runs for the zkcuda_matmul function using the BN254ConfigSha2UniKZG configuration, expanding coverage for different proving system setups.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds timers to the deferred PCS proving implementation to measure performance of different stages. It also adds new benchmark runs for zkcuda_matmul with a different configuration (BN254ConfigSha2UniKZG).

Comment on lines +15 to +17
zkcuda_matmul::<BN254Config, ExpanderPCSDefered<BN254ConfigSha2UniKZG>, 4>();
zkcuda_matmul::<BN254Config, ExpanderPCSDefered<BN254ConfigSha2UniKZG>, 8>();
zkcuda_matmul::<BN254Config, ExpanderPCSDefered<BN254ConfigSha2UniKZG>, 16>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

These lines are very similar to lines 8-10. To avoid code duplication and improve maintainability, consider using a macro to generate these calls. Since const generics must be known at compile time, a loop cannot be used here, but a macro is a good alternative.

@zhiyong1997 zhiyong1997 changed the title [Minor] Add some timer ZKCuda-No-Oversubscribe Jul 8, 2025
@zhiyong1997

zhiyong1997 commented Jul 9, 2025 •

Copy link
Copy Markdown
Contributor Author

Multi-Process Oversubscription v.s. Limited-process Multi-SIMD

Setting: 7950X3D with 16 pyhsical cores, testing size: $2^{13}$. Field BN254.

GKR

Parallelism Multi-Process (ms) Multi-SIMD (ms)
16 8 8
32 25 15
64 46 25
128 91 50
256 191 81
512 510 166

PCS Opening

Parallelism Multi-Process (ms) Multi-SIMD (ms)
16 57 59
32 170 70
64 187 97
128 489 132
256 975 183
512 2350 296

Note that the work is exactly the same for these two cases for PCS opening. The only difference is Multi-Process may involve context switching.

@zhiyong1997
zhiyong1997 marked this pull request as ready for review July 29, 2025 02:44
@zhiyong1997
zhiyong1997 merged commit bdf8cd2 into master Jul 29, 2025
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.

1 participant