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

Feat: Integrate miden-gpu crate into prover #1310

Merged
merged 11 commits into from
Apr 29, 2024

Conversation

TheMenko
Copy link

This PR removes ministark-gpu, and instead adds the new miden-gpu crate, that is based off of ministark-gpu.
miden-gpu adds support for the RPX hash.

I've also changed the code in a way to be more generic over Hasher when using metal.
The MetalRpoExecutionProver is now just MetalExecutionProver.

There are also some small changes to air and cli to go along with this change.

Note: This PR requires changes to the crypto crate. I opened the pull request that adds RpxRandomCoin.

@TheMenko TheMenko marked this pull request as ready for review April 24, 2024 13:02
@TheMenko TheMenko marked this pull request as draft April 24, 2024 13:20
@TheMenko TheMenko marked this pull request as ready for review April 24, 2024 14:25
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! This looks great! Not a full review yet, but I left a few comments inline.

The main comment is about treating RPX somewhat separately (i.e., not integrating it into the main structure as much). This is because the situation when RPO and RPX co-exist is temporary and eventually we'll leave only one of them.

For now, we can think of RPX as "experimental" which will be used primarily for benchmarking.

prover/Cargo.toml Outdated Show resolved Hide resolved
air/src/options.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
core/Cargo.toml Outdated Show resolved Hide resolved
miden/src/cli/prove.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Still not a full review - but I reviewed pretty much everything except for some things in the gpu.rs file. Left a few small comments inline.

miden/src/cli/prove.rs Outdated Show resolved Hide resolved
miden/src/cli/prove.rs Outdated Show resolved Hide resolved
miden/src/examples/mod.rs Outdated Show resolved Hide resolved
verifier/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

I finally finished the review and left some more comments inline. Most of them are pretty minor.

prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/gpu.rs Outdated Show resolved Hide resolved
prover/src/lib.rs Outdated Show resolved Hide resolved
air/src/proof.rs Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth 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! Thank you! I left a couple of nit comments inline - but other than these, this is good to go.

Also, could you rebase from the latest next? We just merged a big PR into next, and while there doesn't seem to be any conflicts here, some lint checks may be failing.

Comment on lines 1 to 2
#[cfg(test)]
mod tests {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we don't need this internal module here. The #[cfg(test)] can be applied to the module import in prover/src/gpu/metal/mod.rs

//! This module contains GPU acceleration logic for Apple Silicon devices.
//! For now, the logic is limited to GPU accelerating trace and constraint commitments,
//! using the RPO 256 or RPX 256 hash functions.
mod tests;
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to the previous comment: we can apply #[cfg(test)] here.

Also, I would move this to line ~33 (i.e., put this after use statements.

@TheMenko TheMenko force-pushed the feat-integrate-miden-gpu-crate branch from 5e7e6e6 to 414b2da Compare April 29, 2024 20:05
@TheMenko
Copy link
Author

Rebase done @bobbinth

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

All looks good! Thank you!

@bobbinth bobbinth merged commit fa09b30 into 0xPolygonMiden:next Apr 29, 2024
15 checks passed
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.

None yet

2 participants