Skip to content

fix: root layer tracegen and proving on the same GPU context#2914

Open
stephenh-axiom-xyz wants to merge 1 commit into
develop-v2.0.0-rc.2from
fix/root-tracegen-prove-stream
Open

fix: root layer tracegen and proving on the same GPU context#2914
stephenh-axiom-xyz wants to merge 1 commit into
develop-v2.0.0-rc.2from
fix/root-tracegen-prove-stream

Conversation

@stephenh-axiom-xyz

Copy link
Copy Markdown
Contributor

Resolves INT-8503.

Overview

Fix root proof generation so root trace generation and proving use the same caller-owned StarkEngine instance. This keeps GPU-backed root proving on a single device context instead of constructing a second engine between trace generation and proof creation.

Changes include:

  • Add RootProver::create_engine helpers in the continuations prover and SDK wrapper.
  • Thread an explicit root engine through generate_proving_ctx, prove_from_ctx, and prove.
  • Update EVM proving, dummy keygen, root proof height computation, and root prover tests to reuse the shared engine.
  • Preserve debug constraint checks and device proving-key transport against the same engine used for trace generation.

@github-actions

Copy link
Copy Markdown
group app.proof_time_ms app.cycles leaf.proof_time_ms
fibonacci 3,058 12,000,265 672
keccak 16,408 18,655,329 3,053
sha2_bench 9,091 14,793,960 1,113
regex 1,174 4,137,067 354
ecrecover 602 123,583 285
pairing 933 1,745,757 305
kitchen_sink 4,116 2,579,903 888

Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights.

Commit: 958898b

Benchmark Workflow

@github-actions

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Comment on lines 305 to +320
let root_prover = RootProver::new::<RootEngine>(
internal_recursive_vk,
internal_recursive_pcs_data.commitment.into(),
root_system_params(),
system_config.memory_config.memory_dimensions(),
system_config.num_public_values,
None,
None,
);
let engine = RootEngine::new(root_prover.get_vk().inner.params.clone());
let engine = root_prover.create_engine::<RootEngine>();
let ctx = root_prover.generate_proving_ctx_no_def::<<RootEngine as StarkEngine>::PB, _>(
internal_recursive_proof,
&user_pvs_proof,
&engine.device().device_ctx,
);
let root_proof = root_prover.root_prove_from_ctx::<RootEngine>(ctx.unwrap())?;
let root_proof = root_prover.root_prove_from_ctx::<RootEngine>(ctx.unwrap(), &engine)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't we just create an engine in the new constructor and use it internally for all the root prover functions. why pass it around?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not sure about this but if engine is an abstraction common among all types of provers, maybe it should be an argument to the constructor itself and each prover can either store a reference or a copy (if safe)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we try to avoid storing Engines, especially in structs that are potentially long-lived (i.e. the RootProver will exist for as long as the Sdk does). They contain device-specific stuff

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

okay, and is the idea that the same prover can be used on multiple devices?

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.

2 participants