diff --git a/.crumb b/.crumb index 49e6ee5e7..f52231b71 100644 --- a/.crumb +++ b/.crumb @@ -108,14 +108,14 @@ } ], "children_root": "sha256:966bedb54caa4209f9ab84526da66f6b13ce72e8831470170364eb5881355748", - "compiled_at": "2026-11-07T04:39:25Z", + "compiled_at": "2026-11-07T05:24:59Z", "compiler": "crumb-compile/1", - "digest": "sha256:a6c82328a0c78547a0bdd10b5413abf92c770c77a60d1ff07cecdfe91318248c", - "evidence_files": 15697, - "evidence_root": "sha256:d27e57dca62f72d32e3df2004050ab45a220c65322d8e91a1d018697d89fdb53", - "files": 24256, - "generated_at_commit": "b93031dd0b45fe89bdaacf0956cdda9f51e29b51", - "source_tree": "sha256:1ee369a73a85f886a202b9d6d4debad425c90c490d9b17247718b9128642af7b" + "digest": "sha256:637c74506d66dc02aac6516cc910dde36a093db01fc824fdcfbc2a28746e64ae", + "evidence_files": 15701, + "evidence_root": "sha256:85d012f3953b2dc22d5b3b69bddf395109e1906144bb3ae6bdedf7ffbc9bb909", + "files": 24262, + "generated_at_commit": "68c4686b47f8d851311cfc054106dc60418edd8f", + "source_tree": "sha256:d4474f1344daa70ec056e39d6005e97294ac723f3d31158952e3b503915ee560" }, "owner_lane": "", "provenance": { diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2356d08a6..f7fcf089a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -13,6 +13,7 @@ The current development method is [Human-Directed Agentic Engineering (HDAE)](RE | Claude Opus 5.5 (via omp) | DRA-288 for `seed/node`: `auth.om`, typed worker proposals decided and committed by the creator alone through the action records of `seed/authority/action.om` (one record per operation identity; a performed or UNKNOWN operation is never started again). Proposals are refused as malformed, not the current assignment, another incarnation, stale input, revoked authority or cancelled. Granted tools run as their own process group; cancellation, revocation, stop and worker death kill the whole group, and the outcome comes from the wait status, so a tool that already exited stays performed and a killed one stays UNKNOWN. Operator pause, cancel and revoke reach workers through a per-worker control eventfd with acknowledged seqs. `sched.om` gains `sched_pause` and `sched_cancel`. `auth-gate.om` runs real forked workers and `/bin/sh` tools through seven phases, with twelve negative controls. Native AArch64 host evidence only; not QUALIFIED on the Spark gate. | | Claude Opus 5.5 (via omp) | DRA-289 for `seed/node`: `journal.om`, a checksummed append-only journal of every authority transition (OPEN, ADMIT, START, DONE, RELEASE, REVOKE, PAUSE, CANCEL), each checked by the recovery tables, written and fdatasync'd before anything acts on it or publishes it; a failed write or sync stops all later appends. `flock` fencing that forked workers also hold, fence numbers per creator incarnation, torn-tail cutting, refusal of corrupt records, other format versions and other objectives. Restart recovery settles operations left in flight (idempotent class 3 by its key, class 1 UNKNOWN and never rerun), releases or readmits each job, and restores authority generation and pause. `auth.om` journals through it and accepts class 3. `journal-gate.om` crashes real creators at every boundary, SIGKILLs them mid-tool and checks the result with its own reader; ten negative controls. Native AArch64 host evidence only; not QUALIFIED on the Spark gate. | | Claude Opus 5.5 (via omp) | DRA-290 for `seed/node`: `code.om`, the coding workflow driving the own Omega model (round40 checkpoint, served by aien-train `ollm serve` `/v1/completions`, aien-train #76) through the Node's scheduler, authority and journal: one inference at a time, typed read/check/replace jobs and a review check, each a cancellable child process group, the round40 repair policy enforced by the creator before every grant, explicit failure reasons and no fallback provider. `infer.om`, a bounded loopback-only completion client returning a versioned record; `tool.om`, the read/check/replace tools inside one root with omagent's path rule (moved to `seed/agent/path.om`), durable replace and sandboxed tests; `gram.om`, the repair grammar. `code-test.om` (54 checks, 15 mutants), `tests/tool-replay.py` (all 108 recorded round40 runs) and live own-model runs with cancellation and crash restart. `seed/agent/agent.om` now kills the tool's whole process group; `seed/authority/action.om` renames a local so the node composes as OM-2. Native AArch64 host evidence only; not QUALIFIED on the Spark gate. | +| Claude Opus 5.5 (via omp, sched lane) | P-DRA-14 DRA-395 for `seed/node`: reconciled scheduler ownership (the spark-harness `Core::pump` at aien-sovereign-core-mv `dffdbd19` is reference-only and not deployed) and reproduced its head-of-line block in Rust and natively. `sched.om` gains four-kind resource requests packed in one word, capacity admission that refuses impossible requests and capacities below use, atomic take and release (also while a result waits for review room), and policy 0 (FIFO with the pump's head-of-line stop rule) behind one `sched_dispatch`. `schedpol-test.om` checks the capacity invariant after every creator step; its blocked-head phases print a checked witness and fail (exit 11) until fair fitting lands (DRA-396). Seven negative controls; independent review by openai-codex/gpt-6-astra. Native AArch64 host evidence only. | | Grok 4.7 (via Cursor Agent) | Merged main `fd3751b31` (#1020, carrying #1045 and #1050) into #1052. The only conflict was the generated root `.crumb` (child `last_commit` stamps, the `tests` digest, and the root digest). Recompiled with the crumb.lock tool (`d0f0b95d`); `crumb verify .` current. The #525/#962 pins were left as committed: `src/checker2/c2_check.c`, `src/compiler/osc_ir.c` and `src/compiler/osc_ir.h` still hash to the SHA-256s in `ACCEPTED`. | | Claude Opus 5.5 (via omp) | #1020 (actions/cache-4.3.0 ->6.1.0): merged main `d3d1b1bc` and recompiled the root crumb with the crumb.lock tool (`d0f0b95d`). The root crumb's source tree covers `.github/workflows/`, so the bump alone left it stale and `AIEN Checks` failed at `crumb verify .` (`1 of 188 crumbs stale`). | | Claude Opus 5.5 (via omp) | #1018 (actions/upload-artifact-4 ->7): merged main `d3d1b1bc` and recompiled the root crumb with the crumb.lock tool (`d0f0b95d`). The root crumb's source tree covers `.github/workflows/`, so the bump alone left it stale and `AIEN Checks` failed at `crumb verify .` (`1 of 188 crumbs stale`). | diff --git a/evidence/node-schedpol/receipt.129f5166e96f461bc3ccca0c93e4e82ca45722758e00e233180125e24d34732b.json b/evidence/node-schedpol/receipt.129f5166e96f461bc3ccca0c93e4e82ca45722758e00e233180125e24d34732b.json new file mode 100644 index 000000000..24cbfe02d --- /dev/null +++ b/evidence/node-schedpol/receipt.129f5166e96f461bc3ccca0c93e4e82ca45722758e00e233180125e24d34732b.json @@ -0,0 +1,408 @@ +{ + "checks": [ + { + "binary_sha256": "5002ecdb280a69e5b35c7672455a4a0714e85ca2d66440d3953a97d3420a07ef", + "case": "schedpol-gate", + "compile_exit": 0, + "expected_exit": 11, + "issue": "DRA-395", + "run_exit": 11, + "source_sha256": "1a6dd34b0aec27e5c1aa5ca05d424ddaf068cdd2a2d0cb60ad5de047e1f3fc8b", + "stderr": "", + "stdout": "schedpol hol witness head=20050 fits_behind=30050 free_cpu=1 idle_worker=1 hol_stops=40\nschedpol hol witness head=20050 fits_behind=50050 free_cpu=1 idle_worker=1 hol_stops=40\n", + "verdict": "PASS", + "wall_ms": 2918 + }, + { + "binary_sha256": "37b674604170b9aa5b9a62445012eee19757432da0c51e8748aa2a710b4d36c1", + "case": "sched-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-287", + "run_exit": 0, + "source_sha256": "4f824e22a83aa1203dcaaa81ffb07989d48ddc5dbd5ef151132660fd8d5d4d2e", + "stderr": "", + "stdout": "idle ticks workers=0 creator=0 wake rounds=200 mean_us=18 max_us=115\nPASS node sched\n", + "verdict": "PASS", + "wall_ms": 7999 + }, + { + "binary_sha256": "b9cd877be1341be8fbb55e1471b3dc4a390927ee5960a2162cbb2af54826edb9", + "case": "auth-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-288", + "run_exit": 0, + "source_sha256": "a1eb14fe28123f094b38711f4856fb1efd1e5cfac56bd0550688b22ac28007e0", + "stderr": "", + "stdout": "PASS node authority\n", + "verdict": "PASS", + "wall_ms": 752 + }, + { + "binary_sha256": "87a561683c5179de702e436fdddcbe0c9f8e21c104fc0ebd6d54bcc6a696e54c", + "case": "journal-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-289", + "run_exit": 0, + "source_sha256": "718f5c98d2bf451b9528e3368215f98475621b489865dc1b6645ef665af212fc", + "stderr": "", + "stdout": "PASS node journal\n", + "verdict": "PASS", + "wall_ms": 3240 + }, + { + "binary_sha256": "d3578b840c8f92b5427ca98444e53fec55bb7b5333edc29161101f8ffb68cf9f", + "case": "code-test-unit", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-290", + "run_exit": 0, + "source_sha256": "17df85938093b0606a530da6e3e9df8b1b0b730bf52a9068cd63221db654910c", + "stderr": "", + "stdout": "CWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWE 0 1002 1 2\nCWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 9\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1013 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1023 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1034 1 4\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWE 0 1045 1 5\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 FAIL 10 0\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 PASS 1 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWE 0 0 3 0\nCWE 0 0 3 1\nCWE 0 0 3 2\nCWO 0 FAIL 17 0\nCWE 0 0 3 6\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWE 0 0 3 4\nCWO 0 FAIL 17 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1054 1 4\nCWE 0 0 3 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWE 0 0 3 5\nCWO 0 FAIL 13 0\nCWE 0 0 3 0\nCWO 0 PASS 1 0\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWO 0 FAIL 12 7\nCWO 0 FAIL 20 0\nCWE 0 1061 1 1\nCWP 0 1 193\nTask: Fix the error in this file and confirm its goal.\nFile: jobs/item76666.om\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\nState: unread\nAnswer:\n\ncode checks=54 fail=0\n", + "verdict": "PASS", + "wall_ms": 30 + }, + { + "binary_sha256": "16fe69abe712bf8111fbad937e6479f011e53de2e3b4f17630184022f48f4f90", + "case": "mut-impossible-admitted", + "compile_exit": 0, + "expected_exit": 31, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if not sp_feas req\n", + "to": "if false\n" + }, + "run_exit": 31, + "source_sha256": "65fba1903752f0e8767e9bd317d653e3e90fefb926d97ce82521fa1cc1941585", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 1 + }, + { + "binary_sha256": "8f5496463990b6582d7686f407ef93bf7adb654d2d1442ea8d664b5476f346f1", + "case": "mut-collect-no-release", + "compile_exit": 0, + "expected_exit": 133, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "j = sub b 1\nsp_give j\n", + "to": "j = sub b 1\n" + }, + "run_exit": 133, + "source_sha256": "eebf3277b50fefc25fe48f304ff9ae300ec4a3c44665b844cd84930cb6bb8c11", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 413 + }, + { + "binary_sha256": "6d5932771bee686091d6043db09a389f8ad88edfdeeef0bf3a890f6b56895a89", + "case": "mut-capacity-ignored", + "compile_exit": 0, + "expected_exit": 44, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if gt sp_need req k a\n", + "to": "if false\n" + }, + "run_exit": 44, + "source_sha256": "41387f0870d2d5b2baac05587f3520af528bca55acc6137ebd87ef9c445e1a49", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 434 + }, + { + "binary_sha256": "6409bebd10797f6476b99adceb41b8e447e1c961cade783d2a258aefe673733c", + "case": "mut-ready-unstamped", + "compile_exit": 0, + "expected_exit": 54, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and get sjdep j topics 0\nsp_ready j\n", + "to": "if ne and get sjdep j topics 0\nput sjst j 2\n" + }, + "run_exit": 54, + "source_sha256": "22bb0727f72e34324ea3ac786b0bfec2a5724a9098f2f7175fdfd512eb0ed328", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 999 + }, + { + "binary_sha256": "a4400760901fdfeaf1ec00ba579b9b4bb558174a7e1f235fe92e651a56b6a563", + "case": "mut-give-after-review", + "compile_exit": 0, + "expected_exit": 122, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "j = sub b 1\nsp_give j\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\n", + "to": "j = sub b 1\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\nsp_give j\n" + }, + "run_exit": 122, + "source_sha256": "4e2cda810317b4ec2acc09485e0d4bb9934fe31dc194019dd117da9dbed1798b", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 938 + }, + { + "binary_sha256": "e9822f44d4f6857c2d9763c60f73e1721cd0bf3ea5846c77a0217bb5b2dd5340", + "case": "mut-no-take", + "compile_exit": 0, + "expected_exit": 130, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjbyp j 0\nsp_take j\n", + "to": "put sjbyp j 0\n" + }, + "run_exit": 130, + "source_sha256": "f786dca6a66ae079f2cf6aadcab0d9d54783dbfb09506db4b5f8f5fb938ebc4a", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 10 + }, + { + "binary_sha256": "f7babdd9c452367f2838d2ffd3cdf3e2d73d609cc021fec39e8aa0fdee2ed3d5", + "case": "mut-cap-below-use", + "compile_exit": 0, + "expected_exit": 131, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if lt sp_need caps k get suse k\n", + "to": "if false\n" + }, + "run_exit": 131, + "source_sha256": "42027e8e7abe4b05a745674d840bec29e4f11f886c3020c054741353e3426b3c", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 10 + }, + { + "binary_sha256": "a475089472116f9684b70d2ae0b4f037e8d016aa866c5c069b12b1fa42887049", + "case": "mut287-wake-all", + "compile_exit": 0, + "expected_exit": 16, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and sc_cell w 32 topics 0\n", + "to": "if true\n" + }, + "run_exit": 16, + "source_sha256": "ed004e27d7c92f2eacebc67837148f851536257c66ff4d5b0a80e072469be298", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 601 + }, + { + "binary_sha256": "bc37cf99ad4ece4b4eec30178f7671c9be001810c516f9299b1ced25b0d68e50", + "case": "mut287-no-wake", + "compile_exit": 0, + "expected_exit": 34, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 0 q\nsc_wake w\n", + "to": "sc_set w 0 q\n" + }, + "run_exit": 34, + "source_sha256": "fa0573b16f47dce27c83b49869e343002151d06c5f6a0d72c2ce517cbb497e36", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6317 + }, + { + "binary_sha256": "e3b2a765381f9072bd9d2eb6692671ea1cddde198acc83296757432de44ff852", + "case": "mut287-review-unbounded", + "compile_exit": 0, + "expected_exit": 50, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 4 4 get sclim 1\n", + "to": "if false\n" + }, + "run_exit": 50, + "source_sha256": "835dd25023f2e040d6d355f39991ad71dc4caafa3f9e1044f84f13567a0c3a30", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3342 + }, + { + "binary_sha256": "3ab19be8433186bea8d4abdc3dd342e23a87c71b82498c02fd9e6b631139589f", + "case": "mut287-admit-unbounded", + "compile_exit": 0, + "expected_exit": 48, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 1 3 get sclim 0\n", + "to": "if false\n" + }, + "run_exit": 48, + "source_sha256": "1e47eef0b672b4d0d7249008f7314bf3bd39318196a486201d319266a6c4d85c", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2841 + }, + { + "binary_sha256": "c4bea06afe26e3ca03f02046ea325f0571377466114e42600487ff7ce7980bfd", + "case": "mut287-unknown-rerun", + "compile_exit": 0, + "expected_exit": 83, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 6\n", + "to": "put sjst j 2\n" + }, + "run_exit": 83, + "source_sha256": "266b4484b296c5d52713058fb7443cde489213e608a8998fdb8e14e87cf99b1d", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6759 + }, + { + "binary_sha256": "add5581a87fcbc5071c477d1c895e7745dcaa341459ed8a181bfa94bbfb94b9a", + "case": "mut287-lost-no-ack", + "compile_exit": 0, + "expected_exit": 92, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 64 get scseq w\n", + "to": "" + }, + "run_exit": 92, + "source_sha256": "96b8702f82c96de5aaaba0f0929de1d977c190ddfe1dcee2d3ce9390b400c5c9", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 5270 + }, + { + "binary_sha256": "a2bf272134d9b30f8fac8f53877fe6122dc205b2d7e763df229b15c8658facb8", + "case": "mut287-deps-ignored", + "compile_exit": 0, + "expected_exit": 68, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 1\n", + "to": "put sjst j 2\n" + }, + "run_exit": 68, + "source_sha256": "89e7b4f5ab2a9795d52ecdc23adb55d31c63724be756b82ac27acbecdc0276b5", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3417 + }, + { + "binary_sha256": "631c5456d455b862ad97c8cf683863a892d60200fcbfcc8f797ae5a7d9949bd8", + "case": "mut287-super-spin", + "compile_exit": 0, + "expected_exit": 138, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/super.om", + "from": "iv = interval\n", + "to": "iv = long 0\n" + }, + "run_exit": 138, + "source_sha256": "5e3438de10ca8d2936cf54ca1e8912180ed5f9a3abf89043ed97d0ea089f0af2", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2211 + }, + { + "binary_sha256": "58d8eea15b6fa620679056ef26f5631c194b9cac5034ae23f93f11558c4eb862", + "case": "mut288-pause-ignored", + "compile_exit": 0, + "expected_exit": 121, + "issue": "DRA-288", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne get scpause 0 0\n", + "to": "if false\n" + }, + "run_exit": 121, + "source_sha256": "ca480b950f76f0f71f1f0705930377b6fa884308df04530ec49987ff0fb51fed", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 754 + } + ], + "compiler": { + "path": "seed/out/omc", + "sha256": "5f90edea61bac241398df5036990d899361a5acd9decb37954ce088ec0f6f6df" + }, + "cpu_affinity": [ + 8, + 9 + ], + "execution": "NATIVE Linux AArch64 host CPU (DGX Spark host, no GPU opened)", + "hashes": { + "seed/authority/action.om": "59cb9c3dfdcd9193bc4a272deda4fcd256a0d7693f3bcb58bc4e30ed78faab2b", + "seed/node/auth-gate.om": "a1eb14fe28123f094b38711f4856fb1efd1e5cfac56bd0550688b22ac28007e0", + "seed/node/auth-test.om": "af66c87f83d73a5bdbaf181378eb69bb0645a86fe9b39de2f1b714041fbc20b8", + "seed/node/auth.om": "edf2f075d3751a8025363bc658252537f865dfc29f975fcf5d93c353b3282b30", + "seed/node/code-test.om": "df87a21e31f38d85ab9145af3fb18bafc52144a20aed0d9fbad60f6059ddacd0", + "seed/node/code.om": "aa9f8463fbe9534626c205e991e3a2170a25cbf91a106932ec399353583c0bf7", + "seed/node/gram.om": "ebba1f4c693f218969dc2f17eb680760977d38d694ac76db477853aefa64b291", + "seed/node/journal-gate.om": "718f5c98d2bf451b9528e3368215f98475621b489865dc1b6645ef665af212fc", + "seed/node/journal.om": "786802ccf5d31ee848285fb6853b3895501a54fe9b9ffb09af2585c222c13c38", + "seed/node/pool.om": "e7fba928bdc5c4194e7aee42109265de4f172d2b197946133d788b2dbcb30ccc", + "seed/node/sched-gate.om": "4f824e22a83aa1203dcaaa81ffb07989d48ddc5dbd5ef151132660fd8d5d4d2e", + "seed/node/sched-test.om": "29a3587d35a217403c63395eb2b11b4992727812af66512be3e452ea6381a545", + "seed/node/sched.om": "4f50c5a4883bdece9ed3299661af5b8c62d6d1fbfc3c88d0eb3f1540f3047e19", + "seed/node/schedpol-gate.om": "1a6dd34b0aec27e5c1aa5ca05d424ddaf068cdd2a2d0cb60ad5de047e1f3fc8b", + "seed/node/schedpol-test.om": "3deb155602c5d2393bf636a8e1c806ff107bbbab7d53411575ca6bbb72143dfc", + "seed/node/super.om": "d104ac8116c6df57fdc93f03791d7315e5b60875d8d6177480ef9967b6f53d5a", + "seed/node/transport.om": "d0dd69ef5e0b71294a2390b3526865d62ca07accd269b9ce57a028339e34f6da" + }, + "issue": "DRA-395", + "platform": "Linux 7.0.0-1019-nvidia aarch64 spark-b87b", + "project": "P-DRA-14", + "script": { + "cases_sha256": "105c52d268f54ad52c78e8c26b5aa1971014353cbceed832efeeae9dc4c126fc", + "path": "~/handoffs/hive/sched/bin/receipt.py", + "sha256": "d2652427bedda4771ca39fc87925c56436ffb69db04cbbefdedc1b37dcbc59d4" + }, + "source_commit": "0bea48c3915a12ef15295e2383f37e1be34788c7", + "source_tree": "6c469682756e8f23b96c655012a54e8c29372425", + "statuses": { + "DEPLOYED": "NOT_DEPLOYED", + "EXERCISED": "native AArch64 host, real forked workers", + "IMPLEMENTED": "resource requests, capacity admission, policy 0 FIFO head-of-line", + "QUALIFIED": "NOT_RUN (Spark gate judge)", + "independent_review": "consult-codex openai-codex/gpt-6-astra on a648d3c0: 2 HIGH, 2 MEDIUM; fixed in this head", + "rust_reference": "EXERCISED: ~/handoffs/hive/sched/rust-repro/REPORT.md, cargo test 3/3 at aien-sovereign-core-mv dffdbd19" + }, + "summary": { + "fail": 0, + "pass": 21 + }, + "timestamp_utc": "2026-11-07T05:18:22.292367+00:00" +} diff --git a/evidence/node-schedpol/receipt.42ee1b5d4f79b1d6537e4b84e21ea60b476d56be3fc1cf43dd11190d38612335.json b/evidence/node-schedpol/receipt.42ee1b5d4f79b1d6537e4b84e21ea60b476d56be3fc1cf43dd11190d38612335.json new file mode 100644 index 000000000..67bd2cf33 --- /dev/null +++ b/evidence/node-schedpol/receipt.42ee1b5d4f79b1d6537e4b84e21ea60b476d56be3fc1cf43dd11190d38612335.json @@ -0,0 +1,354 @@ +{ + "checks": [ + { + "binary_sha256": "0bf4dcec39b05d099cb80d878b2c0af7d23bf98b0257a2baa04ff81b7d6045bb", + "case": "schedpol-gate", + "compile_exit": 0, + "expected_exit": 11, + "issue": "DRA-395", + "run_exit": 11, + "source_sha256": "1b1939f5b125735ba543f48890b2f0fd60930a8171ef335c3d0ec9dcee8bd94e", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 973 + }, + { + "binary_sha256": "a3443e9352b0177959ef18c7e3cf1e98bd8780a5e723f69ce8d669e4faa657a3", + "case": "sched-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-287", + "run_exit": 0, + "source_sha256": "b505f26328abcbfb978699e1dc4669060a07011f4a91ba459c58c33b136b331c", + "stderr": "", + "stdout": "idle ticks workers=0 creator=0 wake rounds=200 mean_us=50 max_us=3094\nPASS node sched\n", + "verdict": "PASS", + "wall_ms": 8051 + }, + { + "binary_sha256": "5aada77c267c6c6d2477b2c1980819c299cfde244f980b80e77c346c394b2015", + "case": "auth-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-288", + "run_exit": 0, + "source_sha256": "a72441059bd6bcfa9d7983a72ed0eb5a4b210059dc2376a9cd16cc77908eb3b4", + "stderr": "", + "stdout": "PASS node authority\n", + "verdict": "PASS", + "wall_ms": 745 + }, + { + "binary_sha256": "09066323eff46ff437e5e9520fbf68aeb5c802098d1da7c1d8117a7d4463e487", + "case": "journal-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-289", + "run_exit": 0, + "source_sha256": "417c6c7d16afb88d41ef4676b1ec792e00afe827a271ead8ef472d5566b6c1c9", + "stderr": "", + "stdout": "PASS node journal\n", + "verdict": "PASS", + "wall_ms": 3237 + }, + { + "binary_sha256": "599e43012bd5067cdbd7279a0a559e49270adcf85ba600f1be42aa1fddba3132", + "case": "code-test-unit", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-290", + "run_exit": 0, + "source_sha256": "f5a168f37c73ff813eec0b1aad1e4eb55dcbbad19cd0398ad40f8a56ae27754d", + "stderr": "", + "stdout": "CWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWE 0 1002 1 2\nCWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 9\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1013 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1023 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1034 1 4\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWE 0 1045 1 5\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 FAIL 10 0\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 PASS 1 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWE 0 0 3 0\nCWE 0 0 3 1\nCWE 0 0 3 2\nCWO 0 FAIL 17 0\nCWE 0 0 3 6\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWE 0 0 3 4\nCWO 0 FAIL 17 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1054 1 4\nCWE 0 0 3 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWE 0 0 3 5\nCWO 0 FAIL 13 0\nCWE 0 0 3 0\nCWO 0 PASS 1 0\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWO 0 FAIL 12 7\nCWO 0 FAIL 20 0\nCWE 0 1061 1 1\nCWP 0 1 193\nTask: Fix the error in this file and confirm its goal.\nFile: jobs/item76666.om\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\nState: unread\nAnswer:\n\ncode checks=54 fail=0\n", + "verdict": "PASS", + "wall_ms": 28 + }, + { + "binary_sha256": "7365fd35ef4800ccbf3b2faa3f81e291c2ca0d23e5976fe4546f14c28628460c", + "case": "mut-impossible-admitted", + "compile_exit": 0, + "expected_exit": 31, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if not sp_feas req\n", + "to": "if false\n" + }, + "run_exit": 31, + "source_sha256": "08ccefd1f2a1c3d1013450d4fcf7e1433ebed021cc653a36e245a96ef63e6ea8", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 0 + }, + { + "binary_sha256": "bedefe224023b836a3c7951a2ae725bbb98657b99425931ba8535a45d22a9e90", + "case": "mut-collect-no-release", + "compile_exit": 0, + "expected_exit": 44, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "j = sub b 1\nsp_give j\n", + "to": "j = sub b 1\n" + }, + "run_exit": 44, + "source_sha256": "f8a49302912725e71ff333ae0765b849a46c737fcf58ff43b87aa8344fe41e27", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 41 + }, + { + "binary_sha256": "d1d5621d6ad94fbb8a7fe406bce240381098735efa9d3a82d0b68f6926e63457", + "case": "mut-capacity-ignored", + "compile_exit": 0, + "expected_exit": 44, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if gt sp_need req k a\n", + "to": "if false\n" + }, + "run_exit": 44, + "source_sha256": "b6e32eb735a65d58853f8af55a142db76290bdca147725b9cf59bbfd8d53f834", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 10 + }, + { + "binary_sha256": "c1be55ea5ff6b564e3d668c536b82d4b0153f5144ef3ef7e9e852437169da051", + "case": "mut-ready-unstamped", + "compile_exit": 0, + "expected_exit": 54, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and get sjdep j topics 0\nsp_ready j\n", + "to": "if ne and get sjdep j topics 0\nput sjst j 2\n" + }, + "run_exit": 54, + "source_sha256": "8b701fe17bc337348b22d0b3a5ea5ae77f3144d198d4afe68dce26e65cd042a2", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 445 + }, + { + "binary_sha256": "233d31705b3cdcae11dcbb050dce28a7da309044d2579d58de1cd8ac377330ab", + "case": "mut287-wake-all", + "compile_exit": 0, + "expected_exit": 16, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and sc_cell w 32 topics 0\n", + "to": "if true\n" + }, + "run_exit": 16, + "source_sha256": "585b52ec51ded8e47fb4229d98d19c80c466d166e58166543ad73887a7b6f0a3", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 601 + }, + { + "binary_sha256": "21c07492defbcbef8e91a2edcbe9377238dfbc674718bd94e4000bd54f13bb09", + "case": "mut287-no-wake", + "compile_exit": 0, + "expected_exit": 34, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 0 q\nsc_wake w\n", + "to": "sc_set w 0 q\n" + }, + "run_exit": 34, + "source_sha256": "da3d3d1b20840d914a9c46a5681ffa02e9548d42c32982ccac09f2f3a8d90a0a", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6320 + }, + { + "binary_sha256": "d267a330595d27008cb65f0b8676c706c8c4f0e6e1691bd5b897b6417827b646", + "case": "mut287-review-unbounded", + "compile_exit": 0, + "expected_exit": 50, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 4 4 get sclim 1\n", + "to": "if false\n" + }, + "run_exit": 50, + "source_sha256": "496533757efb4436c9311b1ee0c416f1f114bca68057e5dafd06221dcb5c6d57", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3354 + }, + { + "binary_sha256": "36f58c3e248fcd5eba08b2347f6b01bde15a8a4905741ed5749be53b8d0a98dc", + "case": "mut287-admit-unbounded", + "compile_exit": 0, + "expected_exit": 48, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 1 3 get sclim 0\n", + "to": "if false\n" + }, + "run_exit": 48, + "source_sha256": "46d72a402c9aaf8d043196ab1c8401b5d588ff0f53b7dbb9ee9aaf033fb68e6b", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2841 + }, + { + "binary_sha256": "247ba3f6201ed6720b6716445a05aed55625cae3052d3ebb379f4871ebfef880", + "case": "mut287-unknown-rerun", + "compile_exit": 0, + "expected_exit": 83, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 6\n", + "to": "put sjst j 2\n" + }, + "run_exit": 83, + "source_sha256": "aa61801a4ce2e58ea3b666c6abb3d06c06a8009e81d7336297d7120c0097415a", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6759 + }, + { + "binary_sha256": "6c8f767c90fed79a38761d35f0d1f28289f6630e38618f98ae2903333965c585", + "case": "mut287-lost-no-ack", + "compile_exit": 0, + "expected_exit": 92, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 64 get scseq w\n", + "to": "" + }, + "run_exit": 92, + "source_sha256": "87a691a907e3462d5de37737dd4022c6b2cb99b1217b139d77d5b6ebf27e4458", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 5278 + }, + { + "binary_sha256": "4adf8694df446a0e4e2f2f81a28fc0337de252256b7f517657aa6d9a78338300", + "case": "mut287-deps-ignored", + "compile_exit": 0, + "expected_exit": 68, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 1\n", + "to": "put sjst j 2\n" + }, + "run_exit": 68, + "source_sha256": "a4fcf0268b1f83cf9cfd1556d855bbdc40994a402dedc8618ccb520295c17f34", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3414 + }, + { + "binary_sha256": "04e4b7d40735859aeac0e58a1c6c63e94448fab0f3c9197eeedeecb09dbcd745", + "case": "mut287-super-spin", + "compile_exit": 0, + "expected_exit": 138, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/super.om", + "from": "iv = interval\n", + "to": "iv = long 0\n" + }, + "run_exit": 138, + "source_sha256": "35caea0f63fc5c9cc75345f2b3207b6b118c4c1fd293734c48cbb9120641dc59", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2210 + }, + { + "binary_sha256": "e0a4cf7ce6a71e6264dde73e562e1ed1550a5575ebc0f87c7c3846060e503bb7", + "case": "mut288-pause-ignored", + "compile_exit": 0, + "expected_exit": 121, + "issue": "DRA-288", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne get scpause 0 0\n", + "to": "if false\n" + }, + "run_exit": 121, + "source_sha256": "b7860b9aa6618dd020a0e2871acf50442e81dace37f4fb692913256a340faebe", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 741 + } + ], + "compiler": { + "path": "seed/out/omc", + "sha256": "5f90edea61bac241398df5036990d899361a5acd9decb37954ce088ec0f6f6df" + }, + "cpu_affinity": [ + 8, + 9 + ], + "execution": "NATIVE Linux AArch64 host CPU (DGX Spark host, no GPU opened)", + "hashes": { + "seed/authority/action.om": "59cb9c3dfdcd9193bc4a272deda4fcd256a0d7693f3bcb58bc4e30ed78faab2b", + "seed/node/auth-gate.om": "a72441059bd6bcfa9d7983a72ed0eb5a4b210059dc2376a9cd16cc77908eb3b4", + "seed/node/auth-test.om": "af66c87f83d73a5bdbaf181378eb69bb0645a86fe9b39de2f1b714041fbc20b8", + "seed/node/auth.om": "edf2f075d3751a8025363bc658252537f865dfc29f975fcf5d93c353b3282b30", + "seed/node/code-test.om": "df87a21e31f38d85ab9145af3fb18bafc52144a20aed0d9fbad60f6059ddacd0", + "seed/node/code.om": "aa9f8463fbe9534626c205e991e3a2170a25cbf91a106932ec399353583c0bf7", + "seed/node/gram.om": "ebba1f4c693f218969dc2f17eb680760977d38d694ac76db477853aefa64b291", + "seed/node/journal-gate.om": "417c6c7d16afb88d41ef4676b1ec792e00afe827a271ead8ef472d5566b6c1c9", + "seed/node/journal.om": "786802ccf5d31ee848285fb6853b3895501a54fe9b9ffb09af2585c222c13c38", + "seed/node/pool.om": "e7fba928bdc5c4194e7aee42109265de4f172d2b197946133d788b2dbcb30ccc", + "seed/node/sched-gate.om": "b505f26328abcbfb978699e1dc4669060a07011f4a91ba459c58c33b136b331c", + "seed/node/sched-test.om": "29a3587d35a217403c63395eb2b11b4992727812af66512be3e452ea6381a545", + "seed/node/sched.om": "a6570edab4c2db5923c4dc87fc828091ba4b34030ef09be013f3b0eac190bd16", + "seed/node/schedpol-gate.om": "1b1939f5b125735ba543f48890b2f0fd60930a8171ef335c3d0ec9dcee8bd94e", + "seed/node/schedpol-test.om": "db076259d17db2ed103c49fb34f9985572775ea3bbb616e8b1e84978bd77ed9c", + "seed/node/super.om": "d104ac8116c6df57fdc93f03791d7315e5b60875d8d6177480ef9967b6f53d5a", + "seed/node/transport.om": "d0dd69ef5e0b71294a2390b3526865d62ca07accd269b9ce57a028339e34f6da" + }, + "issue": "DRA-395", + "platform": "Linux 7.0.0-1019-nvidia aarch64 spark-b87b", + "project": "P-DRA-14", + "script": { + "cases_sha256": "3a6e6bb927f78d36ac59501ac7e8c256fa3b0b991737d9c38b661c067cc72e29", + "path": "~/handoffs/hive/sched/bin/receipt.py", + "sha256": "d2652427bedda4771ca39fc87925c56436ffb69db04cbbefdedc1b37dcbc59d4" + }, + "source_commit": "84b3b8fdffc3d46f6ca9f707ff2f0979ecad8786", + "source_tree": "a913bf5a86fccf353c07e76c6ab54d242bad8adc", + "statuses": { + "DEPLOYED": "NOT_DEPLOYED", + "EXERCISED": "native AArch64 host, real forked workers", + "IMPLEMENTED": "resource requests, capacity admission, policy 0 FIFO head-of-line", + "QUALIFIED": "NOT_RUN (Spark gate judge)", + "independent_review": "pending", + "rust_reference": "EXERCISED: ~/handoffs/hive/sched/rust-repro/REPORT.md, cargo test 3/3 at aien-sovereign-core-mv dffdbd19" + }, + "summary": { + "fail": 0, + "pass": 18 + }, + "timestamp_utc": "2026-11-07T05:06:20.605126+00:00" +} diff --git a/evidence/node-schedpol/receipt.b5a72289415f9cfc9a496814733a09cf622e5ced236998b6fec159c8825844b7.json b/evidence/node-schedpol/receipt.b5a72289415f9cfc9a496814733a09cf622e5ced236998b6fec159c8825844b7.json new file mode 100644 index 000000000..e842d86e3 --- /dev/null +++ b/evidence/node-schedpol/receipt.b5a72289415f9cfc9a496814733a09cf622e5ced236998b6fec159c8825844b7.json @@ -0,0 +1,802 @@ +{ + "checks": [ + { + "binary_sha256": "5002ecdb280a69e5b35c7672455a4a0714e85ca2d66440d3953a97d3420a07ef", + "case": "schedpol-gate", + "compile_exit": 0, + "expected_exit": 11, + "issue": "DRA-395", + "repeat": { + "outcomes": { + "11": 30 + }, + "runs": 30 + }, + "run_exit": 11, + "source_sha256": "1a6dd34b0aec27e5c1aa5ca05d424ddaf068cdd2a2d0cb60ad5de047e1f3fc8b", + "stderr": "", + "stdout": "schedpol hol witness head=20050 fits_behind=30050 free_cpu=1 idle_worker=1 hol_stops=40\nschedpol hol witness head=20050 fits_behind=50050 free_cpu=1 idle_worker=1 hol_stops=40\n", + "stdout_has": [ + "schedpol hol witness head=20050 fits_behind=30050 free_cpu=1 idle_worker=1", + "schedpol hol witness head=20050 fits_behind=50050 free_cpu=1 idle_worker=1" + ], + "verdict": "PASS", + "wall_ms": 87670 + }, + { + "binary_sha256": "37b674604170b9aa5b9a62445012eee19757432da0c51e8748aa2a710b4d36c1", + "case": "sched-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-287", + "run_exit": 0, + "source_sha256": "4f824e22a83aa1203dcaaa81ffb07989d48ddc5dbd5ef151132660fd8d5d4d2e", + "stderr": "", + "stdout": "idle ticks workers=0 creator=0 wake rounds=200 mean_us=25 max_us=1139\nPASS node sched\n", + "verdict": "PASS", + "wall_ms": 7947 + }, + { + "binary_sha256": "b9cd877be1341be8fbb55e1471b3dc4a390927ee5960a2162cbb2af54826edb9", + "case": "auth-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-288", + "run_exit": 0, + "source_sha256": "a1eb14fe28123f094b38711f4856fb1efd1e5cfac56bd0550688b22ac28007e0", + "stderr": "", + "stdout": "PASS node authority\n", + "verdict": "PASS", + "wall_ms": 759 + }, + { + "binary_sha256": "87a561683c5179de702e436fdddcbe0c9f8e21c104fc0ebd6d54bcc6a696e54c", + "case": "journal-gate", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-289", + "run_exit": 0, + "source_sha256": "718f5c98d2bf451b9528e3368215f98475621b489865dc1b6645ef665af212fc", + "stderr": "", + "stdout": "PASS node journal\n", + "verdict": "PASS", + "wall_ms": 3424 + }, + { + "binary_sha256": "d3578b840c8f92b5427ca98444e53fec55bb7b5333edc29161101f8ffb68cf9f", + "case": "code-test-unit", + "compile_exit": 0, + "expected_exit": 0, + "issue": "DRA-290", + "run_exit": 0, + "source_sha256": "17df85938093b0606a530da6e3e9df8b1b0b730bf52a9068cd63221db654910c", + "stderr": "", + "stdout": "CWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWE 0 1002 1 2\nCWR 0 0 2\n\n\n\nCWE 0 0 2 1\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 9\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1013 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWE 0 1023 1 3\nCWR 0 0 2\n\n\n\nCWE 0 0 2 2\nCWO 0 FAIL 10 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 13 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWO 0 FAIL 11 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1034 1 4\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWO 0 FAIL 14 0\nCWR 0 0 13\nTests passed.\nCWE 0 0 2 4\nCWE 0 1045 1 5\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 FAIL 10 0\nCWR 0 0 15\nFile not found.\nCWE 0 0 2 5\nCWO 0 PASS 1 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWO 0 FAIL 18 0\nCWE 0 0 3 0\nCWE 0 0 3 1\nCWE 0 0 3 2\nCWO 0 FAIL 17 0\nCWE 0 0 3 6\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWE 0 0 3 4\nCWO 0 FAIL 17 0\nCWR 0 0 2\n\n\n\nCWE 0 0 2 3\nCWE 0 1054 1 4\nCWE 0 0 3 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWE 0 0 3 5\nCWO 0 FAIL 13 0\nCWE 0 0 3 0\nCWO 0 PASS 1 0\nCWE 0 0 3 6\nCWO 0 FAIL 15 0\nCWE 0 0 3 0\nCWO 0 FAIL 15 0\nCWO 0 FAIL 12 7\nCWO 0 FAIL 20 0\nCWE 0 1061 1 1\nCWP 0 1 193\nTask: Fix the error in this file and confirm its goal.\nFile: jobs/item76666.om\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\nState: unread\nAnswer:\n\ncode checks=54 fail=0\n", + "verdict": "PASS", + "wall_ms": 53 + }, + { + "binary_sha256": "16fe69abe712bf8111fbad937e6479f011e53de2e3b4f17630184022f48f4f90", + "case": "mut-impossible-admitted", + "compile_exit": 0, + "expected_exit": 31, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if not sp_feas req\n", + "to": "if false\n" + }, + "run_exit": 31, + "source_sha256": "65fba1903752f0e8767e9bd317d653e3e90fefb926d97ce82521fa1cc1941585", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 0 + }, + { + "binary_sha256": "8f5496463990b6582d7686f407ef93bf7adb654d2d1442ea8d664b5476f346f1", + "case": "mut-collect-no-release", + "compile_exit": 0, + "expected_exit": 133, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "j = sub b 1\nsp_give j\n", + "to": "j = sub b 1\n" + }, + "run_exit": 133, + "source_sha256": "eebf3277b50fefc25fe48f304ff9ae300ec4a3c44665b844cd84930cb6bb8c11", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 414 + }, + { + "binary_sha256": "6d5932771bee686091d6043db09a389f8ad88edfdeeef0bf3a890f6b56895a89", + "case": "mut-capacity-ignored", + "compile_exit": 0, + "expected_exit": 44, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if gt sp_need req k a\n", + "to": "if false\n" + }, + "run_exit": 44, + "source_sha256": "41387f0870d2d5b2baac05587f3520af528bca55acc6137ebd87ef9c445e1a49", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 436 + }, + { + "binary_sha256": "6409bebd10797f6476b99adceb41b8e447e1c961cade783d2a258aefe673733c", + "case": "mut-ready-unstamped", + "compile_exit": 0, + "expected_exit": 54, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and get sjdep j topics 0\nsp_ready j\n", + "to": "if ne and get sjdep j topics 0\nput sjst j 2\n" + }, + "run_exit": 54, + "source_sha256": "22bb0727f72e34324ea3ac786b0bfec2a5724a9098f2f7175fdfd512eb0ed328", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 1001 + }, + { + "binary_sha256": "a4400760901fdfeaf1ec00ba579b9b4bb558174a7e1f235fe92e651a56b6a563", + "case": "mut-give-after-review", + "compile_exit": 0, + "expected_exit": 122, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "j = sub b 1\nsp_give j\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\n", + "to": "j = sub b 1\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\nsp_give j\n" + }, + "run_exit": 122, + "source_sha256": "4e2cda810317b4ec2acc09485e0d4bb9934fe31dc194019dd117da9dbed1798b", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 931 + }, + { + "binary_sha256": "e9822f44d4f6857c2d9763c60f73e1721cd0bf3ea5846c77a0217bb5b2dd5340", + "case": "mut-no-take", + "compile_exit": 0, + "expected_exit": 130, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjbyp j 0\nsp_take j\n", + "to": "put sjbyp j 0\n" + }, + "run_exit": 130, + "source_sha256": "f786dca6a66ae079f2cf6aadcab0d9d54783dbfb09506db4b5f8f5fb938ebc4a", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 11 + }, + { + "binary_sha256": "f7babdd9c452367f2838d2ffd3cdf3e2d73d609cc021fec39e8aa0fdee2ed3d5", + "case": "mut-cap-below-use", + "compile_exit": 0, + "expected_exit": 131, + "issue": "DRA-395", + "mutation": { + "file": "seed/node/sched.om", + "from": "if lt sp_need caps k get suse k\n", + "to": "if false\n" + }, + "run_exit": 131, + "source_sha256": "42027e8e7abe4b05a745674d840bec29e4f11f886c3020c054741353e3426b3c", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 11 + }, + { + "binary_sha256": "a475089472116f9684b70d2ae0b4f037e8d016aa866c5c069b12b1fa42887049", + "case": "mut287-wake-all", + "compile_exit": 0, + "expected_exit": 16, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne and sc_cell w 32 topics 0\n", + "to": "if true\n" + }, + "run_exit": 16, + "source_sha256": "ed004e27d7c92f2eacebc67837148f851536257c66ff4d5b0a80e072469be298", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 602 + }, + { + "binary_sha256": "bc37cf99ad4ece4b4eec30178f7671c9be001810c516f9299b1ced25b0d68e50", + "case": "mut287-no-wake", + "compile_exit": 0, + "expected_exit": 34, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 0 q\nsc_wake w\n", + "to": "sc_set w 0 q\n" + }, + "run_exit": 34, + "source_sha256": "fa0573b16f47dce27c83b49869e343002151d06c5f6a0d72c2ce517cbb497e36", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6316 + }, + { + "binary_sha256": "e3b2a765381f9072bd9d2eb6692671ea1cddde198acc83296757432de44ff852", + "case": "mut287-review-unbounded", + "compile_exit": 0, + "expected_exit": 50, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 4 4 get sclim 1\n", + "to": "if false\n" + }, + "run_exit": 50, + "source_sha256": "835dd25023f2e040d6d355f39991ad71dc4caafa3f9e1044f84f13567a0c3a30", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3357 + }, + { + "binary_sha256": "3ab19be8433186bea8d4abdc3dd342e23a87c71b82498c02fd9e6b631139589f", + "case": "mut287-admit-unbounded", + "compile_exit": 0, + "expected_exit": 48, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ge sched_count 1 3 get sclim 0\n", + "to": "if false\n" + }, + "run_exit": 48, + "source_sha256": "1e47eef0b672b4d0d7249008f7314bf3bd39318196a486201d319266a6c4d85c", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2846 + }, + { + "binary_sha256": "c4bea06afe26e3ca03f02046ea325f0571377466114e42600487ff7ce7980bfd", + "case": "mut287-unknown-rerun", + "compile_exit": 0, + "expected_exit": 83, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 6\n", + "to": "put sjst j 2\n" + }, + "run_exit": 83, + "source_sha256": "266b4484b296c5d52713058fb7443cde489213e608a8998fdb8e14e87cf99b1d", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 6771 + }, + { + "binary_sha256": "add5581a87fcbc5071c477d1c895e7745dcaa341459ed8a181bfa94bbfb94b9a", + "case": "mut287-lost-no-ack", + "compile_exit": 0, + "expected_exit": 92, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "sc_set w 64 get scseq w\n", + "to": "" + }, + "run_exit": 92, + "source_sha256": "96b8702f82c96de5aaaba0f0929de1d977c190ddfe1dcee2d3ce9390b400c5c9", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 5277 + }, + { + "binary_sha256": "a2bf272134d9b30f8fac8f53877fe6122dc205b2d7e763df229b15c8658facb8", + "case": "mut287-deps-ignored", + "compile_exit": 0, + "expected_exit": 68, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/sched.om", + "from": "put sjst j 1\n", + "to": "put sjst j 2\n" + }, + "run_exit": 68, + "source_sha256": "89e7b4f5ab2a9795d52ecdc23adb55d31c63724be756b82ac27acbecdc0276b5", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 3420 + }, + { + "binary_sha256": "631c5456d455b862ad97c8cf683863a892d60200fcbfcc8f797ae5a7d9949bd8", + "case": "mut287-super-spin", + "compile_exit": 0, + "expected_exit": 138, + "issue": "DRA-287", + "mutation": { + "file": "seed/node/super.om", + "from": "iv = interval\n", + "to": "iv = long 0\n" + }, + "run_exit": 138, + "source_sha256": "5e3438de10ca8d2936cf54ca1e8912180ed5f9a3abf89043ed97d0ea089f0af2", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 2211 + }, + { + "binary_sha256": "58d8eea15b6fa620679056ef26f5631c194b9cac5034ae23f93f11558c4eb862", + "case": "mut288-pause-ignored", + "compile_exit": 0, + "expected_exit": 121, + "issue": "DRA-288", + "mutation": { + "file": "seed/node/sched.om", + "from": "if ne get scpause 0 0\n", + "to": "if false\n" + }, + "run_exit": 121, + "source_sha256": "ca480b950f76f0f71f1f0705930377b6fa884308df04530ec49987ff0fb51fed", + "stderr": "", + "stdout": "", + "verdict": "PASS", + "wall_ms": 712 + } + ], + "compiler": { + "path": "seed/out/omc", + "sha256": "5f90edea61bac241398df5036990d899361a5acd9decb37954ce088ec0f6f6df" + }, + "cpu_affinity": [ + 8, + 9 + ], + "execution": "NATIVE Linux AArch64 host CPU (DGX Spark host, no GPU opened)", + "hashes": { + "seed/authority/action.om": "59cb9c3dfdcd9193bc4a272deda4fcd256a0d7693f3bcb58bc4e30ed78faab2b", + "seed/node/auth-gate.om": "a1eb14fe28123f094b38711f4856fb1efd1e5cfac56bd0550688b22ac28007e0", + "seed/node/auth-test.om": "af66c87f83d73a5bdbaf181378eb69bb0645a86fe9b39de2f1b714041fbc20b8", + "seed/node/auth.om": "edf2f075d3751a8025363bc658252537f865dfc29f975fcf5d93c353b3282b30", + "seed/node/code-test.om": "df87a21e31f38d85ab9145af3fb18bafc52144a20aed0d9fbad60f6059ddacd0", + "seed/node/code.om": "aa9f8463fbe9534626c205e991e3a2170a25cbf91a106932ec399353583c0bf7", + "seed/node/gram.om": "ebba1f4c693f218969dc2f17eb680760977d38d694ac76db477853aefa64b291", + "seed/node/journal-gate.om": "718f5c98d2bf451b9528e3368215f98475621b489865dc1b6645ef665af212fc", + "seed/node/journal.om": "786802ccf5d31ee848285fb6853b3895501a54fe9b9ffb09af2585c222c13c38", + "seed/node/pool.om": "e7fba928bdc5c4194e7aee42109265de4f172d2b197946133d788b2dbcb30ccc", + "seed/node/sched-gate.om": "4f824e22a83aa1203dcaaa81ffb07989d48ddc5dbd5ef151132660fd8d5d4d2e", + "seed/node/sched-test.om": "29a3587d35a217403c63395eb2b11b4992727812af66512be3e452ea6381a545", + "seed/node/sched.om": "4f50c5a4883bdece9ed3299661af5b8c62d6d1fbfc3c88d0eb3f1540f3047e19", + "seed/node/schedpol-gate.om": "1a6dd34b0aec27e5c1aa5ca05d424ddaf068cdd2a2d0cb60ad5de047e1f3fc8b", + "seed/node/schedpol-test.om": "3deb155602c5d2393bf636a8e1c806ff107bbbab7d53411575ca6bbb72143dfc", + "seed/node/super.om": "d104ac8116c6df57fdc93f03791d7315e5b60875d8d6177480ef9967b6f53d5a", + "seed/node/transport.om": "d0dd69ef5e0b71294a2390b3526865d62ca07accd269b9ce57a028339e34f6da" + }, + "issue": "DRA-395", + "platform": "Linux 7.0.0-1019-nvidia aarch64 spark-b87b", + "project": "P-DRA-14", + "script": { + "cases": { + "cases": [ + { + "case": "schedpol-gate", + "compose": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "expect": 11, + "gate": "seed/node/schedpol-gate.om", + "issue": "DRA-395", + "repeat": 30, + "stdout_has": [ + "schedpol hol witness head=20050 fits_behind=30050 free_cpu=1 idle_worker=1", + "schedpol hol witness head=20050 fits_behind=50050 free_cpu=1 idle_worker=1" + ], + "timeout": 120 + }, + { + "case": "sched-gate", + "compose": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "expect": 0, + "gate": "seed/node/sched-gate.om", + "issue": "DRA-287" + }, + { + "case": "auth-gate", + "compose": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/authority/action.om", + "seed/node/journal.om", + "seed/node/auth.om", + "seed/node/auth-test.om" + ], + "expect": 0, + "gate": "seed/node/auth-gate.om", + "issue": "DRA-288" + }, + { + "case": "journal-gate", + "clean": [ + "build/node/jt" + ], + "compose": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/authority/action.om", + "seed/node/journal.om", + "seed/node/auth.om", + "seed/node/journal-test.om" + ], + "expect": 0, + "gate": "seed/node/journal-gate.om", + "issue": "DRA-289" + }, + { + "args": [ + "unit", + "build/node/cu" + ], + "case": "code-test-unit", + "clean": [ + "build/node/cu" + ], + "expect": 0, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/authority/action.om", + "seed/node/journal.om", + "seed/node/auth.om", + "seed/node/gram.om", + "seed/node/code.om", + "seed/node/code-test.om" + ], + "issue": "DRA-290", + "om2": true + }, + { + "case": "mut-impossible-admitted", + "expect": 31, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "if not sp_feas req\n", + "if false\n" + ] + }, + { + "case": "mut-collect-no-release", + "expect": 133, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "j = sub b 1\nsp_give j\n", + "j = sub b 1\n" + ] + }, + { + "case": "mut-capacity-ignored", + "expect": 44, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "if gt sp_need req k a\n", + "if false\n" + ] + }, + { + "case": "mut-ready-unstamped", + "expect": 54, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "if ne and get sjdep j topics 0\nsp_ready j\n", + "if ne and get sjdep j topics 0\nput sjst j 2\n" + ] + }, + { + "case": "mut-give-after-review", + "expect": 122, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "j = sub b 1\nsp_give j\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\n", + "j = sub b 1\nif ge sched_count 4 4 get sclim 1\ncontinue\nend\nsp_give j\n" + ] + }, + { + "case": "mut-no-take", + "expect": 130, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "put sjbyp j 0\nsp_take j\n", + "put sjbyp j 0\n" + ] + }, + { + "case": "mut-cap-below-use", + "expect": 131, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/schedpol-test.om" + ], + "issue": "DRA-395", + "mutate": [ + "seed/node/sched.om", + "if lt sp_need caps k get suse k\n", + "if false\n" + ] + }, + { + "case": "mut287-wake-all", + "expect": 16, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "if ne and sc_cell w 32 topics 0\n", + "if true\n" + ] + }, + { + "case": "mut287-no-wake", + "expect": 34, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "sc_set w 0 q\nsc_wake w\n", + "sc_set w 0 q\n" + ] + }, + { + "case": "mut287-review-unbounded", + "expect": 50, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "if ge sched_count 4 4 get sclim 1\n", + "if false\n" + ] + }, + { + "case": "mut287-admit-unbounded", + "expect": 48, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "if ge sched_count 1 3 get sclim 0\n", + "if false\n" + ] + }, + { + "case": "mut287-unknown-rerun", + "expect": 83, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "put sjst j 6\n", + "put sjst j 2\n" + ] + }, + { + "case": "mut287-lost-no-ack", + "expect": 92, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "sc_set w 64 get scseq w\n", + "" + ] + }, + { + "case": "mut287-deps-ignored", + "expect": 68, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/sched.om", + "put sjst j 1\n", + "put sjst j 2\n" + ] + }, + { + "args": [ + "idle" + ], + "case": "mut287-super-spin", + "expect": 138, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/node/sched-test.om" + ], + "issue": "DRA-287", + "mutate": [ + "seed/node/super.om", + "iv = interval\n", + "iv = long 0\n" + ] + }, + { + "case": "mut288-pause-ignored", + "expect": 121, + "fragments": [ + "seed/node/transport.om", + "seed/node/pool.om", + "seed/node/super.om", + "seed/node/sched.om", + "seed/authority/action.om", + "seed/node/journal.om", + "seed/node/auth.om", + "seed/node/auth-test.om" + ], + "issue": "DRA-288", + "mutate": [ + "seed/node/sched.om", + "if ne get scpause 0 0\n", + "if false\n" + ] + } + ], + "issue": "DRA-395", + "statuses": { + "DEPLOYED": "NOT_DEPLOYED", + "EXERCISED": "native AArch64 host, real forked workers", + "IMPLEMENTED": "resource requests, capacity admission, policy 0 FIFO head-of-line", + "QUALIFIED": "NOT_RUN (Spark gate judge)", + "independent_review": "consult-codex openai-codex/gpt-6-astra: round 1 on a648d3c0 (2 HIGH, 2 MEDIUM, fixed); round 2 on 73997760 APPROVE-equivalent, 1 LOW doc finding + 3 evidence risks, fixed in this head", + "rust_reference": "EXERCISED: ~/handoffs/hive/sched/rust-repro/REPORT.md, cargo test 3/3 at aien-sovereign-core-mv dffdbd19" + } + }, + "cases_sha256": "199b4d556a74744fe584c6a80811da05e7df56f4637b4f3833af3174fa4f4223", + "path": "~/handoffs/hive/sched/bin/receipt.py", + "sha256": "3bd068fbf1a452570d91a6d1ea4b08b50f84cbd42c9fba29f44d5663be8b67dc", + "source": "#!/usr/bin/env python3\n\"\"\"Run a scheduler-policy case list against a clean omega-mv checkout and\nwrite a content-addressed receipt (evidence//receipt..json).\n\nUsage: receipt.py CASES.json REPO OUTDIR_REL [--write]\nRun it under the queen pool lock, e.g.\n flock -o ~/handoffs/hive/queen/pool-8-9.lock taskset -c 8-9 nice -n 10 receipt.py ...\n\nA case: {\"case\", \"issue\", \"fragments\": [paths] | \"gate\": path, \"om2\": bool,\n \"mutate\": [path, old, new] (optional; old must occur exactly once),\n \"args\": [..], \"expect\": int, \"timeout\": s, \"clean\": [rel dirs removed first],\n \"stdout_has\": [substrings every run must print] (optional),\n \"repeat\": N runs, each must pass (optional, default 1)}.\nThe receipt embeds this script's source and the case list for replay.\nMutants are applied to a disposable copy of the fragment; the checkout is\nnever modified. Verification tooling only: the implementation is the .om.\n\"\"\"\nimport hashlib, json, os, platform, shutil, subprocess, sys, tempfile, time, datetime\n\ndef sh(cmd, cwd, **kw):\n return subprocess.run(cmd, cwd=cwd, capture_output=True, **kw)\n\ndef sha(path):\n h = hashlib.sha256()\n with open(path, 'rb') as f:\n h.update(f.read())\n return h.hexdigest()\n\ndef main():\n cases_path, repo, outrel = sys.argv[1], os.path.abspath(sys.argv[2]), sys.argv[3]\n write = '--write' in sys.argv\n spec = json.load(open(cases_path))\n dirty = sh(['git', 'status', '--porcelain', '--untracked-files=normal'], repo).stdout.decode()\n dirty = [l for l in dirty.splitlines() if not l[3:].startswith('build/')]\n if dirty:\n print('REFUSED: dirty tree\\n' + '\\n'.join(dirty), file=sys.stderr)\n sys.exit(3)\n head = sh(['git', 'rev-parse', 'HEAD'], repo).stdout.decode().strip()\n tree = sh(['git', 'rev-parse', 'HEAD^{tree}'], repo).stdout.decode().strip()\n omc = os.path.join(repo, 'seed/out/omc')\n work = tempfile.mkdtemp(prefix='schedrcpt-')\n files = set()\n results = []\n for c in spec['cases']:\n frags = c.get('fragments') or [c['gate']]\n src = b'om2\\n' if c.get('om2') else b''\n mut = c.get('mutate')\n for fr in frags:\n files.add(fr)\n data = open(os.path.join(repo, fr), 'rb').read()\n if mut and mut[0] == fr:\n old, new = mut[1].encode(), mut[2].encode()\n n = data.count(old)\n if n != 1:\n print(f'REFUSED: mutant {c[\"case\"]}: pattern occurs {n} times', file=sys.stderr)\n sys.exit(4)\n data = data.replace(old, new)\n src += data\n if c.get('gate') and not mut and c.get('compose'):\n composed = b''.join(open(os.path.join(repo, f), 'rb').read() for f in c['compose'])\n if composed != src:\n print(f'REFUSED: {c[\"gate\"]} is not the concatenation', file=sys.stderr)\n sys.exit(5)\n binp = os.path.join(work, c['case'])\n p = subprocess.run([omc], input=src, capture_output=True)\n with open(binp, 'wb') as f:\n f.write(p.stdout)\n os.chmod(binp, 0o755)\n r = {'case': c['case'], 'issue': c.get('issue'), 'compile_exit': p.returncode,\n 'expected_exit': c['expect'], 'source_sha256': hashlib.sha256(src).hexdigest()}\n if mut:\n r['mutation'] = {'file': mut[0], 'from': mut[1], 'to': mut[2]}\n if p.returncode != 0:\n r.update(run_exit=None, verdict='FAIL', stderr=p.stderr.decode(errors='replace'))\n results.append(r)\n continue\n runs, code, out, err = [], None, b'', b''\n t0 = time.monotonic()\n for n in range(c.get('repeat', 1)):\n for d in c.get('clean', []):\n shutil.rmtree(os.path.join(repo, d), ignore_errors=True)\n try:\n q = subprocess.run([binp] + c.get('args', []), cwd=repo, capture_output=True,\n timeout=c.get('timeout', 120))\n code, out, err = q.returncode, q.stdout, q.stderr\n except subprocess.TimeoutExpired as e:\n code, out, err = 'timeout', e.stdout or b'', e.stderr or b''\n text = out.decode(errors='replace')\n miss = [s for s in c.get('stdout_has', []) if s not in text]\n runs.append({'exit': code, 'missing_stdout': miss})\n ok = all(x['exit'] == c['expect'] and not x['missing_stdout'] for x in runs)\n r.update(run_exit=code, wall_ms=int((time.monotonic() - t0) * 1000),\n stdout=out.decode(errors='replace')[-4000:],\n stderr=err.decode(errors='replace')[-2000:],\n binary_sha256=sha(binp),\n verdict='PASS' if ok else 'FAIL')\n if c.get('stdout_has'):\n r['stdout_has'] = c['stdout_has']\n if len(runs) > 1:\n hist = {}\n for x in runs:\n k = f\"{x['exit']}{'' if not x['missing_stdout'] else ' missing-stdout'}\"\n hist[k] = hist.get(k, 0) + 1\n r['repeat'] = {'runs': len(runs), 'outcomes': hist}\n results.append(r)\n print(f\"{r['verdict']} {c['case']} expect={c['expect']} got={code}\"\n + (f\" runs={r['repeat']['outcomes']}\" if len(runs) > 1 else ''), flush=True)\n shutil.rmtree(work, ignore_errors=True)\n rec = {\n 'project': 'P-DRA-14', 'issue': spec['issue'], 'source_commit': head, 'source_tree': tree,\n 'platform': ' '.join([platform.system(), platform.release(), platform.machine(), platform.node()]),\n 'cpu_affinity': sorted(os.sched_getaffinity(0)),\n 'execution': 'NATIVE Linux AArch64 host CPU (DGX Spark host, no GPU opened)',\n 'timestamp_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(),\n 'compiler': {'path': 'seed/out/omc', 'sha256': sha(omc)},\n 'hashes': {f: sha(os.path.join(repo, f)) for f in sorted(files)},\n 'script': {'path': '~/handoffs/hive/sched/bin/receipt.py', 'sha256': sha(__file__),\n 'source': open(__file__).read(),\n 'cases_sha256': sha(cases_path), 'cases': spec},\n 'statuses': spec.get('statuses', {}),\n 'checks': results,\n 'summary': {'pass': sum(r['verdict'] == 'PASS' for r in results),\n 'fail': sum(r['verdict'] != 'PASS' for r in results)},\n }\n body = (json.dumps(rec, indent=2, sort_keys=True) + '\\n').encode()\n digest = hashlib.sha256(body).hexdigest()\n print(f\"summary pass={rec['summary']['pass']} fail={rec['summary']['fail']} receipt_sha256={digest}\")\n if write:\n d = os.path.join(repo, outrel)\n os.makedirs(d, exist_ok=True)\n path = os.path.join(d, f'receipt.{digest}.json')\n with open(path, 'wb') as f:\n f.write(body)\n print(path)\n else:\n with open(os.path.join(tempfile.gettempdir(), f'sched-receipt-{digest}.json'), 'wb') as f:\n f.write(body)\n sys.exit(0 if rec['summary']['fail'] == 0 else 1)\n\nmain()\n" + }, + "source_commit": "68c4686b47f8d851311cfc054106dc60418edd8f", + "source_tree": "f00bdfa4fe9b7bda77e28e8335b05c6b192b565a", + "statuses": { + "DEPLOYED": "NOT_DEPLOYED", + "EXERCISED": "native AArch64 host, real forked workers", + "IMPLEMENTED": "resource requests, capacity admission, policy 0 FIFO head-of-line", + "QUALIFIED": "NOT_RUN (Spark gate judge)", + "independent_review": "consult-codex openai-codex/gpt-6-astra: round 1 on a648d3c0 (2 HIGH, 2 MEDIUM, fixed); round 2 on 73997760 APPROVE-equivalent, 1 LOW doc finding + 3 evidence risks, fixed in this head", + "rust_reference": "EXERCISED: ~/handoffs/hive/sched/rust-repro/REPORT.md, cargo test 3/3 at aien-sovereign-core-mv dffdbd19" + }, + "summary": { + "fail": 0, + "pass": 21 + }, + "timestamp_utc": "2026-11-07T05:24:52.494416+00:00" +} diff --git a/evidence/node-schedpol/rust-reference.46813a1edb5836a365ef9d470682d2fc26bb5f16bbd3f9e2cab559c8f8d17cc0.json b/evidence/node-schedpol/rust-reference.46813a1edb5836a365ef9d470682d2fc26bb5f16bbd3f9e2cab559c8f8d17cc0.json new file mode 100644 index 000000000..089b25464 --- /dev/null +++ b/evidence/node-schedpol/rust-reference.46813a1edb5836a365ef9d470682d2fc26bb5f16bbd3f9e2cab559c8f8d17cc0.json @@ -0,0 +1,47 @@ +{ + "blobs": { + "crates/spark-harness/src/scheduler/core.rs": "32c3f431b58c7aece11527a3da2acafda2b27f7e", + "crates/spark-harness/src/scheduler/mod.rs": "001db62c4f4a" + }, + "command": "cd && CARGO_TARGET_DIR= flock -o ~/handoffs/hive/queen/pool-8-9.lock taskset -c 8-9 nice -n 10 cargo test -p spark-harness --test dra395_blocked_head -- --nocapture --test-threads=1", + "commit": "dffdbd195edcbe1ec3bd2fa255355b15c530f31e", + "deployment": "reference-only: mod.rs opt-in, ProvisionalConfig::enabled false by default, no spark-harness API or MCP tool uses it; only consumer aien-runtime optional feature provisional-prep; installed ~/.local/bin/spark-harness sha256 9fe2941155ca0b7cae6d26f64ba6b9ac9a66ace215e9a60af1275718c0eb1eae has no provisional code; no process runs", + "exit": 0, + "identity": "rustc 1.98.1 (48a229cea 2026-09-01)\ncargo 1.98.1 (797e8a9bc 2026-08-05)\naarch64\ndffdbd195edcbe1ec3bd2fa255355b15c530f31e\n32c3f431b58c7aece11527a3da2acafda2b27f7e\n1bb855132603f39b6f8aa41a317c31d4a9cf7d3dd2fa979fe14efb692c79df94 crates/spark-harness/tests/dra395_blocked_head.rs\n?? crates/spark-harness/tests/dra395_blocked_head.rs\n", + "issue": "DRA-395", + "kind": "reference reproduction (Rust, upstream unmodified)", + "log_sha256": "ca7af21c9809529ff508774c2f34359e52d121f75a0dd8939fbceaae2fd651cd", + "output_lines_139_154": [ + " Finished `test` profile [unoptimized + debuginfo] target(s) in 1m 04s", + " Running tests/dra395_blocked_head.rs (/tmp/sched-ref/target/debug/deps/dra395_blocked_head-f683a118c59ae894)", + "", + "running 3 tests", + "test a_blocked_head ... DRA395-RUST blocked_head step=after_register_abc running=[a] free_cpu=1 running_count=1 queue=[b,c] states=[a:Provisional:queued=false b:Blocked:queued=true c:Blocked:queued=true] dispatched_by_b=[] dispatched_by_c=[]", + "DRA395-RUST blocked_head step=after_work_done_a running=[b,c] free_cpu=1 running_count=2 queue=[] states=[a:AwaitingFinalProof:queued=false b:Provisional:queued=false c:Provisional:queued=false] dispatched_by_release=[\"b\", \"c\"]", + "ok", + "test b_bounded_queue_exclusion ... DRA395-RUST queue_exclusion step=after_register_abde running=[a] free_cpu=1 running_count=1 queue=[b,d] states=[a:Provisional:queued=false b:Blocked:queued=true d:Blocked:queued=true e:Blocked:queued=false] dispatched_by_e=[]", + "DRA395-RUST queue_exclusion step=after_work_done_a running=[b,d] free_cpu=0 running_count=2 queue=[e] states=[a:AwaitingFinalProof:queued=false b:Provisional:queued=false d:Provisional:queued=false e:Blocked:queued=true] dispatched_by_release=[\"b\", \"d\"]", + "ok", + "test c_impossible_request ... DRA395-RUST impossible_request cpu_request=5 cpu_limit=4 result=Err(ExceedsCapacity(\"big\")) registered=false queue=[]", + "ok", + "", + "test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s", + "", + "EXIT=0" + ], + "platform": "Linux 7.0.0-1019-nvidia aarch64 spark-b87b", + "project": "P-DRA-14", + "repository": "aien-dev/aien-sovereign-core-mv", + "result": "3 passed, 0 failed (assertions encode the observed behaviour)", + "source_lines": { + "bounded fill in task-id order": "core.rs:584-596", + "head-of-line stop": "core.rs:598-602 (doc 566-567)", + "impossible refused": "core.rs:654-655, permits.rs:51-54", + "release on WorkDone": "core.rs:724-739, 379-381" + }, + "test_file": { + "path": "crates/spark-harness/tests/dra395_blocked_head.rs (untracked, added to a scratch clone)", + "sha256": "1bb855132603f39b6f8aa41a317c31d4a9cf7d3dd2fa979fe14efb692c79df94", + "source": "// SPDX-License-Identifier: Apache-2.0\n//\n//! DRA-395 evidence: observe the CURRENT head-of-line behaviour of\n//! `Core::pump` (src/scheduler/core.rs). These tests assert what the\n//! reference scheduler does today; they are not a specification.\n\nmod common;\n\nuse common::{req, H};\nuse spark_harness::execution::TaskState;\nuse spark_harness::scheduler::{\n EventKind, Outcome, ProvisionalConfig, ResourceLimits, SchedError,\n};\n\nconst CPU: u32 = 4;\n\nfn cfg(queue_capacity: usize) -> ProvisionalConfig {\n ProvisionalConfig {\n enabled: true,\n queue_capacity,\n limits: ResourceLimits {\n cpu_slots: CPU,\n memory_bytes: 1 << 40,\n max_concurrency: 4,\n },\n lease_ttl: 1_000,\n dedup_window: 64,\n }\n}\n\nfn provisional(h: &H, ids: &[&str]) -> Vec {\n ids.iter()\n .filter(|t| h.sched.state(t).unwrap() == TaskState::Provisional)\n .map(|t| t.to_string())\n .collect()\n}\n\nfn free_cpu(h: &H) -> u32 {\n CPU - h.sched.permits_in_use().cpu_in_use\n}\n\nfn obs(scenario: &str, step: &str, h: &H, ids: &[&str], extra: &str) {\n let pool = h.sched.permits_in_use();\n let states: Vec = ids\n .iter()\n .map(|t| {\n let i = h.sched.task(t).unwrap();\n format!(\"{t}:{:?}:queued={}\", i.state, i.queued)\n })\n .collect();\n println!(\n \"DRA395-RUST {scenario} step={step} running=[{}] free_cpu={} running_count={} queue=[{}] states=[{}]{extra}\",\n provisional(h, ids).join(\",\"),\n free_cpu(h),\n pool.running,\n h.sched.queue().join(\",\"),\n states.join(\" \"),\n );\n}\n\n#[test]\nfn a_blocked_head() {\n let ids = [\"a\", \"b\", \"c\"];\n let mut h = H::new(cfg(64));\n let fx = h.register(\"a\", 3, &[]);\n assert_eq!(fx.dispatched, vec![\"a\"]);\n let fx_b = h.register(\"b\", 2, &[]);\n let fx_c = h.register(\"c\", 1, &[]);\n obs(\n \"blocked_head\",\n \"after_register_abc\",\n &h,\n &ids,\n &format!(\n \" dispatched_by_b={:?} dispatched_by_c={:?}\",\n fx_b.dispatched, fx_c.dispatched\n ),\n );\n // Current behaviour: b (2 cpu) heads the queue and does not fit next to\n // a (3 of 4); c (1 cpu) would fit but is behind b and stays queued.\n assert!(fx_b.dispatched.is_empty());\n assert!(fx_c.dispatched.is_empty());\n assert_eq!(h.sched.queue(), vec![\"b\", \"c\"]);\n assert_eq!(free_cpu(&h), 1);\n let c = h.sched.task(\"c\").unwrap();\n assert_eq!((c.state, c.queued), (TaskState::Blocked, true));\n\n // a leaves Provisional (WorkDone -> AwaitingFinalProof) and releases\n // its permits.\n let fx = h.work_done(\"a\");\n obs(\n \"blocked_head\",\n \"after_work_done_a\",\n &h,\n &ids,\n &format!(\" dispatched_by_release={:?}\", fx.dispatched),\n );\n assert_eq!(fx.dispatched, vec![\"b\", \"c\"]);\n assert_eq!(free_cpu(&h), 1);\n}\n\n#[test]\nfn b_bounded_queue_exclusion() {\n let ids = [\"a\", \"b\", \"d\", \"e\"];\n let mut h = H::new(cfg(2));\n assert_eq!(h.register(\"a\", 3, &[]).dispatched, vec![\"a\"]);\n h.register(\"b\", 2, &[]);\n h.register(\"d\", 2, &[]);\n let fx_e = h.register(\"e\", 1, &[]);\n obs(\n \"queue_exclusion\",\n \"after_register_abde\",\n &h,\n &ids,\n &format!(\" dispatched_by_e={:?}\", fx_e.dispatched),\n );\n assert!(fx_e.dispatched.is_empty());\n assert_eq!(h.sched.queue(), vec![\"b\", \"d\"]);\n assert_eq!(free_cpu(&h), 1);\n let e = h.sched.task(\"e\").unwrap();\n assert_eq!((e.state, e.queued), (TaskState::Blocked, false));\n\n let fx = h.work_done(\"a\");\n obs(\n \"queue_exclusion\",\n \"after_work_done_a\",\n &h,\n &ids,\n &format!(\" dispatched_by_release={:?}\", fx.dispatched),\n );\n assert_eq!(fx.dispatched, vec![\"b\", \"d\"]);\n assert_eq!(free_cpu(&h), 0);\n let e = h.sched.task(\"e\").unwrap();\n assert_eq!((e.state, e.queued), (TaskState::Blocked, true));\n}\n\n#[test]\nfn c_impossible_request() {\n let mut h = H::new(cfg(64));\n let r = h.send(EventKind::RegisterTask {\n task: \"big\".into(),\n resources: req(5),\n producers: vec![],\n });\n let registered = h.sched.task(\"big\").is_some();\n println!(\n \"DRA395-RUST impossible_request cpu_request=5 cpu_limit={CPU} result={} registered={registered} queue=[{}]\",\n match &r {\n Ok(Outcome::Applied(fx)) => format!(\"Applied(dispatched={:?})\", fx.dispatched),\n Ok(o) => format!(\"{o:?}\"),\n Err(e) => format!(\"Err({e:?})\"),\n },\n h.sched.queue().join(\",\"),\n );\n assert!(matches!(&r, Err(SchedError::ExceedsCapacity(t)) if t == \"big\"), \"{r:?}\");\n assert!(!registered);\n}\n" + } +} diff --git a/seed/node/.crumb b/seed/node/.crumb index 8225cd12b..1490be0cb 100644 --- a/seed/node/.crumb +++ b/seed/node/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-11-07T03:51:26Z", + "compiled_at": "2026-11-07T05:22:36Z", "compiler": "crumb-compile/1", - "digest": "sha256:24501ac83754018dfd584d223112ae43ce47790ce8b9b15871fbc63a7bc317f1", + "digest": "sha256:65192349b7404c211a674800b04944de68f6bc3708a67b746294f1a1ecd6a9a2", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 24, - "generated_at_commit": "507483cd8cb177015006ebcd7d95bd4ae792be56", - "source_tree": "sha256:2c9e620c185d3759a56e4dd7668b796f45515093fc7f2ed4e927bc24039be80c" + "files": 26, + "generated_at_commit": "41282f5f9b920e0a049159f6eff59938f029d474", + "source_tree": "sha256:9616c594c149318463cb00a65a3a8866efda168db76ac87f8d58284da492fcb4" }, "owner_lane": "", "seed": { diff --git a/seed/node/README.md b/seed/node/README.md index bdbde47bd..2ea2cddf3 100644 --- a/seed/node/README.md +++ b/seed/node/README.md @@ -13,7 +13,7 @@ Source fragments, concatenated in this order before one program with `fn main`: | `transport.om` | one arena: 64 immutable records, topic scan, eventfd hints, stop flag (#1055) | | `pool.om` | K arenas reused by epoch, reader holds, fail-closed rollover (DRA-286) | | `super.om` | forked workers, death detection, reaping, creator-loss detection, bounded stop (DRA-286) | -| `sched.om` | subscriptions, dependency wake-ups, bounded admission and review, job loss handling (DRA-287) | +| `sched.om` | subscriptions, dependency wake-ups, bounded admission and review, job loss handling (DRA-287); resource requests and the selection policy (P-DRA-14) | | `seed/authority/action.om` | the existing action records the authority layer commits through | | `journal.om` | durable journal of every authority transition, fencing, restart recovery (DRA-289) | | `auth.om` | typed proposals, one commit owner, cancellation of real child tools, operator controls (DRA-288) | @@ -362,7 +362,139 @@ The gate covers the following phases: | `sched.om`: `put sjst j 6` to `put sjst j 2` (UNKNOWN job rerun) | 83 | | `sched.om`: delete `sc_set w 64 get scseq w` (dead worker's assignment not retired) | 92 | | `sched.om`: `put sjst j 1` to `put sjst j 2` (dependencies ignored) | 68 | -| `super.om`: `iv = interval` to `iv = 0`, run with `idle` (workers spin) | 138 | +| `super.om`: `iv = interval` to `iv = long 0`, run with `idle` (workers spin) | 138 | + +## Resource-aware selection (P-DRA-14) + +Owner: the adaptive scheduling lane, [P-DRA-14](https://linear.app/drake-stapleton/project/aien-adaptive-scheduling-feasible-work-and-fair-progress-f20e588c68cd) +(DRA-395 to DRA-399). It owns selection policy, fairness, reservation and +ranking in `sched.om` and `schedpol-test.om`; transport, pool, supervision, +authority, journal and the workflow stay with their DRA-286..290 owners. +There is one scheduler: these are policies of `sched_dispatch`, not a second +dispatcher. + +Status (DRA-395): IMPLEMENTED: resource requests, capacity admission and +policy 0, FIFO head-of-line, which reproduces the stop rule of the reference +pump. The regression below fails on purpose until DRA-396 adds fair fitting. + +```sh +cat seed/node/transport.om seed/node/pool.om seed/node/super.om seed/node/sched.om seed/node/schedpol-test.om > build/node/schedpol-composed.om +cmp build/node/schedpol-composed.om seed/node/schedpol-gate.om +seed/out/omc < seed/node/schedpol-gate.om > build/node/schedpol-gate +chmod +x build/node/schedpol-gate +timeout 120 build/node/schedpol-gate # DRA-395: exit 11, the blocked head +``` + +### Reference pump and ownership + +aien-dev/aien-sovereign-core-mv at `dffdbd195edcbe1ec3bd2fa255355b15c530f31e`, +`crates/spark-harness/src/scheduler/core.rs` (blob `32c3f431b58c`) `Core::pump` +fills a bounded ready queue in task-id order (lines 584-596), then dispatches +from its head while `PermitPool::try_acquire` succeeds (598-602); the first +head that does not fit ends the pump. A request over the limits is refused at +registration (`ExceedsCapacity`, 654-655 with `permits.rs` 51-54). + +That pump is reference-only, not deployed and not yet superseded: +- `scheduler/mod.rs` (blob `001db62c4f4a`) says it is opt-in (`ProvisionalConfig::enabled` false by default) and that no spark-harness API or MCP tool uses it. +- Its only consumer in that repository is the optional `aien-runtime` feature `provisional-prep` and that crate's tests. +- The installed `~/.local/bin/spark-harness` on the Spark (sha256 `9fe2941155ca…`, built 2026-09-18) offers `test`, `mcp`, `validate` and `eval` and contains no provisional-scheduler code; no spark-harness process runs. + +`sched.om` becomes the forward owner when this stack merges and DRA-292 +deploys it. Until then neither scheduler dispatches live hive work. + +Call graph of the Omega side (one creator calls everything): + +| Entry | Callers | +| --- | --- | +| `sched_dispatch` | `sched_step` (`code.om` `cw_drive`, tests), `sched_publish` (`code.om` `cw_issue`), `sched_pause` (`auth_pause`) | +| `sched_admit`, `sched_admitr` | `jn_admit` (`journal.om`, from `cw_issue`), the readmission in `jn_recover` | +| `sched_collect`, `sched_lost` | `sched_step`, `sched_stop` | +| `sched_cancel`, `sched_review` | `auth_cancel`, `jn_release` | +| `sched_wjob`, `sched_wdone` | the worker loops (`code.om` `cw_worker`, `cw_job`) | + +The coding workflow keeps one inference in flight itself (`cw_plan`), always +starting with the lowest-numbered objective that needs a turn, above the +scheduler, which sees every job as one worker and no resource. + +### Resources and policy 0 + +A request is one ulong of four 16-bit counts: kind 0 CPU slots, 1 memory MiB, +2 inference slots, 3 caller-defined. Capacities default to 65535 of each, so +callers that declare nothing (`sched_admit`) always pass their own fit check +and are never refused for resources; under policy 0 they can still wait +behind a resource-blocked head. A job takes its whole need when it is +assigned and gives it back when its worker reports done (even while its +result waits for review room) or is reaped. Every job also needs one idle +live worker. A capacity is never set below the current use or below one +admitted job's need. + +One behaviour changes for every caller: DRA-287 assigned ready jobs in slot +order, which is an accident of which slot was free; selection now follows a +policy. Phase F below is the case that differs: a job admitted first into a +lower slot but made ready later by a publication used to be assigned first; +under policy 0 the job that became ready first is. No consumer in this +directory depends on slot order (the DRA-287, DRA-288, DRA-289 gates and the +DRA-290 unit checks pass unchanged). + +Policy 0 serves the ready job that became ready first, if it fits; when it +does not, nothing is assigned. That is the stop rule of the reference pump +(598-602): a head that does not fit holds back every later job. Its queue is +not reproduced. The pump batches newly eligible tasks in task-id order into +a queue of `queue_capacity`, so an eligible task can be left outside it +(scenario b of the Rust reproduction); here every admitted job is in the +table and ready order is the order of becoming ready. The bounded-queue +exclusion is therefore evidenced for Rust only. + +| Function | Contract | +| --- | --- | +| `sched_admitr id deps flags req` | `sched_admit` with a resource request; -8 when a kind exceeds its capacity (counted, never queued). | +| `sched_cap caps` | Set every capacity; -8 and no change when a kind would fall below its use or below one admitted job's need. | +| `sched_policy p win db by` | Policy (0 only, for now), candidate window 1..64 slots, dispatch budget 1..64 per event, bypass budget 1..65535; -7 out of range. | +| `sched_stat i` | Counters 0..15, capacity 16..19, use 20..23, policy words 24..29. | + +Admission order (`sjarr`) and ready order (`sjrdy`) are logical counters, so +selection never reads the clock. + +### Regression and controls + +`schedpol-test.om` checks after every creator step that each kind's use is at +most its capacity and equals the needs of the running jobs that hold it, and +that every running job whose worker has not reported done holds its need. + +| Phase | Scenario | Exit when it fails | +| --- | --- | --- | +| C | requests over CPU, memory or inference capacity refused (-8) and counted; lowering a capacity below an admitted need, or below the use of two running jobs that each fit it alone, refused with nothing changed | 30..41, 130..134 | +| D | 12 jobs with mixed needs on 3 workers, capacity 4 CPU, 1024 MiB, 1 inference: each runs once, all resources free at the end | 42..48 | +| V | review limit 1: both 1-CPU jobs finish, one result waits for review room, yet both CPUs are free and a 2-CPU job runs | 120..126 | +| F | ready order: a job made ready by a later publication is served after one ready earlier | 50..57 | +| A | blocked head: a (3 CPU) runs, b (2 CPU) cannot fit, c (1 CPU) fits | 11 with the witness line | +| B | a second head-of-line case after the pump's queue-of-two scenario: a runs, b and d (2 CPU) wait, e (1 CPU) fits | 21 with the witness line | + +A and B do not fail on a timeout alone. When the fitting job has not run +within 400 ms, the test checks, with no step in between, that a is running +and unfinished and holds its need, that the head is ready and does not fit, +that the job behind it is ready and fits, that a live worker is idle and that +dispatch stopped at the head; then it prints the witness and the phase +returns 11 (21). Both phases always run; the first failure is the exit. +At DRA-395 the gate passes C, D, V and F and exits 11: + +``` +schedpol hol witness head=20050 fits_behind=30050 free_cpu=1 idle_worker=1 hol_stops=40 +schedpol hol witness head=20050 fits_behind=50050 free_cpu=1 idle_worker=1 hol_stops=40 +``` + +This is the block the Rust pump shows; its reproduction (test source, +command, output) is kept in `evidence/node-schedpol/rust-reference.*.json`. + +| Change to `sched.om` | Expected exit | +| --- | --- | +| `if not sp_feas req` to `if false` (impossible requests admitted) | 31 | +| the `lt sp_need caps k get suse k` check of `sched_cap` made `if false` (capacity below use accepted) | 131 | +| `sp_take j` deleted from `sp_start` (running jobs hold nothing) | 130 | +| `sp_give j` deleted from `sched_collect` (resources never returned) | 133 | +| `sp_give j` moved after the review-room check in `sched_collect` (release waits for review) | 122 | +| `if gt sp_need req k a` to `if false` in `sp_fits` (capacity ignored) | 44 | +| `sp_ready j` in `sched_publish` to `put sjst j 2` (ready order not stamped) | 54 | ## Proposals, authority and cancellation (DRA-288) diff --git a/seed/node/auth-gate.om b/seed/node/auth-gate.om index d410104de..b950adf40 100644 --- a/seed/node/auth-gate.om +++ b/seed/node/auth-gate.om @@ -938,7 +938,19 @@ note before its done seq. Each word has one writer; the creator writes a note worker word only after it has reaped that worker. note Job states: 0 free, 1 waiting for deps, 2 ready, 3 running, 4 in review, note 6 UNKNOWN (its worker died mid-job and the job is not safe to rerun). +note +note Resources and selection policy (P-DRA-14, DRA-395). A request is one +note ulong of four 16-bit counts, kind k at bits 16k..16k+15: kind 0 CPU +note slots, 1 memory MiB, 2 inference slots, 3 caller-defined. scap holds +note the configured capacity of each kind, suse the sum of the needs of the +note jobs that hold resources (sjheld 1). A job takes its whole need when it +note is assigned and gives it back when its worker reports done or is reaped, +note never in part. Every job also needs one idle live worker. +note sjarr: admission order (waiting age; kept across reruns). sjrdy: order +note in which the job last became ready. sjbyp: times it was bypassed. +note Decisions read only these logical counters, never the clock. const SJCAP ulong 64 +const SPVER ulong 1 global scmap long 2 global sclim ulong 2 global sjst ulong 64 @@ -948,10 +960,26 @@ global sjw ulong 64 global sjatt ulong 64 global sjfl ulong 64 global sjout ulong 64 +global sjneed ulong 64 +global sjheld ulong 64 +global sjarr ulong 64 +global sjrdy ulong 64 +global sjbyp ulong 64 global scbusy ulong 64 global scseq ulong 64 global swcur ulong 2 global scpause ulong 1 +global scap ulong 4 +global suse ulong 4 +note Policy words: 0 policy (0 FIFO head-of-line), 1 candidate window in +note slots, 2 dispatch budget per event, 3 bypass budget, 4 cursor, +note 5 reserved job slot + 1 (0 none). +global scpol ulong 8 +note Counters (sched_stat): 0 admissions, 1 ready stamps, 2 dispatch events, +note 3 slots examined, 4 jobs assigned, 5 bypasses, 6 reservations made, +note 7 impossible requests refused, 8 head-of-line stops, 9 reserved jobs +note assigned. +global scst ulong 16 fn sc_cell w ulong off ulong to ulong ret mapget get scmap 0 add mul w 128 off 8 @@ -989,13 +1017,160 @@ put sclim 0 a put sclim 1 rl for j ulong 64 put sjst j 0 +put sjheld j 0 put scbusy j 0 put scseq j 0 end +for k ulong 4 +put scap k 65535 +put suse k 0 +end +for i ulong 16 +put scst i 0 +end +put scpol 0 0 +put scpol 1 64 +put scpol 2 64 +put scpol 3 4 +put scpol 4 0 +put scpol 5 0 put scpause 0 0 ret 0 end +note Count of kind k (0..3) in packed request req. +fn sp_need req ulong k ulong to ulong +ret and shr req mul k 16 65535 +end + +note Free capacity of kind k. sched_cap never sets a capacity below the +note use, so this cannot underflow. +fn sp_free k ulong to ulong +ret sub get scap k get suse k +end + +note Does req fit in the free capacity once the reserved request res has +note what it still lacks? Of each kind, res keeps min(free, its need); res 0 +note is no reservation. This keeps the reserved job's attainable capacity +note from ever shrinking (the drain). +fn sp_fits req ulong res ulong to bool +for k ulong 4 +f = sp_free k +r = sp_need res k +a = ulong 0 +if gt f r +a = sub f r +end +if gt sp_need req k a +ret false +end +end +ret true +end + +note Could req ever run, with the configured capacity all free? +fn sp_feas req ulong to bool +for k ulong 4 +if gt sp_need req k get scap k +ret false +end +end +ret true +end + +note Job j takes its whole need. +fn sp_take j ulong to void +for k ulong 4 +put suse k add get suse k sp_need get sjneed j k +end +put sjheld j 1 +end + +note Job j gives back its need, if it holds it. +fn sp_give j ulong to void +if eq get sjheld j 0 +ret +end +for k ulong 4 +put suse k sub get suse k sp_need get sjneed j k +end +put sjheld j 0 +end + +note Job j becomes ready, stamped with the next ready order. +fn sp_ready j ulong to void +put sjst j 2 +put sjrdy j get scst 1 +put scst 1 add get scst 1 1 +end + +note Creator: counter i of scst, capacity (i 16..19) or use (i 20..23) of a +note kind, or policy word (i 24..29). +fn sched_stat i ulong to ulong +if lt i 16 +ret get scst i +end +if lt i 20 +ret get scap sub i 16 +end +if lt i 24 +ret get suse sub i 20 +end +if lt i 30 +ret get scpol sub i 24 +end +ret 0 +end + +note Creator: set the capacity of every kind from caps (packed like a +note request). 0, or -8 when the new capacity of a kind is below its use by +note running jobs, or below the need of any one admitted job (nothing +note changes). +fn sched_cap caps ulong to long +for k ulong 4 +if lt sp_need caps k get suse k +ret neg long 8 +end +end +for j ulong 64 +s = get sjst j +if and ge s 1 le s 3 +for k ulong 4 +if gt sp_need get sjneed j k sp_need caps k +ret neg long 8 +end +end +end +end +for k ulong 4 +put scap k sp_need caps k +end +ret 0 +end + +note Creator: policy p (0 FIFO head-of-line), candidate window win slots +note (1..64), dispatch budget db jobs per event (1..64), bypass budget by +note (1..65535). The cursor and any reservation are kept. 0 or -7. +fn sched_policy p ulong win ulong db ulong by ulong to long +if gt p 0 +ret neg long 7 +end +if or eq win 0 gt win 64 +ret neg long 7 +end +if or eq db 0 gt db 64 +ret neg long 7 +end +if or eq by 0 gt by 65535 +ret neg long 7 +end +put scpol 0 p +put scpol 1 win +put scpol 2 db +put scpol 3 by +ret 0 +end + note Creator: drop this process's scheduling mappings. fn sched_free to long r = mapdrop get scmap 1 @@ -1017,11 +1192,17 @@ end ret n end -note Creator: admit job id. deps 0 makes it ready at once; otherwise it waits -note for a publication whose topics meet deps. flags bit 0: safe to rerun -note after its worker dies. Returns the job slot, or -2 when admitted work -note (waiting, ready, running) is at its limit: refused, not queued. -fn sched_admit id ulong deps ulong flags ulong to long +note Creator: admit job id needing req (packed resources). deps 0 makes it +note ready at once; otherwise it waits for a publication whose topics meet +note deps. flags bit 0: safe to rerun after its worker dies. Returns the job +note slot; -8 when req exceeds the configured capacity of a kind (it could +note never run); -2 when admitted work (waiting, ready, running) is at its +note limit: refused, not queued. +fn sched_admitr id ulong deps ulong flags ulong req ulong to long +if not sp_feas req +put scst 7 add get scst 7 1 +ret neg long 8 +end if ge sched_count 1 3 get sclim 0 ret neg long 2 end @@ -1033,8 +1214,13 @@ put sjfl j flags put sjatt j 0 put sjout j 0 put sjw j 0 +put sjneed j req +put sjheld j 0 +put sjbyp j 0 +put sjarr j get scst 0 +put scst 0 add get scst 0 1 if eq deps 0 -put sjst j 2 +sp_ready j else put sjst j 1 end @@ -1044,6 +1230,11 @@ end ret neg long 2 end +note Creator: sched_admitr with no resource need beyond one worker. +fn sched_admit id ulong deps ulong flags ulong to long +ret sched_admitr id deps flags 0 +end + note Creator: worker w is woken by publications whose topics meet topics. fn sched_want w ulong topics ulong to long if ge w 64 @@ -1058,43 +1249,100 @@ sc_set w 40 ulong monons r = sup_wake w end -note Creator: give ready jobs to idle live workers, lowest slot first. A -note worker is idle when the creator has collected its last assignment. -note The job id and the input epoch and version are written before the seq. -note Returns the number assigned. -fn sched_dispatch c long to ulong -if ne get scpause 0 0 -ret 0 -end -n = mapget c 48 8 -k = ulong 0 -for j ulong 64 -if eq get sjst j 2 +note Lowest idle live worker below n, or 64 when none. A worker is idle when +note the creator has collected its last assignment. +fn sp_idle n ulong to ulong for w ulong n bound 64 if and gt get swpid w 0 eq get scbusy w 0 +ret w +end +end +ret 64 +end + +note Assign job j to idle worker w: it takes its need; the job id and the +note input epoch and version are written before the seq, then the wake. +fn sp_start c long j ulong w ulong to void q = add get scseq w 1 put scseq w q put scbusy w add j 1 put sjst j 3 put sjw j w put sjatt j add get sjatt j 1 +put sjbyp j 0 +sp_take j +if eq get scpol 5 add j 1 +put scpol 5 0 +put scst 9 add get scst 9 1 +end sc_set w 8 get sjid j sc_set w 16 pool_epoch c sc_set w 24 node_count pool_current c sc_set w 0 q sc_wake w -k = add k 1 -break +put scst 4 add get scst 4 1 +end + +note Policy 0, FIFO head-of-line: the stop rule of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump, +note 598-602), not its queue: the head here is the ready job that became +note ready first (the pump batches newly eligible tasks in task-id order +note into a bounded queue). The head is chosen when it fits, and when it +note does not fit nothing is chosen, so a head that does +note not fit holds back every later job. Returns the slot or 64. +fn sp_fifo to ulong +h = ulong 64 +for j ulong 64 +if eq get sjst j 2 +if eq h 64 +h = j +else +if lt get sjrdy j get sjrdy h +h = j +end +end +end +end +put scst 3 add get scst 3 64 +if eq h 64 +ret 64 +end +if sp_fits get sjneed h 0 +ret h +end +put scst 8 add get scst 8 1 +ret 64 +end + +note Creator: assign ready jobs to idle live workers under the policy, at +note most the dispatch budget per call. Returns the number assigned. +fn sched_dispatch c long to ulong +if ne get scpause 0 0 +ret 0 end +n = mapget c 48 8 +k = ulong 0 +put scst 2 add get scst 2 1 +for i ulong get scpol 2 bound 64 +w = sp_idle n +if ge w 64 +break end +j = sp_fifo +if ge j 64 +break end +sp_start c j w +k = add k 1 end ret k end note Creator: move finished jobs into review while review has room. A worker note whose result is waiting for room keeps it and gets no new job, so a -note full review queue stops assignment instead of dropping work. +note full review queue stops assignment instead of dropping work. A job +note gives back its resources as soon as its worker reported done, even +note while its result waits for room. fn sched_collect c long to ulong n = mapget c 48 8 k = ulong 0 @@ -1102,10 +1350,11 @@ for w ulong n bound 64 b = get scbusy w if gt b 0 if eq sc_cell w 64 get scseq w +j = sub b 1 +sp_give j if ge sched_count 4 4 get sclim 1 -ret k +continue end -j = sub b 1 put sjst j 4 put sjout j sc_cell w 72 put scbusy w 0 @@ -1137,8 +1386,9 @@ end j = sub b 1 sc_set w 64 get scseq w put scbusy w 0 +sp_give j if ne and get sjfl j 1 0 -put sjst j 2 +sp_ready j else put sjst j 6 end @@ -1177,7 +1427,7 @@ end for j ulong 64 if eq get sjst j 1 if ne and get sjdep j topics 0 -put sjst j 2 +sp_ready j end end end diff --git a/seed/node/journal-gate.om b/seed/node/journal-gate.om index 5b0751639..25cad1073 100644 --- a/seed/node/journal-gate.om +++ b/seed/node/journal-gate.om @@ -938,7 +938,19 @@ note before its done seq. Each word has one writer; the creator writes a note worker word only after it has reaped that worker. note Job states: 0 free, 1 waiting for deps, 2 ready, 3 running, 4 in review, note 6 UNKNOWN (its worker died mid-job and the job is not safe to rerun). +note +note Resources and selection policy (P-DRA-14, DRA-395). A request is one +note ulong of four 16-bit counts, kind k at bits 16k..16k+15: kind 0 CPU +note slots, 1 memory MiB, 2 inference slots, 3 caller-defined. scap holds +note the configured capacity of each kind, suse the sum of the needs of the +note jobs that hold resources (sjheld 1). A job takes its whole need when it +note is assigned and gives it back when its worker reports done or is reaped, +note never in part. Every job also needs one idle live worker. +note sjarr: admission order (waiting age; kept across reruns). sjrdy: order +note in which the job last became ready. sjbyp: times it was bypassed. +note Decisions read only these logical counters, never the clock. const SJCAP ulong 64 +const SPVER ulong 1 global scmap long 2 global sclim ulong 2 global sjst ulong 64 @@ -948,10 +960,26 @@ global sjw ulong 64 global sjatt ulong 64 global sjfl ulong 64 global sjout ulong 64 +global sjneed ulong 64 +global sjheld ulong 64 +global sjarr ulong 64 +global sjrdy ulong 64 +global sjbyp ulong 64 global scbusy ulong 64 global scseq ulong 64 global swcur ulong 2 global scpause ulong 1 +global scap ulong 4 +global suse ulong 4 +note Policy words: 0 policy (0 FIFO head-of-line), 1 candidate window in +note slots, 2 dispatch budget per event, 3 bypass budget, 4 cursor, +note 5 reserved job slot + 1 (0 none). +global scpol ulong 8 +note Counters (sched_stat): 0 admissions, 1 ready stamps, 2 dispatch events, +note 3 slots examined, 4 jobs assigned, 5 bypasses, 6 reservations made, +note 7 impossible requests refused, 8 head-of-line stops, 9 reserved jobs +note assigned. +global scst ulong 16 fn sc_cell w ulong off ulong to ulong ret mapget get scmap 0 add mul w 128 off 8 @@ -989,13 +1017,160 @@ put sclim 0 a put sclim 1 rl for j ulong 64 put sjst j 0 +put sjheld j 0 put scbusy j 0 put scseq j 0 end +for k ulong 4 +put scap k 65535 +put suse k 0 +end +for i ulong 16 +put scst i 0 +end +put scpol 0 0 +put scpol 1 64 +put scpol 2 64 +put scpol 3 4 +put scpol 4 0 +put scpol 5 0 put scpause 0 0 ret 0 end +note Count of kind k (0..3) in packed request req. +fn sp_need req ulong k ulong to ulong +ret and shr req mul k 16 65535 +end + +note Free capacity of kind k. sched_cap never sets a capacity below the +note use, so this cannot underflow. +fn sp_free k ulong to ulong +ret sub get scap k get suse k +end + +note Does req fit in the free capacity once the reserved request res has +note what it still lacks? Of each kind, res keeps min(free, its need); res 0 +note is no reservation. This keeps the reserved job's attainable capacity +note from ever shrinking (the drain). +fn sp_fits req ulong res ulong to bool +for k ulong 4 +f = sp_free k +r = sp_need res k +a = ulong 0 +if gt f r +a = sub f r +end +if gt sp_need req k a +ret false +end +end +ret true +end + +note Could req ever run, with the configured capacity all free? +fn sp_feas req ulong to bool +for k ulong 4 +if gt sp_need req k get scap k +ret false +end +end +ret true +end + +note Job j takes its whole need. +fn sp_take j ulong to void +for k ulong 4 +put suse k add get suse k sp_need get sjneed j k +end +put sjheld j 1 +end + +note Job j gives back its need, if it holds it. +fn sp_give j ulong to void +if eq get sjheld j 0 +ret +end +for k ulong 4 +put suse k sub get suse k sp_need get sjneed j k +end +put sjheld j 0 +end + +note Job j becomes ready, stamped with the next ready order. +fn sp_ready j ulong to void +put sjst j 2 +put sjrdy j get scst 1 +put scst 1 add get scst 1 1 +end + +note Creator: counter i of scst, capacity (i 16..19) or use (i 20..23) of a +note kind, or policy word (i 24..29). +fn sched_stat i ulong to ulong +if lt i 16 +ret get scst i +end +if lt i 20 +ret get scap sub i 16 +end +if lt i 24 +ret get suse sub i 20 +end +if lt i 30 +ret get scpol sub i 24 +end +ret 0 +end + +note Creator: set the capacity of every kind from caps (packed like a +note request). 0, or -8 when the new capacity of a kind is below its use by +note running jobs, or below the need of any one admitted job (nothing +note changes). +fn sched_cap caps ulong to long +for k ulong 4 +if lt sp_need caps k get suse k +ret neg long 8 +end +end +for j ulong 64 +s = get sjst j +if and ge s 1 le s 3 +for k ulong 4 +if gt sp_need get sjneed j k sp_need caps k +ret neg long 8 +end +end +end +end +for k ulong 4 +put scap k sp_need caps k +end +ret 0 +end + +note Creator: policy p (0 FIFO head-of-line), candidate window win slots +note (1..64), dispatch budget db jobs per event (1..64), bypass budget by +note (1..65535). The cursor and any reservation are kept. 0 or -7. +fn sched_policy p ulong win ulong db ulong by ulong to long +if gt p 0 +ret neg long 7 +end +if or eq win 0 gt win 64 +ret neg long 7 +end +if or eq db 0 gt db 64 +ret neg long 7 +end +if or eq by 0 gt by 65535 +ret neg long 7 +end +put scpol 0 p +put scpol 1 win +put scpol 2 db +put scpol 3 by +ret 0 +end + note Creator: drop this process's scheduling mappings. fn sched_free to long r = mapdrop get scmap 1 @@ -1017,11 +1192,17 @@ end ret n end -note Creator: admit job id. deps 0 makes it ready at once; otherwise it waits -note for a publication whose topics meet deps. flags bit 0: safe to rerun -note after its worker dies. Returns the job slot, or -2 when admitted work -note (waiting, ready, running) is at its limit: refused, not queued. -fn sched_admit id ulong deps ulong flags ulong to long +note Creator: admit job id needing req (packed resources). deps 0 makes it +note ready at once; otherwise it waits for a publication whose topics meet +note deps. flags bit 0: safe to rerun after its worker dies. Returns the job +note slot; -8 when req exceeds the configured capacity of a kind (it could +note never run); -2 when admitted work (waiting, ready, running) is at its +note limit: refused, not queued. +fn sched_admitr id ulong deps ulong flags ulong req ulong to long +if not sp_feas req +put scst 7 add get scst 7 1 +ret neg long 8 +end if ge sched_count 1 3 get sclim 0 ret neg long 2 end @@ -1033,8 +1214,13 @@ put sjfl j flags put sjatt j 0 put sjout j 0 put sjw j 0 +put sjneed j req +put sjheld j 0 +put sjbyp j 0 +put sjarr j get scst 0 +put scst 0 add get scst 0 1 if eq deps 0 -put sjst j 2 +sp_ready j else put sjst j 1 end @@ -1044,6 +1230,11 @@ end ret neg long 2 end +note Creator: sched_admitr with no resource need beyond one worker. +fn sched_admit id ulong deps ulong flags ulong to long +ret sched_admitr id deps flags 0 +end + note Creator: worker w is woken by publications whose topics meet topics. fn sched_want w ulong topics ulong to long if ge w 64 @@ -1058,43 +1249,100 @@ sc_set w 40 ulong monons r = sup_wake w end -note Creator: give ready jobs to idle live workers, lowest slot first. A -note worker is idle when the creator has collected its last assignment. -note The job id and the input epoch and version are written before the seq. -note Returns the number assigned. -fn sched_dispatch c long to ulong -if ne get scpause 0 0 -ret 0 -end -n = mapget c 48 8 -k = ulong 0 -for j ulong 64 -if eq get sjst j 2 +note Lowest idle live worker below n, or 64 when none. A worker is idle when +note the creator has collected its last assignment. +fn sp_idle n ulong to ulong for w ulong n bound 64 if and gt get swpid w 0 eq get scbusy w 0 +ret w +end +end +ret 64 +end + +note Assign job j to idle worker w: it takes its need; the job id and the +note input epoch and version are written before the seq, then the wake. +fn sp_start c long j ulong w ulong to void q = add get scseq w 1 put scseq w q put scbusy w add j 1 put sjst j 3 put sjw j w put sjatt j add get sjatt j 1 +put sjbyp j 0 +sp_take j +if eq get scpol 5 add j 1 +put scpol 5 0 +put scst 9 add get scst 9 1 +end sc_set w 8 get sjid j sc_set w 16 pool_epoch c sc_set w 24 node_count pool_current c sc_set w 0 q sc_wake w -k = add k 1 -break +put scst 4 add get scst 4 1 +end + +note Policy 0, FIFO head-of-line: the stop rule of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump, +note 598-602), not its queue: the head here is the ready job that became +note ready first (the pump batches newly eligible tasks in task-id order +note into a bounded queue). The head is chosen when it fits, and when it +note does not fit nothing is chosen, so a head that does +note not fit holds back every later job. Returns the slot or 64. +fn sp_fifo to ulong +h = ulong 64 +for j ulong 64 +if eq get sjst j 2 +if eq h 64 +h = j +else +if lt get sjrdy j get sjrdy h +h = j +end +end +end +end +put scst 3 add get scst 3 64 +if eq h 64 +ret 64 +end +if sp_fits get sjneed h 0 +ret h +end +put scst 8 add get scst 8 1 +ret 64 +end + +note Creator: assign ready jobs to idle live workers under the policy, at +note most the dispatch budget per call. Returns the number assigned. +fn sched_dispatch c long to ulong +if ne get scpause 0 0 +ret 0 end +n = mapget c 48 8 +k = ulong 0 +put scst 2 add get scst 2 1 +for i ulong get scpol 2 bound 64 +w = sp_idle n +if ge w 64 +break end +j = sp_fifo +if ge j 64 +break end +sp_start c j w +k = add k 1 end ret k end note Creator: move finished jobs into review while review has room. A worker note whose result is waiting for room keeps it and gets no new job, so a -note full review queue stops assignment instead of dropping work. +note full review queue stops assignment instead of dropping work. A job +note gives back its resources as soon as its worker reported done, even +note while its result waits for room. fn sched_collect c long to ulong n = mapget c 48 8 k = ulong 0 @@ -1102,10 +1350,11 @@ for w ulong n bound 64 b = get scbusy w if gt b 0 if eq sc_cell w 64 get scseq w +j = sub b 1 +sp_give j if ge sched_count 4 4 get sclim 1 -ret k +continue end -j = sub b 1 put sjst j 4 put sjout j sc_cell w 72 put scbusy w 0 @@ -1137,8 +1386,9 @@ end j = sub b 1 sc_set w 64 get scseq w put scbusy w 0 +sp_give j if ne and get sjfl j 1 0 -put sjst j 2 +sp_ready j else put sjst j 6 end @@ -1177,7 +1427,7 @@ end for j ulong 64 if eq get sjst j 1 if ne and get sjdep j topics 0 -put sjst j 2 +sp_ready j end end end diff --git a/seed/node/sched-gate.om b/seed/node/sched-gate.om index 19309bdc2..4039ce563 100644 --- a/seed/node/sched-gate.om +++ b/seed/node/sched-gate.om @@ -938,7 +938,19 @@ note before its done seq. Each word has one writer; the creator writes a note worker word only after it has reaped that worker. note Job states: 0 free, 1 waiting for deps, 2 ready, 3 running, 4 in review, note 6 UNKNOWN (its worker died mid-job and the job is not safe to rerun). +note +note Resources and selection policy (P-DRA-14, DRA-395). A request is one +note ulong of four 16-bit counts, kind k at bits 16k..16k+15: kind 0 CPU +note slots, 1 memory MiB, 2 inference slots, 3 caller-defined. scap holds +note the configured capacity of each kind, suse the sum of the needs of the +note jobs that hold resources (sjheld 1). A job takes its whole need when it +note is assigned and gives it back when its worker reports done or is reaped, +note never in part. Every job also needs one idle live worker. +note sjarr: admission order (waiting age; kept across reruns). sjrdy: order +note in which the job last became ready. sjbyp: times it was bypassed. +note Decisions read only these logical counters, never the clock. const SJCAP ulong 64 +const SPVER ulong 1 global scmap long 2 global sclim ulong 2 global sjst ulong 64 @@ -948,10 +960,26 @@ global sjw ulong 64 global sjatt ulong 64 global sjfl ulong 64 global sjout ulong 64 +global sjneed ulong 64 +global sjheld ulong 64 +global sjarr ulong 64 +global sjrdy ulong 64 +global sjbyp ulong 64 global scbusy ulong 64 global scseq ulong 64 global swcur ulong 2 global scpause ulong 1 +global scap ulong 4 +global suse ulong 4 +note Policy words: 0 policy (0 FIFO head-of-line), 1 candidate window in +note slots, 2 dispatch budget per event, 3 bypass budget, 4 cursor, +note 5 reserved job slot + 1 (0 none). +global scpol ulong 8 +note Counters (sched_stat): 0 admissions, 1 ready stamps, 2 dispatch events, +note 3 slots examined, 4 jobs assigned, 5 bypasses, 6 reservations made, +note 7 impossible requests refused, 8 head-of-line stops, 9 reserved jobs +note assigned. +global scst ulong 16 fn sc_cell w ulong off ulong to ulong ret mapget get scmap 0 add mul w 128 off 8 @@ -989,13 +1017,160 @@ put sclim 0 a put sclim 1 rl for j ulong 64 put sjst j 0 +put sjheld j 0 put scbusy j 0 put scseq j 0 end +for k ulong 4 +put scap k 65535 +put suse k 0 +end +for i ulong 16 +put scst i 0 +end +put scpol 0 0 +put scpol 1 64 +put scpol 2 64 +put scpol 3 4 +put scpol 4 0 +put scpol 5 0 put scpause 0 0 ret 0 end +note Count of kind k (0..3) in packed request req. +fn sp_need req ulong k ulong to ulong +ret and shr req mul k 16 65535 +end + +note Free capacity of kind k. sched_cap never sets a capacity below the +note use, so this cannot underflow. +fn sp_free k ulong to ulong +ret sub get scap k get suse k +end + +note Does req fit in the free capacity once the reserved request res has +note what it still lacks? Of each kind, res keeps min(free, its need); res 0 +note is no reservation. This keeps the reserved job's attainable capacity +note from ever shrinking (the drain). +fn sp_fits req ulong res ulong to bool +for k ulong 4 +f = sp_free k +r = sp_need res k +a = ulong 0 +if gt f r +a = sub f r +end +if gt sp_need req k a +ret false +end +end +ret true +end + +note Could req ever run, with the configured capacity all free? +fn sp_feas req ulong to bool +for k ulong 4 +if gt sp_need req k get scap k +ret false +end +end +ret true +end + +note Job j takes its whole need. +fn sp_take j ulong to void +for k ulong 4 +put suse k add get suse k sp_need get sjneed j k +end +put sjheld j 1 +end + +note Job j gives back its need, if it holds it. +fn sp_give j ulong to void +if eq get sjheld j 0 +ret +end +for k ulong 4 +put suse k sub get suse k sp_need get sjneed j k +end +put sjheld j 0 +end + +note Job j becomes ready, stamped with the next ready order. +fn sp_ready j ulong to void +put sjst j 2 +put sjrdy j get scst 1 +put scst 1 add get scst 1 1 +end + +note Creator: counter i of scst, capacity (i 16..19) or use (i 20..23) of a +note kind, or policy word (i 24..29). +fn sched_stat i ulong to ulong +if lt i 16 +ret get scst i +end +if lt i 20 +ret get scap sub i 16 +end +if lt i 24 +ret get suse sub i 20 +end +if lt i 30 +ret get scpol sub i 24 +end +ret 0 +end + +note Creator: set the capacity of every kind from caps (packed like a +note request). 0, or -8 when the new capacity of a kind is below its use by +note running jobs, or below the need of any one admitted job (nothing +note changes). +fn sched_cap caps ulong to long +for k ulong 4 +if lt sp_need caps k get suse k +ret neg long 8 +end +end +for j ulong 64 +s = get sjst j +if and ge s 1 le s 3 +for k ulong 4 +if gt sp_need get sjneed j k sp_need caps k +ret neg long 8 +end +end +end +end +for k ulong 4 +put scap k sp_need caps k +end +ret 0 +end + +note Creator: policy p (0 FIFO head-of-line), candidate window win slots +note (1..64), dispatch budget db jobs per event (1..64), bypass budget by +note (1..65535). The cursor and any reservation are kept. 0 or -7. +fn sched_policy p ulong win ulong db ulong by ulong to long +if gt p 0 +ret neg long 7 +end +if or eq win 0 gt win 64 +ret neg long 7 +end +if or eq db 0 gt db 64 +ret neg long 7 +end +if or eq by 0 gt by 65535 +ret neg long 7 +end +put scpol 0 p +put scpol 1 win +put scpol 2 db +put scpol 3 by +ret 0 +end + note Creator: drop this process's scheduling mappings. fn sched_free to long r = mapdrop get scmap 1 @@ -1017,11 +1192,17 @@ end ret n end -note Creator: admit job id. deps 0 makes it ready at once; otherwise it waits -note for a publication whose topics meet deps. flags bit 0: safe to rerun -note after its worker dies. Returns the job slot, or -2 when admitted work -note (waiting, ready, running) is at its limit: refused, not queued. -fn sched_admit id ulong deps ulong flags ulong to long +note Creator: admit job id needing req (packed resources). deps 0 makes it +note ready at once; otherwise it waits for a publication whose topics meet +note deps. flags bit 0: safe to rerun after its worker dies. Returns the job +note slot; -8 when req exceeds the configured capacity of a kind (it could +note never run); -2 when admitted work (waiting, ready, running) is at its +note limit: refused, not queued. +fn sched_admitr id ulong deps ulong flags ulong req ulong to long +if not sp_feas req +put scst 7 add get scst 7 1 +ret neg long 8 +end if ge sched_count 1 3 get sclim 0 ret neg long 2 end @@ -1033,8 +1214,13 @@ put sjfl j flags put sjatt j 0 put sjout j 0 put sjw j 0 +put sjneed j req +put sjheld j 0 +put sjbyp j 0 +put sjarr j get scst 0 +put scst 0 add get scst 0 1 if eq deps 0 -put sjst j 2 +sp_ready j else put sjst j 1 end @@ -1044,6 +1230,11 @@ end ret neg long 2 end +note Creator: sched_admitr with no resource need beyond one worker. +fn sched_admit id ulong deps ulong flags ulong to long +ret sched_admitr id deps flags 0 +end + note Creator: worker w is woken by publications whose topics meet topics. fn sched_want w ulong topics ulong to long if ge w 64 @@ -1058,43 +1249,100 @@ sc_set w 40 ulong monons r = sup_wake w end -note Creator: give ready jobs to idle live workers, lowest slot first. A -note worker is idle when the creator has collected its last assignment. -note The job id and the input epoch and version are written before the seq. -note Returns the number assigned. -fn sched_dispatch c long to ulong -if ne get scpause 0 0 -ret 0 -end -n = mapget c 48 8 -k = ulong 0 -for j ulong 64 -if eq get sjst j 2 +note Lowest idle live worker below n, or 64 when none. A worker is idle when +note the creator has collected its last assignment. +fn sp_idle n ulong to ulong for w ulong n bound 64 if and gt get swpid w 0 eq get scbusy w 0 +ret w +end +end +ret 64 +end + +note Assign job j to idle worker w: it takes its need; the job id and the +note input epoch and version are written before the seq, then the wake. +fn sp_start c long j ulong w ulong to void q = add get scseq w 1 put scseq w q put scbusy w add j 1 put sjst j 3 put sjw j w put sjatt j add get sjatt j 1 +put sjbyp j 0 +sp_take j +if eq get scpol 5 add j 1 +put scpol 5 0 +put scst 9 add get scst 9 1 +end sc_set w 8 get sjid j sc_set w 16 pool_epoch c sc_set w 24 node_count pool_current c sc_set w 0 q sc_wake w -k = add k 1 -break +put scst 4 add get scst 4 1 +end + +note Policy 0, FIFO head-of-line: the stop rule of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump, +note 598-602), not its queue: the head here is the ready job that became +note ready first (the pump batches newly eligible tasks in task-id order +note into a bounded queue). The head is chosen when it fits, and when it +note does not fit nothing is chosen, so a head that does +note not fit holds back every later job. Returns the slot or 64. +fn sp_fifo to ulong +h = ulong 64 +for j ulong 64 +if eq get sjst j 2 +if eq h 64 +h = j +else +if lt get sjrdy j get sjrdy h +h = j +end +end end end +put scst 3 add get scst 3 64 +if eq h 64 +ret 64 +end +if sp_fits get sjneed h 0 +ret h +end +put scst 8 add get scst 8 1 +ret 64 end + +note Creator: assign ready jobs to idle live workers under the policy, at +note most the dispatch budget per call. Returns the number assigned. +fn sched_dispatch c long to ulong +if ne get scpause 0 0 +ret 0 +end +n = mapget c 48 8 +k = ulong 0 +put scst 2 add get scst 2 1 +for i ulong get scpol 2 bound 64 +w = sp_idle n +if ge w 64 +break +end +j = sp_fifo +if ge j 64 +break +end +sp_start c j w +k = add k 1 end ret k end note Creator: move finished jobs into review while review has room. A worker note whose result is waiting for room keeps it and gets no new job, so a -note full review queue stops assignment instead of dropping work. +note full review queue stops assignment instead of dropping work. A job +note gives back its resources as soon as its worker reported done, even +note while its result waits for room. fn sched_collect c long to ulong n = mapget c 48 8 k = ulong 0 @@ -1102,10 +1350,11 @@ for w ulong n bound 64 b = get scbusy w if gt b 0 if eq sc_cell w 64 get scseq w +j = sub b 1 +sp_give j if ge sched_count 4 4 get sclim 1 -ret k +continue end -j = sub b 1 put sjst j 4 put sjout j sc_cell w 72 put scbusy w 0 @@ -1137,8 +1386,9 @@ end j = sub b 1 sc_set w 64 get scseq w put scbusy w 0 +sp_give j if ne and get sjfl j 1 0 -put sjst j 2 +sp_ready j else put sjst j 6 end @@ -1177,7 +1427,7 @@ end for j ulong 64 if eq get sjst j 1 if ne and get sjdep j topics 0 -put sjst j 2 +sp_ready j end end end diff --git a/seed/node/sched.om b/seed/node/sched.om index 1e90ebb04..c3df18428 100644 --- a/seed/node/sched.om +++ b/seed/node/sched.om @@ -12,7 +12,19 @@ note before its done seq. Each word has one writer; the creator writes a note worker word only after it has reaped that worker. note Job states: 0 free, 1 waiting for deps, 2 ready, 3 running, 4 in review, note 6 UNKNOWN (its worker died mid-job and the job is not safe to rerun). +note +note Resources and selection policy (P-DRA-14, DRA-395). A request is one +note ulong of four 16-bit counts, kind k at bits 16k..16k+15: kind 0 CPU +note slots, 1 memory MiB, 2 inference slots, 3 caller-defined. scap holds +note the configured capacity of each kind, suse the sum of the needs of the +note jobs that hold resources (sjheld 1). A job takes its whole need when it +note is assigned and gives it back when its worker reports done or is reaped, +note never in part. Every job also needs one idle live worker. +note sjarr: admission order (waiting age; kept across reruns). sjrdy: order +note in which the job last became ready. sjbyp: times it was bypassed. +note Decisions read only these logical counters, never the clock. const SJCAP ulong 64 +const SPVER ulong 1 global scmap long 2 global sclim ulong 2 global sjst ulong 64 @@ -22,10 +34,26 @@ global sjw ulong 64 global sjatt ulong 64 global sjfl ulong 64 global sjout ulong 64 +global sjneed ulong 64 +global sjheld ulong 64 +global sjarr ulong 64 +global sjrdy ulong 64 +global sjbyp ulong 64 global scbusy ulong 64 global scseq ulong 64 global swcur ulong 2 global scpause ulong 1 +global scap ulong 4 +global suse ulong 4 +note Policy words: 0 policy (0 FIFO head-of-line), 1 candidate window in +note slots, 2 dispatch budget per event, 3 bypass budget, 4 cursor, +note 5 reserved job slot + 1 (0 none). +global scpol ulong 8 +note Counters (sched_stat): 0 admissions, 1 ready stamps, 2 dispatch events, +note 3 slots examined, 4 jobs assigned, 5 bypasses, 6 reservations made, +note 7 impossible requests refused, 8 head-of-line stops, 9 reserved jobs +note assigned. +global scst ulong 16 fn sc_cell w ulong off ulong to ulong ret mapget get scmap 0 add mul w 128 off 8 @@ -63,13 +91,160 @@ put sclim 0 a put sclim 1 rl for j ulong 64 put sjst j 0 +put sjheld j 0 put scbusy j 0 put scseq j 0 end +for k ulong 4 +put scap k 65535 +put suse k 0 +end +for i ulong 16 +put scst i 0 +end +put scpol 0 0 +put scpol 1 64 +put scpol 2 64 +put scpol 3 4 +put scpol 4 0 +put scpol 5 0 put scpause 0 0 ret 0 end +note Count of kind k (0..3) in packed request req. +fn sp_need req ulong k ulong to ulong +ret and shr req mul k 16 65535 +end + +note Free capacity of kind k. sched_cap never sets a capacity below the +note use, so this cannot underflow. +fn sp_free k ulong to ulong +ret sub get scap k get suse k +end + +note Does req fit in the free capacity once the reserved request res has +note what it still lacks? Of each kind, res keeps min(free, its need); res 0 +note is no reservation. This keeps the reserved job's attainable capacity +note from ever shrinking (the drain). +fn sp_fits req ulong res ulong to bool +for k ulong 4 +f = sp_free k +r = sp_need res k +a = ulong 0 +if gt f r +a = sub f r +end +if gt sp_need req k a +ret false +end +end +ret true +end + +note Could req ever run, with the configured capacity all free? +fn sp_feas req ulong to bool +for k ulong 4 +if gt sp_need req k get scap k +ret false +end +end +ret true +end + +note Job j takes its whole need. +fn sp_take j ulong to void +for k ulong 4 +put suse k add get suse k sp_need get sjneed j k +end +put sjheld j 1 +end + +note Job j gives back its need, if it holds it. +fn sp_give j ulong to void +if eq get sjheld j 0 +ret +end +for k ulong 4 +put suse k sub get suse k sp_need get sjneed j k +end +put sjheld j 0 +end + +note Job j becomes ready, stamped with the next ready order. +fn sp_ready j ulong to void +put sjst j 2 +put sjrdy j get scst 1 +put scst 1 add get scst 1 1 +end + +note Creator: counter i of scst, capacity (i 16..19) or use (i 20..23) of a +note kind, or policy word (i 24..29). +fn sched_stat i ulong to ulong +if lt i 16 +ret get scst i +end +if lt i 20 +ret get scap sub i 16 +end +if lt i 24 +ret get suse sub i 20 +end +if lt i 30 +ret get scpol sub i 24 +end +ret 0 +end + +note Creator: set the capacity of every kind from caps (packed like a +note request). 0, or -8 when the new capacity of a kind is below its use by +note running jobs, or below the need of any one admitted job (nothing +note changes). +fn sched_cap caps ulong to long +for k ulong 4 +if lt sp_need caps k get suse k +ret neg long 8 +end +end +for j ulong 64 +s = get sjst j +if and ge s 1 le s 3 +for k ulong 4 +if gt sp_need get sjneed j k sp_need caps k +ret neg long 8 +end +end +end +end +for k ulong 4 +put scap k sp_need caps k +end +ret 0 +end + +note Creator: policy p (0 FIFO head-of-line), candidate window win slots +note (1..64), dispatch budget db jobs per event (1..64), bypass budget by +note (1..65535). The cursor and any reservation are kept. 0 or -7. +fn sched_policy p ulong win ulong db ulong by ulong to long +if gt p 0 +ret neg long 7 +end +if or eq win 0 gt win 64 +ret neg long 7 +end +if or eq db 0 gt db 64 +ret neg long 7 +end +if or eq by 0 gt by 65535 +ret neg long 7 +end +put scpol 0 p +put scpol 1 win +put scpol 2 db +put scpol 3 by +ret 0 +end + note Creator: drop this process's scheduling mappings. fn sched_free to long r = mapdrop get scmap 1 @@ -91,11 +266,17 @@ end ret n end -note Creator: admit job id. deps 0 makes it ready at once; otherwise it waits -note for a publication whose topics meet deps. flags bit 0: safe to rerun -note after its worker dies. Returns the job slot, or -2 when admitted work -note (waiting, ready, running) is at its limit: refused, not queued. -fn sched_admit id ulong deps ulong flags ulong to long +note Creator: admit job id needing req (packed resources). deps 0 makes it +note ready at once; otherwise it waits for a publication whose topics meet +note deps. flags bit 0: safe to rerun after its worker dies. Returns the job +note slot; -8 when req exceeds the configured capacity of a kind (it could +note never run); -2 when admitted work (waiting, ready, running) is at its +note limit: refused, not queued. +fn sched_admitr id ulong deps ulong flags ulong req ulong to long +if not sp_feas req +put scst 7 add get scst 7 1 +ret neg long 8 +end if ge sched_count 1 3 get sclim 0 ret neg long 2 end @@ -107,8 +288,13 @@ put sjfl j flags put sjatt j 0 put sjout j 0 put sjw j 0 +put sjneed j req +put sjheld j 0 +put sjbyp j 0 +put sjarr j get scst 0 +put scst 0 add get scst 0 1 if eq deps 0 -put sjst j 2 +sp_ready j else put sjst j 1 end @@ -118,6 +304,11 @@ end ret neg long 2 end +note Creator: sched_admitr with no resource need beyond one worker. +fn sched_admit id ulong deps ulong flags ulong to long +ret sched_admitr id deps flags 0 +end + note Creator: worker w is woken by publications whose topics meet topics. fn sched_want w ulong topics ulong to long if ge w 64 @@ -132,43 +323,100 @@ sc_set w 40 ulong monons r = sup_wake w end -note Creator: give ready jobs to idle live workers, lowest slot first. A -note worker is idle when the creator has collected its last assignment. -note The job id and the input epoch and version are written before the seq. -note Returns the number assigned. -fn sched_dispatch c long to ulong -if ne get scpause 0 0 -ret 0 -end -n = mapget c 48 8 -k = ulong 0 -for j ulong 64 -if eq get sjst j 2 +note Lowest idle live worker below n, or 64 when none. A worker is idle when +note the creator has collected its last assignment. +fn sp_idle n ulong to ulong for w ulong n bound 64 if and gt get swpid w 0 eq get scbusy w 0 +ret w +end +end +ret 64 +end + +note Assign job j to idle worker w: it takes its need; the job id and the +note input epoch and version are written before the seq, then the wake. +fn sp_start c long j ulong w ulong to void q = add get scseq w 1 put scseq w q put scbusy w add j 1 put sjst j 3 put sjw j w put sjatt j add get sjatt j 1 +put sjbyp j 0 +sp_take j +if eq get scpol 5 add j 1 +put scpol 5 0 +put scst 9 add get scst 9 1 +end sc_set w 8 get sjid j sc_set w 16 pool_epoch c sc_set w 24 node_count pool_current c sc_set w 0 q sc_wake w -k = add k 1 -break +put scst 4 add get scst 4 1 +end + +note Policy 0, FIFO head-of-line: the stop rule of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump, +note 598-602), not its queue: the head here is the ready job that became +note ready first (the pump batches newly eligible tasks in task-id order +note into a bounded queue). The head is chosen when it fits, and when it +note does not fit nothing is chosen, so a head that does +note not fit holds back every later job. Returns the slot or 64. +fn sp_fifo to ulong +h = ulong 64 +for j ulong 64 +if eq get sjst j 2 +if eq h 64 +h = j +else +if lt get sjrdy j get sjrdy h +h = j +end +end +end +end +put scst 3 add get scst 3 64 +if eq h 64 +ret 64 +end +if sp_fits get sjneed h 0 +ret h +end +put scst 8 add get scst 8 1 +ret 64 +end + +note Creator: assign ready jobs to idle live workers under the policy, at +note most the dispatch budget per call. Returns the number assigned. +fn sched_dispatch c long to ulong +if ne get scpause 0 0 +ret 0 end +n = mapget c 48 8 +k = ulong 0 +put scst 2 add get scst 2 1 +for i ulong get scpol 2 bound 64 +w = sp_idle n +if ge w 64 +break end +j = sp_fifo +if ge j 64 +break end +sp_start c j w +k = add k 1 end ret k end note Creator: move finished jobs into review while review has room. A worker note whose result is waiting for room keeps it and gets no new job, so a -note full review queue stops assignment instead of dropping work. +note full review queue stops assignment instead of dropping work. A job +note gives back its resources as soon as its worker reported done, even +note while its result waits for room. fn sched_collect c long to ulong n = mapget c 48 8 k = ulong 0 @@ -176,10 +424,11 @@ for w ulong n bound 64 b = get scbusy w if gt b 0 if eq sc_cell w 64 get scseq w +j = sub b 1 +sp_give j if ge sched_count 4 4 get sclim 1 -ret k +continue end -j = sub b 1 put sjst j 4 put sjout j sc_cell w 72 put scbusy w 0 @@ -211,8 +460,9 @@ end j = sub b 1 sc_set w 64 get scseq w put scbusy w 0 +sp_give j if ne and get sjfl j 1 0 -put sjst j 2 +sp_ready j else put sjst j 6 end @@ -251,7 +501,7 @@ end for j ulong 64 if eq get sjst j 1 if ne and get sjdep j topics 0 -put sjst j 2 +sp_ready j end end end diff --git a/seed/node/schedpol-gate.om b/seed/node/schedpol-gate.om new file mode 100644 index 000000000..ef15476ba --- /dev/null +++ b/seed/node/schedpol-gate.om @@ -0,0 +1,2046 @@ +note Omega Node transport, concatenate with a program-mode consumer. +note Trusted forked processes only. This is transport, not write authority. +note One publisher PID, 64 immutable records per epoch; reuse only via node_reset. +note Layout: 4096 byte header then 64 slots of 4160 bytes. +note Header u64: magic, ABI, published count, stop, publisher PID, epoch. +note Slot u64: version, length, topic mask; payload begins at offset 64. +const NCAP ulong 64 +const NBYTES ulong 270336 +const NMAGIC ulong 1313817669 + +fn node_new to long +h = mapnew neg int 1 0 NBYTES 3 33 +if le h 0 +ret h +end +r = mapset h 8 8 1 +r = mapset h 32 8 ulong getpid +r = mapset h 0 8 NMAGIC +ret h +end + +fn node_valid h long to bool +ret and eq mapget h 0 8 NMAGIC eq mapget h 8 8 1 +end + +fn node_offset v ulong to ulong +ret add 4096 mul sub v 1 4160 +end + +note Return version, or -1 stopped, -2 full, -3 length, -4 topic, +note -5 invalid header, -6 wrong publisher. Refusals do not publish. +fn node_publish h long topics ulong src view uchar 4096 n ulong to long +if not node_valid h +ret neg long 5 +end +if ne mapget h 32 8 ulong getpid +ret neg long 6 +end +if ne mapget h 24 8 0 +ret neg long 1 +end +if gt n 4096 +ret neg long 3 +end +if eq topics 0 +ret neg long 4 +end +v = mapget h 16 8 +if gt v NCAP +ret neg long 5 +end +if eq v NCAP +ret neg long 2 +end +v = add v 1 +off = node_offset v +r = mapwrite h add off 64 src 0 n +r = mapset h add off 8 8 n +r = mapset h add off 16 8 topics +note mapset has barriers before and after its aligned store. +r = mapset h off 8 v +r = mapset h 16 8 v +ret long v +end + +note Header and record checks precede copying. No partial publication is read. +note Returns payload length, -5 invalid header/record, -7 unavailable version. +fn node_read h long v ulong dst edit uchar 4096 to long +if not node_valid h +ret neg long 5 +end +if or eq v 0 gt v NCAP +ret neg long 7 +end +latest = mapget h 16 8 +if gt latest NCAP +ret neg long 5 +end +if gt v latest +ret neg long 7 +end +off = node_offset v +if ne mapget h off 8 v +ret neg long 5 +end +n = mapget h add off 8 8 +if gt n 4096 +ret neg long 5 +end +ret mapread h add off 64 dst 0 n +end + +note Return the next matching version after cursor, zero if caught up, +note or negative refusal. Caller advances its cursor through returned versions. +fn node_next h long cursor ulong topics ulong to long +if not node_valid h +ret neg long 5 +end +if or gt cursor NCAP eq topics 0 +ret neg long 7 +end +latest = mapget h 16 8 +if or gt latest NCAP gt cursor latest +ret neg long 5 +end +v = cursor +note At most NCAP published slots can be examined. +while lt v latest bound 64 +v = add v 1 +off = node_offset v +if ne mapget h off 8 v +ret neg long 5 +end +if ne and mapget h add off 16 8 topics 0 +ret long v +end +end +ret 0 +end + +fn node_stop h long to long +if not node_valid h +ret neg long 5 +end +if ne mapget h 32 8 ulong getpid +ret neg long 6 +end +ret mapset h 24 8 1 +end + +note Creator only. Retire every record so a pool can reuse the arena for a new +note epoch. The caller must first prove no reader holds the old epoch (pool.om). +note The count drops to zero before any record version is cleared. +fn node_reset h long epoch ulong to long +if not node_valid h +ret neg long 5 +end +if ne mapget h 32 8 ulong getpid +ret neg long 6 +end +if eq epoch 0 +ret neg long 7 +end +r = mapset h 16 8 0 +for i ulong NCAP +r = mapset h node_offset add i 1 8 0 +end +r = mapset h 24 8 0 +r = mapset h 40 8 epoch +ret 0 +end + +fn node_epoch h long to ulong +ret mapget h 40 8 +end + +note The latest published version of the arena's current epoch (0 when empty). +fn node_count h long to ulong +ret mapget h 16 8 +end + +note One nonblocking eventfd per consumer. Saturation means already readable. +note Interrupted operations retry at most 64 times, then return EINTR. +fn node_notify fd int to long +buf = new uchar 8 0 +put buf 0 1 +for i ulong 64 +r = write fd buf 0 8 +if eq r 8 +ret 0 +end +if eq r neg long 11 +ret 0 +end +if ne r neg long 4 +if lt r 0 +ret r +end +ret neg long 5 +end +end +ret neg long 4 +end + +fn node_drain fd int to long +buf = new uchar 8 0 +for i ulong 64 +r = read fd buf 0 8 +if or eq r 8 eq r neg long 11 +ret 0 +end +if ne r neg long 4 +if lt r 0 +ret r +end +ret neg long 5 +end +end +ret neg long 4 +end + +fn node_pollfd p edit uchar 16 off ulong fd int to void +for i ulong 4 +put p add off i uchar and shr uint fd uint mul i 8 255 +end +put p add off 4 1 +end + +note Returns 2 stop, 1 wake, 0 timeout or negative errno. +note Control takes priority when both descriptors are ready. +note EINTR returns to caller so it can recompute its monotonic deadline. +fn node_wait h long wake int stop int interval long to long +p = new uchar 16 0 +if not node_valid h +ret neg long 5 +end +if or lt wake 0 lt stop 0 +ret neg long 9 +end +if eq wake stop +ret neg long 22 +end +if ne mapget h 24 8 0 +ret 2 +end +node_pollfd p 0 wake +node_pollfd p 8 stop +r = pollfds p 0 16 interval +if lt r 0 +ret r +end +if ne mapget h 24 8 0 +ret 2 +end +if ne and get p 14 56 0 +ret neg long 5 +end +if ne and get p 14 1 0 +r = node_drain stop +if lt r 0 +ret r +end +ret 2 +end +if ne and get p 6 56 0 +ret neg long 5 +end +if ne and get p 6 1 0 +r = node_drain wake +if lt r 0 +ret r +end +ret 1 +end +ret 0 +end +note Omega Node epoch pool. Concatenate after transport.om, before super.om. +note K arenas (1..8) and one control page are mapped before any worker fork, +note so every forked worker inherits the same shared mappings. +note Single writer: the creator writes the current epoch, the arena table and +note every arena record. Worker w alone writes hold word w while it lives; +note the creator clears hold w only after it has reaped worker w. +note Control u64: 0 magic, 8 ABI, 16 current epoch, 24 stop, 32 creator PID, +note 40 arena count K, 48 worker slots W, 64+8k arena handle k, +note 128+8k epoch of arena k (0 free), 256+8w hold of worker w (0 none), +note 768+8w worker PID, 1280+8w worker state (0 empty, 1 live, 2 reaped). +const PMAGIC ulong 1347374924 +const PCAP ulong 8 +const PWCAP ulong 64 +const PBYTES ulong 4096 + +fn pool_valid c long to bool +ret and eq mapget c 0 8 PMAGIC eq mapget c 8 8 1 +end + +fn pool_mine c long to bool +ret eq mapget c 32 8 ulong getpid +end + +fn pool_arena c long k ulong to long +ret long mapget c add 64 mul k 8 8 +end + +note Drop the first n arenas and the control page of a pool being refused. +fn pool_unwind c long n ulong to long +for i ulong n bound 8 +r = mapdrop pool_arena c i +end +ret mapdrop c +end + +note Return the control handle, or -7 bad size, or a negative mapping errno. +note Arena 0 starts as epoch 1. Call before forking any worker. +fn pool_new k ulong w ulong to long +if or eq k 0 gt k PCAP +ret neg long 7 +end +if or eq w 0 gt w PWCAP +ret neg long 7 +end +c = mapnew neg int 1 0 PBYTES 3 33 +if le c 0 +ret c +end +r = mapset c 32 8 ulong getpid +r = mapset c 40 8 k +r = mapset c 48 8 w +for i ulong k bound 8 +h = node_new +if le h 0 +r = pool_unwind c i +ret h +end +r = mapset c add 64 mul i 8 8 ulong h +end +r = node_reset pool_arena c 0 1 +r = mapset c 128 8 1 +r = mapset c 16 8 1 +r = mapset c 8 8 1 +r = mapset c 0 8 PMAGIC +ret c +end + +note Arena index holding epoch e, or -5 when no arena holds it. +fn pool_slot c long e ulong to long +k = mapget c 40 8 +if gt k PCAP +ret neg long 5 +end +for i ulong k bound 8 +if eq mapget c add 128 mul i 8 8 e +ret long i +end +end +ret neg long 5 +end + +note Creator: the arena of the current epoch, or a negative refusal. +fn pool_current c long to long +if not pool_valid c +ret neg long 5 +end +k = pool_slot c mapget c 16 8 +if lt k 0 +ret k +end +ret pool_arena c ulong k +end + +fn pool_epoch c long to ulong +ret mapget c 16 8 +end + +note Worker step: store hold e for worker w, then read the epoch again. mapset +note and mapget fence both sides, so a creator that moved the epoch before it +note scanned holds either sees this hold or this read sees the move. Returns +note the arena of e, -8 when the epoch moved, or -5 when no arena holds e. +note Every refusal clears the hold. +fn pool_hold c long w ulong e ulong to long +if ge w mapget c 48 8 +ret neg long 7 +end +hw = add 256 mul w 8 +r = mapset c hw 8 e +if ne mapget c 16 8 e +r = mapset c hw 8 0 +ret neg long 8 +end +k = pool_slot c e +if lt k 0 +r = mapset c hw 8 0 +ret k +end +h = pool_arena c ulong k +if ne node_epoch h e +r = mapset c hw 8 0 +ret neg long 5 +end +ret h +end + +note Worker w holds the current epoch and returns its arena. Returns -1 +note stopped, -5 invalid, -7 bad worker, -8 the epoch kept moving. +fn pool_acquire c long w ulong to long +if not pool_valid c +ret neg long 5 +end +if ge w mapget c 48 8 +ret neg long 7 +end +for t ulong 16 +if ne mapget c 24 8 0 +r = mapset c add 256 mul w 8 8 0 +ret neg long 1 +end +h = pool_hold c w mapget c 16 8 +if ne h neg long 8 +ret h +end +end +ret neg long 8 +end + +note Worker w gives up its hold. Its old arena must not be read afterwards. +fn pool_release c long w ulong to long +if ge w mapget c 48 8 +ret neg long 7 +end +ret mapset c add 256 mul w 8 8 0 +end + +fn pool_held c long e ulong to bool +n = mapget c 48 8 +for w ulong n bound 64 +if eq mapget c add 256 mul w 8 8 e +ret true +end +end +ret false +end + +note Creator step: retire arena i and open epoch n in it, then publish n. +fn pool_reuse c long i ulong n ulong to long +off = add 128 mul i 8 +r = mapset c off 8 0 +r = node_reset pool_arena c i n +if lt r 0 +ret r +end +r = mapset c off 8 n +r = mapset c 16 8 n +ret long n +end + +note Creator step: an arena that is free or whose older epoch no worker holds, +note or -9. Call only after the current epoch has moved past that arena. +fn pool_pick c long to long +e = mapget c 16 8 +k = mapget c 40 8 +for i ulong k bound 8 +ek = mapget c add 128 mul i 8 8 +if ne ek e +if or eq ek 0 not pool_held c ek +ret long i +end +end +end +ret neg long 9 +end + +note Creator: open the next epoch in a free or unheld arena and make it current. +note Returns the new epoch, -1 stopped, -5 invalid, -6 not creator, or -9 when +note every other arena is still held: the pool fails closed, nothing changes. +fn pool_roll c long to long +if not pool_valid c +ret neg long 5 +end +if not pool_mine c +ret neg long 6 +end +if ne mapget c 24 8 0 +ret neg long 1 +end +k = pool_pick c +if lt k 0 +ret k +end +ret pool_reuse c ulong k add mapget c 16 8 1 +end + +note Creator: publish to the current epoch; when it is full, roll once and retry. +note Returns the version, or the refusal of the publish or of the roll. +fn pool_publish c long topics ulong src view uchar 4096 n ulong to long +h = pool_current c +if lt h 0 +ret h +end +v = node_publish h topics src n +if ne v neg long 2 +ret v +end +r = pool_roll c +if lt r 0 +ret r +end +h = pool_current c +if lt h 0 +ret h +end +ret node_publish h topics src n +end + +fn pool_stop c long to long +if not pool_valid c +ret neg long 5 +end +if not pool_mine c +ret neg long 6 +end +ret mapset c 24 8 1 +end + +fn pool_stopped c long to bool +ret ne mapget c 24 8 0 +end + +note Creator: record worker w's PID and state for observers. +fn pool_setw c long w ulong pid ulong st ulong to long +if not pool_mine c +ret neg long 6 +end +if ge w mapget c 48 8 +ret neg long 7 +end +r = mapset c add 768 mul w 8 8 pid +ret mapset c add 1280 mul w 8 8 st +end + +note Creator: clear hold w. Only after worker w has been reaped. +fn pool_clear c long w ulong to long +if not pool_mine c +ret neg long 6 +end +if ge w mapget c 48 8 +ret neg long 7 +end +ret mapset c add 256 mul w 8 8 0 +end + +note Drop every mapping of the pool in this process. Other processes keep +note their own inherited mappings until they drop them or exit. +fn pool_free c long to long +ret pool_unwind c mapget c 40 8 +end +note Omega Node worker supervision. Concatenate after transport.om and pool.om. +note The creator forks trusted workers from its own binary: sup_spawn returns 0 +note in the child, which runs its worker function and exits with its result. +note Death is seen without polling PIDs. Worker w alone holds the write end of +note its close-on-exec life pipe, so its exit hangs up the creator's read end. +note Every worker holds the read end of the creator's life pipe, whose only +note writer is the creator, so creator death hangs up every worker. +note Per worker: wake, stop and ack eventfds, kept across respawns. +note Workers must not exec: exec closes the life pipe and reads as death. +global swpid long 64 +global swwake int 64 +global swstop int 64 +global swack int 64 +global swlife int 64 +global swst ulong 64 +global swpw ulong 64 +global swpar int 2 +global swme ulong 1 +global swws uchar 4 +global swpf uchar 8 +global swpoll uchar 1024 + +fn sup_fd off ulong to int +v = ulong get swpf off +v = or v shl ulong get swpf add off 1 8 +v = or v shl ulong get swpf add off 2 16 +v = or v shl ulong get swpf add off 3 24 +ret int v +end + +note Poll record j at swpoll offset off; a negative fd is stored as itself +note (bit pattern) so the kernel ignores that record. +fn sup_gpfd off ulong fd int to void +u = bitcast uint fd +for i ulong 4 +put swpoll add off i uchar and shr u uint mul i 8 255 +end +put swpoll add off 4 1 +put swpoll add off 5 0 +put swpoll add off 6 0 +put swpoll add off 7 0 +end + +fn sup_lpfd p edit uchar 24 off ulong fd int to void +for i ulong 4 +put p add off i uchar and shr uint fd uint mul i 8 255 +end +put p add off 4 1 +end + +note Read and reset an eventfd counter: the number of hints since the last +note take, 0 when none is pending, or a negative errno. +fn sup_take fd int to long +buf = new uchar 8 0 +for i ulong 64 +r = read fd buf 0 8 +if eq r 8 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get buf j mul j 8 +end +ret long and v 9223372036854775807 +end +if eq r neg long 11 +ret 0 +end +if ne r neg long 4 +if lt r 0 +ret r +end +ret neg long 5 +end +end +ret neg long 4 +end + +fn sup_closeall to void +for i ulong 64 +if ge get swwake i 0 +r = fclose get swwake i +end +if ge get swstop i 0 +r = fclose get swstop i +end +if ge get swack i 0 +r = fclose get swack i +end +if ge get swlife i 0 +r = fclose get swlife i +end +put swwake i neg int 1 +put swstop i neg int 1 +put swack i neg int 1 +put swlife i neg int 1 +end +for i ulong 2 +if ge get swpar i 0 +r = fclose get swpar i +end +put swpar i neg int 1 +end +end + +note Creator: create the creator life pipe and three eventfds per worker slot. +note Call once after pool_new and before sup_spawn. 0 or a negative errno; +note a failure closes everything this call opened. +fn sup_init c long to long +if not pool_mine c +ret neg long 6 +end +for i ulong 64 +put swpid i 0 +put swst i 0 +put swwake i neg int 1 +put swstop i neg int 1 +put swack i neg int 1 +put swlife i neg int 1 +end +put swme 0 0 +put swpar 0 neg int 1 +put swpar 1 neg int 1 +r = pipefds swpf 0 8 524288 +if lt r 0 +ret r +end +put swpar 0 sup_fd 0 +put swpar 1 sup_fd 4 +n = mapget c 48 8 +for i ulong n bound 64 +a = eventfd uint 0 +if lt a 0 +sup_closeall +ret a +end +put swwake i int a +a = eventfd uint 0 +if lt a 0 +sup_closeall +ret a +end +put swstop i int a +a = eventfd uint 0 +if lt a 0 +sup_closeall +ret a +end +put swack i int a +end +ret 0 +end + +note Creator: fork worker w. Returns 0 in the child, the child PID in the +note creator, -7 bad slot, -16 slot still live, or a negative errno. The +note child keeps only its own life write end; the creator keeps the read end. +fn sup_spawn c long w ulong to long +if not pool_mine c +ret neg long 6 +end +if ge w mapget c 48 8 +ret neg long 7 +end +if ne get swpid w 0 +ret neg long 16 +end +r = pipefds swpf 0 8 524288 +if lt r 0 +ret r +end +rd = sup_fd 0 +wr = sup_fd 4 +pid = fork +if eq pid 0 +r = fclose get swpar 1 +put swpar 1 neg int 1 +r = fclose rd +put swlife w wr +put swme 0 add w 1 +ret 0 +end +r = fclose wr +if lt pid 0 +r = fclose rd +ret pid +end +put swpid w pid +put swlife w rd +r = pool_setw c w ulong pid 1 +ret pid +end + +note Worker: 3 creator gone, 2 stop, 1 wake hint, 0 timeout, negative errno. +note Creator loss outranks stop, which outranks work. A set stop flag makes +note the poll nonblocking. Hints are drained; rescan shared state after 1. +fn sup_wwait c long w ulong interval long to long +p = new uchar 24 0 +if ge w 64 +ret neg long 7 +end +iv = interval +if pool_stopped c +iv = 0 +end +sup_lpfd p 0 get swwake w +sup_lpfd p 8 get swstop w +sup_lpfd p 16 get swpar 0 +r = pollfds p 0 24 iv +if lt r 0 +ret r +end +if ne get p 22 0 +ret 3 +end +if pool_stopped c +ret 2 +end +if ne and get p 14 56 0 +ret neg long 5 +end +if ne and get p 14 1 0 +r = node_drain get swstop w +ret 2 +end +if ne and get p 6 56 0 +ret neg long 5 +end +if ne and get p 6 1 0 +r = node_drain get swwake w +if lt r 0 +ret r +end +ret 1 +end +ret 0 +end + +note Worker or creator: post a hint on worker w's ack eventfd. +fn sup_ack w ulong to long +if ge w 64 +ret neg long 7 +end +ret node_notify get swack w +end + +note Creator: wake worker w with a work hint. +fn sup_wake w ulong to long +if ge w 64 +ret neg long 7 +end +if le get swpid w 0 +ret neg long 3 +end +ret node_notify get swwake w +end + +fn sup_live c long to ulong +n = mapget c 48 8 +k = ulong 0 +for w ulong n bound 64 +if gt get swpid w 0 +k = add k 1 +end +end +ret k +end + +note Creator: reap worker w, then release what it held. A worker that has not +note exited within about one second gets SIGKILL first. Only after the exact +note PID is reaped are its hold, PID and life pipe released. Returns the raw +note wait status, -3 no live worker, or the waitpid errno (nothing released). +fn sup_reap c long w ulong to long +if ge w 64 +ret neg long 7 +end +pid = get swpid w +if le pid 0 +ret neg long 3 +end +done = false +for t ulong 100 +r = waitpid int pid swws 0 4 1 +if eq r pid +done = true +break +end +if ne r 0 +ret r +end +r = sleepns 10000000 +end +if not done +r = killpid int pid 9 +r = waitpid int pid swws 0 4 0 +if ne r pid +ret r +end +end +st = ulong get swws 0 +st = or st shl ulong get swws 1 8 +put swst w st +r = fclose get swlife w +put swlife w neg int 1 +put swpid w 0 +r = pool_clear c w +r = pool_setw c w 0 2 +ret long st +end + +note Creator: wait up to interval ns for deaths and, when acks is true, acks. +note Ack counts are left pending for sup_take. Every worker whose life pipe +note hung up is reaped. Returns the number reaped, or a negative errno. +fn sup_pollx c long interval long acks bool to long +n = mapget c 48 8 +m = ulong 0 +for w ulong n bound 64 +if gt get swpid w 0 +o = mul m 16 +if acks +sup_gpfd o get swack w +else +sup_gpfd o neg int 1 +end +sup_gpfd add o 8 get swlife w +put swpw m w +m = add m 1 +end +end +if eq m 0 +ret 0 +end +r = pollfds swpoll 0 mul m 16 interval +if lt r 0 +ret r +end +dead = long 0 +for j ulong m bound 64 +o = add mul j 16 14 +if ne get swpoll o 0 +r = sup_reap c get swpw j +if lt r 0 +ret r +end +dead = add dead 1 +end +end +ret dead +end + +note Creator: wait up to interval ns for acks and deaths (see sup_pollx). +fn sup_poll c long interval long to long +ret sup_pollx c interval true +end + +note Creator: stop admission, post every live worker's stop eventfd, then reap +note until all have exited or interval ns pass; survivors get SIGKILL and are +note reaped. Returns how many had to be killed, or a refusal. +fn sup_stop c long interval long to long +r = pool_stop c +if lt r 0 +ret r +end +n = mapget c 48 8 +for w ulong n bound 64 +if gt get swpid w 0 +r = node_notify get swstop w +end +end +dl = add monons interval +for t ulong 100000 +if eq sup_live c 0 +ret 0 +end +now = monons +if ge now dl +break +end +r = sup_pollx c sub dl now false +if lt r 0 +if ne r neg long 4 +break +end +end +end +killed = long 0 +for w ulong n bound 64 +if gt get swpid w 0 +r = killpid int get swpid w 9 +r = sup_reap c w +killed = add killed 1 +end +end +ret killed +end +note Omega Node cooperative scheduling (DRA-287). Concatenate after +note transport.om, pool.om and super.om, before one program with fn main. +note One creator admits, assigns, collects and reviews jobs. Workers never +note write each other's state, and no step waits for every worker. +note Scheduling page: one 128-byte cell per worker w at 128*w. +note Creator writes 0 assigned seq, 8 job id, 16 input epoch, 24 input +note version, 32 interest topics, 40 wake stamp (monons at the last post). +note Worker writes 64 done seq, 72 outcome, 80 wakes, 88 last wake latency +note ns, 96 largest wake latency ns. +note Outbox: worker w's result bytes at 4096*w of a second mapping, written +note before its done seq. Each word has one writer; the creator writes a +note worker word only after it has reaped that worker. +note Job states: 0 free, 1 waiting for deps, 2 ready, 3 running, 4 in review, +note 6 UNKNOWN (its worker died mid-job and the job is not safe to rerun). +note +note Resources and selection policy (P-DRA-14, DRA-395). A request is one +note ulong of four 16-bit counts, kind k at bits 16k..16k+15: kind 0 CPU +note slots, 1 memory MiB, 2 inference slots, 3 caller-defined. scap holds +note the configured capacity of each kind, suse the sum of the needs of the +note jobs that hold resources (sjheld 1). A job takes its whole need when it +note is assigned and gives it back when its worker reports done or is reaped, +note never in part. Every job also needs one idle live worker. +note sjarr: admission order (waiting age; kept across reruns). sjrdy: order +note in which the job last became ready. sjbyp: times it was bypassed. +note Decisions read only these logical counters, never the clock. +const SJCAP ulong 64 +const SPVER ulong 1 +global scmap long 2 +global sclim ulong 2 +global sjst ulong 64 +global sjdep ulong 64 +global sjid ulong 64 +global sjw ulong 64 +global sjatt ulong 64 +global sjfl ulong 64 +global sjout ulong 64 +global sjneed ulong 64 +global sjheld ulong 64 +global sjarr ulong 64 +global sjrdy ulong 64 +global sjbyp ulong 64 +global scbusy ulong 64 +global scseq ulong 64 +global swcur ulong 2 +global scpause ulong 1 +global scap ulong 4 +global suse ulong 4 +note Policy words: 0 policy (0 FIFO head-of-line), 1 candidate window in +note slots, 2 dispatch budget per event, 3 bypass budget, 4 cursor, +note 5 reserved job slot + 1 (0 none). +global scpol ulong 8 +note Counters (sched_stat): 0 admissions, 1 ready stamps, 2 dispatch events, +note 3 slots examined, 4 jobs assigned, 5 bypasses, 6 reservations made, +note 7 impossible requests refused, 8 head-of-line stops, 9 reserved jobs +note assigned. +global scst ulong 16 + +fn sc_cell w ulong off ulong to ulong +ret mapget get scmap 0 add mul w 128 off 8 +end + +fn sc_set w ulong off ulong v ulong to void +r = mapset get scmap 0 add mul w 128 off 8 v +end + +note Creator, before any fork: map the scheduling page and the outboxes and +note set the limits on admitted (a) and in-review (rl) jobs, each 1..64. +note Returns 0, -6 not creator, -7 bad limit, or a mapping errno. +fn sched_new c long a ulong rl ulong to long +if not pool_mine c +ret neg long 6 +end +if or eq a 0 gt a SJCAP +ret neg long 7 +end +if or eq rl 0 gt rl SJCAP +ret neg long 7 +end +s = mapnew neg int 1 0 8192 3 33 +if le s 0 +ret s +end +o = mapnew neg int 1 0 262144 3 33 +if le o 0 +r = mapdrop s +ret o +end +put scmap 0 s +put scmap 1 o +put sclim 0 a +put sclim 1 rl +for j ulong 64 +put sjst j 0 +put sjheld j 0 +put scbusy j 0 +put scseq j 0 +end +for k ulong 4 +put scap k 65535 +put suse k 0 +end +for i ulong 16 +put scst i 0 +end +put scpol 0 0 +put scpol 1 64 +put scpol 2 64 +put scpol 3 4 +put scpol 4 0 +put scpol 5 0 +put scpause 0 0 +ret 0 +end + +note Count of kind k (0..3) in packed request req. +fn sp_need req ulong k ulong to ulong +ret and shr req mul k 16 65535 +end + +note Free capacity of kind k. sched_cap never sets a capacity below the +note use, so this cannot underflow. +fn sp_free k ulong to ulong +ret sub get scap k get suse k +end + +note Does req fit in the free capacity once the reserved request res has +note what it still lacks? Of each kind, res keeps min(free, its need); res 0 +note is no reservation. This keeps the reserved job's attainable capacity +note from ever shrinking (the drain). +fn sp_fits req ulong res ulong to bool +for k ulong 4 +f = sp_free k +r = sp_need res k +a = ulong 0 +if gt f r +a = sub f r +end +if gt sp_need req k a +ret false +end +end +ret true +end + +note Could req ever run, with the configured capacity all free? +fn sp_feas req ulong to bool +for k ulong 4 +if gt sp_need req k get scap k +ret false +end +end +ret true +end + +note Job j takes its whole need. +fn sp_take j ulong to void +for k ulong 4 +put suse k add get suse k sp_need get sjneed j k +end +put sjheld j 1 +end + +note Job j gives back its need, if it holds it. +fn sp_give j ulong to void +if eq get sjheld j 0 +ret +end +for k ulong 4 +put suse k sub get suse k sp_need get sjneed j k +end +put sjheld j 0 +end + +note Job j becomes ready, stamped with the next ready order. +fn sp_ready j ulong to void +put sjst j 2 +put sjrdy j get scst 1 +put scst 1 add get scst 1 1 +end + +note Creator: counter i of scst, capacity (i 16..19) or use (i 20..23) of a +note kind, or policy word (i 24..29). +fn sched_stat i ulong to ulong +if lt i 16 +ret get scst i +end +if lt i 20 +ret get scap sub i 16 +end +if lt i 24 +ret get suse sub i 20 +end +if lt i 30 +ret get scpol sub i 24 +end +ret 0 +end + +note Creator: set the capacity of every kind from caps (packed like a +note request). 0, or -8 when the new capacity of a kind is below its use by +note running jobs, or below the need of any one admitted job (nothing +note changes). +fn sched_cap caps ulong to long +for k ulong 4 +if lt sp_need caps k get suse k +ret neg long 8 +end +end +for j ulong 64 +s = get sjst j +if and ge s 1 le s 3 +for k ulong 4 +if gt sp_need get sjneed j k sp_need caps k +ret neg long 8 +end +end +end +end +for k ulong 4 +put scap k sp_need caps k +end +ret 0 +end + +note Creator: policy p (0 FIFO head-of-line), candidate window win slots +note (1..64), dispatch budget db jobs per event (1..64), bypass budget by +note (1..65535). The cursor and any reservation are kept. 0 or -7. +fn sched_policy p ulong win ulong db ulong by ulong to long +if gt p 0 +ret neg long 7 +end +if or eq win 0 gt win 64 +ret neg long 7 +end +if or eq db 0 gt db 64 +ret neg long 7 +end +if or eq by 0 gt by 65535 +ret neg long 7 +end +put scpol 0 p +put scpol 1 win +put scpol 2 db +put scpol 3 by +ret 0 +end + +note Creator: drop this process's scheduling mappings. +fn sched_free to long +r = mapdrop get scmap 1 +if lt r 0 +ret r +end +ret mapdrop get scmap 0 +end + +note Jobs whose state is in lo..hi. +fn sched_count lo ulong hi ulong to ulong +n = ulong 0 +for j ulong 64 +s = get sjst j +if and ge s lo le s hi +n = add n 1 +end +end +ret n +end + +note Creator: admit job id needing req (packed resources). deps 0 makes it +note ready at once; otherwise it waits for a publication whose topics meet +note deps. flags bit 0: safe to rerun after its worker dies. Returns the job +note slot; -8 when req exceeds the configured capacity of a kind (it could +note never run); -2 when admitted work (waiting, ready, running) is at its +note limit: refused, not queued. +fn sched_admitr id ulong deps ulong flags ulong req ulong to long +if not sp_feas req +put scst 7 add get scst 7 1 +ret neg long 8 +end +if ge sched_count 1 3 get sclim 0 +ret neg long 2 +end +for j ulong 64 +if eq get sjst j 0 +put sjid j id +put sjdep j deps +put sjfl j flags +put sjatt j 0 +put sjout j 0 +put sjw j 0 +put sjneed j req +put sjheld j 0 +put sjbyp j 0 +put sjarr j get scst 0 +put scst 0 add get scst 0 1 +if eq deps 0 +sp_ready j +else +put sjst j 1 +end +ret long j +end +end +ret neg long 2 +end + +note Creator: sched_admitr with no resource need beyond one worker. +fn sched_admit id ulong deps ulong flags ulong to long +ret sched_admitr id deps flags 0 +end + +note Creator: worker w is woken by publications whose topics meet topics. +fn sched_want w ulong topics ulong to long +if ge w 64 +ret neg long 7 +end +sc_set w 32 topics +ret 0 +end + +fn sc_wake w ulong to void +sc_set w 40 ulong monons +r = sup_wake w +end + +note Lowest idle live worker below n, or 64 when none. A worker is idle when +note the creator has collected its last assignment. +fn sp_idle n ulong to ulong +for w ulong n bound 64 +if and gt get swpid w 0 eq get scbusy w 0 +ret w +end +end +ret 64 +end + +note Assign job j to idle worker w: it takes its need; the job id and the +note input epoch and version are written before the seq, then the wake. +fn sp_start c long j ulong w ulong to void +q = add get scseq w 1 +put scseq w q +put scbusy w add j 1 +put sjst j 3 +put sjw j w +put sjatt j add get sjatt j 1 +put sjbyp j 0 +sp_take j +if eq get scpol 5 add j 1 +put scpol 5 0 +put scst 9 add get scst 9 1 +end +sc_set w 8 get sjid j +sc_set w 16 pool_epoch c +sc_set w 24 node_count pool_current c +sc_set w 0 q +sc_wake w +put scst 4 add get scst 4 1 +end + +note Policy 0, FIFO head-of-line: the stop rule of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump, +note 598-602), not its queue: the head here is the ready job that became +note ready first (the pump batches newly eligible tasks in task-id order +note into a bounded queue). The head is chosen when it fits, and when it +note does not fit nothing is chosen, so a head that does +note not fit holds back every later job. Returns the slot or 64. +fn sp_fifo to ulong +h = ulong 64 +for j ulong 64 +if eq get sjst j 2 +if eq h 64 +h = j +else +if lt get sjrdy j get sjrdy h +h = j +end +end +end +end +put scst 3 add get scst 3 64 +if eq h 64 +ret 64 +end +if sp_fits get sjneed h 0 +ret h +end +put scst 8 add get scst 8 1 +ret 64 +end + +note Creator: assign ready jobs to idle live workers under the policy, at +note most the dispatch budget per call. Returns the number assigned. +fn sched_dispatch c long to ulong +if ne get scpause 0 0 +ret 0 +end +n = mapget c 48 8 +k = ulong 0 +put scst 2 add get scst 2 1 +for i ulong get scpol 2 bound 64 +w = sp_idle n +if ge w 64 +break +end +j = sp_fifo +if ge j 64 +break +end +sp_start c j w +k = add k 1 +end +ret k +end + +note Creator: move finished jobs into review while review has room. A worker +note whose result is waiting for room keeps it and gets no new job, so a +note full review queue stops assignment instead of dropping work. A job +note gives back its resources as soon as its worker reported done, even +note while its result waits for room. +fn sched_collect c long to ulong +n = mapget c 48 8 +k = ulong 0 +for w ulong n bound 64 +b = get scbusy w +if gt b 0 +if eq sc_cell w 64 get scseq w +j = sub b 1 +sp_give j +if ge sched_count 4 4 get sclim 1 +continue +end +put sjst j 4 +put sjout j sc_cell w 72 +put scbusy w 0 +k = add k 1 +end +end +end +ret k +end + +note Creator, after worker w was reaped: retire its unfinished assignment. +note A rerunnable job is ready again; any other becomes UNKNOWN (6), since +note it may have had effects. A finished result is left for sched_collect. +note Returns 1 when an assignment was retired, 0 when none, -16 still live. +fn sched_lost c long w ulong to long +if ge w 64 +ret neg long 7 +end +if gt get swpid w 0 +ret neg long 16 +end +b = get scbusy w +if eq b 0 +ret 0 +end +if eq sc_cell w 64 get scseq w +ret 0 +end +j = sub b 1 +sc_set w 64 get scseq w +put scbusy w 0 +sp_give j +if ne and get sjfl j 1 0 +sp_ready j +else +put sjst j 6 +end +ret 1 +end + +note Creator loop step: wait up to interval ns for an ack or a death, take +note acks, retire the jobs of reaped workers, collect, then dispatch. +note Returns the number of workers reaped, or a negative errno. +fn sched_step c long interval long to long +d = sup_poll c interval +if lt d 0 +ret d +end +n = mapget c 48 8 +for w ulong n bound 64 +if gt get swpid w 0 +r = sup_take get swack w +else +r = sched_lost c w +end +end +k = sched_collect c +k = sched_dispatch c +ret d +end + +note Creator: publish an artifact, make waiting jobs whose deps meet topics +note ready, wake each live worker whose interest meets topics, dispatch. +note Returns the version, or the publish refusal with nothing woken. +fn sched_publish c long topics ulong src view uchar 4096 n ulong to long +v = pool_publish c topics src n +if le v 0 +ret v +end +for j ulong 64 +if eq get sjst j 1 +if ne and get sjdep j topics 0 +sp_ready j +end +end +end +m = mapget c 48 8 +for w ulong m bound 64 +if gt get swpid w 0 +if ne and sc_cell w 32 topics 0 +sc_wake w +end +end +end +k = sched_dispatch c +ret v +end + +note Creator: accept the result of job j in review and free its slot. +note Returns its outcome, or -3 when j is not in review. +fn sched_review j ulong to long +if ge j 64 +ret neg long 3 +end +if ne get sjst j 4 +ret neg long 3 +end +put sjst j 0 +ret long get sjout j +end + +note Creator: free an UNKNOWN job once its outcome has been settled +note elsewhere. Returns 0, or -3 when j is not UNKNOWN. +fn sched_settle j ulong to long +if ge j 64 +ret neg long 3 +end +if ne get sjst j 6 +ret neg long 3 +end +put sjst j 0 +ret 0 +end + +note Creator: while paused (on true) no job is assigned; running jobs go on +note and finished results are still collected. Resuming dispatches at once. +note Returns the number assigned on resume, else 0. +fn sched_pause c long on bool to ulong +if on +put scpause 0 1 +ret 0 +end +put scpause 0 0 +ret sched_dispatch c +end + +note Creator: cancel job j. A waiting or ready job never started, so it is +note freed with no effect: 1. A running job needs its worker: 2, and the +note outcome comes from the worker. A job in review already finished: 3, +note nothing is cancelled. UNKNOWN stays UNKNOWN: 4. -3 free or bad slot. +fn sched_cancel j ulong to long +if ge j 64 +ret neg long 3 +end +s = get sjst j +if or eq s 1 eq s 2 +put sjst j 0 +ret 1 +end +if eq s 3 +ret 2 +end +if eq s 4 +ret 3 +end +if eq s 6 +ret 4 +end +ret neg long 3 +end + +note Creator: stop every worker within interval ns (sup_stop), retire the +note assignments of the reaped workers, collect finished results. +note Returns how many workers had to be killed, or a refusal. +fn sched_stop c long interval long to long +k = sup_stop c interval +if lt k 0 +ret k +end +n = mapget c 48 8 +for w ulong n bound 64 +r = sched_lost c w +end +m = sched_collect c +ret k +end + +note Worker w: the assignment seq when a job is waiting, else 0. Job id, +note input epoch and input version are words 8, 16 and 24 of its cell. +fn sched_wjob w ulong to ulong +q = sc_cell w 0 +if gt q sc_cell w 64 +ret q +end +ret 0 +end + +note Worker w: finish assignment q with outcome and the first n (at most +note 4096) bytes of src. Bytes and outcome are written before the done seq; +note then the creator gets an ack. 0, -7 bad n, or the ack refusal. +fn sched_wdone w ulong q ulong outcome ulong src view uchar 4096 n ulong to long +if gt n 4096 +ret neg long 7 +end +if gt n 0 +r = mapwrite get scmap 1 mul w 4096 src 0 n +end +sc_set w 72 outcome +sc_set w 64 q +ret sup_ack w +end + +note Creator: copy worker w's last result bytes into dst. +fn sched_result w ulong dst edit uchar 4096 to long +ret mapread get scmap 1 mul w 4096 dst 0 4096 +end + +note Worker w: sup_wwait that records its wakes and wake latency. +fn sched_wwait c long w ulong interval long to long +r = sup_wwait c w interval +if eq r 1 +now = ulong monons +st = sc_cell w 40 +lat = ulong 0 +if gt now st +lat = sub now st +end +sc_set w 80 add sc_cell w 80 1 +sc_set w 88 lat +if gt lat sc_cell w 96 +sc_set w 96 lat +end +end +ret r +end + +note Worker w: count the versions of the current epoch that meet its +note interest and are newer than its cursor, moving the cursor past them. +note A new epoch restarts the cursor at 0. A worker with no interest scans +note nothing. Returns the count or a refusal. +fn sched_wscan c long w ulong to long +t = sc_cell w 32 +if eq t 0 +ret 0 +end +h = pool_acquire c w +if le h 0 +ret h +end +e = mapget c add 256 mul w 8 8 +if ne get swcur 0 e +put swcur 0 e +put swcur 1 0 +end +k = long 0 +for i ulong 65 +v = node_next h get swcur 1 t +if lt v 0 +r = pool_release c w +ret v +end +if eq v 0 +break +end +put swcur 1 ulong v +k = add k 1 +end +r = pool_release c w +ret k +end +note Concatenate after transport.om, pool.om, super.om and sched.om. CPU-only +note acceptance of the resource-aware selection policy (P-DRA-14) with real +note forked workers: impossible requests, the capacity invariant under churn, +note ready order, and the head-of-line scenarios of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump). +note After every creator step the test checks that no kind is used beyond its +note capacity and that the use equals the needs of the jobs holding them. +note No GPU, model or network. +text pok "PASS node schedpol\n" +text pst "schedpol events=" +text pex " examined=" +text pas " assigned=" +text phol " hol_stops=" +text pbyp " bypasses=" +text pres " reservations=" +text pnl "\n" +text pw1 "schedpol hol witness head=" +text pw2 " fits_behind=" +text pw3 " free_cpu=" +text pw4 " idle_worker=" +global ptc long 1 + +fn pt_ok ok bool code int to void +if not ok +exit code +end +end + +fn pt_num v ulong to void +d = new uchar 20 0 +x = v +k = ulong 20 +for i ulong 20 +k = sub k 1 +put d k uchar add rem x 10 48 +x = div x 10 +if eq x 0 +break +end +end +r = write 1 d k sub 20 k +end + +note Packed request: cpu slots, memory MiB, inference slots, kind 3. +fn pt_req cpu ulong mem ulong inf ulong x ulong to ulong +ret or or cpu shl mem 16 or shl inf 32 shl x 48 +end + +note Worker: run assignment q for the milliseconds in the low four decimal +note digits of its job id, then report outcome id+1 and 8 bytes. 0 done, +note 2 stopped, 3 creator gone, 4 wait error, 5 report refused. +fn pt_run c long w ulong q ulong to int +buf = new uchar 4096 0 +id = sc_cell w 8 +dl = add ulong monons mul rem id 10000 1000000 +for t ulong 1000000 +now = ulong monons +if ge now dl +break +end +r = sched_wwait c w long sub dl now +if eq r 2 +ret 2 +end +if eq r 3 +ret 3 +end +if lt r 0 +ret 4 +end +end +if ne sched_wdone w q add id 1 buf 8 0 +ret 5 +end +ret 0 +end + +fn pt_worker w ulong to int +c = get ptc 0 +for it ulong 1000000000 +q = sched_wjob w +if gt q 0 +r = pt_run c w q +if eq r 2 +ret 0 +end +if ne r 0 +ret add 60 r +end +continue +end +r = sched_wwait c w neg long 1 +if eq r 2 +ret 0 +end +if eq r 3 +ret 41 +end +if lt r 0 +ret 43 +end +end +ret 45 +end + +fn pt_spawn c long w ulong to bool +p = sup_spawn c w +if eq p 0 +exit pt_worker w +end +ret gt p 0 +end + +note Fresh pool for w workers (spawned), admission limit a, review limit rl, +note capacities caps. Exits with code on any refusal. +fn pt_setup w ulong a ulong rl ulong caps ulong code int to long +c = pool_new 4 w +pt_ok gt c 0 code +put ptc 0 c +pt_ok eq sup_init c 0 code +pt_ok eq sched_new c a rl 0 code +pt_ok eq sched_cap caps 0 code +for i ulong w bound 64 +pt_ok pt_spawn c i code +end +ret c +end + +fn pt_down c long code int to void +pt_ok ge sched_stop c 2000000000 0 code +sup_closeall +pt_ok eq sched_free 0 code +pt_ok eq pool_free c 0 code +end + +note The capacity invariant: of each kind the use is at most the capacity +note and equals the sum of the needs of the jobs that hold resources; only +note a running job holds them, and every running job whose worker has not +note reported done holds them. +fn pt_inv code int to void +for j ulong 64 +if eq get sjst j 3 +w = get sjw j +if ne sc_cell w 64 get scseq w +pt_ok eq get sjheld j 1 code +end +end +end +for k ulong 4 +s = ulong 0 +for j ulong 64 +if eq get sjheld j 1 +pt_ok eq get sjst j 3 code +s = add s sp_need get sjneed j k +end +end +pt_ok eq get suse k s code +pt_ok le get suse k get scap k code +end +end + +note One creator step of up to 10 ms, then the invariant. +fn pt_step c long code int to void +r = sched_step c 10000000 +pt_ok ge r 0 code +pt_inv code +end + +note Step until job j is in a state in lo..hi, up to ms. True when reached. +fn pt_until c long j ulong lo ulong hi ulong ms ulong code int to bool +dl = add ulong monons mul ms 1000000 +for t ulong 1000000 +s = get sjst j +if and ge s lo le s hi +ret true +end +if ge ulong monons dl +ret false +end +pt_step c code +end +ret false +end + +note Review every job in review whose outcome is its id + 1. +fn pt_review code int to ulong +n = ulong 0 +for j ulong 64 +if eq get sjst j 4 +pt_ok eq sched_review j long add get sjid j 1 code +n = add n 1 +end +end +ret n +end + +note Step and review until n jobs were reviewed, up to ms. +fn pt_drain c long n ulong ms ulong code int to void +dl = add ulong monons mul ms 1000000 +k = ulong 0 +for t ulong 1000000 +k = add k pt_review code +if ge k n +ret +end +pt_ok lt ulong monons dl code +pt_step c code +end +exit code +end + +fn pt_admit id ulong deps ulong req ulong code int to ulong +j = sched_admitr id deps 0 req +pt_ok ge j 0 code +ret ulong j +end + +note Phase C: a request beyond the capacity of any kind is refused (-8) and +note counted; lowering a capacity below an admitted job's need, or below +note the use of two running jobs that each fit it alone, is refused and +note changes nothing. +fn pt_impossible to void +c = pt_setup 2 8 8 pt_req 4 1024 1 8 30 +pt_ok eq sched_admitr 1 0 0 pt_req 5 0 0 0 neg long 8 31 +pt_ok eq sched_admitr 2 0 0 pt_req 1 1025 0 0 neg long 8 32 +pt_ok eq sched_admitr 3 0 0 pt_req 0 0 2 0 neg long 8 33 +pt_ok eq sched_stat 7 3 34 +a = pt_admit 4 0 pt_req 3 0 0 0 35 +pt_ok eq sched_cap pt_req 2 1024 1 8 neg long 8 36 +pt_ok eq sched_stat 16 4 37 +pt_ok eq sched_cancel a 1 38 +pt_ok eq sched_cap pt_req 2 1024 1 8 0 39 +pt_ok eq sched_stat 16 2 40 +pt_ok eq sched_cap pt_req 4 1024 1 8 0 130 +p = pt_admit 130400 0 pt_req 2 0 0 0 130 +q = pt_admit 140400 0 pt_req 2 0 0 0 130 +pt_ok pt_until c p 3 3 2000 130 130 +pt_ok pt_until c q 3 3 2000 130 130 +pt_ok eq sched_cap pt_req 3 1024 1 8 neg long 8 131 +pt_ok eq sched_stat 16 4 132 +pt_drain c 2 3000 133 +pt_ok eq sched_cap pt_req 3 1024 1 8 0 134 +pt_down c 41 +end + +note Phase D: 12 jobs with mixed CPU, memory and inference needs on three +note workers, capacities 4 CPU, 1024 MiB, 1 inference slot. Every job runs +note once and returns its outcome; the invariant holds at every step and +note every resource is free at the end. +fn pt_churn to void +c = pt_setup 3 16 8 pt_req 4 1024 1 0 42 +for i ulong 12 +cpu = add rem i 3 1 +mem = mul add rem i 6 1 100 +inf = rem i 2 +id = add mul add i 1 10000 add 30 mul rem i 4 15 +j = pt_admit id 0 pt_req cpu mem inf 0 43 +end +pt_drain c 12 10000 44 +for k ulong 4 +pt_ok eq get suse k 0 45 +end +pt_ok eq sched_count 1 6 0 46 +pt_ok eq sched_stat 4 12 47 +pt_down c 48 +end + +note Some running job whose worker has reported done (its result waits +note for review room). +fn pt_held to bool +for j ulong 64 +if eq get sjst j 3 +w = get sjw j +if eq sc_cell w 64 get scseq w +ret true +end +end +end +ret false +end + +note Phase V: release while review is full. Review limit 1, two workers, +note 2 CPU: j1 and j2 (1 CPU, 50 ms) both finish; one enters review, the +note other's result waits for room, yet both CPUs are free at once and j3 +note (2 CPU) runs before anything is reviewed. +fn pt_release to void +c = pt_setup 2 8 1 pt_req 2 1024 1 8 120 +j1 = pt_admit 150050 0 pt_req 1 0 0 0 120 +j2 = pt_admit 160050 0 pt_req 1 0 0 0 120 +dl = add ulong monons 2000000000 +for t ulong 1000000 +if eq sched_count 4 4 1 +if pt_held +break +end +end +pt_ok lt ulong monons dl 121 +pt_step c 121 +end +note The done report may land after the last collect: one more step +note collects it (review stays full, so nothing else changes). +pt_step c 121 +pt_ok eq get suse 0 0 122 +j3 = pt_admit 170050 0 pt_req 2 0 0 0 123 +pt_ok pt_until c j3 3 4 2000 123 124 +pt_drain c 3 3000 125 +pt_down c 126 +end + +note Phase F: ready order. With one worker, x is admitted first waiting on +note topic 8 and y second ready at once; then topic 8 is published. FIFO +note (policy 0) serves the job that became ready first, y. +fn pt_order to void +buf = new uchar 4096 0 +c = pt_setup 1 8 8 pt_req 4 1024 1 8 50 +x = pt_admit 60050 8 0 51 +y = pt_admit 70050 0 0 52 +pt_ok gt sched_publish c 8 buf 16 0 53 +pt_ok eq get sjst y 3 54 +pt_ok eq get sjst x 2 55 +pt_drain c 2 3000 56 +pt_down c 57 +end + +note Witness of a head-of-line block, read with no step in between: a runs +note unfinished holding its need, the head h is ready and does not fit, x +note is ready and fits, a live worker is idle, and dispatch stopped at the +note head at least once since h0 (codes code..code+4 when not). +fn pt_witness c long a ulong h ulong x ulong h0 ulong code int to void +w = get sjw a +pt_ok eq get sjst a 3 code +pt_ok ne sc_cell w 64 get scseq w code +pt_ok eq get sjheld a 1 code +pt_ok eq get sjst h 2 add code 1 +pt_ok not sp_fits get sjneed h 0 add code 1 +pt_ok eq get sjst x 2 add code 2 +pt_ok sp_fits get sjneed x 0 add code 2 +i = sp_idle mapget c 48 8 +pt_ok lt i 64 add code 3 +pt_ok gt sched_stat 8 h0 add code 4 +r = write 1 pw1 0 len pw1 +pt_num get sjid h +r = write 1 pw2 0 len pw2 +pt_num get sjid x +r = write 1 pw3 0 len pw3 +pt_num sp_free 0 +r = write 1 pw4 0 len pw4 +pt_num i +r = write 1 phol 0 len phol +pt_num sub sched_stat 8 h0 +r = write 1 pnl 0 1 +end + +note Phase A: the blocked head. a (3 CPU, 800 ms) runs; then b (2 CPU, +note cannot fit) and c (1 CPU, fits) arrive with no dependency. The target: +note c runs while a still runs and b waits (0). When c has not run within +note 400 ms, the witness is checked and printed and the phase returns 11: +note c stayed idle behind b although a CPU and a worker were free. +fn pt_blocked to int +c = pt_setup 3 8 8 pt_req 4 1024 1 8 10 +a = pt_admit 10800 0 pt_req 3 0 0 0 10 +pt_ok pt_until c a 3 3 2000 10 10 +b = pt_admit 20050 0 pt_req 2 0 0 0 10 +x = pt_admit 30050 0 pt_req 1 0 0 0 10 +h0 = sched_stat 8 +v = int 0 +if pt_until c x 3 4 400 10 +pt_ok eq get sjst a 3 12 +pt_ok eq get sjst b 2 13 +else +pt_witness c a b x h0 12 +v = int 11 +end +pt_drain c 3 5000 17 +pt_down c 18 +ret v +end + +note Phase B: a second head-of-line case, after the pump's queue-of-two +note scenario (the bounded queue itself is not modelled: every admitted +note job is in the table). a (3 CPU, 800 ms) runs, b and d (2 CPU) cannot +note fit, e (1 CPU) fits. Target: e runs while a still runs (0); else the +note witness and 21. +fn pt_exclude to int +c = pt_setup 3 8 8 pt_req 4 1024 1 8 20 +a = pt_admit 10800 0 pt_req 3 0 0 0 20 +pt_ok pt_until c a 3 3 2000 20 20 +b = pt_admit 20050 0 pt_req 2 0 0 0 20 +d = pt_admit 40050 0 pt_req 2 0 0 0 20 +e = pt_admit 50050 0 pt_req 1 0 0 0 20 +h0 = sched_stat 8 +v = int 0 +if pt_until c e 3 4 400 20 +pt_ok eq get sjst a 3 22 +else +pt_witness c a b e h0 22 +v = int 21 +end +pt_drain c 4 5000 27 +pt_down c 28 +ret v +end + +fn pt_stats to void +r = write 1 pst 0 len pst +pt_num sched_stat 2 +r = write 1 pex 0 len pex +pt_num sched_stat 3 +r = write 1 pas 0 len pas +pt_num sched_stat 4 +r = write 1 phol 0 len phol +pt_num sched_stat 8 +r = write 1 pbyp 0 len pbyp +pt_num sched_stat 5 +r = write 1 pres 0 len pres +pt_num sched_stat 6 +r = write 1 pnl 0 1 +end + +note The regression phases A and B return their verdict, so both run and +note print their witness; the first failing one is the exit status. +fn main to int +pt_impossible +pt_churn +pt_release +pt_order +ra = pt_blocked +rb = pt_exclude +if ne ra 0 +ret ra +end +if ne rb 0 +ret rb +end +if ne write 1 pok 0 len pok long len pok +ret 100 +end +ret 0 +end diff --git a/seed/node/schedpol-test.om b/seed/node/schedpol-test.om new file mode 100644 index 000000000..5535dd71c --- /dev/null +++ b/seed/node/schedpol-test.om @@ -0,0 +1,439 @@ +note Concatenate after transport.om, pool.om, super.om and sched.om. CPU-only +note acceptance of the resource-aware selection policy (P-DRA-14) with real +note forked workers: impossible requests, the capacity invariant under churn, +note ready order, and the head-of-line scenarios of the reference pump +note (aien-sovereign-core-mv spark-harness scheduler/core.rs Core::pump). +note After every creator step the test checks that no kind is used beyond its +note capacity and that the use equals the needs of the jobs holding them. +note No GPU, model or network. +text pok "PASS node schedpol\n" +text pst "schedpol events=" +text pex " examined=" +text pas " assigned=" +text phol " hol_stops=" +text pbyp " bypasses=" +text pres " reservations=" +text pnl "\n" +text pw1 "schedpol hol witness head=" +text pw2 " fits_behind=" +text pw3 " free_cpu=" +text pw4 " idle_worker=" +global ptc long 1 + +fn pt_ok ok bool code int to void +if not ok +exit code +end +end + +fn pt_num v ulong to void +d = new uchar 20 0 +x = v +k = ulong 20 +for i ulong 20 +k = sub k 1 +put d k uchar add rem x 10 48 +x = div x 10 +if eq x 0 +break +end +end +r = write 1 d k sub 20 k +end + +note Packed request: cpu slots, memory MiB, inference slots, kind 3. +fn pt_req cpu ulong mem ulong inf ulong x ulong to ulong +ret or or cpu shl mem 16 or shl inf 32 shl x 48 +end + +note Worker: run assignment q for the milliseconds in the low four decimal +note digits of its job id, then report outcome id+1 and 8 bytes. 0 done, +note 2 stopped, 3 creator gone, 4 wait error, 5 report refused. +fn pt_run c long w ulong q ulong to int +buf = new uchar 4096 0 +id = sc_cell w 8 +dl = add ulong monons mul rem id 10000 1000000 +for t ulong 1000000 +now = ulong monons +if ge now dl +break +end +r = sched_wwait c w long sub dl now +if eq r 2 +ret 2 +end +if eq r 3 +ret 3 +end +if lt r 0 +ret 4 +end +end +if ne sched_wdone w q add id 1 buf 8 0 +ret 5 +end +ret 0 +end + +fn pt_worker w ulong to int +c = get ptc 0 +for it ulong 1000000000 +q = sched_wjob w +if gt q 0 +r = pt_run c w q +if eq r 2 +ret 0 +end +if ne r 0 +ret add 60 r +end +continue +end +r = sched_wwait c w neg long 1 +if eq r 2 +ret 0 +end +if eq r 3 +ret 41 +end +if lt r 0 +ret 43 +end +end +ret 45 +end + +fn pt_spawn c long w ulong to bool +p = sup_spawn c w +if eq p 0 +exit pt_worker w +end +ret gt p 0 +end + +note Fresh pool for w workers (spawned), admission limit a, review limit rl, +note capacities caps. Exits with code on any refusal. +fn pt_setup w ulong a ulong rl ulong caps ulong code int to long +c = pool_new 4 w +pt_ok gt c 0 code +put ptc 0 c +pt_ok eq sup_init c 0 code +pt_ok eq sched_new c a rl 0 code +pt_ok eq sched_cap caps 0 code +for i ulong w bound 64 +pt_ok pt_spawn c i code +end +ret c +end + +fn pt_down c long code int to void +pt_ok ge sched_stop c 2000000000 0 code +sup_closeall +pt_ok eq sched_free 0 code +pt_ok eq pool_free c 0 code +end + +note The capacity invariant: of each kind the use is at most the capacity +note and equals the sum of the needs of the jobs that hold resources; only +note a running job holds them, and every running job whose worker has not +note reported done holds them. +fn pt_inv code int to void +for j ulong 64 +if eq get sjst j 3 +w = get sjw j +if ne sc_cell w 64 get scseq w +pt_ok eq get sjheld j 1 code +end +end +end +for k ulong 4 +s = ulong 0 +for j ulong 64 +if eq get sjheld j 1 +pt_ok eq get sjst j 3 code +s = add s sp_need get sjneed j k +end +end +pt_ok eq get suse k s code +pt_ok le get suse k get scap k code +end +end + +note One creator step of up to 10 ms, then the invariant. +fn pt_step c long code int to void +r = sched_step c 10000000 +pt_ok ge r 0 code +pt_inv code +end + +note Step until job j is in a state in lo..hi, up to ms. True when reached. +fn pt_until c long j ulong lo ulong hi ulong ms ulong code int to bool +dl = add ulong monons mul ms 1000000 +for t ulong 1000000 +s = get sjst j +if and ge s lo le s hi +ret true +end +if ge ulong monons dl +ret false +end +pt_step c code +end +ret false +end + +note Review every job in review whose outcome is its id + 1. +fn pt_review code int to ulong +n = ulong 0 +for j ulong 64 +if eq get sjst j 4 +pt_ok eq sched_review j long add get sjid j 1 code +n = add n 1 +end +end +ret n +end + +note Step and review until n jobs were reviewed, up to ms. +fn pt_drain c long n ulong ms ulong code int to void +dl = add ulong monons mul ms 1000000 +k = ulong 0 +for t ulong 1000000 +k = add k pt_review code +if ge k n +ret +end +pt_ok lt ulong monons dl code +pt_step c code +end +exit code +end + +fn pt_admit id ulong deps ulong req ulong code int to ulong +j = sched_admitr id deps 0 req +pt_ok ge j 0 code +ret ulong j +end + +note Phase C: a request beyond the capacity of any kind is refused (-8) and +note counted; lowering a capacity below an admitted job's need, or below +note the use of two running jobs that each fit it alone, is refused and +note changes nothing. +fn pt_impossible to void +c = pt_setup 2 8 8 pt_req 4 1024 1 8 30 +pt_ok eq sched_admitr 1 0 0 pt_req 5 0 0 0 neg long 8 31 +pt_ok eq sched_admitr 2 0 0 pt_req 1 1025 0 0 neg long 8 32 +pt_ok eq sched_admitr 3 0 0 pt_req 0 0 2 0 neg long 8 33 +pt_ok eq sched_stat 7 3 34 +a = pt_admit 4 0 pt_req 3 0 0 0 35 +pt_ok eq sched_cap pt_req 2 1024 1 8 neg long 8 36 +pt_ok eq sched_stat 16 4 37 +pt_ok eq sched_cancel a 1 38 +pt_ok eq sched_cap pt_req 2 1024 1 8 0 39 +pt_ok eq sched_stat 16 2 40 +pt_ok eq sched_cap pt_req 4 1024 1 8 0 130 +p = pt_admit 130400 0 pt_req 2 0 0 0 130 +q = pt_admit 140400 0 pt_req 2 0 0 0 130 +pt_ok pt_until c p 3 3 2000 130 130 +pt_ok pt_until c q 3 3 2000 130 130 +pt_ok eq sched_cap pt_req 3 1024 1 8 neg long 8 131 +pt_ok eq sched_stat 16 4 132 +pt_drain c 2 3000 133 +pt_ok eq sched_cap pt_req 3 1024 1 8 0 134 +pt_down c 41 +end + +note Phase D: 12 jobs with mixed CPU, memory and inference needs on three +note workers, capacities 4 CPU, 1024 MiB, 1 inference slot. Every job runs +note once and returns its outcome; the invariant holds at every step and +note every resource is free at the end. +fn pt_churn to void +c = pt_setup 3 16 8 pt_req 4 1024 1 0 42 +for i ulong 12 +cpu = add rem i 3 1 +mem = mul add rem i 6 1 100 +inf = rem i 2 +id = add mul add i 1 10000 add 30 mul rem i 4 15 +j = pt_admit id 0 pt_req cpu mem inf 0 43 +end +pt_drain c 12 10000 44 +for k ulong 4 +pt_ok eq get suse k 0 45 +end +pt_ok eq sched_count 1 6 0 46 +pt_ok eq sched_stat 4 12 47 +pt_down c 48 +end + +note Some running job whose worker has reported done (its result waits +note for review room). +fn pt_held to bool +for j ulong 64 +if eq get sjst j 3 +w = get sjw j +if eq sc_cell w 64 get scseq w +ret true +end +end +end +ret false +end + +note Phase V: release while review is full. Review limit 1, two workers, +note 2 CPU: j1 and j2 (1 CPU, 50 ms) both finish; one enters review, the +note other's result waits for room, yet both CPUs are free at once and j3 +note (2 CPU) runs before anything is reviewed. +fn pt_release to void +c = pt_setup 2 8 1 pt_req 2 1024 1 8 120 +j1 = pt_admit 150050 0 pt_req 1 0 0 0 120 +j2 = pt_admit 160050 0 pt_req 1 0 0 0 120 +dl = add ulong monons 2000000000 +for t ulong 1000000 +if eq sched_count 4 4 1 +if pt_held +break +end +end +pt_ok lt ulong monons dl 121 +pt_step c 121 +end +note The done report may land after the last collect: one more step +note collects it (review stays full, so nothing else changes). +pt_step c 121 +pt_ok eq get suse 0 0 122 +j3 = pt_admit 170050 0 pt_req 2 0 0 0 123 +pt_ok pt_until c j3 3 4 2000 123 124 +pt_drain c 3 3000 125 +pt_down c 126 +end + +note Phase F: ready order. With one worker, x is admitted first waiting on +note topic 8 and y second ready at once; then topic 8 is published. FIFO +note (policy 0) serves the job that became ready first, y. +fn pt_order to void +buf = new uchar 4096 0 +c = pt_setup 1 8 8 pt_req 4 1024 1 8 50 +x = pt_admit 60050 8 0 51 +y = pt_admit 70050 0 0 52 +pt_ok gt sched_publish c 8 buf 16 0 53 +pt_ok eq get sjst y 3 54 +pt_ok eq get sjst x 2 55 +pt_drain c 2 3000 56 +pt_down c 57 +end + +note Witness of a head-of-line block, read with no step in between: a runs +note unfinished holding its need, the head h is ready and does not fit, x +note is ready and fits, a live worker is idle, and dispatch stopped at the +note head at least once since h0 (codes code..code+4 when not). +fn pt_witness c long a ulong h ulong x ulong h0 ulong code int to void +w = get sjw a +pt_ok eq get sjst a 3 code +pt_ok ne sc_cell w 64 get scseq w code +pt_ok eq get sjheld a 1 code +pt_ok eq get sjst h 2 add code 1 +pt_ok not sp_fits get sjneed h 0 add code 1 +pt_ok eq get sjst x 2 add code 2 +pt_ok sp_fits get sjneed x 0 add code 2 +i = sp_idle mapget c 48 8 +pt_ok lt i 64 add code 3 +pt_ok gt sched_stat 8 h0 add code 4 +r = write 1 pw1 0 len pw1 +pt_num get sjid h +r = write 1 pw2 0 len pw2 +pt_num get sjid x +r = write 1 pw3 0 len pw3 +pt_num sp_free 0 +r = write 1 pw4 0 len pw4 +pt_num i +r = write 1 phol 0 len phol +pt_num sub sched_stat 8 h0 +r = write 1 pnl 0 1 +end + +note Phase A: the blocked head. a (3 CPU, 800 ms) runs; then b (2 CPU, +note cannot fit) and c (1 CPU, fits) arrive with no dependency. The target: +note c runs while a still runs and b waits (0). When c has not run within +note 400 ms, the witness is checked and printed and the phase returns 11: +note c stayed idle behind b although a CPU and a worker were free. +fn pt_blocked to int +c = pt_setup 3 8 8 pt_req 4 1024 1 8 10 +a = pt_admit 10800 0 pt_req 3 0 0 0 10 +pt_ok pt_until c a 3 3 2000 10 10 +b = pt_admit 20050 0 pt_req 2 0 0 0 10 +x = pt_admit 30050 0 pt_req 1 0 0 0 10 +h0 = sched_stat 8 +v = int 0 +if pt_until c x 3 4 400 10 +pt_ok eq get sjst a 3 12 +pt_ok eq get sjst b 2 13 +else +pt_witness c a b x h0 12 +v = int 11 +end +pt_drain c 3 5000 17 +pt_down c 18 +ret v +end + +note Phase B: a second head-of-line case, after the pump's queue-of-two +note scenario (the bounded queue itself is not modelled: every admitted +note job is in the table). a (3 CPU, 800 ms) runs, b and d (2 CPU) cannot +note fit, e (1 CPU) fits. Target: e runs while a still runs (0); else the +note witness and 21. +fn pt_exclude to int +c = pt_setup 3 8 8 pt_req 4 1024 1 8 20 +a = pt_admit 10800 0 pt_req 3 0 0 0 20 +pt_ok pt_until c a 3 3 2000 20 20 +b = pt_admit 20050 0 pt_req 2 0 0 0 20 +d = pt_admit 40050 0 pt_req 2 0 0 0 20 +e = pt_admit 50050 0 pt_req 1 0 0 0 20 +h0 = sched_stat 8 +v = int 0 +if pt_until c e 3 4 400 20 +pt_ok eq get sjst a 3 22 +else +pt_witness c a b e h0 22 +v = int 21 +end +pt_drain c 4 5000 27 +pt_down c 28 +ret v +end + +fn pt_stats to void +r = write 1 pst 0 len pst +pt_num sched_stat 2 +r = write 1 pex 0 len pex +pt_num sched_stat 3 +r = write 1 pas 0 len pas +pt_num sched_stat 4 +r = write 1 phol 0 len phol +pt_num sched_stat 8 +r = write 1 pbyp 0 len pbyp +pt_num sched_stat 5 +r = write 1 pres 0 len pres +pt_num sched_stat 6 +r = write 1 pnl 0 1 +end + +note The regression phases A and B return their verdict, so both run and +note print their witness; the first failing one is the exit status. +fn main to int +pt_impossible +pt_churn +pt_release +pt_order +ra = pt_blocked +rb = pt_exclude +if ne ra 0 +ret ra +end +if ne rb 0 +ret rb +end +if ne write 1 pok 0 len pok long len pok +ret 100 +end +ret 0 +end