Skip to content

Commit

Permalink
fix(benchmarks): auto-trigger CI, produce correct output (#3873)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregory Sobol <[email protected]>
  • Loading branch information
StackOverflowExcept1on and grishasobol authored Apr 12, 2024
1 parent 7663ef5 commit a8b0d45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
# apply some patches for `pallets/gear/src/weights.rs`
cp runtime/vara/src/weights/pallet_gear.rs pallets/gear/src/weights.rs
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear/src/weights.rs
# apply some patches for `pallets/gear-builtin/src/weights.rs`
cp runtime/vara/src/weights/pallet_gear_builtin.rs pallets/gear-builtin/src/weights.rs
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear-builtin/src/weights.rs
# generate code for lightweight scheduler that is used in gtest and other crates
./scripts/weight-dump.sh
Expand Down Expand Up @@ -79,14 +82,15 @@ jobs:
with:
commit_message: >-
chore(runtime): update weights
file_pattern: "pallets/gear/src/ runtime/vara/src/weights/ utils/wasm-instrument/src/gas_metering/"
file_pattern: "pallets/gear/src/ pallets/gear-builtin/src/ runtime/vara/src/weights/ utils/wasm-instrument/src/gas_metering/"

- name: Create Pull Request
if: ${{ inputs.change-type == 'pull_request' }}
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
pallets/gear/src/
pallets/gear-builtin/src/
runtime/vara/src/weights/
utils/wasm-instrument/src/gas_metering/
commit-message: update weights
Expand All @@ -97,3 +101,6 @@ jobs:
body: |
`run_all_benchmarks.sh` script is applied to update weights (branch: `${{ github.ref_name }}`, commit ${{ github.sha }})
**Note:** If CI fails, try manually updating the heuristic tests: `runtime/vara/src/tests.rs`
labels: |
A0-pleasereview
A4-insubstantial
5 changes: 2 additions & 3 deletions pallets/gear/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,8 @@ pub mod pallet {
// actual version to avoid re-instrumentation
version: T::Schedule::get().instruction_weights.version,
// some benchmarks have data in user stack memory
check_and_canonize_stack_end: false,
// without stack end canonization, program has mutable globals.
check_mut_global_exports: false,
// TODO: consider to remove checking data section and stack overlap #3875
check_data_section: false,
..Default::default()
},
)
Expand Down
4 changes: 4 additions & 0 deletions scripts/unpack-weights.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ unzip -o $VARA_RUNTIME && rm $VARA_RUNTIME
# apply some patches for `pallets/gear/src/weights.rs`
cp runtime/vara/src/weights/pallet_gear.rs pallets/gear/src/weights.rs
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear/src/weights.rs

# apply some patches for `pallets/gear-builtin/src/weights.rs`
cp runtime/vara/src/weights/pallet_gear_builtin.rs pallets/gear-builtin/src/weights.rs
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear-builtin/src/weights.rs

0 comments on commit a8b0d45

Please sign in to comment.