Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b0fbeec
temp fix for para inherent weight overestimation
ordian Jul 19, 2024
940c02e
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Jul 22, 2024
67c295d
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Jul 22, 2024
08dc2cc
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Jul 22, 2024
f920d3b
fixup
ordian Jul 23, 2024
9c7d1b5
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Jul 23, 2024
42d0302
another fixup
ordian Jul 23, 2024
f4d2eee
fixup
ordian Jul 25, 2024
b235de4
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Jul 25, 2024
be07fcb
fix a typo
ordian Jul 26, 2024
9fe7a6b
polkadot bench: make bitfields full in builder
ordian Jul 26, 2024
ce6d0ac
rename some weight files
ordian Jul 26, 2024
64b367c
some more weight renames
ordian Jul 26, 2024
d305a1a
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 6, 2024
c8b2c30
fmt
ordian Aug 6, 2024
e9258b7
rename rococo weights too
ordian Aug 6, 2024
6133e83
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Aug 7, 2024
c9f313c
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Aug 7, 2024
ea9abce
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Aug 7, 2024
254c11c
prdoc
ordian Aug 7, 2024
ca5ee10
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 7, 2024
c4e0989
restore the comment
ordian Aug 7, 2024
cbe0b3f
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 14, 2024
277f40a
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 16, 2024
90e4eaf
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 22, 2024
b5873d4
adjust some of the runtime builder params
ordian Aug 22, 2024
05d90cb
adjust backing bench
ordian Aug 22, 2024
bb75fb5
rename validaty to backing votes
ordian Aug 22, 2024
73d3e6e
fix a typo
ordian Aug 22, 2024
1ca7b53
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Aug 22, 2024
18c3e03
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Aug 23, 2024
46c7965
Merge branch 'master' into ao-fix-parainclusion-weight-overestimation
ordian Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions polkadot/runtime/parachains/src/paras_inherent/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ use polkadot_primitives::v7::GroupIndex;
use crate::builder::BenchBuilder;

benchmarks! {
enter_empty {
let scenario = BenchBuilder::<T>::new()
Comment thread
alexggh marked this conversation as resolved.
.build();

let mut benchmark = scenario.data.clone();

benchmark.bitfields.clear();
benchmark.backed_candidates.clear();
benchmark.disputes.clear();
Comment on lines +35 to +37
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these really needed if we just called build() on a default BenchBuilder instance?

}: enter(RawOrigin::None, benchmark)
verify {
// Assert that the block was not discarded
assert!(Included::<T>::get().is_some());
}
// Variant over `v`, the number of dispute statements in a dispute statement set. This gives the
// weight of a single dispute statement set.
enter_variable_disputes {
Expand Down
18 changes: 15 additions & 3 deletions polkadot/runtime/parachains/src/paras_inherent/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use polkadot_primitives::{
use super::{BackedCandidate, Config, DisputeStatementSet, Weight};

pub trait WeightInfo {
/// The weight of processing an empty parachain inherent.
fn enter_empty() -> Weight;
/// Variant over `v`, the count of dispute statements in a dispute statement set. This gives the
/// weight of a single dispute statement set.
fn enter_variable_disputes(v: u32) -> Weight;
Expand All @@ -45,6 +47,9 @@ pub struct TestWeightInfo;
// mock.
#[cfg(not(feature = "runtime-benchmarks"))]
impl WeightInfo for TestWeightInfo {
fn enter_empty() -> Weight {
Weight::zero()
}
fn enter_variable_disputes(v: u32) -> Weight {
// MAX Block Weight should fit 4 disputes
Weight::from_parts(80_000 * v as u64 + 80_000, 0)
Expand All @@ -66,6 +71,9 @@ impl WeightInfo for TestWeightInfo {
// running as a test.
#[cfg(feature = "runtime-benchmarks")]
impl WeightInfo for TestWeightInfo {
fn enter_empty() -> Weight {
Weight::zero()
}
fn enter_variable_disputes(_v: u32) -> Weight {
Weight::zero()
}
Expand Down Expand Up @@ -123,7 +131,8 @@ where
set_proof_size_to_tx_size(
<<T as Config>::WeightInfo as WeightInfo>::enter_variable_disputes(
statement_set.as_ref().statements.len() as u32,
),
)
.saturating_sub(<<T as Config>::WeightInfo as WeightInfo>::enter_empty()),
Comment thread
sandreim marked this conversation as resolved.
statement_set,
)
}
Expand All @@ -133,14 +142,16 @@ pub fn signed_bitfields_weight<T: Config>(
) -> Weight {
set_proof_size_to_tx_size(
<<T as Config>::WeightInfo as WeightInfo>::enter_bitfields()
.saturating_sub(<<T as Config>::WeightInfo as WeightInfo>::enter_empty())
.saturating_mul(bitfields.len() as u64),
bitfields,
)
}

pub fn signed_bitfield_weight<T: Config>(bitfield: &UncheckedSignedAvailabilityBitfield) -> Weight {
set_proof_size_to_tx_size(
<<T as Config>::WeightInfo as WeightInfo>::enter_bitfields(),
<<T as Config>::WeightInfo as WeightInfo>::enter_bitfields()
.saturating_sub(<<T as Config>::WeightInfo as WeightInfo>::enter_empty()),
bitfield,
)
}
Expand All @@ -155,7 +166,8 @@ pub fn backed_candidate_weight<T: frame_system::Config + Config>(
<<T as Config>::WeightInfo as WeightInfo>::enter_backed_candidates_variable(
candidate.validity_votes().len() as u32,
)
},
}
.saturating_sub(<<T as Config>::WeightInfo as WeightInfo>::enter_empty()),
Comment thread
alexggh marked this conversation as resolved.
candidate,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Autogenerated weights for `runtime_parachains::paras_inherent`
//! Autogenerated weights for `polkadot_runtime_parachains::paras_inherent`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-03-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-h2rr8wx7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-gt9vlx8r-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024

// Executed Command:
Expand All @@ -32,7 +32,7 @@
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
// --pallet=runtime_parachains::paras_inherent
// --pallet=polkadot_runtime_parachains::paras_inherent
// --chain=rococo-dev
// --header=./polkadot/file_header.txt
// --output=./polkadot/runtime/rococo/src/weights/
Expand All @@ -45,9 +45,50 @@
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;

/// Weight functions for `runtime_parachains::paras_inherent`.
/// Weight functions for `polkadot_runtime_parachains::paras_inherent`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::WeightInfo for WeightInfo<T> {
/// Storage: `ParaInherent::Included` (r:1 w:1)
/// Proof: `ParaInherent::Included` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::ParentHash` (r:1 w:0)
/// Proof: `System::ParentHash` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `ParasShared::AllowedRelayParents` (r:1 w:1)
/// Proof: `ParasShared::AllowedRelayParents` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::AvailabilityCores` (r:1 w:1)
/// Proof: `ParaScheduler::AvailabilityCores` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParasShared::ActiveValidatorKeys` (r:1 w:0)
/// Proof: `ParasShared::ActiveValidatorKeys` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0)
/// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `ParaInherent::OnChainVotes` (r:1 w:1)
/// Proof: `ParaInherent::OnChainVotes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParasDisputes::Frozen` (r:1 w:0)
/// Proof: `ParasDisputes::Frozen` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaInclusion::V1` (r:1 w:0)
/// Proof: `ParaInclusion::V1` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::SessionStartBlock` (r:1 w:0)
/// Proof: `ParaScheduler::SessionStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::ValidatorGroups` (r:1 w:0)
/// Proof: `ParaScheduler::ValidatorGroups` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::ClaimQueue` (r:1 w:1)
/// Proof: `ParaScheduler::ClaimQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParasShared::ActiveValidatorIndices` (r:1 w:0)
/// Proof: `ParasShared::ActiveValidatorIndices` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Session::DisabledValidators` (r:1 w:0)
/// Proof: `Session::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `v` is `[10, 200]`.
fn enter_empty() -> Weight {
// Proof Size summary in bytes:
// Measured: `8967`
// Estimated: `12432`
// Minimum execution time: 111_675_000 picoseconds.
Weight::from_parts(126_295_131, 0)
Comment thread
ordian marked this conversation as resolved.
Outdated
.saturating_add(Weight::from_parts(0, 12432))
.saturating_add(T::DbWeight::get().reads(15))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `ParaInherent::Included` (r:1 w:1)
/// Proof: `ParaInherent::Included` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::ParentHash` (r:1 w:0)
Expand Down Expand Up @@ -109,13 +150,13 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::Weigh
/// The range of component `v` is `[10, 200]`.
fn enter_variable_disputes(v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `67785`
// Estimated: `73725 + v * (23 ±0)`
// Minimum execution time: 949_716_000 picoseconds.
Weight::from_parts(482_361_515, 0)
.saturating_add(Weight::from_parts(0, 73725))
// Standard Error: 17_471
.saturating_add(Weight::from_parts(50_100_764, 0).saturating_mul(v.into()))
// Measured: `67786`
// Estimated: `73726 + v * (23 ±0)`
// Minimum execution time: 905_910_000 picoseconds.
Weight::from_parts(518_709_529, 0)
.saturating_add(Weight::from_parts(0, 73726))
// Standard Error: 18_141
.saturating_add(Weight::from_parts(41_779_459, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(25))
.saturating_add(T::DbWeight::get().writes(15))
.saturating_add(Weight::from_parts(0, 23).saturating_mul(v.into()))
Expand All @@ -140,18 +181,6 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::Weigh
/// Proof: `ParasDisputes::Frozen` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaInclusion::V1` (r:2 w:1)
/// Proof: `ParaInclusion::V1` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1)
/// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:1)
/// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpChannelDigests` (r:1 w:1)
/// Proof: `Hrmp::HrmpChannelDigests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::FutureCodeUpgrades` (r:1 w:0)
/// Proof: `Paras::FutureCodeUpgrades` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Registrar::Paras` (r:1 w:0)
/// Proof: `Registrar::Paras` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `ParasDisputes::Disputes` (r:1 w:0)
/// Proof: `ParasDisputes::Disputes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::SessionStartBlock` (r:1 w:0)
/// Proof: `ParaScheduler::SessionStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParaScheduler::ValidatorGroups` (r:1 w:0)
Expand All @@ -164,25 +193,15 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::Weigh
/// Proof: `ParasShared::ActiveValidatorIndices` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Session::DisabledValidators` (r:1 w:0)
/// Proof: `Session::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParasDisputes::Included` (r:0 w:1)
/// Proof: `ParasDisputes::Included` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Hrmp::HrmpWatermarks` (r:0 w:1)
/// Proof: `Hrmp::HrmpWatermarks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::Heads` (r:0 w:1)
/// Proof: `Paras::Heads` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::UpgradeGoAheadSignal` (r:0 w:1)
/// Proof: `Paras::UpgradeGoAheadSignal` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Paras::MostRecentContext` (r:0 w:1)
/// Proof: `Paras::MostRecentContext` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn enter_bitfields() -> Weight {
// Proof Size summary in bytes:
// Measured: `42757`
// Estimated: `48697`
// Minimum execution time: 437_627_000 picoseconds.
Weight::from_parts(460_975_000, 0)
.saturating_add(Weight::from_parts(0, 48697))
.saturating_add(T::DbWeight::get().reads(23))
.saturating_add(T::DbWeight::get().writes(15))
// Measured: `42374`
// Estimated: `48314`
// Minimum execution time: 333_230_000 picoseconds.
Weight::from_parts(341_021_000, 0)
.saturating_add(Weight::from_parts(0, 48314))
.saturating_add(T::DbWeight::get().reads(17))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `ParaInherent::Included` (r:1 w:1)
/// Proof: `ParaInherent::Included` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
Expand Down Expand Up @@ -245,15 +264,13 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::Weigh
/// Storage: `Paras::MostRecentContext` (r:0 w:1)
/// Proof: `Paras::MostRecentContext` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `v` is `[101, 200]`.
fn enter_backed_candidates_variable(v: u32, ) -> Weight {
fn enter_backed_candidates_variable(_v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `42829`
// Estimated: `48769`
// Minimum execution time: 1_305_254_000 picoseconds.
Weight::from_parts(1_347_160_667, 0)
.saturating_add(Weight::from_parts(0, 48769))
// Standard Error: 22_128
.saturating_add(Weight::from_parts(57_229, 0).saturating_mul(v.into()))
// Measured: `42830`
// Estimated: `48770`
// Minimum execution time: 1_401_417_000 picoseconds.
Weight::from_parts(1_461_289_202, 0)
Comment thread
ordian marked this conversation as resolved.
Outdated
.saturating_add(Weight::from_parts(0, 48770))
.saturating_add(T::DbWeight::get().reads(26))
.saturating_add(T::DbWeight::get().writes(15))
}
Expand Down Expand Up @@ -323,11 +340,11 @@ impl<T: frame_system::Config> polkadot_runtime_parachains::paras_inherent::Weigh
/// Proof: `Paras::MostRecentContext` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn enter_backed_candidate_code_upgrade() -> Weight {
// Proof Size summary in bytes:
// Measured: `42842`
// Estimated: `48782`
// Minimum execution time: 38_637_547_000 picoseconds.
Weight::from_parts(41_447_412_000, 0)
.saturating_add(Weight::from_parts(0, 48782))
// Measured: `42843`
// Estimated: `48783`
// Minimum execution time: 34_576_373_000 picoseconds.
Weight::from_parts(37_896_045_000, 0)
.saturating_add(Weight::from_parts(0, 48783))
.saturating_add(T::DbWeight::get().reads(28))
.saturating_add(T::DbWeight::get().writes(15))
}
Expand Down
Loading