Skip to content

Conversation

@georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Nov 21, 2025

Adds to PGO that for each PC, we collect statistics of the next PC, and persist it to a next_pcs.json file.

The checked-in file has been generated as:
cargo run --bin powdr_openvm -r prove guest-keccak --input 100 --autoprecompiles 1 --apc-candidates-dir keccak100 --mock

For example, consider this memcpy block. Its last instruction is 2105080. In next_pcs.json, you'll find this entry:

  "2105080": {
    "2105084": 300,   // Exit the loop
    "2105036": 2500   // Jump to the beginning of the current basic block
  },

For example, we could generate a precompile that only works when the block is run twice, which would be more efficient than running the original precompile twice (because it only has to accesses the 8 registers once, among other things).

In this (very artificial) run, there are only 7 PCs where the next PC is not PC is not 100% determined, despite there being 63 basic blocks that are executed at least once.

@georgwiese georgwiese mentioned this pull request Nov 24, 2025
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