Skip to content

Consolidate benchmark config into a single generated registry - #33

Merged
ford442 merged 1 commit into
mainfrom
claude/benchmark-config-consolidation-qwck19
Aug 12, 2026
Merged

Consolidate benchmark config into a single generated registry#33
ford442 merged 1 commit into
mainfrom
claude/benchmark-config-consolidation-qwck19

Conversation

@ford442

@ford442 ford442 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Benchmark configuration used to live in three hand-maintained places (backend/benchmarks/configs.js, src/components/BenchmarkRunner.js, src/utils/machineProfiles.js), which had already drifted — webgpu_dispatch/webgpu_dispatch_wasm only existed on the frontend, and getMultiplier() was duplicated as an inline switch in the frontend fallback simulation.

This PR introduces a single hand-edited config source and generates the rest:

  • shared/benchmark-registry.json — canonical configurations[] (with per-config multiplier), machineProfiles, and wasmLoaderConfigs.
  • scripts/generate-benchmark-config.js — emits backend/benchmarks/configs.generated.js (CommonJS) and src/generated/benchmarkRegistry.js (ESM) from the registry. Supports --check for CI drift detection.
  • backend/benchmarks/configs.js — now only holds the mock benchmark-running logic (runConfig, runConfigsSequential, generateResult); config data is imported from the generated module.
  • src/components/BenchmarkRunner.js — inline configurations[] array and duplicated multiplier switch removed; both now import from the generated registry.
  • src/utils/machineProfiles.js — re-exports machineProfiles from the generated registry instead of duplicating the object.
  • webgpu_dispatch / webgpu_dispatch_wasm are now present in both the backend and frontend generated configs.
  • npm run config:generate / npm run config:check added to package.json; .github/workflows/config-check.yml runs the check on push/PR to fail CI on drift.
  • CLAUDE.md updated: directory structure, "How to Add a New Compilation Config" workflow, and "Common Pitfalls" now reflect the single-source-of-truth model.

Test plan

  • npm run config:check passes against the committed generated files
  • node backend/benchmarks/configs.js loads correctly and runConfigsSequential produces results (via backend/server.js's existing /api/configurations route)
  • node backend/cli.js list still works (CLI benchmark path untouched)
  • CI=true npx react-scripts build compiles cleanly with no new warnings
  • Manual smoke test of the web UI (npm run web) — run/GPU benchmark buttons and machine-profile playback

Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a shared benchmark registry that centralizes benchmark settings, multipliers, loaders, and machine profiles.
    • Added commands to generate configuration files and verify that generated files are up to date.
    • Added automated configuration checks for pushes and pull requests targeting the main branch.
    • Added recognition for an additional GPU execution mode.
  • Documentation

    • Updated configuration setup guidance, generated-file workflows, registry details, and common pitfalls.

Replace three hand-maintained copies of benchmark config (backend
configs.js, frontend BenchmarkRunner.js, frontend machineProfiles.js)
with one canonical shared/benchmark-registry.json plus a generator
script that emits backend/benchmarks/configs.generated.js (CJS) and
src/generated/benchmarkRegistry.js (ESM). Backend and frontend now
import the generated data instead of hand-rolled arrays/switches,
webgpu_dispatch* configs are present on both sides, and
`npm run config:check` (wired into CI) fails the build on drift.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jeFBxMgkwAb3pZ5GHwZQA
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Benchmark configuration centralization

Layer / File(s) Summary
Registry and generated outputs
shared/benchmark-registry.json, scripts/generate-benchmark-config.js, package.json
The shared registry defines benchmark metadata and machine profiles. The generator creates backend and frontend modules and checks for stale or missing outputs.
Backend and frontend registry consumers
backend/benchmarks/configs.js, src/components/BenchmarkRunner.js, src/utils/machineProfiles.js
Backend and frontend code now import generated configurations, multipliers, loader settings, and machine profiles. GPU detection includes webgpu_dispatch.
Drift validation and configuration guidance
.github/workflows/config-check.yml, CLAUDE.md
CI runs npm run config:check for pushes and pull requests targeting main. Documentation describes the shared registry and generated-file workflow.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: consolidating benchmark configuration into a generated canonical registry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/benchmark-config-consolidation-qwck19

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ford442
ford442 merged commit 47fa054 into main Aug 12, 2026
1 of 2 checks passed
@ford442
ford442 deleted the claude/benchmark-config-consolidation-qwck19 branch August 12, 2026 02:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/config-check.yml:
- Line 13: Update the actions/checkout@v4 step to set persist-credentials to
false, preventing the job from storing the GITHUB_TOKEN in local Git
configuration.

In `@backend/benchmarks/configs.js`:
- Around line 19-23: Update runConfig’s result dispatch so webgpu_dispatch uses
the dispatch-overhead metrics path rather than the generic GPU/WebGL labeling
path; keep webgpu_compute on its existing handling and preserve current behavior
for other configurations.

In `@shared/benchmark-registry.json`:
- Around line 79-84: Update the GPU-only selection logic in BenchmarkRunner to
identify configurations by compilation.family === "gpu" rather than requiring
IDs to include "compute". Ensure webgpu_dispatch is included while non-GPU
configurations remain excluded.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 331aca81-f13f-436f-bfb7-a0516afefb61

📥 Commits

Reviewing files that changed from the base of the PR and between 3cd158b and 6748ad4.

⛔ Files ignored due to path filters (2)
  • backend/benchmarks/configs.generated.js is excluded by !**/*.generated.*
  • src/generated/benchmarkRegistry.js is excluded by !**/generated/**
📒 Files selected for processing (8)
  • .github/workflows/config-check.yml
  • CLAUDE.md
  • backend/benchmarks/configs.js
  • package.json
  • scripts/generate-benchmark-config.js
  • shared/benchmark-registry.json
  • src/components/BenchmarkRunner.js
  • src/utils/machineProfiles.js

config-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

For actions/checkout@v4, does persist-credentials default to true, and does setting persist-credentials: false prevent the GitHub token from being stored in local Git configuration?

💡 Result:

For actions/checkout@v4, the persist-credentials input defaults to true [1][2][3]. Setting persist-credentials to false does prevent the GitHub token (or SSH key) from being configured in the local Git configuration [1][4][5]. When persist-credentials is set to true (the default), the action automatically configures the local Git settings with the provided token, which allows subsequent steps in the job to run authenticated Git commands [1][4]. Setting this to false opts out of this behavior, ensuring the token is not stored in the local Git configuration [1][5].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- workflow ---'
cat -n .github/workflows/config-check.yml

printf '%s\n' '--- package scripts ---'
node - <<'JS'
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
console.log(JSON.stringify({ scripts: pkg.scripts }, null, 2));
JS

printf '%s\n' '--- Git-related references in the config-check path ---'
rg -n -i 'git|github|token|credential|checkout|config:check' package.json .github/workflows . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200

Repository: ford442/benching_machine

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- workflow ---'
cat -n .github/workflows/config-check.yml

printf '%s\n' '--- config:check script ---'
node - <<'JS'
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
console.log(pkg.scripts && pkg.scripts['config:check']);
JS

printf '%s\n' '--- files referenced by config:check ---'
node - <<'JS'
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const script = pkg.scripts && pkg.scripts['config:check'];
console.log(script || '(missing)');
JS
rg -n --glob 'package.json' --glob '.github/workflows/config-check.yml' --glob '*.js' --glob '*.mjs' --glob '*.cjs' --glob '*.ts' --glob '*.yml' --glob '*.yaml' \
  'config:check|git (clone|fetch|pull|push)|actions/checkout|GITHUB_TOKEN|github\.token|persist-credentials' .

Repository: ford442/benching_machine

Length of output: 870


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- generator outline and size ---'
wc -l scripts/generate-benchmark-config.js
ast-grep outline scripts/generate-benchmark-config.js

printf '%s\n' '--- Git, token, and credential references in generator ---'
rg -n -i 'git|github|token|credential|exec|spawn|https?://|fetch\(' scripts/generate-benchmark-config.js || true

printf '%s\n' '--- generator entry points and file operations ---'
rg -n 'process\.argv|readFile|writeFile|existsSync|readdir|path\.|require\(' scripts/generate-benchmark-config.js

Repository: ford442/benching_machine

Length of output: 1811


Disable persisted Git credentials.

Set persist-credentials: false because this job does not require Git authentication. This prevents actions/checkout@v4 from storing the GITHUB_TOKEN in local Git configuration.

Proposed fix
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v4
+        with:
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.29.0)

[warning] 13-13: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/config-check.yml at line 13, Update the
actions/checkout@v4 step to set persist-credentials to false, preventing the job
from storing the GITHUB_TOKEN in local Git configuration.

Source: Linters/SAST tools

Comment on lines 19 to +23
async function runConfig(configId) {
const m = getMultiplier(configId);
const supportsWasmThreads = ['wasm_threads','wasm_simd','wasm_max','wasm64','wasmfs'].includes(configId);
const supportsOpenMP = ['wasm_openmp', 'wasm_max'].includes(configId);
const isGPU = ['webgl_compute', 'webgpu_compute'].includes(configId);
const isGPU = ['webgl_compute', 'webgpu_compute', 'webgpu_dispatch'].includes(configId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add a dispatch-specific result path.

Line 23 classifies webgpu_dispatch as GPU. The GPU branch only handles webgpu_compute separately. The remaining GPU path reports "Matrix Mult (WebGL)". Backend results for WebGPU dispatch are therefore mislabeled. Return dispatch-overhead metrics for webgpu_dispatch instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/benchmarks/configs.js` around lines 19 - 23, Update runConfig’s
result dispatch so webgpu_dispatch uses the dispatch-overhead metrics path
rather than the generic GPU/WebGL labeling path; keep webgpu_compute on its
existing handling and preserve current behavior for other configurations.

Comment on lines +79 to +84
{ "id": "webgpu_dispatch", "name": "WebGPU Dispatch Overhead", "desc": "JS ↔ GPU Binding Stress", "color": "#e67e22",
"compilation": { "family": "gpu", "toolchain": "WGSL→GPU driver", "backend": "GPU (compute shader)", "language": "WGSL", "optLevel": "driver", "flags": [], "postProcess": [], "status": "real" },
"multiplier": 10.0 },
{ "id": "webgpu_dispatch_wasm", "name": "WebGPU Dispatch (WASM)", "desc": "Real C++ via Emscripten + Dawn (experimental)", "color": "#c0392b",
"compilation": { "family": "wasm", "toolchain": "emcc→Dawn glue", "backend": "Emscripten/WebGPU", "language": "C++", "optLevel": "O3", "flags": ["-O3", "-s USE_WEBGPU=1"], "postProcess": [], "status": "experimental" },
"multiplier": 2.5 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include webgpu_dispatch in the GPU-only run.

This new GPU configuration does not match id.includes('compute') in src/components/BenchmarkRunner.js Line 393. The GPU Benchmarks action skips it. Select GPU configurations from compilation.family === 'gpu' instead of an ID substring.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shared/benchmark-registry.json` around lines 79 - 84, Update the GPU-only
selection logic in BenchmarkRunner to identify configurations by
compilation.family === "gpu" rather than requiring IDs to include "compute".
Ensure webgpu_dispatch is included while non-GPU configurations remain excluded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants