Skip to content

Commit

Permalink
update to use omni bencher
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Aug 14, 2024
1 parent 3802117 commit 6050b27
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: ${{ github.event.issue.pull_request && contains(fromJson('["MEMBER", "OWNER"]'), github.event.comment.author_association) && startsWith(github.event.comment.body, '/bench ') }}
runs-on: [self-hosted, linux]
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Get PR branch
id: issue
with:
Expand All @@ -30,7 +30,7 @@ jobs:
with:
submodules: recursive
ref: ${{ fromJson(steps.issue.outputs.result).sha }}
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Prepare command
id: command
with:
Expand All @@ -54,7 +54,7 @@ jobs:
default:
throw new Error('Invalid command')
}
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Post comment
id: comment
with:
Expand All @@ -71,7 +71,7 @@ jobs:
`
})
return data.data.id
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -82,13 +82,15 @@ jobs:
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Install weight-gen
run: cargo install --git https://github.com/open-web3-stack/wasm-bencher.git --bin weight-gen --force
run: cargo install --git https://github.com/open-web3-stack/wasm-bencher.git --bin weight-gen
- name: Install omni-bencher
run: cargo install frame-omni-bencher
- name: Setup cmake
uses: jwlawson/[email protected]
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: Run benchmarks
run: ${{steps.command.outputs.result}} > ${{runner.temp}}/out.txt
- name: Commit
Expand All @@ -98,7 +100,7 @@ jobs:
git add .
git commit -m '${{github.event.comment.body}}' --allow-empty
git push origin HEAD:${{ fromJson(steps.issue.outputs.result).ref }}
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Update comment
with:
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -85,7 +85,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,23 @@ endif
ifeq ($(words $(pallet_folder)), 0)
$(error pallet_folder not defined)
endif
cargo run $(options) --release --bin=acala --features=runtime-benchmarks --features=with-mandala-runtime -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=$(pallet) --extrinsic="*" --wasm-execution=compiled --heap-pages=4096 --output=./modules/$(pallet_folder)/src/weights.rs --template=./templates/module-weight-template.hbs
cargo build $(options) --release --features=runtime-benchmarks -p mandala-runtime
frame-omni-bencher v1 benchmark pallet --runtime target/release/wbuild/mandala-runtime/mandala_runtime.compact.compressed.wasm --steps=50 --repeat=20 --pallet=$(pallet) --extrinsic="*" --heap-pages=4096 --output=./modules/$(pallet_folder)/src/weights.rs --template=./templates/module-weight-template.hbs

.PHONY: benchmark-mandala
benchmark-mandala:
cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-mandala-runtime -- benchmark pallet --chain=dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/
cargo build $(options) --release --features=runtime-benchmarks -p mandala-runtime
frame-omni-bencher v1 pallet --runtime target/release/wbuild/mandala-runtime/mandala_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/

.PHONY: benchmark-karura
benchmark-karura:
cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-karura-runtime -- benchmark pallet --chain=karura-dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/
cargo build $(options) --release --features=runtime-benchmarks -p karura-runtime
frame-omni-bencher v1 pallet --runtime target/release/wbuild/karura-runtime/karura_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/

.PHONY: benchmark-acala
benchmark-acala:
cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-acala-runtime -- benchmark pallet --chain=acala-dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/

.PHONY: benchmark-machine
benchmark-machine:
cargo run --profile production --features=with-acala-runtime -- benchmark machine --chain=acala-dev
cargo build $(options) --release --features=runtime-benchmarks -p acala-runtime
frame-omni-bencher v1 pallet --runtime target/release/wbuild/acala-runtime/acala_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/

.PHONY: clippy-fix
clippy-fix:
Expand Down

0 comments on commit 6050b27

Please sign in to comment.