Skip to content

benchmark action updates weights automatically #1777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 37 commits into
base: devnet-ready
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f2125d4
benchmark action updates weights automatically
JohnReedV Jun 23, 2025
27de78c
only commit if needed
JohnReedV Jun 23, 2025
4cb16f4
CI test
JohnReedV Jun 23, 2025
7ee5402
fix action
JohnReedV Jun 24, 2025
6b17d6a
update weight
JohnReedV Jun 24, 2025
a1dce2e
fix action
JohnReedV Jun 24, 2025
90f3264
give correct commit perms
JohnReedV Jun 24, 2025
3f755ba
improve previous solution
JohnReedV Jun 24, 2025
185e1f7
return label skip checks
JohnReedV Jun 24, 2025
b244879
bump spec
JohnReedV Jun 24, 2025
68d7a91
Merge branch 'devnet-ready' into auto-update-weight-values
JohnReedV Jun 24, 2025
c2eba39
fix
JohnReedV Jun 24, 2025
1065243
fix int drift
JohnReedV Jun 24, 2025
2d9d83f
use awk
JohnReedV Jun 25, 2025
30b2b03
bump spec
JohnReedV Jun 25, 2025
61250c3
Update benchmark_action.sh
JohnReedV Jun 25, 2025
f761a86
Merge branch 'devnet-ready' into auto-update-weight-values
JohnReedV Jun 25, 2025
e4880a4
Update benchmark_action.sh
JohnReedV Jun 25, 2025
959149b
Merge branch 'auto-update-weight-values' of github.com:opentensor/sub…
JohnReedV Jun 25, 2025
3ed7aac
Update benchmark_action.sh
JohnReedV Jun 25, 2025
ff37c4b
new method
JohnReedV Jun 25, 2025
a4be331
fix
JohnReedV Jun 25, 2025
6cfceea
Update benchmark_action.sh
JohnReedV Jun 25, 2025
f41d4f4
Update benchmark_action.sh
JohnReedV Jun 25, 2025
c5e53cd
Update benchmark_action.sh
JohnReedV Jun 25, 2025
22f711b
fix
JohnReedV Jun 25, 2025
971c5b0
Update benchmark_action.sh
JohnReedV Jun 26, 2025
222dc6c
Update benchmark_action.sh
JohnReedV Jun 26, 2025
41075fb
Update benchmark_action.sh
JohnReedV Jun 26, 2025
6754212
bump spec
JohnReedV Jun 26, 2025
aee9fe6
Update benchmark_action.sh
JohnReedV Jun 26, 2025
af57db2
Merge branch 'devnet-ready' into auto-update-weight-values
JohnReedV Jun 26, 2025
f690b68
Update benchmark_action.sh
JohnReedV Jun 26, 2025
e5267a7
Merge branch 'auto-update-weight-values' of github.com:opentensor/sub…
JohnReedV Jun 26, 2025
0b24d45
Update benchmark_action.sh
JohnReedV Jun 26, 2025
b2da5f4
Update benchmark_action.sh
JohnReedV Jun 27, 2025
255c074
Update benchmark_action.sh
JohnReedV Jun 27, 2025
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
212 changes: 110 additions & 102 deletions .github/workflows/run-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ name: Validate-Benchmarks

on:
pull_request:
types:
- opened
- synchronize
types: [opened, synchronize]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

concurrency:
group: run-benchmarks-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -17,104 +19,110 @@ jobs:
runs-on: Benchmarking

env:
SKIP_BENCHMARKS: '0'
SKIP_BENCHMARKS: '0'
AUTO_COMMIT_WEIGHTS: '1'

steps:
- name: Check out PR branch
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Install GitHub CLI
# We disallow skipping benchmarks for PRs from forks to avoid exposing secrets
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
sudo apt-get update
sudo apt-get install -y gh
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token

- name: Check skip label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Install system dependencies
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
sudo apt-get update
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Check skip label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Install Rust toolchain
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Check skip label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Cache Rust build
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: Swatinem/rust-cache@v2
with:
key: bench-${{ hashFiles('**/Cargo.lock') }}

- name: Check skip label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Build node with benchmarks
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
cargo build --profile production -p node-subtensor --features runtime-benchmarks

- name: Check skip label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Run & validate benchmarks
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
chmod +x scripts/benchmark_action.sh
./scripts/benchmark_action.sh

- name: Check skip label after run
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label was found — but benchmarks already ran."
fi
# ──────────────────────────────────────────────────────────────────
- name: Check out PR branch
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install GitHub CLI
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
sudo apt-get update
sudo apt-get install -y gh
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token

# (1) — original skip-label check
- name: Check skip label
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Install system dependencies
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
sudo apt-get update
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler

# (2)
- name: Check skip label
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Install Rust toolchain
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

# (3)
- name: Check skip label
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Cache Rust build
if: ${{ env.SKIP_BENCHMARKS != '1' }}
uses: Swatinem/rust-cache@v2
with:
key: bench-${{ hashFiles('**/Cargo.lock') }}

# (4)
- name: Check skip label
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Build node with benchmarks
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
cargo build --profile production -p node-subtensor --features runtime-benchmarks

# (5)
- name: Check skip label
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label found — skipping benchmarks."
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
fi

- name: Run & validate benchmarks
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
chmod +x scripts/benchmark_action.sh
scripts/benchmark_action.sh

# (6) — final, unchanged
- name: Check skip label after run
if: ${{ env.SKIP_BENCHMARKS != '1' }}
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
echo "skip-validate-benchmarks label was found — but benchmarks already ran."
fi
Loading
Loading