Add per-opcode weight profiler to benchmark reports#302
Open
mokita-j wants to merge 18 commits into
Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Merged
Contributor
Author
|
Report with the weight profiler can be consulted here: https://paritytech.github.io/revive-differential-tests/reports/benchmark-2026-06-16-160848.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in opcode-level profiler to
retester benchmark. Samples K txs per step path (first / middle / last), traces each via pallet-revive'sExecutionTracer, and emits per-opcoderef_time+proof_size+ counts intoreport.json. The HTML grows an Opcode Profile section with per-step min/mean/max band charts, sortable per-platform tables, andcross-platform category bars.
Sampling the same step path at multiple lifecycle points allows us to analyze future optimizations like hot/cold storage pricing.
Depends on PR#12374 (adds
state_callRecorded). Without it, trace replay over-accounts proof_size and tail extrinsics hitCheckWeight::ExhaustsResources.Features
--benchmark.profile-watched-txsmaster switch +--benchmark.profile-samples-per-step-path(default 3),--benchmark.profile-concurrency,--benchmark.profile-step-limit,--benchmark.profile-allRun Benchmarksworkflow (.github/workflows/benchmark.yaml): four new dispatch inputs —profile-watched-txs(toggle, default off),profile-samples-per-step-path,profile-concurrency,profile-step-limit. When the toggle is on, the polkadot-sdk build steps add--cfg revive_debugto bothRUSTFLAGSandWASM_BUILD_RUSTFLAGSreport.jsonper platform × mode × workload: workload-aggregate opcodes (top-N=64 +"Other"overflow), per-tx breakdown (tx_profiles[]),weight_consumed_*/base_call_weight_*/ unattributed residual, embeddedopcode_catalog(byte → name + category).VM-exclusiverow for one-sided categories).network = westend. Only theasset-hub-westend-runtimedefinesDebugEnabled = ConstBool<{ cfg!(revive_debug) }>;asset-hub-polkadot-runtime(from polkadot-fellows/runtimes) has no equivalent gate, so the cfg would be a silent no-op there. Avalidate-inputsjob at the top of the workflow fails fast on the bad combination so we don't burn CI compiling polkadot-sdk for a run that can't produce traces.Design decisions
trace_tx), not per-block.trace_block's response size scales with#extrinsics × per-tx step countand overruns both the WASM heap (128 MB) and subxt's 10 MB JSON-RPC frame on EVM-heavy workloads. Per-tx bounds the response to one tx's trace.state_callRecorded, not subxt's runtime API. Plainstate_calldoesn't installProofSizeExt→ reclaim breaks → replay diverges from authoring. We call the recorded variant via raw RPC.Bumped
pallet-revive0.11.3 → 0.18.0(the version that exposesExecutionStepKind, needed for the PVM syscall name lookup).