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 WebGPU support #1459

Open
wants to merge 11 commits into
base: next
Choose a base branch
from
Open

Add WebGPU support #1459

wants to merge 11 commits into from

Conversation

GopherJ
Copy link
Contributor

@GopherJ GopherJ commented Aug 19, 2024

Describe your changes

Add WebGPU prover, companion PR: https://github.com/0xPolygonMiden/miden-gpu/pull/17, mostly based on @cf 's awesome work at: https://github.com/cf/miden-vm/tree/async_prover

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
@GopherJ GopherJ marked this pull request as draft August 19, 2024 00:59
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
@GopherJ
Copy link
Contributor Author

GopherJ commented Aug 20, 2024

WebGPUTraceLde

pub async fn new(
    trace_info: &TraceInfo,
    main_trace: &ColMatrix<Felt>,
    domain: &StarkDomain<Felt>,
    webgpu_hash_fn: HashFn,
) -> (Self, TracePolyTable<E>) {
    // extend the main execution trace and build a Merkle tree from the extended trace
    let (main_segment_lde, main_segment_tree, main_segment_polys) =
        build_trace_commitment_sync::<E, Felt, H>(main_trace, domain); // <--- using sync because of a rust type hint issue

    let trace_poly_table = TracePolyTable::new(main_segment_polys);
    let trace_lde = WebGPUTraceLde {
        main_segment_lde,
        main_segment_tree,
        aux_segment_lde: None,
        aux_segment_tree: None,
        blowup: domain.trace_to_lde_blowup(),
        trace_info: trace_info.clone(),
        webgpu_hash_fn,
    };

    (trace_lde, trace_poly_table)
}

currently I'm using build_trace_commitment_sync because rust compiler seems has a type hint issue, once that's resolved we can switch to use build_trace_commitment(main_trace, domain, webgpu_hash_fn).await and the PR should then be ready for review

@GopherJ GopherJ marked this pull request as ready for review August 23, 2024 13:37
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
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.

1 participant