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/aien-architecture-mv/patches/c7c2cfc8abbbce15 # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## Fix measurement-window docs, GB10 lock path, and script hashes merged `c7c2cfc8abbbce15` #356 · opened 2026-10-30 11:32 UTC · closed 2026-10-30 11:48 UTC · merged 2026-10-30 11:48 UTC Imported from GitHub aien-dev/aien-architecture-mv#356, by drakestapleton Base `a0a7146f198613c1df3e6ddc96a8582f95c0d95d` · Head `77c27b1cc545a55ffe7886d1e3012ff0be489cf1` Merged on GitHub as `0dcaa29d540a9c70aab2c9a68f84b5ae201adf2c`; reachable from main `bccab5ea7a17be6c9ab30b1bd05db4898a4601be` (observed 2026-11-18T16:37:27Z) drakestapleton wrote on 2026-10-30 11:32 UTC ## Issue-first tracking Tracking issue: Refs #354 Gates advanced and status: Findings 2–5 and `tools/ops/SHA256SUMS` stay in this PR. ArchReview review `5711650598` is addressed in `77c27b1cc545a55ffe7886d1e3012ff0be489cf1`. Finding 1's installed-copy check is NOT_RUN (out of scope). Offline close test PASS. Starve test cases 1–4 PASS, case 5 SKIP. `spark-baseline` and `spark-calibrate` full runs NOT_RUN. Source, test and qualification evidence: head `77c27b1cc545a55ffe7886d1e3012ff0be489cf1`. Commands and results below. - Implementation issue exists and its scope/ownership is current. - This PR documents remaining unrun/failed gates. - Issue ledger will be reconciled when this PR merges. Refs #354 ## What changed ### Finding 2 `docs/ops/MEASUREMENT_WINDOWS.md` opened the example window with the default `--gb10 exclusive`, then ran `spark-baseline`, which refuses that lock (it exits when the window's `gb10` file is `exclusive` or `shared`). The example now opens with `--gb10 none`, so the calibrate and baseline commands under it can run. The default is still documented. A window that does not measure the 27B can keep it. Holding the GPU lock and taking a 27B baseline means two windows. ### Finding 3 `tools/ops/README.md` said `quiet-build` never waits and runs on the efficient cores. The script waits for a live measurement flag (at most 1 minute), then the quiet gate, then a shared quiet lock. The whole wait is capped at 25 minutes (`SPARK_BUILD_MAX_WAIT`, default 1500 s). If it gets the lock in time, it runs the command as given. Past the cap it runs at nice 19, with no lock and no core pinning, and records an intrusion so the open window is "shared machine" (L405). The README now says that. `quiet-build` is unchanged. ### Finding 4 The README table includes `test-spark-window-starve.sh`. The row now states what the gated case proves, and the plain-flock starvation limit. See the review section. ### Finding 5 `spark-calibrate` and `spark-baseline` read `${SPARK_GB10_LOCK:-/tmp/aien-gb10.lock}`, the same default as `spark-window`. Those reads are marked for tests only (see spark-window:63). The sampler comment in `spark-baseline` names the GPU lock and does not name the old hard-coded path. ### Hash manifest `tools/ops/SHA256SUMS` lists the sha256 of every script in `tools/ops`. From that directory, `sha256sum -c SHA256SUMS` checks them. The names are bare, so the check is run from `tools/ops`, as the README says. `spark-window` is unchanged. Main hash and this PR's hash are the same: `01ac196e3e0fdcf7c2a69706ab0b6ca813af1bf67a4b56599fb65c351169fe14` Scripts this PR changes: script main this PR `spark-baseline` `9386d7940bcb8a115c3d09c344cd30e815af799e4f7250e0aa07b595c64cb231` `925e55b6348ba8de23c863cc7476735eda6d1bb43c953b16e1fac04cc565c42a` `spark-calibrate` `8d5c8b2f58b7cd5e66cfcd93916e539b22c1b9f73d2948df8e3148bb1e176b4b` `09c45c5a664a3ca1dba3a083cbbcd16d643f114345952868b13c5bafe7e9c40b` `test-spark-window-starve.sh` `dce3d2986b84d678afd8c314bde3a068c26ec53f10edce8fabd6cda1df3c95a8` `b33a7df6e31ae75816a1d1c733750d0d18edb69bf6f4aa4f6bc9f1cd6870085b` ### Finding 1 The copy of `spark-window` installed on the Spark was not compared to `01ac196e3e0fdcf7…`. Not done here. ## Review `5711650598` Case 3's two shared holders now take `$SPARK_QUIET_GATE` shared and then the quiet lock, the quiet-build order (`flock -s "$SPARK_QUIET_GATE" true` then `flock -s "$SPARK_QUIET_LOCK" sleep …`). With the gate up, the next iteration waits outside, the holders already inside finish, and the drain completes. A separate probe of that shape saw phase `chip held, gate up, draining the quiet lock for at most 300s (try 1)` and then `holding`. The old two-holder plain `flock -s` scenario is case 5, labeled known-starvable. Linux flock gives an exclusive waiter no priority, so that case can starve. It is skipped unless `SPARK_STARVE_PLAIN=1`. ## Tests Host: 4 CPUs, not the Spark, no GB10. - `sh -n tools/ops/test-spark-window-starve.sh`: OK - `sh -n tools/ops/spark-baseline`: OK - `sh -n tools/ops/spark-calibrate`: OK - `cd tools/ops && sha256sum -c SHA256SUMS`: all 9 OK, including `spark-window` `01ac196e3e0fdcf7c2a69706ab0b6ca813af1bf67a4b56599fb65c351169fe14` - `sha256sum -c tools/ops/SHA256SUMS` from the repo root: FAILED open or read on all 9 names. The manifest lists bare names, so this command only sees the files when the cwd is `tools/ops`. - `tools/ops/test_spark_window_close.sh`: pass 23, fail 0, exit 0. PASS. The script was not modified. - `tools/ops/test-spark-window-starve.sh` (default, `SPARK_STARVE_PLAIN` unset), exit 0: - PASS case 1: no contention opens - PASS case 2 one holder, no pause between holders (tries 1) - PASS case 3 two holders through the quiet gate, no pause (tries 1) - PASS case 4 chip busy 6 s: opened only after the chip was free (window opened 5 s after the start) - SKIP case 5 known-starvable: two plain flock -s holders, no gate - Case 5 with `SPARK_STARVE_PLAIN=1`: not run. The default run skips it. - `spark-baseline` end to end: NOT RUN (needs the 27B server on 127.0.0.1:18091, an open window, and yardstick sensors) - `spark-calibrate` end to end: NOT RUN (needs an open window, the omega memcpy probe at `3bd56731`, `spark-receipt`, and wall-power sensors) - Installed `~/.local/bin/spark-window` on the Spark: NOT RUN ## Architecture change No subsystem responsibility change. Docs, the starve test, and two lock-path reads. No ADR. No security-boundary, secret, or effect-broker change. Failure behavior of `spark-baseline` and `spark-calibrate` is the same when `SPARK_GB10_LOCK` is unset. No diagrams. - Planned work is not described as implemented. - Machine naming remains hardware-neutral. - Tool/Skill/World/Cortex/J-Space responsibilities remain distinct. - External irreversible effects still require AEGIS + Effect Broker. - Secrets do not enter model-visible or provenance state. — Grokbot
drakestapleton reviewed (COMMENTED) on 2026-10-30 11:36 UTC Triage: needs-changes (small). Review at `e81997c`, read-only. Verified - Findings 2 to 5 from #291 are fixed and match the scripts: - MEASUREMENT_WINDOWS now opens with `--gb10 none`, consistent with spark-baseline:28-29. - The quiet-build row matches quiet-build:21-58 (60 s flag wait, gate, shared lock, `SPARK_BUILD_MAX_WAIT` 1500 s, nice 19 plus intrusion log). - test-spark-window-starve.sh is now listed. - spark-calibrate:23 and spark-baseline:49 use `${SPARK_GB10_LOCK:-/tmp/aien-gb10.lock}`. - SHA256SUMS: all 9 entries match the bytes at the head, and nothing in tools/ops is missing. spark-window is `01ac196e…fe14`, the repo copy, unchanged from main. The file uses bare names, so it must be run from `tools/ops`, as the README says. Requested - README.md:12 says the window "still opens while shared quiet holders run back to back", but case 3 failed on a 4-CPU VM at both 60 s and 180 s. Case 3's holders use plain `flock -s`, which skips `$SPARK_QUIET_GATE`, and Linux flock gives no priority to an exclusive waiter. The window only gets in during the rare moment when both holders are between iterations, so this is a timing race, not a threshold problem: `SPARK_IDLE_LOAD=100000` (test line 15) turns off the load limit, two holders stay under `IDLE_N=3`, and nothing reads the CPU count. The 4/4 result under taskset on the Spark is likely the timing being kinder there; I haven't confirmed that. Suggestion: make case 3 go through the gate first, as quiet-build does (`flock -s "$SPARK_QUIET_GATE" true; flock -s "$SPARK_QUIET_LOCK" sleep …`). That makes it deterministic and actually exercises L322. Keep the plain-flock version as a separate case marked known-starvable, or let an env var skip it, and reword the README row to match. - Nits: - The spark-baseline:43 comment still names the hard-coded lock path. - spark-window:63 says `SPARK_GB10_LOCK` is for tests only and the 27B server uses the fixed path. Please say so next to the new lines, so nobody sets it in production and has spark-baseline watch the wrong lock. Not blocking, still open - Finding 1: the installed spark-window was not compared with `01ac196e…`. - Not run: spark-baseline and spark-calibrate end to end, and the Spark install. The diff is low-risk with the variable unset. - At review time Analyze (c-cpp) was still running and the mergeable state was unknown. — Grokbot drakestapleton reviewed (COMMENTED) on 2026-10-30 11:47 UTC Triage: ready-to-merge. Re-review at `77c27b1` (read-only), following my earlier review `5711650598`. Verified - Case 3 now takes `$SPARK_QUIET_GATE` and then the quiet lock, quiet-build's order (quiet-build:41, :45). With spark-window's exclusive gate at :336, the window now gets in reliably. - Case 5 runs only with `SPARK_STARVE_PLAIN=1`. Otherwise it prints SKIP and doesn't affect the exit code (:72-78). - The README row now matches what the test proves. - spark-calibrate and spark-baseline: since `e81997c` the changes are comments only. Compared with main, the lock path is `${SPARK_GB10_LOCK:-/tmp/aien-gb10.lock}` with the default unchanged, so it's safe with the variable unset. spark-window is unchanged (`01ac196e`). - SHA256SUMS: all 9 entries match the head bytes and nothing in tools/ops is missing. README:19 ("From `tools/ops`") covers the bare-name format. - Checks are green and the merge state is clean. The VM results (cases 1-4 PASS, case 5 skipped, close test 23/23, `sha256sum -c` 9/9) are as reported, not re-run here. Nits, optional - "the gate in spark-window (L322)" reads like a line number; the gate is actually taken at spark-window:330-336. - The README row no longer mentions the chip-busy case (case 4). - The tests-only note appears twice, at spark-baseline:48 and :49. - Consider adding `(cd tools/ops && sha256sum -c SHA256SUMS)` to the README for runs from the repo root. - Case 2 is still the timing-based plain-flock run with one holder. It passed on both hosts but isn't guaranteed the way case 3 now is. Still open, not blocking - Finding 1: the installed spark-window hasn't been compared with `01ac196e`. - spark-baseline and spark-calibrate haven't been run end to end on the Spark. — Grokbot ### Apply it ``` git checkout -b patch-c7c2cfc8abbbce15 a0a7146f198613c1df3e6ddc96a8582f95c0d95d curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/c7c2cfc8abbbce15.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aien-architecture-mv 356 77c27b1cc545a55ffe7886d1e3012ff0be489cf1 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-architecture-mv","number":356,"url":"https://github.com/aien-dev/aien-architecture-mv/pull/356","export_sha256":"e0ab76730762f7bd707f3b0c07e133f83d4287854fada828261004f8d4bcaa1a","imported_utc":"2026-11-18T16:37:27Z"} ``` ### Changes ``` diff --git a/docs/ops/MEASUREMENT_WINDOWS.md b/docs/ops/MEASUREMENT_WINDOWS.md index 3b1a8ca..b844089 100644 --- a/docs/ops/MEASUREMENT_WINDOWS.md +++ b/docs/ops/MEASUREMENT_WINDOWS.md @@ -44,17 +44,21 @@ the window is marked "shared machine" (L405). ## Exact commands -Open a window (waits its turn; prints the window id when it holds the box): +Open a window that will run the commands below, including `spark-baseline` (waits its turn; prints the +window id when it holds the box). `spark-baseline` refuses a window that holds the GPU lock, so this +open passes `--gb10 none`: ```sh -id=$(spark-window open my-measurement --ledger L109 --lease 20 --wait) +id=$(spark-window open my-measurement --ledger L109 --lease 20 --gb10 none --wait) ``` -By default the window also holds the GPU lock (`--gb10 exclusive`, added by L154), so GPU-only jobs -cannot run inside it. The 27B server takes that lock itself for every reply, so a window that measures -the 27B server, including `spark-baseline`, must be opened with `--gb10 none`; `spark-baseline` refuses -otherwise. `spark-calibrate` works in both: it uses the window's GPU lock when the window holds it and -takes the lock itself when it does not. +By default `open` holds the GPU lock (`--gb10 exclusive`, added by L154), so GPU-only jobs cannot run +inside it. The 27B server takes that lock itself for every reply, so a window that measures the 27B +server, including `spark-baseline`, must be opened with `--gb10 none`; `spark-baseline` refuses +otherwise. A window that does not measure the 27B can leave that default and skip `spark-baseline`. +To hold the GPU lock for other work and still take a 27B baseline, use two windows: the default for +the GPU-holding work, and `--gb10 none` for `spark-baseline`. `spark-calibrate` works in both: it +uses the window's GPU lock when the window holds it and takes the lock itself when it does not. Calibrate and take the baseline inside it: diff --git a/tools/ops/README.md b/tools/ops/README.md index 71bb46a..c322a42 100644 --- a/tools/ops/README.md +++ b/tools/ops/README.md @@ -9,11 +9,14 @@ How and when to use them: [docs/ops/MEASUREMENT_WINDOWS.md](../../docs/ops/MEASU | `spark-build-once` | Build cache keyed by the source tree, command and env knobs; concurrent callers build once | | `spark-window` | One measurement window at a time; holds the quiet lock exclusive; box state at open and close. A bare `close` only closes a window you opened (same shell tree, or `SPARK_WINDOW` set); otherwise refused with exit 3, use `close