Merge pull request #20 from eth-applied-research-group/kw/r0-gpu

feat: Add GPU support for risc0
This commit is contained in:
kevaundray
2025-05-24 20:45:38 +01:00
committed by GitHub
3 changed files with 662 additions and 10 deletions

657
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,5 +17,9 @@ tempfile = "3.3"
serde_json = "1.0"
thiserror = "2"
[features]
metal = ["risc0-zkvm/metal"]
cuda = ["risc0-zkvm/cuda"]
[lints]
workspace = true

View File

@@ -29,6 +29,17 @@ impl EreRisc0 {
program: <RV32_IM_RISCZERO_ZKVM_ELF as Compiler>::Program,
resource_type: ProverResourceType,
) -> Self {
match resource_type {
ProverResourceType::Cpu => {
#[cfg(any(feature = "cuda", feature = "metal"))]
panic!("CPU mode requires both 'cuda' and 'metal' features to be disabled");
}
ProverResourceType::Gpu => {
#[cfg(not(any(feature = "cuda", feature = "metal")))]
panic!("GPU selected but neither 'cuda' nor 'metal' feature is enabled");
}
}
Self {
program,
resource_type,