Files
Guoliang ChenandClaude Mythos 5.2 71d13b5fbe
ci / checks (push) Successful in 1m0s
ci / corpus (push) Successful in 18s
ci / linux (push) Successful in 6m4s
release / build-and-publish (push) Successful in 5m31s
Release 0.66.2: every source file names its author
Every tracked file that can carry a comment (880 of them) now opens with
"Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with
"Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love,
luciochen.com", in the file's own comment syntax. No behaviour change: the
diff outside the version bump and changelogs is comment lines only.

- tools/stamp_author.py: writes the lines; idempotent, `--check` lists
  what is missing. Headers go under a shebang and under Markdown front
  matter.
- Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON
  and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the
  LICENSE files (already carry the copyright line).
- tools/linux_check.sh: --help reads its header from line 3, now that the
  author line sits under the shebang.
- tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-24 12:11:09 -08:00

80 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Author: Guoliang Chen, a Senior Digital Design Engineer
# The timed CLI sweeps: `format --check` (cold and warm cache) and `check`
# (default rules, and `--select error,warning,style`) over five opentitan
# trees, one binary at a time, three tries per cell, wall clock and peak RSS
# from `/usr/bin/time -l`.
#
# tools/perf/sweep.sh <lucisv-binary> <label> <opentitan-dir> <out-dir> \
# [tries] [trees]
#
# `trees` is a space-separated list, defaulting to all five; pass one tree to
# check a single cell (`sweeptable.py` reads whatever is there).
#
# Each cell writes `<out-dir>/<label>__<tree>__<command>__<cache>.txt`, which
# holds the three runs' `/usr/bin/time -l` blocks; `sweeptable.py` reads them.
# The formatter cache is a scratch `--cache-dir` under `<out-dir>`, so nothing
# is ever written into the corpus.
#
# Every `lucisv` invocation goes through `tools/guard.sh -m 8 -t 1800`.
set -u
BIN=${1:?usage: sweep.sh <binary> <label> <opentitan> <outdir> [tries]}
LABEL=${2:?}
OT=${3:?}
OUT=${4:?}
TRIES=${5:-3}
HERE=$(cd "$(dirname "$0")" && pwd)
GUARD="$HERE/../guard.sh"
CACHE="$OUT/fmtcache"
TREES=${6:-"hw/ip hw/top_earlgrey/ip hw/top_darjeeling/ip hw/dv hw/vendor"}
mkdir -p "$OUT"
# Cache warmth, per try, not per cell.
#
# Until take 5 §P0 this deleted `$CACHE` once before the *three* cold tries,
# so tries 2 and 3 read the store the first try had just written: two of every
# three "cold" numbers were warm. Now a cold try deletes the scratch cache
# immediately before itself, and a warm cell is primed by one explicit
# untimed run whose output is kept in the log but not counted. `sweeptable.py`
# prints the "N files from cache" each try reported, so a cold row that is not
# actually cold is visible rather than inferred.
#
# Only `$CACHE` — a scratch directory under `$OUT` — is ever removed. Nothing
# inside the corpus is touched.
run_cell() {
local tree=$1 name=$2 cache=$3
shift 3
local safe=${tree//\//_}
local log="$OUT/${LABEL}__${safe}__${name}__${cache}.txt"
: >"$log"
if [ "$cache" = warm ]; then
echo "--- prime (untimed, not a try) ---" >>"$log"
rm -rf "$CACHE"
"$GUARD" -m 8 -t 1800 -- "$BIN" "$@" >>"$log" 2>>"$log"
echo "--- prime exit $? ---" >>"$log"
fi
local i
for i in $(seq 1 "$TRIES"); do
if [ "$cache" = cold ]; then rm -rf "$CACHE"; fi
echo "--- try $i ---" >>"$log"
# `-l` puts the resource block on stderr; both streams are kept.
"$GUARD" -m 8 -t 1800 -- /usr/bin/time -l "$BIN" "$@" >>"$log" 2>>"$log"
echo "--- exit $? ---" >>"$log"
done
echo "$log"
}
for tree in $TREES; do
echo "== $LABEL $tree"
run_cell "$tree" format cold format --cache-dir "$CACHE" --check "$OT/$tree"
run_cell "$tree" format warm format --cache-dir "$CACHE" --check "$OT/$tree"
run_cell "$tree" check default check "$OT/$tree"
run_cell "$tree" check select check --select error,warning,style "$OT/$tree"
done
# Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com