fix(bench): stop hardcoding the run date and replace GNU-only grep -oP in run_bench.sh - #1899
Open
yujung7768903 wants to merge 1 commit into
Open
yujung7768903 wants to merge 1 commit into
yujung7768903 wants to merge 1 commit into
Conversation
run_bench.sh recorded a fixed `DATE="2026-03-15"` in every CSV row, so benchmark results were stamped with a date unrelated to the run. It also parsed tok/s with `grep -oP`, which is GNU-only. BSD grep (macOS) rejects `-P`, so both tok/s fields came back empty and every run was written as a FAILED row even when the benchmark succeeded. - DATE is now `date +%F` - HARDWARE and MLX_VERSION are environment-overridable, defaults unchanged - tok/s and ms parsing moved to `sed -n -E`, which works under BSD and GNU sed - added `set -euo pipefail` plus an argument check; the parse helpers are written so a failed run still falls through to the existing FAILED row resolves lablup#1666 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
benchmarks/run_bench.shhas two defects that make its CSV output wrong.The run date is hardcoded (
run_bench.sh:10).DATE="2026-03-15"is written straight into thedatecolumn, so every row carries that fixed date no matter when the benchmark ran.grep -oPis GNU-only (run_bench.sh:24,26). The tok/s extraction isgrep -oP '[\d.]+(?= tok/s)', and the BSD grep shipped with macOS has no-P. Both tok/s fields come back empty, the[ -z "$DECODE_TOKS" ]branch is taken, and a benchmark that completed normally is recorded as a FAILED row. Those two lines are the only use ofgrep -Pacross the shell scripts and the Makefile at upstream HEAD (6976e1df).DATE="2026-03-15"DATE=$(date +%F)HARDWARE="NVIDIA_GB10_CUDA13.0"${HARDWARE:-NVIDIA_GB10_CUDA13.0}MLX_VERSION="0.31.1"${MLX_VERSION:-0.31.1}grep -oP(GNU-only)sed -n -E(BSD and GNU)set -euo pipefail+ argument count checkDefaults are unchanged, so existing invocations behave as before.
One note on the approach: applying the issue's four items literally collides with itself. Under
-e/pipefail,grepexiting 1 on no match kills the script before it can reach the existing FAILED-row branch. Moving the parsing tosed -n ...pavoids that — no match means no output and exit 0, so the empty string still flows into[ -z "$DECODE_TOKS" ]and the existing FAILED handling is preserved. A failing binary invocation is caught with|| trueso it takes the same path.Related issues
resolves #1666
Test plan
Validated by running real inference, not a stub or faked output.
/usr/bin/grep— BSD grep 2.6.0-FreeBSD (no GNU grep on PATH)mlxcel-macos-aarch64.zipofficial release binary, sha256 verified)mlx-community/Qwen3-0.6B-4bit./benchmarks/run_bench.sh mlx-community/Qwen3-0.6B-4bit out.csvBoth versions were run back to back with no environment variables set. Only the columns that differ are shown; the other eight are identical.
prefill_ms104.12prefill_tok_s182.48decode_ms547.64decode_tok_s182.60date2026-03-15(hardcoded)2026-09-15(run date)promptFAILED"Explain the concept of..."The before run produced that row even though inference finished normally. The cause is printed on stderr:
Also checked:
HARDWARE=Apple_M3_Metal MLX_VERSION=mlxcel-0.7.0records those two columns with those values; omitting them records the previous defaultsbash -npassesNotes for reviewers
No Rust sources are touched, so
cargo fmt,cargo clippy,cargo testandcargo denyare unaffected by this change and were not run — this machine has no Rust toolchain, which is also why validation used the official v0.7.0 release binary rather than a local build.Type of change:
fix.🤖 Generated with Claude Code