revive: Rework the instruction benchmark (#7721)
Fixes https://github.com/paritytech/polkadot-sdk/issues/6157 This fixes the last remaining benchmark that was not correct since it was too low level to be written in Rust. Instead, we opted. This PR changes the benchmark that determines the scaling from `ref_time` to PolkaVM `Gas` by benchmarking the absolute worst case of an instruction: One that causes two cache misses by touching two cache lines. The Contract itself is designed to be as simple as possible. It does random unaligned reads in a loop until the `r` (repetition) number is reached. The randomness is fully generated by the host and written to the guests memory before the benchmark is run. This allows the benchmark to determine the influence of one loop iteration via linear regression. --------- Co-authored-by:cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
xermicus <cyrill@parity.io> Co-authored-by:
PG Herveou <pgherveou@gmail.com>
Showing
- Cargo.lock 2 additions, 0 deletionsCargo.lock
- prdoc/pr_7721.prdoc 16 additions, 0 deletionsprdoc/pr_7721.prdoc
- substrate/frame/revive/Cargo.toml 5 additions, 0 deletionssubstrate/frame/revive/Cargo.toml
- substrate/frame/revive/fixtures/contracts/instr_benchmark.rs 0 additions, 43 deletionssubstrate/frame/revive/fixtures/contracts/instr_benchmark.rs
- substrate/frame/revive/fixtures/src/lib.rs 0 additions, 1 deletionsubstrate/frame/revive/fixtures/src/lib.rs
- substrate/frame/revive/src/benchmarking/call_builder.rs 4 additions, 1 deletionsubstrate/frame/revive/src/benchmarking/call_builder.rs
- substrate/frame/revive/src/benchmarking/code.rs 22 additions, 3 deletionssubstrate/frame/revive/src/benchmarking/code.rs
- substrate/frame/revive/src/benchmarking/mod.rs 75 additions, 10 deletionssubstrate/frame/revive/src/benchmarking/mod.rs
- substrate/frame/revive/src/gas.rs 6 additions, 5 deletionssubstrate/frame/revive/src/gas.rs
- substrate/frame/revive/src/wasm/mod.rs 32 additions, 1 deletionsubstrate/frame/revive/src/wasm/mod.rs
- substrate/frame/revive/src/weights.rs 463 additions, 450 deletionssubstrate/frame/revive/src/weights.rs
Please register or sign in to comment