Run Benchmarks workflow (openxla/tokamax)
The Run Benchmarks workflow from openxla/tokamax, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Run Benchmarks workflow from the openxla/tokamax repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: Run Benchmarks
on:
# Allow manual runs from the Actions tab for testing
workflow_dispatch:
inputs:
benchmark_filter:
description: "Regex to filter by benchmark name (e.g., 'attention.*')."
required: false
type: string
default: ""
environment_filter:
description: "Regex to filter by environment configuration ID (e.g., 'b200.*')."
required: false
type: string
default: ""
enable_xprof:
description: "Enable xprof trace collection."
required: false
type: boolean
default: false
schedule:
- cron: "0 0 * * *" # Runs at 00:00 UTC every day
permissions:
contents: read
pull-requests: write
jobs:
run_benchmarks:
name: Run Tokamax benchmarks
uses: google-ml-infra/bap/.github/workflows/run-benchmarks.yaml@affd28b492f67c242afa8b119e590b25816b7b88
with:
registry_file: "tokamax/benchmarks/benchmark_registry.pbtxt"
ml_actions_ref: "affd28b492f67c242afa8b119e590b25816b7b88"
publish_metrics: true
pub_sub_gcp_project_id: "ml-oss-benchmarking-production"
pub_sub_gcp_topic_id: "public-results-prod"
benchmark_filter: ${{ inputs.benchmark_filter }}
environment_filter: ${{ inputs.environment_filter }}
custom_env_vars: |
${{ inputs.enable_xprof == true && 'TOKAMAX_DUMP_XPROF=true' || '' }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Run Benchmarks on: # Allow manual runs from the Actions tab for testing workflow_dispatch: inputs: benchmark_filter: description: "Regex to filter by benchmark name (e.g., 'attention.*')." required: false type: string default: "" environment_filter: description: "Regex to filter by environment configuration ID (e.g., 'b200.*')." required: false type: string default: "" enable_xprof: description: "Enable xprof trace collection." required: false type: boolean default: false schedule: - cron: "0 0 * * *" # Runs at 00:00 UTC every day permissions: contents: read pull-requests: write jobs: run_benchmarks: timeout-minutes: 30 name: Run Tokamax benchmarks uses: google-ml-infra/bap/.github/workflows/run-benchmarks.yaml@affd28b492f67c242afa8b119e590b25816b7b88 with: registry_file: "tokamax/benchmarks/benchmark_registry.pbtxt" ml_actions_ref: "affd28b492f67c242afa8b119e590b25816b7b88" publish_metrics: true pub_sub_gcp_project_id: "ml-oss-benchmarking-production" pub_sub_gcp_topic_id: "public-results-prod" benchmark_filter: ${{ inputs.benchmark_filter }} environment_filter: ${{ inputs.environment_filter }} custom_env_vars: | ${{ inputs.enable_xprof == true && 'TOKAMAX_DUMP_XPROF=true' || '' }}
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.