open-standards/wai/wai-quantum-landscape-fpga/scripts/power_campaign.sh
Transaction Science d4867b1b83 wai-quantum-landscape-fpga: the review of #677 answered
The lock and reloads. load takes the board lock before it reconfigures, and the session check sees
other runs of this tool and its scripts (their own parents excepted), so a reload waits for the job
that holds the board. The scripts do not hold the lock across the steps they run. A reload of the
same design, which passes the signature and the ID, is seen by the engine's uptime counter and its
reset BOUND register: the engine checks both before it takes a workload or a table as loaded and
after every job, and refuses a result read across a reload. A batch that comes back short, and a
sampled chain whose sweep count is wrong, are refused.

The AXI port. It checks the port's write width as well as its read width; it fills a result page
with the illegal cell pair before a write-back and refuses a result still holding it; it refuses a
transfer whose page moved. It is written against two traits, so a software link tests it off the
board: the guard, the DMA, the sequencer's count, the write-back's layout, dropped accesses.

Tests. lowered_settle's five cases and 300 random workloads with fields to 2^40 against the
reference; the joint test counts against the chains requested and checks the control's cell family.
CI gates on the change, requires tests to run, denies clippy warnings, certifies the model member,
runs a job on it, builds on linux-arm64, and replays both testbenches in Icarus Verilog
(scripts/run_tb.sh). The names check reads .v, .tcl, .xdc and .dat files.

The build. The tool version and each block's version are enforced; the multi-core build refuses the
AXI link. The documents. The latency table says how each row was timed; the engine's share of a
chain is its own clock count; the sampling energy carries its error and its floor; the known answer
is placed in time; the step response is reported; derived figures are marked; the scope of the
meter, the guard's window and the DMA's locked pages are stated; provenance says what the private
code declared; old names are gone; the build and simulator results have a raw record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 03:22:22 -05:00

42 lines
2.5 KiB
Shell
Executable file

#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# The power campaign, in a fixed order: the run/halt step response, a known-answer vehicle where one
# is present, a null, each job class, then the clock-scaling check. Run ON the board as root,
# detached, and touch nothing on the board until DONE appears (the meter reads the whole board, the
# processor included):
# sudo setsid nohup sh power_campaign.sh [OUTDIR] > /dev/null 2>&1 &
# Needs wai-quantum-landscape-fpga and the loaded engine. A known-answer vehicle of your own goes in
# KNOWN_ANSWER (a script taking the bitstream name, settle, passes and samples, printing
# "pass run|halt sample microwatts" lines) and KNOWN_BITSTREAM; without them that step is skipped,
# and the null and the clock-scaling check are the instrument's checks.
cd "$(dirname "$0")"
OUT=${1:-power-$(date -u +%Y%m%dT%H%M%SZ)}/power; mkdir -p "$OUT"
BIT=${ENGINE_BITSTREAM:-landscape.bit.bin}
log() { echo "$(date -u +%FT%TZ) $*" >> "$OUT/campaign.log"; }
guard() {
# the tool leaves out itself and what it descends from: this script, and run_all.sh if that started it
f=$(./wai-quantum-landscape-fpga foreign) || { log "STOP: another session is on the board: $f"; echo STOPPED > "$OUT/DONE"; exit 3; }
}
log "start; $(./wai-quantum-landscape-fpga status 2>&1 | tr '\n' ' ')"
guard
./wai-quantum-landscape-fpga meter t0-recall 1 0 300 > "$OUT/step.dat" 2>&1; log "step done"
if [ -n "${KNOWN_ANSWER:-}" ] && [ -n "${KNOWN_BITSTREAM:-}" ]; then
guard
sh "$KNOWN_ANSWER" "$KNOWN_BITSTREAM" 60 8 30 > "$OUT/known_answer.dat" 2>&1; log "known answer done exit=$?"
[ -d /sys/class/gpio/gpio594 ] && echo 594 > /sys/class/gpio/unexport
./wai-quantum-landscape-fpga load "$BIT" >> "$OUT/campaign.log" 2>&1 || { log "reload of the engine failed"; echo FAILED > "$OUT/DONE"; exit 2; }
else
log "known answer skipped: KNOWN_ANSWER and KNOWN_BITSTREAM not set"
fi
for spec in "null:t0-recall 8 60 30 --null --predict 0" "t0-recall:t0-recall 10 60 30 --predict 160" \
"gibbs-recall:gibbs-recall 10 60 30 --predict 12" "t0-idle:t0-idle 8 60 30 --predict 4"; do
name=${spec%%:*}; args=${spec#*:}
guard
./wai-quantum-landscape-fpga meter $args > "$OUT/$name.dat" 2>&1; log "$name done exit=$?"
done
guard
./wai-quantum-landscape-fpga clock 30 >> "$OUT/campaign.log" 2>&1
./wai-quantum-landscape-fpga meter t0-recall 6 60 30 --predict 80 > "$OUT/t0-recall-50MHz.dat" 2>&1; log "50 MHz done exit=$?"
./wai-quantum-landscape-fpga clock 15 >> "$OUT/campaign.log" 2>&1
log "end"
echo DONE > "$OUT/DONE"