feat(cuda): R4 DEEP composition + FRI commit phase on GPU#648
Open
ColoCarletti wants to merge 57 commits into
Open
feat(cuda): R4 DEEP composition + FRI commit phase on GPU#648ColoCarletti wants to merge 57 commits into
ColoCarletti wants to merge 57 commits into
Conversation
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
# Conflicts: # crypto/math-cuda/build.rs # crypto/math-cuda/src/device.rs # crypto/math-cuda/src/lib.rs # crypto/stark/src/gpu_lde.rs # crypto/stark/src/prover.rs # prover/tests/cuda_path_integration.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the GPU-resident proving pipeline through Round 4. R4 DEEP composition and the full FRI commit phase (fold + per-layer Keccak leaves + pair-hash Merkle
tree) now run device-side, with only per-layer roots D2H'd for the transcript. The R2 composition-parts LDE moves to a
_keepvariant so its de-interleaved devicebuffer is retained on
Round2and reused by R4 DEEP without a re-H2D. Also lands a Blelloch chunk-scan parallel batch-inverse kernel as infrastructure for futureGPU-side denominator inversion (not yet wired).
Changes
crypto/math-cuda/kernels/{inverse,deep,fri}.cu— new kernels.crypto/math-cuda/src/{inverse,deep,fri}.rs— host orchestrators includingFriCommitState(ping-pong eval buffers, in-place inv_twiddles squaring, per-layerfused fold + leaves + tree).
crypto/stark/src/gpu_lde.rs— new dispatches:try_evaluate_parts_on_lde_gpu_keep,try_deep_composition_gpu,try_fri_commit_gpu. New counters:gpu_deep_calls,gpu_fri_calls.crypto/stark/src/prover.rs—Round2.gpu_composition_partsholds the R2 keep handle; R4 DEEP fast path insidecompute_deep_composition_poly_evaluationsconsumes R1 main/aux + R2 parts handles when available.
crypto/stark/src/fri/mod.rs—commit_phase_from_evaluationsroutes throughtry_fri_commit_gpuwhen cuda is enabled.cuda_path_integrationasserts the two new counters fireend-to-end.
Fallback
Every dispatch is gated by TypeId checks (Goldilocks + ext3) and the LDE-size threshold. Below threshold or on any cudarc error, the dispatch returns
Noneandthe existing CPU implementation runs unchanged. Exception: mid-FRI-loop cudarc failure panics, because the transcript is already advanced and a CPU restart would
re-sample
zeta_0against mutated state.Test plan
cargo test -p math-cuda --release --tests(GPU host) — 67 testscargo test -p stark --release --features cuda— 128 testscargo test -p stark --release(no cuda) — 128 testscargo test -p lambda-vm-prover --release(no cuda) — 384 testscargo test -p lambda-vm-prover --release --features cuda --test cuda_path_integration -- --ignored— all 6 counters fire end-to-endcargo clippy --workspace --all-targets --features cuda -- -D warnings— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo fmt --all --check— clean