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

add on gpu compile flag support #176

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

add on gpu compile flag support #176

wants to merge 21 commits into from

Conversation

macro-ss
Copy link

support gpu build with --features gpu,cuda

gpu test case:
  cd prover;./s.sh 1;./p.sh 1

cpu test case:
  cd prover;./s.sh;./p.sh
@xander42280
Copy link
Contributor

use ./p.sh 1 thread 'main' panicked at library/core/src/panicking.rs:229:5:

thread 'main' panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustacuda-0.1.3/src/stream.rs:357:18:
Failed to destroy CUDA stream.: AssertError
stack backtrace:
0: 0x56207893fbd5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc3f31700732fbe36
1: 0x5620789671bb - core::fmt::write::h264759443e5452a8
2: 0x56207893c4af - std::io::Write::write_fmt::h19859b0cdace055d
3: 0x56207893f9ae - std::sys::backtrace::print::hcbfceb9c09962082
4: 0x562078940e09 - std::panicking::default_hook::{{closure}}::ha304a6ddd175ee6f
5: 0x562078940bac - std::panicking::default_hook::hae5ab9b28248136a
6: 0x562078941431 - std::panicking::rust_panic_with_hook::hbf6178baa52721f9
7: 0x562078941297 - std::panicking::begin_panic_handler::{{closure}}::hab58fc1731670d4c
8: 0x562078940099 - std::sys::backtrace::__rust_end_short_backtrace::h5237252f6772769b
9: 0x562078940f24 - rust_begin_unwind
10: 0x562078964c33 - core::panicking::panic_fmt::hea2003cd03a74d6c
11: 0x562078965106 - core::result::unwrap_failed::h66f542b8211e74b0
12: 0x562078907250 - <rustacuda::stream::Stream as core::ops::drop::Drop>::drop::h66df494550f47aec
13: 0x562078541aa0 - core::ptr::drop_in_place<plonky2::fri::oracle::CudaInvContext<plonky2_field::goldilocks_field::GoldilocksField,plonky2::plonk::config::PoseidonGoldilocksConfig,2_usize>>::h3eb891d7a5428ccd
14: 0x562078577d4b - zkmips::prove_single_seg_common::h9e5a7fe236506454
15: 0x562078580c64 - zkmips::main::hb496cc487e2e75ec
16: 0x562078344cd3 - std::sys::backtrace::__rust_begin_short_backtrace::ha09dd7aa7cab4ec2
17: 0x562078507ad9 - std::rt::lang_start::{{closure}}::ha94951fdb2aaeb99
18: 0x56207893325d - std::rt::lang_start_internal::h99fdbebdafe8d634
19: 0x562078581645 - main
20: 0x7f8635e08d90 -
21: 0x7f8635e08e40 - __libc_start_main
22: 0x562077f59de5 - _start
23: 0x0 -
thread 'main' panicked at library/core/src/panicking.rs:229:5:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
./p.sh: line 10: 2114220 Aborted (core dumped) BASEDIR=../emulator/test-vectors RUST_LOG=info BLOCK_NO=13284491 SEG_FILE_DIR="/tmp/output" SEG_START_ID=0 SEG_NUM=1 SEG_SIZE=262144 cargo run $FEAT --release --example zkmips prove_segments

@xander42280
Copy link
Contributor

run https://github.com/zkMIPS/zkvm-benchmarks
when sha2-chain use GPU
[2024-11-09T12:09:15Z INFO zkm_prover::generation] Trace lengths (before padding): TraceCheckpoint { arithmetic_len: 203375, cpu_len: 1048576, poseidon_len: 3356, poseidon_sponge_len: 3356, logic_len: 229241, memory_len: 3241579 }
thread 'main' panicked at /home/ubuntu/gpu_zkm/plonky2-gpu/plonky2/src/fri/oracle.rs:233:110:
called Option::unwrap() on a None value
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

macro-ss and others added 12 commits November 26, 2024 12:02
* add emulator support and test case for sys verify

* add initial support for precompile

* fix input problems

* add missed elf

* update zkmips

* fix clippy

* remove unused return

* update example test

* update SHA_ID and readme

* fix input type

* remove duplicated code

* fix fmt

(cherry picked from commit 921cd4c)
1. prove_root_with_assumption gpu support
2. correct error by "cargo fmt --all  -- --check"
@xander42280
Copy link
Contributor

when run zkvm-benchmarks error:
[2024-12-09T02:15:11Z INFO zkm_prover::generation] Trace lengths (before padding): TraceCheckpoint { arithmetic_len: 203375, cpu_len: 1048576, poseidon_len: 3356, poseidon_sponge_len: 3356, logic_len: 229241, memory_len: 3241579 }
thread 'main' panicked at /home/ubuntu/gpu_zkm/plonky2-gpu/plonky2/src/fri/oracle.rs:233:110:
called Option::unwrap() on a None value
stack backtrace:
0: 0x5589e09f1ac5 - <std::sys::backtrace::print::DisplayBacktrace as core::fmt::Display>::fmt::hc3f31700732fbe36
1: 0x5589e0a1710b - core::fmt::write::h264759443e5452a8
2: 0x5589e09ef2ff - std::io::Write::write_fmt::h19859b0cdace055d
3: 0x5589e09f189e - std::sys::backtrace::print::hcbfceb9c09962082
4: 0x5589e09f2cf9 - std::panicking::default_hook::{{closure}}::ha304a6ddd175ee6f
5: 0x5589e09f2a9c - std::panicking::default_hook::hae5ab9b28248136a
6: 0x5589e09f3321 - std::panicking::rust_panic_with_hook::hbf6178baa52721f9
7: 0x5589e09f3153 - std::panicking::begin_panic_handler::{{closure}}::hab58fc1731670d4c
8: 0x5589e09f1f89 - std::sys::backtrace::__rust_end_short_backtrace::h5237252f6772769b
9: 0x5589e09f2e14 - rust_begin_unwind
10: 0x5589e0a14ad3 - core::panicking::panic_fmt::hea2003cd03a74d6c
11: 0x5589e0a14b5c - core::panicking::panic::hb580cc4fc421f3c8
12: 0x5589e0a149b9 - core::option::unwrap_failed::ha8ca2f24e398bc62
13: 0x5589e084ae1e - plonky2::fri::oracle::PolynomialBatch<F,C,
>::from_values_with_gpu::hf77170ca3f2573d9
14: 0x5589e0842e66 - core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once::hbcbdb704c883af11
15: 0x5589e062925a - <alloc::vec::Vec as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h68333352757e1a00
16: 0x5589e0829021 - zkm_prover::prover::prove_gpu::h9ccd32738037d023
17: 0x5589e080de02 - zkm_script::prove_single_seg_common::hb33a90bdd7b361c4
18: 0x5589e0813767 - zkm_script::benchmark_sha2_chain::h5aa348d42b0ad051
19: 0x5589e08098b3 - utils::benchmark::ha68c54c24d872bad
20: 0x5589e080db6b - zkm_script::main::h7d76662542e27d67
21: 0x5589e0881823 - std::sys::backtrace::__rust_begin_short_backtrace::h8f70a4a1db787501
22: 0x5589e0869799 - std::rt::lang_start::{{closure}}::h319661fe9c44cb79
23: 0x5589e09e6e2d - std::rt::lang_start_internal::h99fdbebdafe8d634
24: 0x5589e08142c5 - main
25: 0x7f33f0467d90 -
26: 0x7f33f0467e40 - __libc_start_main
27: 0x5589e060dd65 - _start
28: 0x0 -
make: *** [Makefile:17: bench-zkm] Error 101

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