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

Keccakf32Memory: use compute_from instead of provide_value #2553

Merged
merged 6 commits into from
Mar 18, 2025

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Mar 14, 2025

This PR changes the usage of std::prover::provide_value in Keccakf32Memory to std::prover::compute_from, in the hope of being able to use the JIT for this machine in #2541.

Witgen time goes of test_data/std/keccakf32_memory_test.asm from 60s to 76s, probably because too many things are being evaluated.
This is fixed by 1c15647.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 4c5e3fd Previous: bc3bea1 Ratio
executor-benchmark/keccak 24221445626 ns/iter (± 1385068933) 20134690647 ns/iter (± 577397123) 1.20

This comment was automatically generated by workflow using github-action-benchmark.

@georgwiese georgwiese marked this pull request as ready for review March 14, 2025 15:15
@georgwiese georgwiese changed the title Keccakf32Memory: use compute_from instead of provide_value Keccakf32Memory: use compute_from instead of provide_value Mar 14, 2025
0,
|acc, e| acc ^ e
);

query |row| {
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be something like

query |row| compute_from_multi(c, row, a, |a_values| {
  array::new(array::len(c), |i| {
     let x = i / 64;
     let z = i % 64;
     let limb = z / 32;
     let bit_in_limb = z % 32;
//      compute c here
  })
});

@georgwiese
Copy link
Collaborator Author

Nice, with compute_from_multi, the witgen is also 4x faster! 🎉

@georgwiese
Copy link
Collaborator Author

georgwiese commented Mar 18, 2025

I realized that most hints are actually not needed; the solver can figure them out. So I removed them. The speed does decrease again though (witgen time for test_data/std/keccakf32_memory_test.asm is back to 60s).

@chriseth chriseth added this pull request to the merge queue Mar 18, 2025
Merged via the queue into main with commit b9ff8cf Mar 18, 2025
16 checks passed
@chriseth chriseth deleted the use-compute-from branch March 18, 2025 15:46
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