Skip to content

[bug] eval CLI catches only RuntimeError, so unknown --transforms / bad --rank-m / --sweep dump an uncaught traceback (the #199/#201 gap, in python -m eval) #258

Description

@real-venus

Summary

eval/cli.py:main wraps evaluate() in except RuntimeError only. Every other CLI in the repo catches the full user-input error family and exits cleanly with code 2:

The eval CLI is the outlier and never received that fix.

Details

--transforms is a free-form comma string with no argparse choices (eval/cli.py:36). On a GPU machine the run gets past Backend() and reaches the smart loop, where the error escapes the except RuntimeError:

# eval/cli.py
try:
    out = evaluate(ev)
    if a.sweep:
        ns = [int(x) for x in a.sweep.split(",")]
        out["scaling"] = estimate_scaling(ns, ev)
except RuntimeError as e:          # <-- ValueError / KeyError escape
    print(f"error: {e}", file=sys.stderr)
    return 2

Uncaught paths (raw traceback + exit 1 instead of error: ... + exit 2):

  • unknown --transformsKeyError from get_transform() (strategy/transforms.py:187)
  • --rank-m 0 or --rank-m > nValueError from multiply_subspace (strategy/subspace.py:214)
  • bad --sweep fooValueError from int(...)

Repro (on the reference GPU box)

python -m eval --transforms bogus     # KeyError traceback, not "error: ..."
python -m eval --rank-m 0             # ValueError traceback
python -m eval --sweep foo            # ValueError traceback

Fix

Widen the handler to match the sibling CLIs:

except (ValueError, RuntimeError, MemoryError, KeyError) as e:
    print(f"error: {e}", file=sys.stderr)
    return 2

This is the exact class of bug already fixed for the strategy CLI (#199) and the attention CLI (#201), just never applied to python -m eval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:evalProtected evaluator, metrics, artifacts, and policy (eval/, benchmarks/)area:matmulExact engine and tile schedules (matmul/)area:strategySmart strategies / transforms (strategy/)status:triageNewly opened, not yet triagedtype:bugBug report/fix; not an accepted miner PR lanetype:strategyNew smart strategy / transform proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions