Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/scripts/pi5-8/gen_measure_header.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / scripts / pi5-8 / gen_measure_header.sh` 26 lines ยท 1513 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # PI5-8: turn host_golden.sh output (llama.cpp ids and greedy tokens) into the pi5_measure.h the measurement 3 # kernel build includes. Requests: the short prompt three times (variance), then the two long prompts. 4 # gen_measure_header.sh GOLDEN_DIR EOS_ID > pi5_measure.h 5 set -euo pipefail 6 d="${1:?golden dir}"; eos="${2:?eos id}" 7 echo "/* generated by scripts/pi5-8/gen_measure_header.sh from $d (llama.cpp reference) */" 8 echo "#define MEAS_EOS ${eos}u" 9 for p in short long1 long2; do 10 ids=$(head -1 "$d/$p.ref" | cut -d' ' -f2- | tr ' ' ',') 11 exp=$(awk '$1=="step"{printf "%s%su", (n++?",":""), $3}' "$d/$p.ref") 12 echo "static const uint32_t meas_${p}_ids[] = {${ids}};" 13 echo "static const uint32_t meas_${p}_exp[] = {${exp}};" 14 done 15 cat <<'EOT' 16 struct meas_req { const char *name; unsigned nids; const uint32_t *ids; unsigned nexp; const uint32_t *exp; }; 17 #define MEAS_N(a) ((unsigned)(sizeof(a) / sizeof((a)[0]))) 18 static const struct meas_req meas_reqs[] = { 19 {"short", MEAS_N(meas_short_ids), meas_short_ids, MEAS_N(meas_short_exp), meas_short_exp}, 20 {"short", MEAS_N(meas_short_ids), meas_short_ids, MEAS_N(meas_short_exp), meas_short_exp}, 21 {"short", MEAS_N(meas_short_ids), meas_short_ids, MEAS_N(meas_short_exp), meas_short_exp}, 22 {"long1", MEAS_N(meas_long1_ids), meas_long1_ids, MEAS_N(meas_long1_exp), meas_long1_exp}, 23 {"long2", MEAS_N(meas_long2_ids), meas_long2_ids, MEAS_N(meas_long2_exp), meas_long2_exp}, 24 }; 25 #define MEAS_NREQ MEAS_N(meas_reqs) 26 EOT