lablup / lablup/mlxcel

chore(bench): fix the --help defects in the bench_speculative/bench_block_width script pair

Open Beginner friendly
#1,669 0 comments 0 reactions 0 assignees View on GitHub
priority:low status:ready type:chore
Dominant language
Rust
Stars
467
Forks
54
Avg merge
4h 25m
Merged PRs (30d)
310

Description

## Summary

The documented bench-script pair `bench_speculative.sh` / `bench_block_width.sh` has two `--help` defects: one script hides a flag it accepts, and the other has no help arm at all and exits 1 on `--help`.

## Background

`bench_speculative.sh` prints usage by slicing its own header comment, but the header lists only `--reps` and `--no-wait` while the parser also accepts `--spread-limit` (documented nowhere). `bench_block_width.sh` has no `-h|--help` case, so `--help` falls through to the unknown-argument branch that prints usage and exits 1, whereas its sibling handles `-h|--help` with exit 0. The two are explicitly a pair (shared `lib/bench_quiet.sh`).

## Proposed Solution

- Add a `--spread-limit` line to the `bench_speculative.sh` header block and bump its `sed` range so the flag appears in usage output.
- Add a `-h|--help` case arm to `bench_block_width.sh` that prints the header and exits 0.

Verify by running both with `--help`.

## Implementation Notes

- `scripts/bench_speculative.sh` prints usage via `sed -n '2,13p' "$0"` (the `-h|--help` arm), while `--spread-limit` is parsed in the same `case` and defaulted earlier; the header comment block (lines 2-13) documents only `--reps` and `--no-wait`.
- `scripts/bench_block_width.sh:70` has the `*)` fallback `sed -n '2,10p' "$0"; exit 1` and no dedicated help arm.

## Acceptance Criteria

- [ ] `bench_speculative.sh --help` documents every flag the parser accepts
- [ ] `bench_block_width.sh --help` prints usage and exits 0

---

## Original Suggestion

### Title: chore(bench): fix the --help defects in the bench_speculative/bench_block_width script pair

The documented bench-script pair `bench_speculative.sh` / `bench_block_width.sh` has two `--help` defects: one script hides a flag it accepts, the other has no help arm at all and exits 1 on `--help`.

## Evidence

- `scripts/bench_speculative.sh:57` prints usage via `sed -n '2,13p' "$0"` — the header block lists only `--reps` and `--no-wait`, while `--spread-limit` is parsed at line 56 (default at line 49) and documented nowhere
- `scripts/bench_block_width.sh:69-70` — the `*)` fallback does `sed -n '2,10p' "$0"; exit 1`, so `--help` is treated as an unknown argument; its sibling handles `-h|--help` with `exit 0`
- The two scripts are explicitly a pair (shared `lib/bench_quiet.sh` note at `bench_speculative.sh:60-62`)

## Suggested fix

Add a `--spread-limit` line to the `bench_speculative.sh` header and bump its `sed` range; add a `-h|--help` case arm to `bench_block_width.sh` that prints the header and exits 0. Verifiable by running both with `--help`.

## Acceptance criteria

- [ ] `bench_speculative.sh --help` documents every flag the parser accepts
- [ ] `bench_block_width.sh --help` prints usage and exits 0

Contributor guide

Open the contributing guide

Research direction

Start with scripts/bench_speculative.sh and scripts/bench_block_width.sh, reading their header comments and argument-parsing case arms. Run both scripts with --help and check that every accepted flag is shown, that bench_block_width.sh exits 0, and that the output matches the intended usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.