refactor(benchmarking): rebrand pallet → pezpallet in CLI and scripts
- Rename CLI argument --pallet to --pezpallet (with --pallet as alias) - Rename --pallets to --pezpallet, --exclude-pallets to --exclude-pezpallets - Update benchmark subcommand from 'pallet' to 'pezpallet' - Rename check-frame-omni-bencher.yml to check-pezframe-omni-bencher.yml - Update all benchmark scripts to use new argument names - Update cmd.py to use pezframe-omni-bencher and --pezpallet
This commit is contained in:
+19
-19
@@ -189,22 +189,22 @@ bench_example = '''**Examples**:
|
||||
%(prog)s
|
||||
|
||||
Runs benchmarks for pallet_balances and pallet_multisig for all runtimes which have these pallets. **--quiet** makes it to output nothing to PR but reactions
|
||||
%(prog)s --pallet pallet_balances pallet_xcm_benchmarks::generic --quiet
|
||||
%(prog)s --pezpallet pallet_balances pallet_xcm_benchmarks::generic --quiet
|
||||
|
||||
Runs bench for all pallets for zagros runtime and fails fast on first failed benchmark
|
||||
%(prog)s --runtime zagros --fail-fast
|
||||
|
||||
Does not output anything and cleans up the previous bot's & author command triggering comments in PR
|
||||
%(prog)s --runtime zagros pezkuwichain --pallet pallet_balances pallet_multisig --quiet --clean
|
||||
%(prog)s --runtime zagros pezkuwichain --pezpallet pallet_balances pallet_multisig --quiet --clean
|
||||
'''
|
||||
|
||||
parser_bench = subparsers.add_parser('bench', aliases=['bench-omni'], help='Runs benchmarks (frame omni bencher)', epilog=bench_example, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser_bench = subparsers.add_parser('bench', aliases=['bench-omni'], help='Runs benchmarks (pezframe omni bencher)', epilog=bench_example, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
|
||||
for arg, config in common_args.items():
|
||||
parser_bench.add_argument(arg, **config)
|
||||
|
||||
parser_bench.add_argument('--runtime', help='Runtime(s) space separated', choices=runtimeNames, nargs='*', default=runtimeNames)
|
||||
parser_bench.add_argument('--pallet', help='Pallet(s) space separated', nargs='*', default=[])
|
||||
parser_bench.add_argument('--pezpallet', help='Pezpallet(s) space separated', nargs='*', default=[])
|
||||
parser_bench.add_argument('--fail-fast', help='Fail fast on first failed benchmark', action='store_true')
|
||||
|
||||
|
||||
@@ -382,26 +382,26 @@ def main():
|
||||
|
||||
print(f'\n')
|
||||
|
||||
# filter out only the specified pallets from collected runtimes/pallets
|
||||
if args.pallet:
|
||||
print(f'Pallets: {args.pallet}')
|
||||
# filter out only the specified pezpallets from collected runtimes/pezpallets
|
||||
if args.pezpallet:
|
||||
print(f'Pezpallets: {args.pezpallet}')
|
||||
new_pallets_map = {}
|
||||
# keep only specified pallets if they exist in the runtime
|
||||
# keep only specified pezpallets if they exist in the runtime
|
||||
for runtime in runtime_pallets_map:
|
||||
if set(args.pallet).issubset(set(runtime_pallets_map[runtime])):
|
||||
new_pallets_map[runtime] = args.pallet
|
||||
if set(args.pezpallet).issubset(set(runtime_pallets_map[runtime])):
|
||||
new_pallets_map[runtime] = args.pezpallet
|
||||
|
||||
runtime_pallets_map = new_pallets_map
|
||||
|
||||
print(f'Filtered out runtimes & pallets: {runtime_pallets_map}\n')
|
||||
print(f'Filtered out runtimes & pezpallets: {runtime_pallets_map}\n')
|
||||
|
||||
if not runtime_pallets_map:
|
||||
if args.pallet and not args.runtime:
|
||||
print(f"No pallets {args.pallet} found in any runtime")
|
||||
elif args.runtime and not args.pallet:
|
||||
print(f"{args.runtime} runtime does not have any pallets")
|
||||
elif args.runtime and args.pallet:
|
||||
print(f"No pallets {args.pallet} found in {args.runtime}")
|
||||
if args.pezpallet and not args.runtime:
|
||||
print(f"No pezpallets {args.pezpallet} found in any runtime")
|
||||
elif args.runtime and not args.pezpallet:
|
||||
print(f"{args.runtime} runtime does not have any pezpallets")
|
||||
elif args.runtime and args.pezpallet:
|
||||
print(f"No pezpallets {args.pezpallet} found in {args.runtime}")
|
||||
else:
|
||||
print('No runtimes found')
|
||||
sys.exit(1)
|
||||
@@ -448,10 +448,10 @@ def main():
|
||||
output_path = xcm_path
|
||||
|
||||
print(f'-- benchmarking {pallet} in {runtime} into {output_path}')
|
||||
cmd = f"frame-omni-bencher v1 benchmark pallet " \
|
||||
cmd = f"pezframe-omni-bencher v1 benchmark pezpallet " \
|
||||
f"--extrinsic=* " \
|
||||
f"--runtime=target/{profile}/wbuild/{config['package']}/{config['package'].replace('-', '_')}.wasm " \
|
||||
f"--pallet={pallet} " \
|
||||
f"--pezpallet={pallet} " \
|
||||
f"--header={header_path} " \
|
||||
f"--output={output_path} " \
|
||||
f"--wasm-execution=compiled " \
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ jobs:
|
||||
id: required
|
||||
run: |
|
||||
cargo build --locked --quiet --release -p asset-hub-zagros-runtime --features runtime-benchmarks
|
||||
cargo run --locked --release -p pezframe-omni-bencher --quiet -- v1 benchmark pallet --runtime target/release/wbuild/asset-hub-zagros-runtime/asset_hub_zagros_runtime.compact.compressed.wasm --all --steps 2 --repeat 1 --quiet
|
||||
cargo run --locked --release -p pezframe-omni-bencher --quiet -- v1 benchmark pezpallet --runtime target/release/wbuild/asset-hub-zagros-runtime/asset_hub_zagros_runtime.compact.compressed.wasm --all --steps 2 --repeat 1 --quiet
|
||||
|
||||
runtime-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
ls -lrt $RUNTIME_BLOB_PATH
|
||||
|
||||
if [[ "$BENCH_CMD" == "pallet" ]]; then
|
||||
cmd="./target/release/pezframe-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1 $FLAGS"
|
||||
cmd="./target/release/pezframe-omni-bencher v1 benchmark pezpallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1 $FLAGS"
|
||||
elif [[ "$BENCH_CMD" == "overhead" ]]; then
|
||||
cmd="./target/release/pezframe-omni-bencher v1 benchmark overhead --runtime $RUNTIME_BLOB_PATH"
|
||||
else
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: script
|
||||
run: cargo run --locked --release -p pezstaging-node-cli --bin bizinikiwi-node --features runtime-benchmarks --quiet -- benchmark pallet --chain dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1 --quiet
|
||||
run: cargo run --locked --release -p pezstaging-node-cli --bin bizinikiwi-node --features runtime-benchmarks --quiet -- benchmark pezpallet --chain dev --pezpallet "*" --extrinsic "*" --steps 2 --repeat 1 --quiet
|
||||
|
||||
# cf https://github.com/pezkuwichain/pezkuwi-sdk/issues/1652
|
||||
test-syscalls:
|
||||
|
||||
@@ -29,8 +29,8 @@ run_benchmark() {
|
||||
echo "Outputting to '$output_file'"
|
||||
|
||||
WASMTIME_BACKTRACE_DETAILS=1 RUST_LOG=${LOG} \
|
||||
../../../../../target/release/pezframe-omni-bencher v1 benchmark pallet \
|
||||
--pallet "$pallet_name" \
|
||||
../../../../../target/release/pezframe-omni-bencher v1 benchmark pezpallet \
|
||||
--pezpallet "$pallet_name" \
|
||||
--extrinsic "*" \
|
||||
--runtime "$WASM_BLOB_PATH" \
|
||||
--steps "$STEPS" \
|
||||
|
||||
@@ -133,11 +133,11 @@ for PALLET in "${PALLETS[@]}"; do
|
||||
echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE";
|
||||
|
||||
OUTPUT=$(
|
||||
$BIZINIKIWI benchmark pallet \
|
||||
$BIZINIKIWI benchmark pezpallet \
|
||||
--chain=dev \
|
||||
--steps=50 \
|
||||
--repeat=20 \
|
||||
--pallet="$PALLET" \
|
||||
--pezpallet="$PALLET" \
|
||||
--extrinsic="*" \
|
||||
--wasm-execution=compiled \
|
||||
--heap-pages=4096 \
|
||||
|
||||
@@ -633,13 +633,13 @@ impl PalletCmd {
|
||||
|
||||
/// Whether this pezpallet should be run.
|
||||
fn pezpallet_selected(&self, pezpallet: &Vec<u8>) -> bool {
|
||||
let include = self.pallets.clone();
|
||||
let include = self.pezpallet.clone();
|
||||
|
||||
let included = include.is_empty()
|
||||
|| include.iter().any(|p| p.as_bytes() == pezpallet)
|
||||
|| include.iter().any(|p| p == "*")
|
||||
|| include.iter().any(|p| p == "all");
|
||||
let excluded = self.exclude_pallets.iter().any(|p| p.as_bytes() == pezpallet);
|
||||
let excluded = self.exclude_pezpallets.iter().any(|p| p.as_bytes() == pezpallet);
|
||||
|
||||
included && !excluded
|
||||
}
|
||||
|
||||
@@ -50,18 +50,18 @@ pub enum ListOutput {
|
||||
/// Benchmark the extrinsic weight of FRAME Pallets.
|
||||
#[derive(Debug, clap::Parser)]
|
||||
pub struct PalletCmd {
|
||||
/// Select a FRAME Pallets to benchmark, or `*` for all (in which case `extrinsic` must be
|
||||
/// Select a FRAME Pezpallets to benchmark, or `*` for all (in which case `extrinsic` must be
|
||||
/// `*`).
|
||||
#[arg(short, long, alias = "pezpallet", num_args = 1.., value_delimiter = ',', value_parser = parse_pallet_name, required_unless_present_any = ["list", "json_input", "all"], default_value_if("all", "true", Some("*".into())))]
|
||||
pub pallets: Vec<String>,
|
||||
#[arg(short, long, alias = "pallet", num_args = 1.., value_delimiter = ',', value_parser = parse_pallet_name, required_unless_present_any = ["list", "json_input", "all"], default_value_if("all", "true", Some("*".into())))]
|
||||
pub pezpallet: Vec<String>,
|
||||
|
||||
/// Select an extrinsic inside the pezpallet to benchmark, or `*` or 'all' for all.
|
||||
#[arg(short, long, required_unless_present_any = ["list", "json_input", "all"], default_value_if("all", "true", Some("*".into())))]
|
||||
pub extrinsic: Option<String>,
|
||||
|
||||
/// Comma separated list of pallets that should be excluded from the benchmark.
|
||||
/// Comma separated list of pezpallets that should be excluded from the benchmark.
|
||||
#[arg(long, value_parser, num_args = 1.., value_delimiter = ',')]
|
||||
pub exclude_pallets: Vec<String>,
|
||||
pub exclude_pezpallets: Vec<String>,
|
||||
|
||||
/// Comma separated list of `pezpallet::extrinsic` combinations that should not be run.
|
||||
///
|
||||
|
||||
@@ -5,9 +5,9 @@ pushd ../pezcumulus
|
||||
cargo run --release --bin pezkuwi-teyrchain \
|
||||
--features runtime-benchmarks \
|
||||
-- \
|
||||
benchmark pallet \
|
||||
benchmark pezpallet \
|
||||
--chain=bridge-hub-pezkuwichain-dev \
|
||||
--pallet=snowbridge_pallet_ethereum_client \
|
||||
--pezpallet=snowbridge_pallet_ethereum_client \
|
||||
--extrinsic="*" \
|
||||
--execution=wasm --wasm-execution=compiled \
|
||||
--steps 50 --repeat 20 \
|
||||
|
||||
@@ -38,11 +38,11 @@ do
|
||||
output_dir="xcm/"
|
||||
extra_args="--template=./templates/xcm-bench-template.hbs"
|
||||
fi
|
||||
$artifactsDir/pezkuwi-teyrchain benchmark pallet \
|
||||
$artifactsDir/pezkuwi-teyrchain benchmark pezpallet \
|
||||
$extra_args \
|
||||
--chain=$benchmarkRuntimeName \
|
||||
--wasm-execution=compiled \
|
||||
--pallet=$pallet \
|
||||
--pezpallet=$pallet \
|
||||
--extrinsic='*' \
|
||||
--steps=$steps \
|
||||
--repeat=$repeat \
|
||||
|
||||
Reference in New Issue
Block a user