Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 123 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions air/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,23 @@ impl ProvingOptions {
self
}

/// Sets partitions for this [ProvingOptions].
///
/// Partitions can be provided to split traces during proving and distribute work across
/// multiple devices. The number of partitions should be equal to the number of devices.
pub const fn with_partitions(mut self, num_partitions: usize) -> Self {
// All currently supported hash functions consume 8 felts per iteration.
// Match statement ensures that future changes to available hashes are reflected here.
let hash_rate = match self.hash_fn {
HashFunction::Blake3_192 => 8,
HashFunction::Blake3_256 => 8,
HashFunction::Rpo256 => 8,
HashFunction::Rpx256 => 8,
};
self.proof_options = self.proof_options.with_partitions(num_partitions, hash_rate);
self
}

// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions miden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ executable = [
"dep:rustyline",
"dep:tracing-subscriber",
]
cuda = ["prover/cuda", "std"]
metal = ["prover/metal", "std"]
std = ["assembly/std", "processor/std", "prover/std", "verifier/std"]
# For internal use, not meant to be used by users
Expand Down
10 changes: 9 additions & 1 deletion miden/src/cli/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use assembly::diagnostics::{IntoDiagnostic, Report, WrapErr};
use clap::Parser;
use miden_vm::{internal::InputFile, ProvingOptions};
use processor::{DefaultHost, ExecutionOptions, ExecutionOptionsError, Program};
#[cfg(all(target_arch = "x86_64", feature = "cuda"))]
use prover::cuda::get_num_of_gpus;
use stdlib::StdLibrary;
use tracing::instrument;

Expand Down Expand Up @@ -65,6 +67,11 @@ impl ProveCmd {
pub fn get_proof_options(&self) -> Result<ProvingOptions, ExecutionOptionsError> {
let exec_options =
ExecutionOptions::new(Some(self.max_cycles), self.expected_cycles, self.trace, false)?;

let partitions = 1;
#[cfg(all(target_arch = "x86_64", feature = "cuda"))]
let partitions = get_num_of_gpus();

Ok(match self.security.as_str() {
"96bits" => {
if self.rpx {
Expand All @@ -82,7 +89,8 @@ impl ProveCmd {
},
other => panic!("{} is not a valid security setting", other),
}
.with_execution_options(exec_options))
.with_execution_options(exec_options)
.with_partitions(partitions))
}

pub fn execute(&self) -> Result<(), Report> {
Expand Down
11 changes: 9 additions & 2 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ edition.workspace = true
async = ["winter-maybe-async/async"]
concurrent = ["processor/concurrent", "std", "winter-prover/concurrent"]
default = ["std"]
metal = ["dep:miden-gpu", "dep:elsa", "dep:pollster", "concurrent", "std"]
metal = ["miden-gpu/metal", "dep:elsa", "dep:pollster", "concurrent"]
cuda = ["miden-gpu/cuda", "concurrent"]
std = ["air/std", "processor/std", "winter-prover/std"]

[dependencies]
Expand All @@ -29,5 +30,11 @@ winter-prover = { package = "winter-prover", version = "0.11", default-features

[target.'cfg(all(target_arch = "aarch64", target_os = "macos"))'.dependencies]
elsa = { version = "1.9", optional = true }
miden-gpu = { version = "0.4", optional = true }
miden-gpu = { path = "../../miden-gpu", optional = true }
pollster = { version = "0.4", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
miden-gpu = { path = "../../miden-gpu", optional = true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and line 33 need to be changed to a publicly released version.


[dev-dependencies]
serial_test = "3.1"
1 change: 1 addition & 0 deletions prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Miden prover can be compiled with the following features:
* `std` - enabled by default and relies on the Rust standard library.
* `concurrent` - implies `std` and also enables multi-threaded proof generation.
* `metal` - enables [Metal](https://en.wikipedia.org/wiki/Metal_(API))-based acceleration of proof generation (for recursive proofs) on supported platforms (e.g., Apple silicon).
* `cuda` - enables [Cuda](https://en.wikipedia.org/wiki/CUDA)-based acceleration of proof generation (for recursive proofs) on supported platforms.
* `no_std` does not rely on the Rust standard library and enables compilation to WebAssembly.
* Only the `wasm32-unknown-unknown` and `wasm32-wasip1` targets are officially supported.

Expand Down
Loading