diff --git a/Makefile b/Makefile index 3551fea3f..de904f537 100644 --- a/Makefile +++ b/Makefile @@ -2604,3 +2604,29 @@ $(GPU_LAUNCH_COST_TEST): tests/gpu_launch_cost_test.c src/omega_gpu_fp8_api.h sr GPU_L2_REUSE_TEST = $(OUT_DIR)/gpu_l2_reuse_test $(GPU_L2_REUSE_TEST): tests/gpu_l2_reuse_test.c src/omega_gpu_fp8_api.h src/omega_gpu_cmdlist.h $(OUT_DIR)/libomega_gpu.a $(CC) $(CFLAGS) -ffp-contract=off -o $@ tests/gpu_l2_reuse_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm + +# OMEGA_OFFLINE_DAGSIM (omega-mv#583): offline resource-DAG cost evaluator. +# Composes per-op costs (from OEV1 files or rx_costmodel predictions) under +# finite resources. Host only, no GPU; reuses rx_costmodel.o and never links +# anything that maps or runs code. +.PHONY: test-dagsim dagsim +DS_OBJ = $(OUT_DIR)/dagsim.o +$(DS_OBJ): tools/dagsim/dagsim.c tools/dagsim/dagsim.h src/runtime/rx_costmodel.h | $(OUT_DIR) + $(CC) $(CFLAGS) -Itools/dagsim -c -o $@ tools/dagsim/dagsim.c + @if nm -u $@ | grep -E 'rx_gen_|aienos_cap_|rx_caproot_|rx_capadmin_|rx_world_|mmap|mprotect|fork|exec|dlopen|system' ; then \ + echo "dagsim.o references an operation an offline evaluator must not have"; \ + rm -f $@; exit 1; fi + +DS_UNIT = $(OUT_DIR)/dagsim_unit +$(DS_UNIT): tests/dagsim/dagsim_unit.c $(DS_OBJ) $(RX_CM_OBJ) src/sha256.c | $(OUT_DIR) + $(CC) $(CFLAGS) -Itools/dagsim -o $@ tests/dagsim/dagsim_unit.c $(DS_OBJ) $(RX_CM_OBJ) src/sha256.c -lm + +test-dagsim: $(DS_UNIT) $(DS_CLI) + ./$(DS_UNIT) + sh tests/dagsim/run_cli.sh $(DS_CLI) $(OUT_DIR)/dagsim-cli-out + +DS_CLI = $(OUT_DIR)/dagsim +$(DS_CLI): tools/dagsim/dagsim_cli.c $(DS_OBJ) $(RX_CM_OBJ) src/sha256.c | $(OUT_DIR) + $(CC) $(CFLAGS) -Itools/dagsim -o $@ tools/dagsim/dagsim_cli.c $(DS_OBJ) $(RX_CM_OBJ) src/sha256.c -lm + +dagsim: $(DS_CLI) diff --git a/docs/research/276-crossover-matrix.md b/docs/research/276-crossover-matrix.md new file mode 100644 index 000000000..27175eb02 --- /dev/null +++ b/docs/research/276-crossover-matrix.md @@ -0,0 +1,74 @@ +# Symposium crossover matrix for aien-architecture#276 + +Written 2026-10-19 by the research/cost-sim-583 agent (ledger L050). Answers the +"Symposium crossover: unresolved" section of aien-dev/aien-architecture#276. + +## What "Symposium" is + +The tracking issue could not find Symposium because it is not an aien-dev repository. +It is the outside project **symposium-dev/symposium** ("cargo agents", licence MIT OR +Apache-2.0): a Cargo subcommand that scans a Rust workspace, matches plugins against +the dependency graph, and installs crate-matched skills, hooks and MCP servers into +whichever coding agent is in use, from one agent-agnostic manifest. + +Pinned source read for this check (read-only clone at `~/workspace/_ext/symposium`): + +- symposium-dev/symposium @ `b420d5dc4c71abde973cea8cb4f30ea4c8e76ae0` (main, 2026-10-19, + "Merge pull request #322 from Fluzko/reference-docs"), 561 tracked files. + Modules: `src/{agents,hook.rs,hook_schema,skills.rs,sync.rs,plugins.rs,predicate.rs, + crate_sources,pm,telemetry,...}`. No cost model, scheduler, DAG, bandwidth, energy + or hardware model exists in the tree: `git grep -il "cost model|simulat|resource.dag| + bandwidth|joule|energy|roofline|critical path|learning mechanism|retention|payback"` + matches only mdbook/RFD prose about telemetry and the blog post, never `src/`. + The three `cost` hits in `src/` are comments about network cost of a registry fetch + (`src/hook.rs:275`, `src/hook.rs:480`, `src/skills.rs:194`). +- Open PRs at the time of the check (30): #320 to #361. Every one is about agent + plugin installation (Claude Code, Codex, Copilot, Goose, Antigravity), skill/hook sync, + or opt-in local telemetry recording (#326 to #358). PR #339 "RFD: Evaluating agent + tasks with and without Symposium" is an A/B protocol for coding-agent tasks, not a + hardware or learning-cost experiment. + +What AIEN already took from Symposium today (another Hermes session, same day): + +- Audit and design: `~/workspace/agents-in-tree/BRIEF.md` (on the Spark). +- ADR 0038 "Agent guidance travels with the tree", aien-architecture branch + `agents/in-tree-guidance` @ `600a7584c277fa02ff3fbea48088e1d0ac07f149`, + `docs/adr/0038-agent-guidance-travels-with-the-tree.md`. +- Seven branch heads in `~/handoffs/2026-10-19-agents-in-tree.md`; the omega one is + `agents/in-tree-guidance` @ `984b7eed9b86e1a25b79251ad5a30529f597faab` and touches only + `.crumb`, `agents.toml`, `skills/omega-basics/SKILL.md`, `tools/.crumb`, + `tools/agent-hooks/*` (10 files, 640 insertions). +- Borrowed-ideas plan: `~/handoffs/2026-10-19-borrowed-ideas/PLAN.md` (Symposium is not one + of its 20 items; its sources are TensorFold, llama.cpp, vLLM, SGLang, seL4, Linux, etc.). + +## Matrix + +Overlap is judged on three tests the issue asks for: same mechanism, same file, same +contract. "None" means all three fail with the evidence named. + +| Deliverable | Symposium (b420d5dc, PRs #320 to #361) | agents-in-tree work (ADR 0038, 7 branches) | Verdict | +|---|---|---|---| +| omega-mv#583 offline resource-DAG cost simulator (schema, evaluator over `src/runtime/rx_costmodel.c` estimates, bounds, energy accounting, attribution, held-out gates) | Mechanism: none (no cost, DAG, scheduling, bandwidth, energy or hardware code in `src/`). Files: none (Rust CLI for agent config; omega is C). Contract: none (its only versioned data contract is the opt-in telemetry JSONL in `md/rfds/telemetry-recording/contract/recorded-data.md`, about agent command counts and durations, not machine resources). | Mechanism: none (hooks that block `--admin`, force push, kill; skill lookup). Files: none. The omega branch touches no path under `src/`, `tests/`, `docs/research/`, `evidence/`. Contract: none. | **None.** | +| omega-mv#584 bounded learning-mechanism search, native pilot, retention and payoff | Mechanism: none (plugin matching is a static predicate over Cargo metadata, `src/predicate.rs`; no search, no update rule, no retention measurement). Files: none. Contract: none. PR #339 is an evaluation RFD for coding-agent productivity with and without Symposium: a methodological neighbour (A/B arms, held-out tasks) but a different subject, no shared artefact. | Mechanism: none. Files: none. Contract: none. | **None.** | +| aien-architecture#246 E03 plan-reuse campaign on `src/runtime/rx_plan.c` with lifecycle payback and retention accounting | Mechanism: partial idea only. Symposium caches resolved plugin predicates (`src/predicate_cache.rs`, `src/workspace_state.rs`) and re-syncs on each hook when dependencies change, which is "reuse a cached result while its inputs are unchanged, invalidate when they change". That is the same shape as plan reuse with precondition invalidation, but it is a build-tool cache keyed on `cargo metadata`, not a verified-plan store, and no code, file or contract is shared with `rx_plan`. | Mechanism: none for the campaign itself. The in-tree skills tell agents how to run tests and what not to touch; they do not implement or measure reuse. Files: none under `src/runtime/` or `tests/runtime/`. | **None at mechanism/file/contract level; one design idea in common (cache + invalidate on changed inputs), already present in rx_plan.** | + +## Reuse / extend / missing, per #276's request + +- Reuse from Symposium: nothing for #583/#584/#246. The parts worth reusing (one manifest, + in-tree skills and hooks, translated per agent) were already taken by ADR 0038 and + belong to agent guidance, not to cost simulation or learning search. +- Extend: nothing. No Symposium component can be extended into a cost model, DAG + evaluator or learning-search harness without becoming a new project. +- Missing: nothing is missing because of Symposium. #583, #584 and #246 proceed on + existing omega code (`rx_costmodel`, `rx_plan`, `omega_realize_synth`) as their issues + already state. + +## Consequence for sequencing + +The "overlapping runtime changes wait for this check" gate in #276 is cleared: there is no +overlap, so #583 (additive offline harness) and #584 (bounded search) need no coordination +with Symposium or with the `agents/in-tree-guidance` branches beyond the ordinary rule of +not editing `agents.toml`, `skills/`, `tools/agent-hooks/` in their worktrees. + +Status: PASS for the crossover check (the check ran and found no overlap). This is a +source observation at the pinned commits above, not a qualification run. diff --git a/evidence/DAGSIM-583-48ca401/PRECOMMIT.md b/evidence/DAGSIM-583-48ca401/PRECOMMIT.md new file mode 100644 index 000000000..2d44ffeec --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/PRECOMMIT.md @@ -0,0 +1,52 @@ +# PRECOMMIT: held-out gates for the shared-bandwidth model (omega-mv#583) + +Written and committed BEFORE any held-out row was measured. Branch +research/cost-sim-583. Evaluator: tools/dagsim at the commit that contains this file. + +## Hypothesis under test + +k threads copying one 1 GB buffer on the Spark CPU behave like k independent copy +ops whose own busy time is `T1/k` (per-thread rate from M1 block4, k=1) and whose +traffic `2 GB / k` each shares one pipe of capacity `CAP` (M1 block4, k=8). The DAG +evaluator predicts time = `max(T1/k, 2 GB / CAP)` with the interval from the receipts' +repeat spread. The structural claim being tested is the processor-sharing pipe: +concurrent full-bandwidth claims do not add. + +Fitting set (used, never re-measured here): `~/yardsticks/aien-model/M1/block4.csv`, +rows gb=1 threads=1 (T1 = 0.1117 s median, 0.1079 to 0.1166) and gb=1 threads=8 +(CAP = 65.4 GB/s read+write median, 60.8 to 69.8). Load during that receipt: 14.8 to 29. + +Held-out set (measured after this file is committed): k = 2, 3, 5, 6 at 1 GB, fresh, +10 reps each, via `quiet-measure flock /tmp/aien-gb10.lock nice -n 10 memcpy_probe 1 k 10`. +Also measured: k = 4 (block4 has it: the lookup control's home ground, excluded from the +gates) and k = 16 (expected OUT of envelope: 16 threads plus the current load exceed +20 cores; excluded from the gates, reported as a refusal case). + +## Development noise (what the gates are set from) + +block4 repeat spread at 1 GB: k=1 is 17.1 to 18.5 GB/s (plus or minus 4% of median), +k=8 is 60.8 to 69.8 (plus or minus 7%), k=4 is 48.6 to 60.9 (plus or minus 11%), +k=16 is 34.6 to 47.1 (plus or minus 15%). Load was 15 to 29 and is 29 now. + +## Gates (numbers fixed now) + +- G-err (numerical error): for each of k = 2, 3, 5, 6, |predicted GB/s minus measured + median GB/s| / measured median <= 25%. PASS needs 4 of 4. 25% is about twice the worst + development spread at the held-out thread counts. +- G-cov (interval coverage): the evaluator's [lo, hi] interval (optimistic to pessimistic + point from the receipts' lo/hi) contains the measured median for at least 3 of the 4 + held-out k. The interval is narrow (about plus or minus 7%), so under load 29 this gate + may fail; a FAIL here means the receipts' repeat spread understates day-to-day variance + and `sd_scale`-style widening is needed, which is a real finding, not a tuning knob. +- Controls reported beside the model, not gated: nearest-k lookup from block4 (log2 + distance), and a spec roofline `max(T1/k, 2 GB / 273 GB/s)`. +- Selection regret: not applicable to this DAG family (one candidate per k); reported as + NOT_RUN for this held-out set. +- Energy: UNMEASURED. No instrument is integrated over these runs. + +## What a FAIL means + +The model is retained only for what passes. A G-err FAIL on k=2,3 (busy-time bound) +falsifies the per-thread rate carrying over from k=1; a FAIL on k=5,6 (pipe bound) +falsifies the k=8 pipe figure as a capacity. Either is recorded in the dossier as a +falsified cost hypothesis with the numbers. diff --git a/evidence/DAGSIM-583-48ca401/PRECOMMIT_round3.md b/evidence/DAGSIM-583-48ca401/PRECOMMIT_round3.md new file mode 100644 index 000000000..8c396bf88 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/PRECOMMIT_round3.md @@ -0,0 +1,20 @@ +# PRECOMMIT round 3: is the low-k shortfall a core-class effect? + +Committed before measuring. Round 2 found two unpinned threads reach 1.47x of one thread +(55.7 vs 37.9 GB/s) while the pipe (95 GB/s) was far from binding. The GB10 has two core +classes: Cortex-X925 at 3.9 GHz on cpus 5-9 and 15-19, Cortex-A725 at 2.8 GHz on cpus 0-4 and +10-14 (`/sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq`, midr parts 0xd85 and 0xd87). + +Experiment: `PIN=5-9,15-19 KS="1 2 3" measure.sh ... round3_x925` and +`PIN=0-4,10-14 KS="1 2 3" measure.sh ... round3_a725`, 10 reps each, both locks, headroom rule. + +Precommitted reading: +- If X925-pinned k=2 is >= 1.8x X925-pinned k=1 (and k=3 >= 2.6x), the round-2 shortfall is + thread placement across classes; the fix is a per-class `compute` resource with its own + per-thread rate in the fixture (OEV1 can express it today). Verdict: RETAINED with a + placement caveat. +- If X925-pinned k=2 is still < 1.6x of k=1, the shortfall is inside one class (cluster-level + memory path or interconnect), and the per-op busy-time model needs a sublinear term: + Verdict: FALSIFIED for k < 5 on this box, schema v2 item. +- A725 rows are the control: the per-thread rate should be lower than X925's; if A725 k=1 is + about 1/1.47 of X925 k=1, the unpinned k=2 figure is consistent with one thread per class. diff --git a/evidence/DAGSIM-583-48ca401/README.md b/evidence/DAGSIM-583-48ca401/README.md new file mode 100644 index 000000000..94d720fc7 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/README.md @@ -0,0 +1,46 @@ +# DAGSIM-583 evidence: offline resource-DAG cost simulator (omega-mv#583) + +Branch `research/cost-sim-583`, evaluator `tools/dagsim`, schema `spec/offline-evidence-v1.md`. +Host spark-b87b (GB10, 20 cores, 128 GiB unified). Everything here is offline: the evaluator never +executed anything, and the only new measurement is a CPU memcpy probe (no GPU). Every number below +is a loaded-box number; load averages are in the file headers. + +## Contents + +| Path | What | Produced by | +|---|---|---| +| `PRECOMMIT.md` | held-out gates and what FAIL means, committed before measuring | hand-written | +| `fixtures/memcpy_k{2,3,5,6,4,16}.oev` | held-out DAGs, fitted from M1 block4 k=1 and k=8 only | `tests/dagsim/heldout_memcpy.sh predict` | +| `predictions/memcpy_k*.json` | evaluator output per DAG (bounds, attribution, sensitivities) | `build/dagsim eval FILE --asof 2026-10-20` | +| `predictions.csv` | predicted seconds, lo/hi, GB/s, lookup control, spec-roofline control | same script | +| `measured/memcpy_k*.csv` | fresh measurements, 10 reps each, block4 CSV shape, load in header | `tests/dagsim/measure.sh` under `quiet-measure` | +| `measured/LOCK.txt` | whether the GB10 lock was held during the runs | same | +| `heldout_results.md` | round 1 gate verdicts (FAIL, FAIL): block4 morning calibration vs afternoon box | `tests/dagsim/heldout_memcpy.sh compare` | +| `heldout_round1_interpretation.md` | why round 1 failed (calibration taken under other tenants' DRAM traffic) | hand-written | +| `round2_fit/`, `fixtures/round2_*.oev`, `round2_predictions/`, `round2_predictions.csv` | same-state refit (k=1, k=8) and predictions committed before the held-out rows | `FIT_DIR=round2_fit ... predict` | +| `round2_heldout/`, `round2_heldout_results.md` | round 2 held-out rows and verdicts (G-err FAIL 3/4, G-cov PASS 3/4) | `measure.sh`, `... compare` | +| `heldout_round2_interpretation.md` | pipe regime retained, low-k independence falsified, next experiment | hand-written | +| `PRECOMMIT_round3.md`, `round3_x925/`, `round3_a725/`, `heldout_round3_interpretation.md` | core-class pinned k=1,2,3; INCONCLUSIVE at load 56 | `measure.sh PIN=`, hand-written | +| `cli-example/` | `run_cli.sh` outputs on the pinned M1 fixtures (JSON, Pareto table) | `tests/dagsim/run_cli.sh` | +| `test-dagsim.log` | `make test-dagsim` output (unit + CLI checks) through `quiet-build` | Makefile | + +## Reproduce + +``` +cd +make PHYSICS_DIR=~/workspace/physics-pf-6d7cf0d4 OUT_DIR=build test-dagsim # 171 unit checks + 26 CLI checks, no GPU +build/dagsim eval tests/dagsim/fixtures/m1_spark_subset.oev --asof 2026-10-20 +build/dagsim pareto tests/dagsim/fixtures/*.oev --asof 2026-10-20 +sh tests/dagsim/heldout_memcpy.sh build/dagsim evidence/DAGSIM-583-48ca401 predict # byte-identical to predictions.csv +``` + +The `--asof` date is required so a rerun on a later day reproduces the same validity check +(the M1 calibration is 30 days; after 2026-11-18 the fixtures refuse as STALE, by design). + +## Status per #583 acceptance box + +Held-out verdict in one line: the shared-pipe rule is retained for k >= 3 on the same box state +(within 1% at k=5,6, intervals cover); low-k per-thread independence is falsified (k=2 +36%); +a calibration from a different box state does not transfer at all (round 1, 1.7x to 2.4x). +Energy: UNMEASURED throughout. Selection regret: NOT_RUN. Independent reproduction: not done. +Full checklist in `~/handoffs/2026-10-19-research-583.md`. diff --git a/evidence/DAGSIM-583-48ca401/cli-example/diff_bad.json b/evidence/DAGSIM-583-48ca401/cli-example/diff_bad.json new file mode 100644 index 000000000..f421e81fe --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/diff_bad.json @@ -0,0 +1 @@ +{"tool": "dagsim diff", "baseline": "tests/dagsim/fixtures/mw_baseline.oev", "transformed": "tests/dagsim/fixtures/mw_bad_elimination.oev", "status": "REFUSED_REMOVED_REQUIRED", "reason": "op check: removal reason 1 not supported by its evidence (ref= proof= changed=)", "kept": 1, "added": 0, "removed": 2, "double_counted": 0, "required_removed": 1, "removed_ns": {"eliminated": 200, "reused": 0, "unchanged_dep": 0, "deferred": 0, "moved": 0, "shared": 0, "lookup": 0}, "changed": ""} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/diff_reuse.json b/evidence/DAGSIM-583-48ca401/cli-example/diff_reuse.json new file mode 100644 index 000000000..6e407059a --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/diff_reuse.json @@ -0,0 +1 @@ +{"tool": "dagsim diff", "baseline": "tests/dagsim/fixtures/mw_baseline.oev", "transformed": "tests/dagsim/fixtures/mw_reuse.oev", "status": "OK", "reason": "", "kept": 3, "added": 1, "removed": 1, "double_counted": 0, "required_removed": 0, "removed_ns": {"eliminated": 0, "reused": 200, "unchanged_dep": 0, "deferred": 0, "moved": 0, "shared": 0, "lookup": 0}, "changed": ""} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/diff_same.json b/evidence/DAGSIM-583-48ca401/cli-example/diff_same.json new file mode 100644 index 000000000..b7a1fbda9 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/diff_same.json @@ -0,0 +1 @@ +{"tool": "dagsim diff", "baseline": "tests/dagsim/fixtures/mw_baseline.oev", "transformed": "tests/dagsim/fixtures/mw_baseline.oev", "status": "OK", "reason": "", "kept": 4, "added": 0, "removed": 0, "double_counted": 0, "required_removed": 0, "removed_ns": {"eliminated": 0, "reused": 0, "unchanged_dep": 0, "deferred": 0, "moved": 0, "shared": 0, "lookup": 0}, "changed": ""} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/overlap.json b/evidence/DAGSIM-583-48ca401/cli-example/overlap.json new file mode 100644 index 000000000..481e3529b --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/overlap.json @@ -0,0 +1,32 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/m1_spark_overlap.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 96256700, "lo": 94706100, "hi": 99059500, "interval_known": true}, + "bounds_ns": {"critical_path": 96256700, "max": 96256700, "resources": {"cpu": 5551000, "gpu": 40736700, "dram_spec": 0, "dram_gpu": 0, "dram_cpu": 3.0581e+07, "unified_mem": 0, "gpu_launch": 40736700}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "realize", "start_ns": 0, "end_ns": 20000, "floor_ns": 20000, "contention_ns": 0, "prov": "measured", "src": "M1/block1.csv:path_ns_per_call"}, + {"id": "gpu_job", "start_ns": 20000, "end_ns": 40756700, "floor_ns": 40736700, "contention_ns": 0, "prov": "measured", "src": "M1/block2.csv:vecadd_65"}, + {"id": "copyA", "start_ns": 40756700, "end_ns": 96256700, "floor_ns": 55500000, "contention_ns": 1.52905e+07, "prov": "measured", "src": "M1/block4.csv:gb=1,threads=1,half"}, + {"id": "copyB", "start_ns": 40756700, "end_ns": 96256700, "floor_ns": 55500000, "contention_ns": 1.52905e+07, "prov": "measured", "src": "M1/block4.csv:gb=1,threads=1,half"} + ], + "critical_path": ["realize", "gpu_job", "copyA"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 40756700, "cap": 137438953472}}, + "attribution_ns": {"compute": 55520000, "bandwidth": 0, "contention": 0, "launch": 40736700, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 4, "total_bytes": 2000000000, "total_busy_ns": 111020000, "total_launch_ns": 40736700, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "gpu_launch", "kind": "launch", "makespan_if_doubled_ns": 55520000, "delta_ns": 40736700, "interval_width_frac": 0, "decision_score": 2036835, "next_experiment": "measure launch with the device context held open (M1 block2 follow-up)"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "gpu", "kind": "compute", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_spec", "kind": "bandwidth", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure this bandwidth on this DAG's shapes (datasheet figure, never attained)"}, + {"resource": "dram_gpu", "kind": "bandwidth", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 0.00182983, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 96256700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/pareto.txt b/evidence/DAGSIM-583-48ca401/cli-example/pareto.txt new file mode 100644 index 000000000..843ec0b02 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/pareto.txt @@ -0,0 +1,6 @@ +# dagsim pareto: objectives = seconds, peak bytes. Energy not measured on every row: shown, never ranked. +# file status seconds lo_s hi_s peak_bytes energy front + tests/dagsim/fixtures/m1_spark_subset.oev OK 0.151757 0.148656 0.157360 2000000000 UNMEASURED no + tests/dagsim/fixtures/m1_spark_overlap.oev OK 0.096257 0.094706 0.099060 2000000000 UNMEASURED yes + tests/dagsim/fixtures/m1_synthetic_power.oev OK 0.151757 0.148656 0.157360 2000000000 syn 15.176 J no + tests/dagsim/fixtures/needs_arch244_trace.oev REFUSED_UNKNOWN - - - - - refused # op objective_replay has prov=unknown (aien-architecture); unknown stays unknown diff --git a/evidence/DAGSIM-583-48ca401/cli-example/stale.json b/evidence/DAGSIM-583-48ca401/cli-example/stale.json new file mode 100644 index 000000000..beb437393 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/stale.json @@ -0,0 +1,8 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/m1_spark_subset.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20788, + "status": "REFUSED_STALE", "reason": "calibration M1-20261019 is stale: asof is 13 day(s) past the validity envelope", + "provenance": [], "synthetic": 0, "offline": true, "gpu_executed": false +} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/subset.json b/evidence/DAGSIM-583-48ca401/cli-example/subset.json new file mode 100644 index 000000000..38784b09d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/subset.json @@ -0,0 +1,31 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/m1_spark_subset.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 151756700, "lo": 148656100, "hi": 157359500, "interval_known": true}, + "bounds_ns": {"critical_path": 151756700, "max": 151756700, "resources": {"cpu": 5551000, "gpu": 40736700, "dram_spec": 0, "dram_gpu": 0, "dram_cpu": 3.0581e+07, "unified_mem": 0, "gpu_launch": 40736700}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "realize", "start_ns": 0, "end_ns": 20000, "floor_ns": 20000, "contention_ns": 0, "prov": "measured", "src": "M1/block1.csv:path_ns_per_call"}, + {"id": "gpu_job", "start_ns": 20000, "end_ns": 40756700, "floor_ns": 40736700, "contention_ns": 0, "prov": "measured", "src": "M1/block2.csv:vecadd_65"}, + {"id": "copy1g", "start_ns": 40756700, "end_ns": 151756700, "floor_ns": 111000000, "contention_ns": 0, "prov": "measured", "src": "M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["realize", "gpu_job", "copy1g"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 40756700, "cap": 137438953472}}, + "attribution_ns": {"compute": 111020000, "bandwidth": 0, "contention": 0, "launch": 40736700, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 3, "total_bytes": 2000000000, "total_busy_ns": 111020000, "total_launch_ns": 40736700, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "gpu_launch", "kind": "launch", "makespan_if_doubled_ns": 111020000, "delta_ns": 40736700, "interval_width_frac": 0, "decision_score": 2036835, "next_experiment": "measure launch with the device context held open (M1 block2 follow-up)"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "gpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_spec", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure this bandwidth on this DAG's shapes (datasheet figure, never attained)"}, + {"resource": "dram_gpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.00182983, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/subset2.json b/evidence/DAGSIM-583-48ca401/cli-example/subset2.json new file mode 100644 index 000000000..38784b09d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/subset2.json @@ -0,0 +1,31 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/m1_spark_subset.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 151756700, "lo": 148656100, "hi": 157359500, "interval_known": true}, + "bounds_ns": {"critical_path": 151756700, "max": 151756700, "resources": {"cpu": 5551000, "gpu": 40736700, "dram_spec": 0, "dram_gpu": 0, "dram_cpu": 3.0581e+07, "unified_mem": 0, "gpu_launch": 40736700}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "realize", "start_ns": 0, "end_ns": 20000, "floor_ns": 20000, "contention_ns": 0, "prov": "measured", "src": "M1/block1.csv:path_ns_per_call"}, + {"id": "gpu_job", "start_ns": 20000, "end_ns": 40756700, "floor_ns": 40736700, "contention_ns": 0, "prov": "measured", "src": "M1/block2.csv:vecadd_65"}, + {"id": "copy1g", "start_ns": 40756700, "end_ns": 151756700, "floor_ns": 111000000, "contention_ns": 0, "prov": "measured", "src": "M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["realize", "gpu_job", "copy1g"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 40756700, "cap": 137438953472}}, + "attribution_ns": {"compute": 111020000, "bandwidth": 0, "contention": 0, "launch": 40736700, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 3, "total_bytes": 2000000000, "total_busy_ns": 111020000, "total_launch_ns": 40736700, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "gpu_launch", "kind": "launch", "makespan_if_doubled_ns": 111020000, "delta_ns": 40736700, "interval_width_frac": 0, "decision_score": 2036835, "next_experiment": "measure launch with the device context held open (M1 block2 follow-up)"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "gpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_spec", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure this bandwidth on this DAG's shapes (datasheet figure, never attained)"}, + {"resource": "dram_gpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.00182983, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/syn.json b/evidence/DAGSIM-583-48ca401/cli-example/syn.json new file mode 100644 index 000000000..8c2ced645 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/syn.json @@ -0,0 +1,31 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/m1_synthetic_power.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["synthetic", "measured", "specified"], "synthetic": 1, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 151756700, "lo": 148656100, "hi": 157359500, "interval_known": true}, + "bounds_ns": {"critical_path": 151756700, "max": 151756700, "resources": {"cpu": 5551000, "gpu": 40736700, "dram_spec": 0, "dram_gpu": 0, "dram_cpu": 3.0581e+07, "unified_mem": 0, "gpu_launch": 40736700}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "realize", "start_ns": 0, "end_ns": 20000, "floor_ns": 20000, "contention_ns": 0, "prov": "measured", "src": "M1/block1.csv:path_ns_per_call"}, + {"id": "gpu_job", "start_ns": 20000, "end_ns": 40756700, "floor_ns": 40736700, "contention_ns": 0, "prov": "measured", "src": "M1/block2.csv:vecadd_65"}, + {"id": "copy1g", "start_ns": 40756700, "end_ns": 151756700, "floor_ns": 111000000, "contention_ns": 0, "prov": "measured", "src": "M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["realize", "gpu_job", "copy1g"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 40756700, "cap": 137438953472}}, + "attribution_ns": {"compute": 111020000, "bandwidth": 0, "contention": 0, "launch": 40736700, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "SYNTHETIC_SENSITIVITY_ONLY", "joules": 15.1757, "instrument": "what-if-100W", "boundary": "wall", "ranking_valid": false}, + "conservation": {"n_ops": 3, "total_bytes": 2000000000, "total_busy_ns": 111020000, "total_launch_ns": 40736700, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "gpu_launch", "kind": "launch", "makespan_if_doubled_ns": 111020000, "delta_ns": 40736700, "interval_width_frac": 0, "decision_score": 2036835, "next_experiment": "measure launch with the device context held open (M1 block2 follow-up)"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "gpu", "kind": "compute", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_spec", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure this bandwidth on this DAG's shapes (datasheet figure, never attained)"}, + {"resource": "dram_gpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.00182983, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 151756700, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/cli-example/unknown.json b/evidence/DAGSIM-583-48ca401/cli-example/unknown.json new file mode 100644 index 000000000..434aba51c --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/cli-example/unknown.json @@ -0,0 +1,8 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "tests/dagsim/fixtures/needs_arch244_trace.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019", "taken_day": 20745, "valid_days": 30, "load1": 24.2, "src": "~/yardsticks/aien-model/M1/"}, + "asof_day": 20746, + "status": "REFUSED_UNKNOWN", "reason": "op objective_replay has prov=unknown (aien-architecture); unknown stays unknown", + "provenance": [], "synthetic": 0, "offline": true, "gpu_executed": false +} diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k16.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k16.oev new file mode 100644 index 000000000..edbf7997d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k16.oev @@ -0,0 +1,27 @@ +# held-out fixture: 16 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy5 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy6 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy7 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy8 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy9 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy10 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy11 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy12 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy13 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy14 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy15 kind=copy engine=cpu t_ns=6981250 lo=6743750 hi=7287500 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=125000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k2.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k2.oev new file mode 100644 index 000000000..88f9f15c7 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k2.oev @@ -0,0 +1,13 @@ +# held-out fixture: 2 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=55850000 lo=53950000 hi=58300000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=1000000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=55850000 lo=53950000 hi=58300000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=1000000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k3.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k3.oev new file mode 100644 index 000000000..8197bdb37 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k3.oev @@ -0,0 +1,14 @@ +# held-out fixture: 3 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=37233333 lo=35966667 hi=38866667 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=666666667 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=37233333 lo=35966667 hi=38866667 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=666666667 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=37233333 lo=35966667 hi=38866667 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=666666667 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k4.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k4.oev new file mode 100644 index 000000000..d6ad6eb22 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k4.oev @@ -0,0 +1,15 @@ +# held-out fixture: 4 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=27925000 lo=26975000 hi=29150000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=27925000 lo=26975000 hi=29150000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=27925000 lo=26975000 hi=29150000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=27925000 lo=26975000 hi=29150000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=500000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k5.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k5.oev new file mode 100644 index 000000000..ceaa92995 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k5.oev @@ -0,0 +1,16 @@ +# held-out fixture: 5 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=22340000 lo=21580000 hi=23320000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=22340000 lo=21580000 hi=23320000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=22340000 lo=21580000 hi=23320000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=22340000 lo=21580000 hi=23320000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=22340000 lo=21580000 hi=23320000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=400000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k6.oev b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k6.oev new file mode 100644 index 000000000..3b20ee6fe --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/memcpy_k6.oev @@ -0,0 +1,17 @@ +# held-out fixture: 6 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=M1-20261019-block4 taken=2026-10-19 valid_days=30 load1=14.8 src=~/yardsticks/aien-model/M1/block4.csv +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy5 kind=copy engine=cpu t_ns=18616667 lo=17983333 hi=19433333 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=333333333 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k16.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k16.oev new file mode 100644 index 000000000..a58d24b7a --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k16.oev @@ -0,0 +1,27 @@ +# held-out fixture: 16 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy5 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy6 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy7 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy8 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy9 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy10 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy11 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy12 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy13 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy14 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +op id=copy15 kind=copy engine=cpu t_ns=3303125 lo=2856250 hi=3643750 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=125000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k2.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k2.oev new file mode 100644 index 000000000..ff2b6da16 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k2.oev @@ -0,0 +1,13 @@ +# held-out fixture: 2 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=26425000 lo=22850000 hi=29150000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=1000000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=26425000 lo=22850000 hi=29150000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=1000000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k3.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k3.oev new file mode 100644 index 000000000..3e144c788 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k3.oev @@ -0,0 +1,14 @@ +# held-out fixture: 3 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=17616667 lo=15233333 hi=19433333 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=666666667 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=17616667 lo=15233333 hi=19433333 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=666666667 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=17616667 lo=15233333 hi=19433333 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=666666667 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k4.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k4.oev new file mode 100644 index 000000000..99edf4ea0 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k4.oev @@ -0,0 +1,15 @@ +# held-out fixture: 4 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=13212500 lo=11425000 hi=14575000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=13212500 lo=11425000 hi=14575000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=13212500 lo=11425000 hi=14575000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=500000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=13212500 lo=11425000 hi=14575000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=500000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k5.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k5.oev new file mode 100644 index 000000000..979e100f3 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k5.oev @@ -0,0 +1,16 @@ +# held-out fixture: 5 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=10570000 lo=9140000 hi=11660000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=10570000 lo=9140000 hi=11660000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=10570000 lo=9140000 hi=11660000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=10570000 lo=9140000 hi=11660000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=400000000 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=10570000 lo=9140000 hi=11660000 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=400000000 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k6.oev b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k6.oev new file mode 100644 index 000000000..998dbd32b --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k6.oev @@ -0,0 +1,17 @@ +# held-out fixture: 6 threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 +calibration id=round2-same-state taken=2026-10-19 valid_days=30 load1=25.11 src=evidence/DAGSIM-583-48ca401/round2_fit +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=dram_cpu kind=bandwidth cap=95.05e9 lo=60.6e9 hi=113e9 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +op id=copy0 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy1 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy2 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy3 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy4 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +op id=copy5 kind=copy engine=cpu t_ns=8808333 lo=7616667 hi=9716667 prov=measured src=evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1 bytes=333333333 bw=dram_cpu +buffer id=src bytes=1000000000 cap=unified_mem +buffer id=dst bytes=1000000000 cap=unified_mem +energy instrument=none diff --git a/evidence/DAGSIM-583-48ca401/heldout_results.md b/evidence/DAGSIM-583-48ca401/heldout_results.md new file mode 100644 index 000000000..d88e28151 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/heldout_results.md @@ -0,0 +1,20 @@ +# Held-out results: shared-bandwidth model vs fresh memcpy measurements + +Gates were precommitted in PRECOMMIT.md before any of these rows were measured. + +| k | measured median GB/s (n, min..max) | predicted GB/s [hi..lo] | rel. error | covered | lookup ctrl GB/s (err) | spec roofline GB/s (err) | envelope | +|---|---|---|---|---|---|---|---| +| 2 | 85.7 (10, 81.4..89.9) | 35.8 [34.3..37.1] | -58.2% | no | 17.9 (-79.1%) | 35.8 (-58.2%) | in | +| 3 | 107.0 (10, 89.4..117.1) | 53.7 [51.4..55.6] | -49.8% | no | 55.9 (-47.8%) | 53.7 (-49.8%) | in | +| 5 | 123.9 (10, 102.6..134.4) | 65.4 [60.8..69.7] | -47.2% | no | 55.9 (-54.9%) | 89.5 (-27.8%) | in | +| 6 | 113.5 (10, 93.5..128.5) | 65.4 [60.8..69.7] | -42.4% | no | 65.9 (-41.9%) | 107.4 (-5.4%) | in | +| 4 | 101.2 (10, 78.0..123.1) | 65.4 [60.8..69.7] | -35.4% | no | 55.9 (-44.8%) | 71.6 (-29.2%) | in (lookup home ground) | +| 16 | 129.2 (10, 103.8..136.5) | 65.4 [60.8..69.7] | -49.4% | no | 43.0 (-66.7%) | 273.0 (+111.3%) | OUT (16 threads + load above 20 cores) | + +## Gates (precommitted) + +- G-err: nominal prediction within 25% of the measured median on each of k=2,3,5,6: 0 of 4 passed. FAIL +- G-cov: [lo..hi] interval covers the measured median on at least 3 of 4 held-out k: 0 of 4 covered. FAIL +- Energy: UNMEASURED (no wall instrument integrated over these runs). + +Load during measurement is in the header lines of measured/*.csv; every number is a loaded-box number. diff --git a/evidence/DAGSIM-583-48ca401/heldout_round1_interpretation.md b/evidence/DAGSIM-583-48ca401/heldout_round1_interpretation.md new file mode 100644 index 000000000..6e72e4d5a --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/heldout_round1_interpretation.md @@ -0,0 +1,44 @@ +# Round 1 interpretation: both precommitted gates FAIL + +Measured 2026-10-19 14:30:43 CDT under the GB10 lock and the quiet lock (`measured/LOCK.txt`), +load1 11.7 at start, MemAvailable 10.1 GB at start (below the 12 GiB headroom rule; the probe +took 2 GB for about 20 s; this is a rule breach and is recorded here, not hidden), GPU utilisation +91% from another agent's chip job during the window (`~/yardsticks/sensors/2026-10-19.csv`, +14:30:36 to 14:31:20), timer overhead 23 ns per read. + +Result (`heldout_results.md`): the evaluator predicted 35.8 / 53.7 / 65.4 / 65.4 GB/s for +k = 2 / 3 / 5 / 6 and the probe measured 85.7 / 107.0 / 123.9 / 113.5 GB/s. Every held-out row +is 1.7x to 2.4x faster than predicted; no interval covers; both controls fail the same way +(lookup -42 to -79%, spec roofline -5 to -58%, and +111% on k=16 where it is meaningless). + +## What was falsified + +Not the DAG mechanics: the per-op floors, the processor-sharing pipe, bounds and attribution +all passed 171 analytical checks and the fixture arithmetic is exact. What failed is the +**transfer of the M1 block4 calibration (09:16 CDT, load 15 to 29, other agents' GPU jobs +streaming the same unified DRAM) to the box state at 14:30 CDT (load 11, one GPU job).** +Both probes pre-touch pages and copy per-thread slices (`bench/m1/block4_membw.c` on branch +m1/hardware-passport vs `tools/dagsim/memcpy_probe.c`; mmap vs malloc is the only difference), +so apparatus is not the explanation. The fitted per-thread rate (17.9 GB/s) and pipe capacity +(65.4 GB/s) were pressure-depressed numbers, and the schema's validity envelope carried only +`load1`, which does not see another tenant's DRAM traffic. + +Consequences for the schema and the evaluator (recorded, not yet implemented): + +1. The calibration envelope needs a DRAM-pressure indicator next to `load1` (GPU utilisation or + GB10 lock holders from the sensor log at the time of the receipt). `rx_costmodel` already + has the concept (pressure buckets); OEV1 calibration records do not, so a v2 field is owed. +2. A fitted bandwidth figure from a loaded window is a lower bound on the quiet figure, not a + capacity. Until pressure is in the envelope, the evaluator should label such caps + `measured_under_pressure` and refuse to rank candidates whose order depends on them. +3. The precommitted interval (receipt repeat spread) understates day-to-day variance by an + order of magnitude. `sd_scale`-style widening on a separate calibration set is required + before G-cov means anything (open item 583-a in the handoff). + +## Round 2 (same box state, same apparatus) + +Fit set measured fresh with the same probe at k=1 and k=8 (`round2_fit/`), new fixtures and +predictions committed before measuring k=2,3,5,6 again (`round2_heldout/`). Gates unchanged. +If round 2 passes, the structural model is retained for same-state use and the finding above is +the cost of the day; if it also fails, the per-thread-plus-shared-pipe model itself is wrong on +this box and goes in the dossier as falsified. diff --git a/evidence/DAGSIM-583-48ca401/heldout_round2_interpretation.md b/evidence/DAGSIM-583-48ca401/heldout_round2_interpretation.md new file mode 100644 index 000000000..0bf0055a4 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/heldout_round2_interpretation.md @@ -0,0 +1,40 @@ +# Round 2 interpretation: same box state, same probe + +Fit: `round2_fit/` (k=1: T1 = 52.85 ms per GB, 45.7 to 58.3; k=8: 95.05 GB/s, 60.6 to 113.0), +measured 19:48:44Z under both locks, load1 25.1, MemAvailable 36 GB. Held-out: `round2_heldout/`, +19:56:45Z, both locks, load1 10.0, MemAvailable 28 GB (headroom rule kept). Predictions were +committed at 9f8a9cea before the held-out rows existed. + +Verdict (`round2_heldout_results.md`): + +- G-err FAIL, 3 of 4: k=3 +13.2%, k=5 -0.4%, k=6 +1.1% pass; k=2 +35.9% fails + (predicted 75.7 GB/s, measured 55.7, spread 54.1 to 57.4, so it is not noise). +- G-cov PASS, 3 of 4 (k=3,5,6 covered; k=2 not). +- Controls: nearest-k lookup equals the model wherever the pipe binds (both use the k=8 figure) + and is worse at k=2 (-32%); the spec roofline (273 GB/s) is +35% to +173% everywhere. + +## What this says + +Retained for this box state: the shared-pipe regime. From k=5 on, k concurrent copies run at +the k=8 pipe figure within 1%, with the interval covering. "No sum of concurrent full-bandwidth +claims" is the right rule and the processor-sharing pipe reproduces it. + +Falsified: independence of per-thread busy time at low k. One thread copies at 37.9 GB/s, two +threads reach 55.7 together (1.47x, not 2x), three reach 83.9 (2.2x). The v1 op model has no +resource between "one core" and "the DRAM pipe", so it cannot express this. + +Candidate explanation, not yet tested: the GB10 has two core classes (10 Cortex-X925, 10 +Cortex-A725; `rx_costmodel` already separates `RX_CM_CORE_X925` and `RX_CM_CORE_A725`), and an +unpinned second thread can land on the slower class or on the other cluster's path to memory. + +## Next small experiment (bounded) + +Pin threads with `taskset` to X925 cores only and re-measure k=1,2,3 (three 20 s runs, CPU +only). If k=2 then reaches about 2x of k=1, the fix is a per-cluster bandwidth resource in the +fixture (expressible in OEV1 today: one `bandwidth` resource per cluster, no schema change). +If not, the per-op busy-time model needs a sublinear thread term, which is a v2 schema item. + +## Residual + +Unexplained after this round: the k=2 shortfall (20 GB/s of 75.7 predicted) and the wide k=8 +repeat spread (60.6 to 113.0 GB/s at load 25). Both are reported as residual, not attributed. diff --git a/evidence/DAGSIM-583-48ca401/heldout_round3_interpretation.md b/evidence/DAGSIM-583-48ca401/heldout_round3_interpretation.md new file mode 100644 index 000000000..749656988 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/heldout_round3_interpretation.md @@ -0,0 +1,22 @@ +# Round 3 interpretation: INCONCLUSIVE (load 56 during the pinned runs) + +`round3_x925/` and `round3_a725/` ran at 20:14Z under both locks, but the host load average +was 56 (20 cores), so the pinned cpus were shared with other tenants' threads the whole time. +Medians (10 reps, GB/s read+write): + +| class | k=1 | k=2 | k=3 | k=2 over k=1 | rep spread at k=3 | +|---|---|---|---|---|---| +| X925 (cpus 5-9,15-19) | 51.9 | 62.5 | 56.1 | 1.20x | 20.2 to 104.6 | +| A725 (cpus 0-4,10-14) | 49.1 | 85.3 | 69.5 | 1.74x | 18.4 to 110.2 | + +Against PRECOMMIT_round3.md: X925 k=2 is 1.20x of k=1, below the 1.6x line, which would read +as "falsified inside one class", but the k=3 rows are slower than k=2 in both classes and the +rep spreads span 5x, which is not a property of the memory path; it is other work on the same +cores. The precommitted reading assumed the pinned cores were ours. They were not. Verdict: +INCONCLUSIVE, not FALSIFIED and not RETAINED. The same six runs on a box with load under 10 +(each is 20 s) would settle it; that is the next experiment, unchanged. + +Two things this round did show, both consistent with round 2 and not depending on scaling: +single-thread memcpy is about the same on either class (51.9 vs 49.1 GB/s), so the per-thread +rate is not a core-frequency effect at k=1; and the sensor log confirms every held-out row of +the day was taken with a GPU job streaming the same DRAM, so no row here is a quiet-box number. diff --git a/evidence/DAGSIM-583-48ca401/measured/LOCK.txt b/evidence/DAGSIM-583-48ca401/measured/LOCK.txt new file mode 100644 index 000000000..d81339a44 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/LOCK.txt @@ -0,0 +1 @@ +gb10 lock held for the runs (2026-10-19T19:30:43Z) diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k16.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k16.csv new file mode 100644 index 000000000..26614afd4 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k16.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 16 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:47-0500 loadavg=11.25 11.07 17.70 6/2028 3614266 MemAvailable= 9420308 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,16,0,0.0150,133.7 +1,16,1,0.0153,130.9 +1,16,2,0.0153,130.9 +1,16,3,0.0156,127.9 +1,16,4,0.0159,125.4 +1,16,5,0.0146,136.5 +1,16,6,0.0153,130.6 +1,16,7,0.0170,117.8 +1,16,8,0.0193,103.8 +1,16,9,0.0166,120.2 +# after 2026-10-19T14:30:47-0500 loadavg=11.25 11.07 17.70 4/2026 3614448 MemAvailable= 9416736 kB diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k2.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k2.csv new file mode 100644 index 000000000..d344fcb84 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k2.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 2 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:43-0500 loadavg=11.70 11.15 17.77 5/2034 3613336 MemAvailable= 10111384 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,2,0,0.0232,86.1 +1,2,1,0.0235,85.2 +1,2,2,0.0224,89.4 +1,2,3,0.0223,89.9 +1,2,4,0.0231,86.7 +1,2,5,0.0246,81.4 +1,2,6,0.0236,84.9 +1,2,7,0.0241,82.9 +1,2,8,0.0235,85.2 +1,2,9,0.0232,86.3 +# after 2026-10-19T14:30:43-0500 loadavg=11.70 11.15 17.77 5/2011 3613402 MemAvailable= 10013956 kB diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k3.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k3.csv new file mode 100644 index 000000000..3a5e5208c --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k3.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 3 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:44-0500 loadavg=11.70 11.15 17.77 5/2019 3613496 MemAvailable= 10002240 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,3,0,0.0176,113.9 +1,3,1,0.0171,117.1 +1,3,2,0.0175,114.1 +1,3,3,0.0176,113.4 +1,3,4,0.0208,95.9 +1,3,5,0.0200,99.8 +1,3,6,0.0208,96.3 +1,3,7,0.0199,100.5 +1,3,8,0.0174,115.0 +1,3,9,0.0224,89.4 +# after 2026-10-19T14:30:44-0500 loadavg=11.70 11.15 17.77 4/2029 3613543 MemAvailable= 9987076 kB diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k4.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k4.csv new file mode 100644 index 000000000..ffe4b02a2 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k4.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 4 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:46-0500 loadavg=11.25 11.07 17.70 7/2031 3613920 MemAvailable= 9626832 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,4,0,0.0201,99.6 +1,4,1,0.0205,97.7 +1,4,2,0.0199,100.5 +1,4,3,0.0257,78.0 +1,4,4,0.0162,123.1 +1,4,5,0.0181,110.7 +1,4,6,0.0196,101.9 +1,4,7,0.0176,113.5 +1,4,8,0.0190,105.1 +1,4,9,0.0244,81.9 +# after 2026-10-19T14:30:46-0500 loadavg=11.25 11.07 17.70 4/2030 3614027 MemAvailable= 9582816 kB diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k5.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k5.csv new file mode 100644 index 000000000..29af7a343 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k5.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 5 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:45-0500 loadavg=11.70 11.15 17.77 5/2029 3613617 MemAvailable= 9895436 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.5 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,5,0,0.0169,118.5 +1,5,1,0.0184,109.0 +1,5,2,0.0168,119.0 +1,5,3,0.0173,115.5 +1,5,4,0.0150,133.4 +1,5,5,0.0195,102.6 +1,5,6,0.0151,132.4 +1,5,7,0.0149,134.3 +1,5,8,0.0155,128.8 +1,5,9,0.0149,134.4 +# after 2026-10-19T14:30:45-0500 loadavg=11.70 11.15 17.77 4/2029 3613677 MemAvailable= 9905508 kB diff --git a/evidence/DAGSIM-583-48ca401/measured/memcpy_k6.csv b/evidence/DAGSIM-583-48ca401/measured/memcpy_k6.csv new file mode 100644 index 000000000..a388dfec9 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/measured/memcpy_k6.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 6 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:30:45-0500 loadavg=11.70 11.15 17.77 4/2028 3613735 MemAvailable= 9848560 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,6,0,0.0176,113.6 +1,6,1,0.0173,115.7 +1,6,2,0.0213,94.0 +1,6,3,0.0214,93.5 +1,6,4,0.0214,93.5 +1,6,5,0.0176,113.5 +1,6,6,0.0213,93.7 +1,6,7,0.0156,128.5 +1,6,8,0.0173,115.7 +1,6,9,0.0171,117.2 +# after 2026-10-19T14:30:46-0500 loadavg=11.70 11.15 17.77 3/2033 3613822 MemAvailable= 9834332 kB diff --git a/evidence/DAGSIM-583-48ca401/predictions.csv b/evidence/DAGSIM-583-48ca401/predictions.csv new file mode 100644 index 000000000..4bd19918e --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions.csv @@ -0,0 +1,7 @@ +k,pred_s,pred_lo_s,pred_hi_s,pred_GBps,lookup_GBps,spec_roofline_GBps,status +2,0.0558,0.0539,0.0583,35.8,17.9,35.8,OK +3,0.0372,0.0360,0.0389,53.7,55.9,53.7,OK +5,0.0306,0.0287,0.0329,65.4,55.9,89.5,OK +6,0.0306,0.0287,0.0329,65.4,65.9,107.4,OK +4,0.0306,0.0287,0.0329,65.4,55.9,71.6,OK +16,0.0306,0.0287,0.0329,65.4,43.0,273.0,OK diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k16.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k16.json new file mode 100644 index 000000000..8a93fedde --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k16.json @@ -0,0 +1,40 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k16.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 3.0581e+07, "lo": 2.86533e+07, "hi": 3.28947e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 6981250, "max": 3.0581e+07, "resources": {"cpu": 5585000, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy5", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy6", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy7", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy8", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy9", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy10", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy11", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy12", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy13", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy14", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy15", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 6981250, "contention_ns": 2.86697e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 1.91131e+06, "contention": 2.86697e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 16, "total_bytes": 2000000000, "total_busy_ns": 111700000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 1.52905e+07, "delta_ns": 1.52905e+07, "interval_width_frac": 0.137615, "decision_score": 2.1042e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k2.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k2.json new file mode 100644 index 000000000..13def156d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k2.json @@ -0,0 +1,26 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k2.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 55850000, "lo": 53950000, "hi": 58300000, "interval_known": true}, + "bounds_ns": {"critical_path": 55850000, "max": 55850000, "resources": {"cpu": 5585000, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 55850000, "floor_ns": 55850000, "contention_ns": 1.52905e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 55850000, "floor_ns": 55850000, "contention_ns": 1.52905e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 55850000, "bandwidth": 0, "contention": 0, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 2, "total_bytes": 2000000000, "total_busy_ns": 111700000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 55850000, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 55850000, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 55850000, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k3.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k3.json new file mode 100644 index 000000000..75a782b70 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k3.json @@ -0,0 +1,27 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k3.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 37233333, "lo": 35966667, "hi": 38866667, "interval_known": true}, + "bounds_ns": {"critical_path": 37233333, "max": 37233333, "resources": {"cpu": 5.585e+06, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 37233333, "floor_ns": 37233333, "contention_ns": 2.03874e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 37233333, "floor_ns": 37233333, "contention_ns": 2.03874e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 37233333, "floor_ns": 37233333, "contention_ns": 2.03874e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 37233333, "bandwidth": 0, "contention": 0, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 3, "total_bytes": 2000000001, "total_busy_ns": 111699999, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 37233333, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 37233333, "delta_ns": 0, "interval_width_frac": 0.137615, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 37233333, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k4.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k4.json new file mode 100644 index 000000000..fa8abe539 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k4.json @@ -0,0 +1,28 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k4.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 3.0581e+07, "lo": 2.86533e+07, "hi": 3.28947e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 27925000, "max": 3.0581e+07, "resources": {"cpu": 5585000, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 27925000, "contention_ns": 2.29358e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 27925000, "contention_ns": 2.29358e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 27925000, "contention_ns": 2.29358e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 27925000, "contention_ns": 2.29358e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 7.64526e+06, "contention": 2.29358e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 4, "total_bytes": 2000000000, "total_busy_ns": 111700000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 27925000, "delta_ns": 2.65604e+06, "interval_width_frac": 0.137615, "decision_score": 365510, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k5.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k5.json new file mode 100644 index 000000000..93448d83d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k5.json @@ -0,0 +1,29 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k5.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 3.0581e+07, "lo": 2.86533e+07, "hi": 3.28947e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 22340000, "max": 3.0581e+07, "resources": {"cpu": 5585000, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 22340000, "contention_ns": 2.44648e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 22340000, "contention_ns": 2.44648e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 22340000, "contention_ns": 2.44648e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 22340000, "contention_ns": 2.44648e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 22340000, "contention_ns": 2.44648e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 6.11621e+06, "contention": 2.44648e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 5, "total_bytes": 2000000000, "total_busy_ns": 111700000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 22340000, "delta_ns": 8.24104e+06, "interval_width_frac": 0.137615, "decision_score": 1.13409e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/predictions/memcpy_k6.json b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k6.json new file mode 100644 index 000000000..8d2a8ce2d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/predictions/memcpy_k6.json @@ -0,0 +1,30 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/memcpy_k6.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "M1-20261019-block4", "taken_day": 20745, "valid_days": 30, "load1": 14.8, "src": "~/yardsticks/aien-model/M1/block4.csv"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 3.0581e+07, "lo": 2.86533e+07, "hi": 3.28947e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 18616667, "max": 3.0581e+07, "resources": {"cpu": 5.585e+06, "dram_cpu": 3.0581e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"}, + {"id": "copy5", "start_ns": 0, "end_ns": 3.0581e+07, "floor_ns": 18616667, "contention_ns": 2.54842e+07, "prov": "measured", "src": "~/yardsticks/aien-model/M1/block4.csv:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 5.09684e+06, "contention": 2.54842e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 6, "total_bytes": 1999999998, "total_busy_ns": 111700002, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 18616667, "delta_ns": 1.19644e+07, "interval_width_frac": 0.137615, "decision_score": 1.64647e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 3.0581e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_fit/LOCK.txt b/evidence/DAGSIM-583-48ca401/round2_fit/LOCK.txt new file mode 100644 index 000000000..6835f7a07 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_fit/LOCK.txt @@ -0,0 +1 @@ +gb10 lock held for the runs (2026-10-19T19:48:44Z) diff --git a/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k1.csv b/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k1.csv new file mode 100644 index 000000000..2578b6c8f --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k1.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 1 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:48:44-0500 loadavg=25.11 16.44 14.19 27/2621 4056104 MemAvailable= 36345576 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.0 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,1,0,0.0583,34.3 +1,1,1,0.0532,37.6 +1,1,2,0.0514,38.9 +1,1,3,0.0474,42.2 +1,1,4,0.0457,43.7 +1,1,5,0.0532,37.6 +1,1,6,0.0569,35.2 +1,1,7,0.0531,37.7 +1,1,8,0.0526,38.0 +1,1,9,0.0493,40.6 +# after 2026-10-19T14:48:45-0500 loadavg=25.11 16.44 14.19 25/2599 4056532 MemAvailable= 39735100 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k8.csv b/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k8.csv new file mode 100644 index 000000000..1017400a5 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_fit/memcpy_k8.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 8 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:48:45-0500 loadavg=25.11 16.44 14.19 17/2615 4056946 MemAvailable= 40916816 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,8,0,0.0192,104.4 +1,8,1,0.0248,80.6 +1,8,2,0.0205,97.5 +1,8,3,0.0177,113.0 +1,8,4,0.0281,71.1 +1,8,5,0.0216,92.6 +1,8,6,0.0197,101.6 +1,8,7,0.0205,97.6 +1,8,8,0.0252,79.4 +1,8,9,0.0330,60.6 +# after 2026-10-19T14:48:46-0500 loadavg=25.11 16.44 14.19 21/2616 4057141 MemAvailable= 41139076 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/LOCK.txt b/evidence/DAGSIM-583-48ca401/round2_heldout/LOCK.txt new file mode 100644 index 000000000..d35c50227 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/LOCK.txt @@ -0,0 +1 @@ +gb10 lock held for the runs (2026-10-19T19:56:45Z) diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k16.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k16.csv new file mode 100644 index 000000000..3d07924ca --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k16.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 16 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:49-0500 loadavg=9.71 15.76 15.40 4/2376 112669 MemAvailable= 29264048 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,16,0,0.0199,100.4 +1,16,1,0.0202,99.0 +1,16,2,0.0202,98.9 +1,16,3,0.0200,99.8 +1,16,4,0.0202,99.1 +1,16,5,0.0200,100.1 +1,16,6,0.0201,99.6 +1,16,7,0.0184,108.7 +1,16,8,0.0167,120.1 +1,16,9,0.0198,101.1 +# after 2026-10-19T14:56:50-0500 loadavg=9.71 15.76 15.40 4/2376 112835 MemAvailable= 29261496 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k2.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k2.csv new file mode 100644 index 000000000..105497470 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k2.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 2 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:45-0500 loadavg=10.04 15.92 15.45 4/2390 111783 MemAvailable= 28376428 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,2,0,0.0349,57.4 +1,2,1,0.0351,56.9 +1,2,2,0.0352,56.7 +1,2,3,0.0355,56.4 +1,2,4,0.0348,57.4 +1,2,5,0.0370,54.1 +1,2,6,0.0364,54.9 +1,2,7,0.0366,54.6 +1,2,8,0.0364,55.0 +1,2,9,0.0364,54.9 +# after 2026-10-19T14:56:46-0500 loadavg=10.04 15.92 15.45 5/2390 111806 MemAvailable= 30194428 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k3.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k3.csv new file mode 100644 index 000000000..6370612e8 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k3.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 3 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:46-0500 loadavg=9.71 15.76 15.40 6/2388 112044 MemAvailable= 29431580 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.0 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,3,0,0.0248,80.7 +1,3,1,0.0267,74.9 +1,3,2,0.0178,112.1 +1,3,3,0.0205,97.4 +1,3,4,0.0220,90.9 +1,3,5,0.0223,89.7 +1,3,6,0.0241,82.9 +1,3,7,0.0244,82.1 +1,3,8,0.0239,83.6 +1,3,9,0.0237,84.3 +# after 2026-10-19T14:56:47-0500 loadavg=9.71 15.76 15.40 5/2389 112118 MemAvailable= 29291512 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k4.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k4.csv new file mode 100644 index 000000000..1505432e4 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k4.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 4 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:49-0500 loadavg=9.71 15.76 15.40 4/2373 112528 MemAvailable= 29285504 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.0 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,4,0,0.0167,119.5 +1,4,1,0.0250,80.0 +1,4,2,0.0230,86.9 +1,4,3,0.0259,77.1 +1,4,4,0.0240,83.5 +1,4,5,0.0228,87.5 +1,4,6,0.0249,80.3 +1,4,7,0.0240,83.4 +1,4,8,0.0230,86.8 +1,4,9,0.0238,84.0 +# after 2026-10-19T14:56:49-0500 loadavg=9.71 15.76 15.40 4/2373 112583 MemAvailable= 29284284 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k5.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k5.csv new file mode 100644 index 000000000..e5cff869d --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k5.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 5 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:47-0500 loadavg=9.71 15.76 15.40 4/2372 112234 MemAvailable= 29253856 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.0 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,5,0,0.0205,97.6 +1,5,1,0.0308,65.0 +1,5,2,0.0264,75.6 +1,5,3,0.0209,95.8 +1,5,4,0.0207,96.8 +1,5,5,0.0200,100.1 +1,5,6,0.0203,98.5 +1,5,7,0.0211,95.0 +1,5,8,0.0263,76.0 +1,5,9,0.0262,76.4 +# after 2026-10-19T14:56:47-0500 loadavg=9.71 15.76 15.40 17/2372 112315 MemAvailable= 29252468 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k6.csv b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k6.csv new file mode 100644 index 000000000..4e1835f08 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout/memcpy_k6.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 6 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T14:56:48-0500 loadavg=9.71 15.76 15.40 3/2373 112389 MemAvailable= 29282096 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.0 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,6,0,0.0177,112.9 +1,6,1,0.0178,112.6 +1,6,2,0.0173,115.3 +1,6,3,0.0213,93.7 +1,6,4,0.0173,115.7 +1,6,5,0.0220,90.9 +1,6,6,0.0216,92.7 +1,6,7,0.0212,94.2 +1,6,8,0.0219,91.5 +1,6,9,0.0215,93.1 +# after 2026-10-19T14:56:48-0500 loadavg=9.71 15.76 15.40 5/2373 112457 MemAvailable= 29280732 kB diff --git a/evidence/DAGSIM-583-48ca401/round2_heldout_results.md b/evidence/DAGSIM-583-48ca401/round2_heldout_results.md new file mode 100644 index 000000000..007d4bc0e --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_heldout_results.md @@ -0,0 +1,20 @@ +# Held-out results: shared-bandwidth model vs fresh memcpy measurements + +Gates were precommitted in PRECOMMIT.md before any of these rows were measured. Calibration: round2-same-state (evidence/DAGSIM-583-48ca401/round2_fit). + +| k | measured median GB/s (n, min..max) | predicted GB/s [hi..lo] | rel. error | covered | lookup ctrl GB/s (err) | spec roofline GB/s (err) | envelope | +|---|---|---|---|---|---|---|---| +| 2 | 55.7 (10, 54.1..57.4) | 75.7 [60.6..87.7] | +35.9% | no | 37.9 (-32.0%) | 75.7 (+35.9%) | in | +| 3 | 83.9 (10, 74.9..112.1) | 95.0 [60.6..113.0] | +13.2% | yes | 95.0 (+13.2%) | 113.5 (+35.3%) | in | +| 5 | 95.4 (10, 65.0..100.1) | 95.0 [60.6..113.0] | -0.4% | yes | 95.0 (-0.4%) | 189.2 (+98.3%) | in | +| 6 | 94.0 (10, 90.9..115.7) | 95.0 [60.6..113.0] | +1.1% | yes | 95.0 (+1.1%) | 227.1 (+141.6%) | in | +| 4 | 83.8 (10, 77.1..119.5) | 95.0 [60.6..113.0] | +13.4% | yes | 95.0 (+13.4%) | 151.4 (+80.7%) | in (lookup home ground) | +| 16 | 99.9 (10, 98.9..120.1) | 95.0 [60.6..113.0] | -4.9% | yes | 95.0 (-4.9%) | 273.0 (+173.3%) | OUT (16 threads + load above 20 cores) | + +## Gates (precommitted) + +- G-err: nominal prediction within 25% of the measured median on each of k=2,3,5,6: 3 of 4 passed. FAIL +- G-cov: [lo..hi] interval covers the measured median on at least 3 of 4 held-out k: 3 of 4 covered. PASS +- Energy: UNMEASURED (no wall instrument integrated over these runs). + +Load during measurement is in the header lines of measured/*.csv; every number is a loaded-box number. diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions.csv b/evidence/DAGSIM-583-48ca401/round2_predictions.csv new file mode 100644 index 000000000..a0bc03c35 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions.csv @@ -0,0 +1,7 @@ +k,pred_s,pred_lo_s,pred_hi_s,pred_GBps,lookup_GBps,spec_roofline_GBps,status +2,0.0264,0.0228,0.0330,75.7,37.9,75.7,OK +3,0.0210,0.0177,0.0330,95.0,95.0,113.5,OK +5,0.0210,0.0177,0.0330,95.0,95.0,189.2,OK +6,0.0210,0.0177,0.0330,95.0,95.0,227.1,OK +4,0.0210,0.0177,0.0330,95.0,95.0,151.4,OK +16,0.0210,0.0177,0.0330,95.0,95.0,273.0,OK diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k16.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k16.json new file mode 100644 index 000000000..dcb3ed9d2 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k16.json @@ -0,0 +1,40 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k16.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 2.10416e+07, "lo": 1.76991e+07, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 3303125, "max": 2.10416e+07, "resources": {"cpu": 2642500, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy5", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy6", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy7", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy8", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy9", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy10", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy11", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy12", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy13", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy14", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy15", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 3303125, "contention_ns": 1.97265e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 1.3151e+06, "contention": 1.97265e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 16, "total_bytes": 2000000000, "total_busy_ns": 52850000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 1.05208e+07, "delta_ns": 1.05208e+07, "interval_width_frac": 0.551289, "decision_score": 5.79999e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k2.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k2.json new file mode 100644 index 000000000..8bbac8c92 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k2.json @@ -0,0 +1,26 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k2.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 26425000, "lo": 22850000, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 26425000, "max": 26425000, "resources": {"cpu": 2642500, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 26425000, "floor_ns": 26425000, "contention_ns": 1.05208e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 26425000, "floor_ns": 26425000, "contention_ns": 1.05208e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 26425000, "bandwidth": 0, "contention": 0, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 2, "total_bytes": 2000000000, "total_busy_ns": 52850000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 26425000, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 26425000, "delta_ns": 0, "interval_width_frac": 0.551289, "decision_score": 0, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 26425000, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k3.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k3.json new file mode 100644 index 000000000..e7cfb25cb --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k3.json @@ -0,0 +1,27 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k3.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 2.10416e+07, "lo": 1.76991e+07, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 17616667, "max": 2.10416e+07, "resources": {"cpu": 2.6425e+06, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 17616667, "contention_ns": 1.40277e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 17616667, "contention_ns": 1.40277e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 17616667, "contention_ns": 1.40277e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 7.01385e+06, "contention": 1.40277e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 3, "total_bytes": 2000000001, "total_busy_ns": 52850001, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 17616667, "delta_ns": 3.42489e+06, "interval_width_frac": 0.551289, "decision_score": 1.8881e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k4.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k4.json new file mode 100644 index 000000000..38c3bf3a8 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k4.json @@ -0,0 +1,28 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k4.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 2.10416e+07, "lo": 1.76991e+07, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 13212500, "max": 2.10416e+07, "resources": {"cpu": 2642500, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 13212500, "contention_ns": 1.57812e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 13212500, "contention_ns": 1.57812e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 13212500, "contention_ns": 1.57812e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 13212500, "contention_ns": 1.57812e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 5.26039e+06, "contention": 1.57812e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 4, "total_bytes": 2000000000, "total_busy_ns": 52850000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 13212500, "delta_ns": 7.82906e+06, "interval_width_frac": 0.551289, "decision_score": 4.31607e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k5.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k5.json new file mode 100644 index 000000000..395700baa --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k5.json @@ -0,0 +1,29 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k5.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 2.10416e+07, "lo": 1.76991e+07, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 10570000, "max": 2.10416e+07, "resources": {"cpu": 2642500, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 10570000, "contention_ns": 1.68332e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 10570000, "contention_ns": 1.68332e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 10570000, "contention_ns": 1.68332e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 10570000, "contention_ns": 1.68332e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 10570000, "contention_ns": 1.68332e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 4.20831e+06, "contention": 1.68332e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 5, "total_bytes": 2000000000, "total_busy_ns": 52850000, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 10570000, "delta_ns": 1.04716e+07, "interval_width_frac": 0.551289, "decision_score": 5.77285e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k6.json b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k6.json new file mode 100644 index 000000000..395d5d026 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round2_predictions/memcpy_k6.json @@ -0,0 +1,30 @@ +{ + "schema": "oev1", "tool": "dagsim", "file": "evidence/DAGSIM-583-48ca401/fixtures/round2_memcpy_k6.oev", + "machine": "spark-b87b", "build_sha": "f4a9849f00000000000000000000000000000000", + "calibration": {"id": "round2-same-state", "taken_day": 20745, "valid_days": 30, "load1": 25.11, "src": "evidence/DAGSIM-583-48ca401/round2_fit"}, + "asof_day": 20746, + "status": "OK", "reason": "", + "provenance": ["measured", "specified"], "synthetic": 0, "offline": true, "gpu_executed": false, + "makespan_ns": {"nominal": 2.10416e+07, "lo": 1.76991e+07, "hi": 3.30033e+07, "interval_known": true}, + "bounds_ns": {"critical_path": 8808333, "max": 2.10416e+07, "resources": {"cpu": 2.6425e+06, "dram_cpu": 2.10416e+07, "unified_mem": 0}, "makespan_ge_bounds": true}, + "ops": [ + {"id": "copy0", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy1", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy2", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy3", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy4", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"}, + {"id": "copy5", "start_ns": 0, "end_ns": 2.10416e+07, "floor_ns": 8808333, "contention_ns": 1.75346e+07, "prov": "measured", "src": "evidence/DAGSIM-583-48ca401/round2_fit:gb=1,threads=1"} + ], + "critical_path": ["copy0"], + "peak_live_bytes": {"unified_mem": {"bytes": 2000000000, "at_ns": 0, "cap": 137438953472}}, + "attribution_ns": {"compute": 0, "bandwidth": 3.50693e+06, "contention": 1.75346e+07, "launch": 0, "serialization": 0, "sync": 0, "residual": 0}, + "energy": {"status": "UNMEASURED", "joules": null, "instrument": "none", "boundary": "", "ranking_valid": false}, + "conservation": {"n_ops": 6, "total_bytes": 1999999998, "total_busy_ns": 52849998, "total_launch_ns": 0, "instrument_overhead_ns": null}, + "sensitivities": [ + {"resource": "dram_cpu", "kind": "bandwidth", "makespan_if_doubled_ns": 1.05208e+07, "delta_ns": 1.05208e+07, "interval_width_frac": 0.551289, "decision_score": 5.79999e+06, "next_experiment": "repeat the bandwidth receipt on a quiet box to tighten lo/hi"}, + {"resource": "cpu", "kind": "compute", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "measure the critical op at the next larger shape"}, + {"resource": "unified_mem", "kind": "capacity", "makespan_if_doubled_ns": 2.10416e+07, "delta_ns": 0, "interval_width_frac": 1, "decision_score": 0, "next_experiment": "none: capacity is a ledger, not a rate"} + ], + "unresolved_residual_ns": 0, + "note": "loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone" +} diff --git a/evidence/DAGSIM-583-48ca401/round3_a725/LOCK.txt b/evidence/DAGSIM-583-48ca401/round3_a725/LOCK.txt new file mode 100644 index 000000000..0273f61c8 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_a725/LOCK.txt @@ -0,0 +1 @@ +gb10 lock held for the runs (2026-10-19T20:14:23Z) diff --git a/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k1.csv b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k1.csv new file mode 100644 index 000000000..e2f889022 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k1.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 1 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:23-0500 loadavg=55.35 47.91 31.39 45/2476 738658 MemAvailable= 28417128 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=37.3 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,1,0,0.0401,49.9 +1,1,1,0.0429,46.6 +1,1,2,0.0392,51.1 +1,1,3,0.0389,51.4 +1,1,4,0.0745,26.8 +1,1,5,0.0443,45.1 +1,1,6,0.0400,50.0 +1,1,7,0.0413,48.4 +1,1,8,0.0421,47.5 +1,1,9,0.0390,51.2 +# after 2026-10-19T15:14:24-0500 loadavg=55.35 47.91 31.39 48/2477 738718 MemAvailable= 30028328 kB diff --git a/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k2.csv b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k2.csv new file mode 100644 index 000000000..840382d0b --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k2.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 2 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:24-0500 loadavg=55.35 47.91 31.39 47/2456 738777 MemAvailable= 30077564 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=36.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,2,0,0.0242,82.8 +1,2,1,0.0252,79.3 +1,2,2,0.0228,87.9 +1,2,3,0.0238,83.9 +1,2,4,0.0383,52.3 +1,2,5,0.0222,90.2 +1,2,6,0.0245,81.7 +1,2,7,0.0231,86.8 +1,2,8,0.0222,90.0 +1,2,9,0.0225,88.7 +# after 2026-10-19T15:14:24-0500 loadavg=55.35 47.91 31.39 46/2455 738821 MemAvailable= 30064236 kB diff --git a/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k3.csv b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k3.csv new file mode 100644 index 000000000..f39c90306 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_a725/memcpy_k3.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 3 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:25-0500 loadavg=55.35 47.91 31.39 46/2461 738863 MemAvailable= 29101876 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=37.3 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,3,0,0.0263,76.1 +1,3,1,0.0272,73.6 +1,3,2,0.0304,65.7 +1,3,3,0.0181,110.2 +1,3,4,0.0389,51.4 +1,3,5,0.0193,103.4 +1,3,6,0.0273,73.3 +1,3,7,0.0914,21.9 +1,3,8,0.0753,26.6 +1,3,9,0.1090,18.4 +# after 2026-10-19T15:14:25-0500 loadavg=55.35 47.91 31.39 47/2462 738917 MemAvailable= 30107328 kB diff --git a/evidence/DAGSIM-583-48ca401/round3_x925/LOCK.txt b/evidence/DAGSIM-583-48ca401/round3_x925/LOCK.txt new file mode 100644 index 000000000..b58476c9e --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_x925/LOCK.txt @@ -0,0 +1 @@ +gb10 lock held for the runs (2026-10-19T20:14:17Z) diff --git a/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k1.csv b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k1.csv new file mode 100644 index 000000000..c083545c9 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k1.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 1 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:18-0500 loadavg=56.08 47.93 31.30 52/2475 738085 MemAvailable= 30058548 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.2 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,1,0,0.0381,52.5 +1,1,1,0.0385,51.9 +1,1,2,0.0400,50.1 +1,1,3,0.0375,53.3 +1,1,4,0.0375,53.3 +1,1,5,0.0379,52.8 +1,1,6,0.0390,51.2 +1,1,7,0.0492,40.6 +1,1,8,0.0390,51.3 +1,1,9,0.0386,51.9 +# after 2026-10-19T15:14:18-0500 loadavg=56.08 47.93 31.30 64/2481 738104 MemAvailable= 30054344 kB diff --git a/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k2.csv b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k2.csv new file mode 100644 index 000000000..7739ed974 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k2.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 2 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:18-0500 loadavg=56.08 47.93 31.30 63/2481 738208 MemAvailable= 29909544 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=22.4 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,2,0,0.0346,57.7 +1,2,1,0.0250,79.9 +1,2,2,0.0388,51.5 +1,2,3,0.0430,46.5 +1,2,4,0.0242,82.8 +1,2,5,0.0490,40.8 +1,2,6,0.0297,67.2 +1,2,7,0.0263,76.0 +1,2,8,0.0407,49.1 +1,2,9,0.0248,80.5 +# after 2026-10-19T15:14:19-0500 loadavg=56.08 47.93 31.30 61/2479 738320 MemAvailable= 29885964 kB diff --git a/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k3.csv b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k3.csv new file mode 100644 index 000000000..e8775e9e0 --- /dev/null +++ b/evidence/DAGSIM-583-48ca401/round3_x925/memcpy_k3.csv @@ -0,0 +1,15 @@ +# omega-mv#583 memcpy_probe; cmd=memcpy_probe 1 3 10; bytes_copied=1000000000 (read+write counted twice below, as in M1 block4) +# before 2026-10-19T15:14:19-0500 loadavg=56.08 47.93 31.30 63/2479 738345 MemAvailable= 29177784 kB +# timer=CLOCK_MONOTONIC overhead_ns_per_read=23.1 (1000 reads) +gb,threads,rep,seconds,GBps_read_plus_write +1,3,0,0.0992,20.2 +1,3,1,0.0340,58.9 +1,3,2,0.0290,69.0 +1,3,3,0.0460,43.5 +1,3,4,0.0783,25.6 +1,3,5,0.0217,92.1 +1,3,6,0.0220,90.9 +1,3,7,0.0375,53.3 +1,3,8,0.0191,104.6 +1,3,9,0.0377,53.0 +# after 2026-10-19T15:14:20-0500 loadavg=56.08 47.93 31.30 59/2479 738478 MemAvailable= 29162316 kB diff --git a/spec/offline-evidence-v1.md b/spec/offline-evidence-v1.md new file mode 100644 index 000000000..e468163e3 --- /dev/null +++ b/spec/offline-evidence-v1.md @@ -0,0 +1,131 @@ +# Offline evidence schema v1 (OEV1) for the resource-DAG cost simulator + +Status: FROZEN 2026-10-19 (omega-mv#583, implement item 1). Consumers: omega-mv#583 +(`tools/dagsim`), omega-mv#584 (candidate screening), aien-architecture#246 (lifecycle +ledgers). A change to a frozen field is a v2, never an edit of v1. + +Purpose: one text file describes a machine, the build and calibration it was measured +with, the resources, an operation DAG with demands, buffer lifetimes, dependencies, +synchronization and the energy instrument, so that an offline evaluator (no GPU, no +execution) can compose existing per-operation estimates into whole-DAG costs and bounds. +The file never carries a number without saying where it came from. + +## File form + +Plain text, UTF-8, one record per line, fields separated by whitespace, `key=value` +pairs after the record keyword, `#` to end of line is a comment. Unknown keywords are +errors (a parser that silently ignores a field would let a fabricated or misspelled +number through). Line numbers are reported on every error. No value may contain +whitespace. Maximum 256 operations, 32 resources, 256 buffers, 1024 dependencies +(static limits; a larger DAG is refused with `REFUSED_UNSUPPORTED`, not truncated). + +Units are fixed by the schema and never per record: time `ns`, bytes `B`, +bandwidth `B/s`, power `W`, energy `J`, capacity `B`. Dates are `YYYY-MM-DD`. +Integers are decimal; reals accept `1.5e9`. + +## Provenance (mandatory wherever a number appears) + +`prov=` takes exactly one of: + +| value | meaning | +|---|---| +| `specified` | a vendor or design ceiling (datasheet). Never attainable by itself. | +| `measured` | read from an instrument on the named machine; `src=` names the receipt. | +| `fitted` | produced by a model fitted on measurements (e.g. `rx_costmodel`); `src=` names the model blob or the fit receipt. | +| `synthetic` | made up for a sensitivity study; results that depend on it are labelled synthetic and never ranked as real. | +| `unknown` | nobody knows. The evaluator refuses to turn this into a number. | + +`lo=` and `hi=` give the interval that the source supports (for `measured`: the repeat +spread of the receipt; for `fitted`: the model's predictive interval). Missing `lo`/`hi` +on a `measured` or `fitted` value means "no interval known" and the evaluator reports +the result without interval coverage. + +## Records + +``` +oev version=1 +machine id= soc= cores= mem_bytes= prov=specified src= +build repo= sha=<40 hex> [physics=] +calibration id= taken= valid_days= load1= src= [model=] +resource id= kind=compute slots= prov=

src= +resource id= kind=bandwidth cap= [lo= hi=] prov=

src= +resource id= kind=capacity cap= prov=

src= +resource id= kind=launch prov=

src= +op id= kind= [engine=] [t_ns= lo= hi= prov=

src=] [bytes= bw=] [launch_ns= launcher=] [M= N= core=<0|1|2> arm=] +dep +buffer id= bytes= cap= [first=] [last=] +sync id= ops= +energy instrument= [boundary=] [joules= prov=measured src=] [power_w= prov=synthetic] +removed op= reason= [ref=] [proof=] +``` + +Semantics the evaluator is allowed to rely on: + +- `machine`, `build`, `calibration` appear once. Every `measured` or `fitted` value is + valid only inside the calibration's validity envelope: the evaluator takes an + `asof` date and refuses (`REFUSED_STALE`) when `asof > taken + valid_days`, and refuses + (`REFUSED_NO_CALIBRATION`) when a measured or fitted value appears without a + `calibration` record. `load1` is the host load during the measurement; it travels with + every result so a loaded-box number is never quoted as a quiet-box number. +- `resource kind=compute slots=n`: n operations may run at once on this engine. A + compute resource is a CPU core pool or the GPU; the schema does not model SM-level + occupancy. +- `resource kind=bandwidth cap=B`: a shared fluid pipe. k operations streaming at once + each get `cap/k` (processor sharing). This is the only contention rule in v1; it is + what makes "sum of concurrent full-bandwidth claims" impossible by construction. +- `resource kind=capacity`: a byte ledger. CPU and GPU unified memory are ONE capacity + resource on the Spark; a file that declares two for the same DRAM is wrong, not refused + (the evaluator cannot know), so the convention is one `unified_mem` resource. +- `resource kind=launch`: a serial queue. Launch cost is paid once per op, one op at a + time per launch resource, before the op's own work. It is additive only when serialized; + two engines with two launch resources overlap their launches. +- `op`: `t_ns` is the operation's own busy time on its engine (compute floor, `F/P`). + `bytes`/`bw` is its traffic on a bandwidth resource (traffic floor, `Q/B`). The op's + ideal floor is `launch + max(t_ns, bytes/cap)`; v1 assumes perfect overlap of its own + compute and traffic inside one op (the issue's stated floor). `kind=barrier` has no + cost and only orders. `kind=matvec` with `M`,`N`,`core`,`arm` and no `t_ns` gets its + `t_ns`, `lo`, `hi` from `rx_costmodel` (`rx_cm_predict`) using the blob named by + `calibration model=`; if that cell is not `known`, the op is `unknown` and the DAG is + refused. `kind=storage` and `kind=persist` are ops whose `bw` is a storage resource. +- `dep a b`: b starts after a ends. Cycles are refused. +- `buffer`: live from the start of `first` to the end of `last`. Missing `first` means + live from t=0 (resident state); missing `last` means live until the end. Peak live bytes + per capacity resource must not exceed `cap`, else `REFUSED_CAPACITY` naming the time + and the buffers. +- `sync id=X ops=a,b,...`: declares a barrier op `X` (no cost, no engine) that completes + when every listed op has completed. Order later work after it with `dep X y`. A barrier + with a measured cost is written as `op id=X kind=barrier t_ns=... prov=...` plus `dep` lines. +- `energy`: `instrument=none` makes every energy figure `UNMEASURED`. A named instrument + with `joules` and a receipt is a measured whole-run figure for the named boundary; the + evaluator never splits it per op. `power_w` with `prov=synthetic` allows a labelled + sensitivity figure `E = P * T` that is never ranked as real energy. `TDP` is not an + instrument. +- `removed`: minimum-work accounting (parent clarification). An op listed here is absent + from the transformed DAG; the record keeps why. `reused`/`lookup` need `ref=`; a + remaining op that depends on a removed op whose reason is not `reused`/`lookup` is a + refusal (`REFUSED_REMOVED_REQUIRED`: required work cannot be removed by assertion). + +## What a result must carry + +Every evaluator output names: schema version, `machine.id`, `build.sha`, +`calibration.id` and `load1`, `asof`, the status (`OK`, `REFUSED_*`), the set of +provenances that fed the result, makespan nominal/lo/hi, the critical-path bound and each +resource-work bound (both must be <= makespan), peak live bytes, energy status, the +attribution ledger (compute, bandwidth, contention, launch, serialization, sync, +residual), and the counterfactual sensitivities. A result whose inputs include +`synthetic` is marked `synthetic=1`. A result never contains a number for an `unknown` +input. + +## Pinned sources for v1 fixtures + +- Spark host `spark-b87b`, GB10, 20 cores, 128 GiB unified memory (specified), DRAM + 273 GB/s (specified). +- M1 hardware passport, omega-mv#578, receipts `~/yardsticks/aien-model/M1/` (measured, + load 15 to 29, omega f4a9849f): block1 realization call path 19.4 to 22.8 us per call; + block2 GPU submit lifecycle 36.8 to 41.6 ms per job (fixed, size independent); block4 + CPU memcpy 1 thread 17.1 to 18.5 GB/s read+write at 1 GB, 8 threads 60.8 to 69.8 GB/s + at 1 GB; GPU weight stream 218.6 GB/s from handoff 2026-10-19-qwen38-decode-speed.md + (not re-measured in M1). +- Not available on 2026-10-19 and therefore `unknown` in every fixture: aien-architecture + #244 traces, #252 clock calibration, #253 hardware atlas, #274 lifetime maps (all + NOT_RUN at the time of freezing). Fixtures that need them refuse. diff --git a/tests/dagsim/dagsim_unit.c b/tests/dagsim/dagsim_unit.c new file mode 100644 index 000000000..f9c6c089e --- /dev/null +++ b/tests/dagsim/dagsim_unit.c @@ -0,0 +1,502 @@ +/* + * dagsim_unit -- analytical tests for the offline resource-DAG evaluator + * (omega-mv#583 acceptance, first box). Any host, no GPU. + * + * Every case is a DAG whose answer is known by hand. The evaluator must + * produce exactly that number (to 1 ns), the same number twice, and never a + * makespan below its own bounds. + */ +#include "dagsim.h" +#include "runtime/rx_costmodel.h" + +#include +#include +#include +#include + +static int g_checks, g_fail; +#define CHECK(cond, ...) do { \ + g_checks++; \ + if (!(cond)) { \ + g_fail++; \ + fprintf(stderr, " FAIL %s:%d ", __FILE__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + fputc('\n', stderr); \ + } \ + } while (0) +#define NEAR(a, b, tol) (fabs((a) - (b)) <= (tol)) + +static const char *HDR = + "oev version=1\n" + "machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\n" + "build repo=omega-mv sha=0000000000000000000000000000000000000000\n" + "calibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\n" + "resource id=mem kind=capacity cap=1000 prov=specified src=test\n" + "energy instrument=none\n"; + +static int eval_text(const char *body, ds_model *m, ds_result *r, const ds_opts *o) { + char text[8192], err[256]; + snprintf(text, sizeof text, "%s%s", HDR, body); + int rc = ds_parse_text(text, m, err, sizeof err); + if (rc != DS_OK) { fprintf(stderr, " parse: %s\n", err); r->status = rc; return rc; } + ds_opts def; memset(&def, 0, sizeof def); + def.asof_day = ds_day_from_date("2026-10-20"); + def.interval_q = 0.9; + rc = ds_eval(m, o ? o : &def, r); + /* invariants every OK result must satisfy */ + if (rc == DS_OK) { + CHECK(r->makespan_ns + 1e-6 >= r->bound_ns, "makespan %.1f below bound %.1f", r->makespan_ns, r->bound_ns); + CHECK(r->makespan_ns + 1e-6 >= r->bound_critical_path_ns, "below critical path bound"); + double s = 0; for (int i = 0; i < DS_ATTR_N; i++) s += r->attr_ns[i]; + CHECK(NEAR(s, r->makespan_ns, 1e-6), "attribution %.3f does not sum to makespan %.3f", s, r->makespan_ns); + ds_result r2; ds_eval(m, o ? o : &def, &r2); + CHECK(memcmp(&r2, r, sizeof r2) == 0, "not deterministic"); + } + return rc; +} + +static void test_serial_chain(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A B\ndep B C\n", &m, &r, NULL); + CHECK(rc == DS_OK, "serial chain status %s: %s", ds_status_name(r.status), r.reason); + CHECK(NEAR(r.makespan_ns, 60, 1e-9), "serial makespan %.3f", r.makespan_ns); + CHECK(NEAR(r.bound_critical_path_ns, 60, 1e-9), "critical path bound %.3f", r.bound_critical_path_ns); + CHECK(r.n_critical == 3, "critical path length %d", r.n_critical); + CHECK(NEAR(r.attr_ns[DS_ATTR_COMPUTE], 60, 1e-9), "compute attribution %.3f", r.attr_ns[DS_ATTR_COMPUTE]); + CHECK(NEAR(r.attr_ns[DS_ATTR_RESIDUAL], 0, 1e-9), "residual %.3f", r.attr_ns[DS_ATTR_RESIDUAL]); + CHECK(NEAR(r.start_ns[2], 30, 1e-9) && NEAR(r.end_ns[2], 60, 1e-9), "C window"); + CHECK(r.prov_mask == (1u << DS_PROV_MEASURED | 1u << DS_PROV_SPECIFIED), "prov mask %x", r.prov_mask); + CHECK(r.n_ops == 3 && NEAR(r.total_busy_ns, 60, 1e-9), "conservation"); +} + +static void test_perfect_overlap(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=4 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK, "overlap status %s", ds_status_name(r.status)); + CHECK(NEAR(r.makespan_ns, 30, 1e-9), "independent overlap makespan %.3f", r.makespan_ns); + CHECK(NEAR(r.attr_ns[DS_ATTR_SERIALIZATION], 0, 1e-9), "no serialization when slots suffice"); + /* same DAG, one slot: work bound 60 binds and the wait is serialization */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK, "one slot status"); + CHECK(NEAR(r.makespan_ns, 60, 1e-9), "one-slot makespan %.3f", r.makespan_ns); + CHECK(NEAR(r.bound_critical_path_ns, 30, 1e-9), "critical path stays 30"); + CHECK(NEAR(r.bound_ns, 60, 1e-9), "resource bound 60, got %.3f", r.bound_ns); + CHECK(NEAR(r.attr_ns[DS_ATTR_SERIALIZATION], 30, 1e-9), "serialization %.3f", r.attr_ns[DS_ATTR_SERIALIZATION]); +} + +static void test_shared_bandwidth(void) { + ds_model m; ds_result r; + /* two 1 GB copies on a 1 GB/s pipe, both slots free: each gets half, both end at 2 s */ + int rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" + "op id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK, "bw status %s: %s", ds_status_name(r.status), r.reason); + CHECK(NEAR(r.makespan_ns, 2e9, 1e-3), "two concurrent full-bandwidth claims must not sum: %.0f", r.makespan_ns); + CHECK(NEAR(r.end_ns[0], 2e9, 1e-3) && NEAR(r.end_ns[1], 2e9, 1e-3), "both end at 2 s"); + CHECK(NEAR(r.op_contention_ns[0], 1e9, 1e-3), "A contention %.0f", r.op_contention_ns[0]); + CHECK(NEAR(r.bound_critical_path_ns, 1e9, 1e-3), "cp bound 1 s"); + CHECK(NEAR(r.bound_ns, 2e9, 1e-3), "pipe work bound 2 s, got %.0f", r.bound_ns); + CHECK(NEAR(r.attr_ns[DS_ATTR_BANDWIDTH] + r.attr_ns[DS_ATTR_CONTENTION], 2e9, 1e-3), "bw+contention = 2 s"); + CHECK(NEAR(r.attr_ns[DS_ATTR_CONTENTION], 1e9, 1e-3), "contention attributed 1 s, got %.0f", r.attr_ns[DS_ATTR_CONTENTION]); + /* unequal: B is half the size; it finishes at 1 s, A at 1.5 s */ + rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" + "op id=B kind=copy engine=cpu bytes=5e8 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK, "bw2 status"); + CHECK(NEAR(r.end_ns[1], 1e9, 1e-3), "B ends at 1 s, got %.0f", r.end_ns[1]); + CHECK(NEAR(r.end_ns[0], 1.5e9, 1e-3), "A ends at 1.5 s, got %.0f", r.end_ns[0]); + /* compute and traffic inside one op overlap: floor is max(F/P, Q/B) */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=compute engine=cpu t_ns=5e8 bytes=1e9 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 1e9, 1e-3), "max(F/P,Q/B) floor, got %.0f", r.makespan_ns); + CHECK(NEAR(r.op_floor_ns[0], 1e9, 1e-3), "op floor"); + /* a compute-bound op streaming alone has no contention, whatever its busy time */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=compute engine=cpu t_ns=4e9 bytes=1e9 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 4e9, 1e-3) && NEAR(r.op_contention_ns[0], 0, 1e-3), + "compute-bound op alone: contention %.0f (want 0)", r.op_contention_ns[0]); + CHECK(NEAR(r.attr_ns[DS_ATTR_COMPUTE], 4e9, 1e-3), "attributed as compute"); + /* serialized sharing: one slot, so no contention and makespan = sum */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" + "op id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 2e9, 1e-3) && NEAR(r.attr_ns[DS_ATTR_CONTENTION], 0, 1e-3), + "serialized copies: no contention, makespan %.0f contention %.0f", r.makespan_ns, r.attr_ns[DS_ATTR_CONTENTION]); +} + +static void test_capacity_refusal(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "buffer id=x bytes=600 cap=mem first=A last=A\n" + "buffer id=y bytes=600 cap=mem first=A last=A\n", &m, &r, NULL); + CHECK(rc == DS_REFUSED_CAPACITY, "1200 live bytes in 1000 must refuse, got %s", ds_status_name(rc)); + CHECK(strstr(r.reason, "x") && strstr(r.reason, "y"), "reason names the buffers: %s", r.reason); + /* same buffers, disjoint lifetimes: fits */ + rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "dep A B\n" + "buffer id=x bytes=600 cap=mem first=A last=A\n" + "buffer id=y bytes=600 cap=mem first=B last=B\n", &m, &r, NULL); + CHECK(rc == DS_OK, "disjoint lifetimes fit, got %s: %s", ds_status_name(rc), r.reason); + CHECK(NEAR(r.peak_live_bytes[0], 600, 1e-9), "peak 600, got %.0f", r.peak_live_bytes[0]); + /* a single buffer larger than the ledger refuses before any scheduling */ + rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "buffer id=big bytes=2000 cap=mem\n", &m, &r, NULL); + CHECK(rc == DS_REFUSED_CAPACITY, "oversized resident buffer refuses"); +} + +static void test_lifetimes(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "dep A B\ndep B C\n" + "buffer id=resident bytes=100 cap=mem\n" + "buffer id=x bytes=300 cap=mem first=A last=B\n" + "buffer id=y bytes=400 cap=mem first=B last=C\n", &m, &r, NULL); + CHECK(rc == DS_OK, "lifetimes status %s: %s", ds_status_name(rc), r.reason); + CHECK(NEAR(r.peak_live_bytes[0], 800, 1e-9), "peak = resident + x + y during B, got %.0f", r.peak_live_bytes[0]); + CHECK(NEAR(r.peak_live_at_ns[0], 10, 1e-9), "peak reached when B starts, got %.1f", r.peak_live_at_ns[0]); +} + +static void test_sync(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=5 prov=measured src=t\n" + "sync id=s ops=A,B\n" + "dep s C\n", &m, &r, NULL); + CHECK(rc == DS_OK, "sync status %s: %s", ds_status_name(rc), r.reason); + int c = ds_find_op(&m, "C"); + CHECK(c >= 0 && NEAR(r.start_ns[c], 30, 1e-9), "C waits for the slower of A,B: start %.1f", c >= 0 ? r.start_ns[c] : -1); + CHECK(NEAR(r.makespan_ns, 35, 1e-9), "sync makespan %.1f", r.makespan_ns); + /* a barrier with a declared cost is attributed as sync */ + rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "op id=fence kind=barrier t_ns=7 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=5 prov=measured src=t\n" + "dep A fence\ndep B fence\ndep fence C\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 42, 1e-9), "costed barrier makespan %.1f", r.makespan_ns); + CHECK(NEAR(r.attr_ns[DS_ATTR_SYNC], 7, 1e-9), "sync attribution %.1f", r.attr_ns[DS_ATTR_SYNC]); +} + +static void test_launch(void) { + ds_model m; ds_result r; + /* two jobs, one launcher, one slot: launches serialize, 80 ms */ + int rc = eval_text( + "resource id=gpu kind=compute slots=1 prov=specified src=test\n" + "resource id=L kind=launch prov=measured src=t\n" + "op id=A kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L prov=measured src=t\n" + "op id=B kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 80e6, 1e-3), "serialized launches add: %.0f", r.makespan_ns); + CHECK(NEAR(r.attr_ns[DS_ATTR_LAUNCH] + r.attr_ns[DS_ATTR_SERIALIZATION], 80e6, 1e-3), "launch+serialization"); + /* two engines, two launchers: launches overlap, 40 ms */ + rc = eval_text( + "resource id=gpu kind=compute slots=1 prov=specified src=test\n" + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "resource id=L1 kind=launch prov=measured src=t\n" + "resource id=L2 kind=launch prov=measured src=t\n" + "op id=A kind=compute engine=gpu t_ns=0 launch_ns=40e6 launcher=L1 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=0 launch_ns=40e6 launcher=L2 prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && NEAR(r.makespan_ns, 40e6, 1e-3), "independent launches overlap: %.0f", r.makespan_ns); +} + +static void test_calibration(void) { + ds_model m; ds_result r; char text[4096], err[256]; + const char *body = + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n"; + /* stale: asof past taken + valid_days */ + ds_opts o; memset(&o, 0, sizeof o); o.interval_q = 0.9; + o.asof_day = ds_day_from_date("2026-11-19"); + int rc = eval_text(body, &m, &r, &o); + CHECK(rc == DS_REFUSED_STALE, "31 days after a 30-day calibration refuses, got %s", ds_status_name(rc)); + o.asof_day = ds_day_from_date("2026-11-18"); + rc = eval_text(body, &m, &r, &o); + CHECK(rc == DS_OK, "last valid day is fine, got %s", ds_status_name(rc)); + /* missing: measured value without a calibration record */ + snprintf(text, sizeof text, + "oev version=1\n" + "machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\n" + "build repo=omega-mv sha=0000000000000000000000000000000000000000\n" + "energy instrument=none\n%s", body); + rc = ds_parse_text(text, &m, err, sizeof err); + CHECK(rc == DS_OK, "parse without calibration: %s", err); + o.asof_day = ds_day_from_date("2026-10-20"); + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_REFUSED_NO_CALIBRATION, "measured without calibration refuses, got %s", ds_status_name(rc)); + /* unknown provenance never becomes a number */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu prov=unknown src=arch-244-not-run\n" + "dep A B\n", &m, &r, NULL); + CHECK(rc == DS_REFUSED_UNKNOWN, "unknown op refuses, got %s", ds_status_name(rc)); + CHECK(strstr(r.reason, "B") != NULL, "reason names the op: %s", r.reason); + CHECK(r.makespan_ns == 0, "no makespan on refusal"); + /* synthetic input marks the result */ + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=synthetic src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && r.synthetic == 1, "synthetic flag"); +} + +static void test_intervals(void) { + ds_model m; ds_result r; double lo, hi; + char text[8192]; + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 lo=0.5e9 hi=2e9 prov=measured src=t\n" + "op id=A kind=compute engine=cpu t_ns=100 lo=80 hi=150 prov=measured src=t\n" + "op id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" + "dep A B\n"); + char err[256]; + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_OK, "parse: %s", err); + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + int rc = ds_eval_interval(&m, &o, &r, &lo, &hi); + CHECK(rc == DS_OK, "interval status"); + CHECK(NEAR(r.makespan_ns, 100 + 1e9, 1e-3), "nominal %.0f", r.makespan_ns); + CHECK(NEAR(lo, 80 + 0.5e9, 1e-3), "optimistic %.0f", lo); + CHECK(NEAR(hi, 150 + 2e9, 1e-3), "pessimistic %.0f", hi); +} + +static void test_energy(void) { + ds_model m; ds_result r; char text[4096], err[256]; + int rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK && !r.energy_measured && !r.energy_synthetic, "instrument=none means UNMEASURED"); + snprintf(text, sizeof text, + "oev version=1\n" + "machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\n" + "build repo=omega-mv sha=0000000000000000000000000000000000000000\n" + "calibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\n" + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\n" + "energy instrument=tdp-guess boundary=soc power_w=100 prov=synthetic\n"); + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_OK, "parse: %s", err); + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_OK && r.energy_synthetic == 1 && !r.energy_measured && NEAR(r.energy_j, 100.0, 1e-9) && r.synthetic, + "synthetic power gives a labelled E=P*T (100 J), got %.3f syn=%d", r.energy_j, r.energy_synthetic); + snprintf(text, sizeof text, + "oev version=1\n" + "machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\n" + "build repo=omega-mv sha=0000000000000000000000000000000000000000\n" + "calibration id=c1 taken=2026-10-19 valid_days=30 load1=1.0 src=test\n" + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=1e9 prov=measured src=t\n" + "energy instrument=cyberpower-ups-nut boundary=wall joules=42.5 prov=measured src=receipt.json\n"); + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_OK, "parse: %s", err); + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_OK && r.energy_measured == 1 && NEAR(r.energy_j, 42.5, 1e-9) && !r.synthetic, "measured joules pass through"); + /* a measured joules figure with no instrument name is a parse error */ + snprintf(text, sizeof text, + "oev version=1\n" + "machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test\n" + "build repo=omega-mv sha=0000000000000000000000000000000000000000\n" + "energy instrument=none joules=42.5 prov=measured src=x\n"); + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_PARSE_ERROR, "joules without an instrument is refused at parse"); +} + +static void test_parse_and_cycles(void) { + ds_model m; ds_result r; char text[4096], err[256]; + snprintf(text, sizeof text, "%s%s", HDR, "resource id=cpu kind=compute slots=1 prov=specified src=test\nbogus x=1\n"); + int rc = ds_parse_text(text, &m, err, sizeof err); + CHECK(rc == DS_PARSE_ERROR && strstr(err, "line 8"), "unknown keyword is an error with its line: %s", err); + snprintf(text, sizeof text, "%s%s", HDR, "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1 prov=measured src=t typo=3\n"); + rc = ds_parse_text(text, &m, err, sizeof err); + CHECK(rc == DS_PARSE_ERROR, "unknown field is an error: %s", err); + snprintf(text, sizeof text, "%s%s", HDR, "resource id=cpu kind=compute slots=1 prov=specified src=test\nop id=A kind=compute engine=cpu t_ns=1 src=t\n"); + rc = ds_parse_text(text, &m, err, sizeof err); + CHECK(rc == DS_PARSE_ERROR, "a number without prov is an error: %s", err); + rc = eval_text( + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=1 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=1 prov=measured src=t\n" + "dep A B\ndep B A\n", &m, &r, NULL); + CHECK(rc == DS_REFUSED_CYCLE, "cycle refuses, got %s", ds_status_name(rc)); + /* the pinned fixture parses and evaluates */ + rc = ds_parse_file("tests/dagsim/fixtures/m1_spark_subset.oev", &m, err, sizeof err); + CHECK(rc == DS_OK, "fixture parses: %s", err); + if (rc == DS_OK) { + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_OK, "fixture evaluates: %s", r.reason); + CHECK(NEAR(r.makespan_ns, 20000 + 40736700 + 111000000, 1e-3), "fixture serial makespan %.0f", r.makespan_ns); + CHECK(!r.energy_measured && !r.energy_synthetic, "fixture energy UNMEASURED"); + } +} + +/* rx_costmodel integration: a matvec op with a fitted blob gets its time from + * rx_cm_predict; an unknown cell refuses. Synthetic observations, so the blob is + * labelled fitted on synthetic data and the result is marked synthetic. */ +static void test_costmodel_reuse(void) { + RxCostModel cm; rx_cm_init(&cm, 2); + uint64_t rng = 0x9E3779B97F4A7C15ull; + for (int i = 0; i < 200; i++) { + rng ^= rng << 13; rng ^= rng >> 7; rng ^= rng << 17; + uint32_t M = 8 + (uint32_t)(rng % 120), N = 4 + (uint32_t)((rng >> 20) % 60); + RxCmFeatures f; memset(&f, 0, sizeof f); + f.op = RX_CM_OP_MATVEC; f.M = M; f.N = N; f.state_bytes = ((uint64_t)M * N + M + N) * 8u; + f.cache_bytes = 1u << 20; f.core = RX_CM_CORE_X925; f.eligible = 3; + double l2 = 10.0 + 0.95 * (log2((double)M) + log2((double)N)); + RxCmObservation o; o.failed = 0; o.ps_per_call = (uint64_t)pow(2.0, l2); + rx_cm_observe(&cm, &f, 0, &o); + } + ds_model m; ds_result r; char text[4096], err[256]; + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=mv kind=matvec engine=cpu M=64 N=16 core=0 arm=0 prov=fitted src=rx_costmodel\n"); + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_OK, "parse: %s", err); + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + int rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_REFUSED_UNKNOWN, "matvec with no model refuses, got %s", ds_status_name(rc)); + o.costmodel = &cm; + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_OK, "matvec with model: %s %s", ds_status_name(rc), r.reason); + RxCmFeatures f; memset(&f, 0, sizeof f); + f.op = RX_CM_OP_MATVEC; f.M = 64; f.N = 16; f.state_bytes = (64u * 16u + 64u + 16u) * 8u; f.cache_bytes = 1u << 20; f.core = 0; + RxCmPrediction p; rx_cm_predict(&cm, &f, 0, &p); + CHECK(p.known, "cell known"); + CHECK(NEAR(r.makespan_ns, pow(2.0, p.mean_log2_ps) / 1000.0, 1e-6), "time comes from rx_cm_predict: %.3f vs %.3f", r.makespan_ns, pow(2.0, p.mean_log2_ps) / 1000.0); + CHECK(r.prov_mask & (1u << DS_PROV_FITTED), "fitted provenance recorded"); + /* arm 1 was never observed: unknown, refuse */ + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=mv kind=matvec engine=cpu M=64 N=16 core=0 arm=1 prov=fitted src=rx_costmodel\n"); + CHECK(ds_parse_text(text, &m, err, sizeof err) == DS_OK, "parse: %s", err); + rc = ds_eval(&m, &o, &r); + CHECK(rc == DS_REFUSED_UNKNOWN, "unobserved arm refuses, got %s", ds_status_name(rc)); +} + +static void test_counterfactual(void) { + ds_model m; ds_result r; + int rc = eval_text( + "resource id=cpu kind=compute slots=2 prov=specified src=test\n" + "resource id=pipe kind=bandwidth cap=1e9 prov=measured src=t\n" + "op id=A kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n" + "op id=B kind=copy engine=cpu bytes=1e9 bw=pipe prov=measured src=t\n", &m, &r, NULL); + CHECK(rc == DS_OK, "cf status"); + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + double d = ds_counterfactual(&m, &o, ds_find_res(&m, "pipe")); + CHECK(NEAR(d, 1e9, 1e-3), "doubling the pipe halves the bandwidth-bound DAG: %.0f", d); + d = ds_counterfactual(&m, &o, ds_find_res(&m, "cpu")); + CHECK(NEAR(d, 2e9, 1e-3), "doubling slots changes nothing when the pipe binds: %.0f", d); +} + +static void test_minimum_work_diff(void) { + ds_model base, tr; ds_diff d; char text[8192], err[256]; + const char *base_body = + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B kind=compute engine=cpu t_ns=20 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A B\ndep B C\n"; + snprintf(text, sizeof text, "%s%s", HDR, base_body); + CHECK(ds_parse_text(text, &base, err, sizeof err) == DS_OK, "base: %s", err); + ds_opts o; memset(&o, 0, sizeof o); o.asof_day = ds_day_from_date("2026-10-20"); o.interval_q = 0.9; + /* no change: identical transformed DAG adds no nodes and removes none */ + CHECK(ds_parse_text(text, &tr, err, sizeof err) == DS_OK, "tr: %s", err); + CHECK(ds_diff_models(&base, &tr, &o, &d) == DS_OK && d.n_removed == 0 && d.n_added == 0 && d.n_kept == 3, "no-change fixture: removed %d added %d kept %d", d.n_removed, d.n_added, d.n_kept); + /* B reused from a lookup: valid, 20 ns of work moves to the reused ledger */ + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=B_lookup kind=compute engine=cpu t_ns=2 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A B_lookup\ndep B_lookup C\n" + "removed op=B reason=reused ref=B_lookup proof=rx_plan:digest\n"); + CHECK(ds_parse_text(text, &tr, err, sizeof err) == DS_OK, "tr2: %s", err); + int rc = ds_diff_models(&base, &tr, &o, &d); + CHECK(rc == DS_OK && NEAR(d.removed_ns[DS_RM_REUSED], 20, 1e-9) && d.n_added == 1, "reuse accounted: %s rc=%s", d.reason, ds_status_name(rc)); + /* eliminated with no proof while C still consumed it: required work cannot vanish by assertion */ + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A C\n" + "removed op=B reason=eliminated\n"); + CHECK(ds_parse_text(text, &tr, err, sizeof err) == DS_OK, "tr3: %s", err); + rc = ds_diff_models(&base, &tr, &o, &d); + CHECK(rc == DS_REFUSED_REMOVED_REQUIRED && d.required_removed, "unproven elimination of consumed work refuses, got %s", ds_status_name(rc)); + /* unchanged_dep on A, but A changed: the consumer is invalidated */ + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A C\n" + "removed op=B reason=unchanged_dep ref=A\n"); + CHECK(ds_parse_text(text, &tr, err, sizeof err) == DS_OK, "tr4: %s", err); + rc = ds_diff_models(&base, &tr, &o, &d); + CHECK(rc == DS_OK && NEAR(d.removed_ns[DS_RM_UNCHANGED_DEP], 20, 1e-9), "unchanged dependency allows skipping B"); + o.changed = "A"; + rc = ds_diff_models(&base, &tr, &o, &d); + CHECK(rc == DS_REFUSED_REMOVED_REQUIRED, "changed A invalidates the skip of B, got %s", ds_status_name(rc)); + o.changed = NULL; + /* shared work counted twice is detected */ + snprintf(text, sizeof text, "%s%s", HDR, + "resource id=cpu kind=compute slots=1 prov=specified src=test\n" + "op id=A kind=compute engine=cpu t_ns=10 prov=measured src=t\n" + "op id=C kind=compute engine=cpu t_ns=30 prov=measured src=t\n" + "dep A C\n" + "removed op=B reason=shared ref=A\n" + "removed op=B reason=shared ref=C\n"); + CHECK(ds_parse_text(text, &tr, err, sizeof err) == DS_OK, "tr5: %s", err); + rc = ds_diff_models(&base, &tr, &o, &d); + CHECK(rc != DS_OK && d.double_counted, "double-counted shared work detected"); +} + +int main(void) { + test_serial_chain(); + test_perfect_overlap(); + test_shared_bandwidth(); + test_capacity_refusal(); + test_lifetimes(); + test_sync(); + test_launch(); + test_calibration(); + test_intervals(); + test_energy(); + test_parse_and_cycles(); + test_costmodel_reuse(); + test_counterfactual(); + test_minimum_work_diff(); + printf("dagsim_unit: %d checks, %d failed\n", g_checks, g_fail); + return g_fail ? 1 : 0; +} diff --git a/tests/dagsim/fixtures/m1_spark_overlap.oev b/tests/dagsim/fixtures/m1_spark_overlap.oev new file mode 100644 index 000000000..249980f17 --- /dev/null +++ b/tests/dagsim/fixtures/m1_spark_overlap.oev @@ -0,0 +1,34 @@ +# OEV1 fixture: Spark M1 hardware passport subset (omega-mv#578), pinned 2026-10-19. +# Every number below is a loaded-machine measurement (load1 15 to 29) or a datasheet +# ceiling, and says which. Nothing here was produced by running a GPU in this harness. +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 physics=6d7cf0d4 +calibration id=M1-20261019 taken=2026-10-19 valid_days=30 load1=24.2 src=~/yardsticks/aien-model/M1/ + +# Resources. One capacity ledger for CPU and GPU (unified memory). +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=gpu kind=compute slots=1 prov=specified src=one-job-at-a-time-engine +resource id=dram_spec kind=bandwidth cap=273e9 prov=specified src=nvidia-dgx-spark-datasheet +resource id=dram_gpu kind=bandwidth cap=218.6e9 lo=218.6e9 hi=219e9 prov=measured src=handoff-2026-10-19-qwen38-decode-speed.md:calc:e726ff77 +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +resource id=gpu_launch kind=launch prov=measured src=M1/block2.csv + +# Ops. Same work as m1_spark_subset.oev, but the 1 GB copy is split into two +# concurrent halves on two CPU slots. They share dram_cpu (processor sharing). +# At two threads the per-thread busy time (55.5 ms) still binds and the shared +# pipe does not (2 GB of traffic at 65.4 GB/s is 30.6 ms), which is what block4 +# shows at 4 threads (50 to 61 GB/s). More halves would hit the pipe. +op id=realize kind=compute engine=cpu t_ns=20000 lo=19400 hi=22800 prov=measured src=M1/block1.csv:path_ns_per_call +op id=gpu_job kind=compute engine=gpu t_ns=0 prov=measured src=M1/block2.csv:vecadd_65 launch_ns=40736700 launcher=gpu_launch +op id=copyA kind=copy engine=cpu t_ns=55500000 lo=53950000 hi=58300000 prov=measured src=M1/block4.csv:gb=1,threads=1,half bytes=1000000000 bw=dram_cpu +op id=copyB kind=copy engine=cpu t_ns=55500000 lo=53950000 hi=58300000 prov=measured src=M1/block4.csv:gb=1,threads=1,half bytes=1000000000 bw=dram_cpu +dep realize gpu_job +dep gpu_job copyA +dep gpu_job copyB + +buffer id=src1g bytes=1000000000 cap=unified_mem first=copyA last=copyB +buffer id=dst1g bytes=1000000000 cap=unified_mem first=copyA last=copyB + +energy instrument=none diff --git a/tests/dagsim/fixtures/m1_spark_subset.oev b/tests/dagsim/fixtures/m1_spark_subset.oev new file mode 100644 index 000000000..34fdf7364 --- /dev/null +++ b/tests/dagsim/fixtures/m1_spark_subset.oev @@ -0,0 +1,32 @@ +# OEV1 fixture: Spark M1 hardware passport subset (omega-mv#578), pinned 2026-10-19. +# Every number below is a loaded-machine measurement (load1 15 to 29) or a datasheet +# ceiling, and says which. Nothing here was produced by running a GPU in this harness. +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 physics=6d7cf0d4 +calibration id=M1-20261019 taken=2026-10-19 valid_days=30 load1=24.2 src=~/yardsticks/aien-model/M1/ + +# Resources. One capacity ledger for CPU and GPU (unified memory). +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=gpu kind=compute slots=1 prov=specified src=one-job-at-a-time-engine +resource id=dram_spec kind=bandwidth cap=273e9 prov=specified src=nvidia-dgx-spark-datasheet +resource id=dram_gpu kind=bandwidth cap=218.6e9 lo=218.6e9 hi=219e9 prov=measured src=handoff-2026-10-19-qwen38-decode-speed.md:calc:e726ff77 +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +resource id=gpu_launch kind=launch prov=measured src=M1/block2.csv + +# Ops. A CPU realization call (block1 path) feeding one GPU job (block2) whose +# fixed submit lifecycle dominates, then a CPU memcpy of 1 GB (block4, 1 thread). +op id=realize kind=compute engine=cpu t_ns=20000 lo=19400 hi=22800 prov=measured src=M1/block1.csv:path_ns_per_call +op id=gpu_job kind=compute engine=gpu t_ns=0 prov=measured src=M1/block2.csv:vecadd_65 launch_ns=40736700 launcher=gpu_launch +op id=copy1g kind=copy engine=cpu t_ns=111000000 lo=107900000 hi=116600000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=2000000000 bw=dram_cpu +dep realize gpu_job +dep gpu_job copy1g + +# Buffers. +buffer id=src1g bytes=1000000000 cap=unified_mem first=copy1g last=copy1g +buffer id=dst1g bytes=1000000000 cap=unified_mem first=copy1g last=copy1g + +# Energy: no wall instrument on this box; nvidia-smi is GPU module only and was not +# integrated over this DAG. UNMEASURED. +energy instrument=none diff --git a/tests/dagsim/fixtures/m1_synthetic_power.oev b/tests/dagsim/fixtures/m1_synthetic_power.oev new file mode 100644 index 000000000..3087178ea --- /dev/null +++ b/tests/dagsim/fixtures/m1_synthetic_power.oev @@ -0,0 +1,31 @@ +# OEV1 fixture: Spark M1 hardware passport subset (omega-mv#578), pinned 2026-10-19. +# Every number below is a loaded-machine measurement (load1 15 to 29) or a datasheet +# ceiling, and says which. Nothing here was produced by running a GPU in this harness. +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 physics=6d7cf0d4 +calibration id=M1-20261019 taken=2026-10-19 valid_days=30 load1=24.2 src=~/yardsticks/aien-model/M1/ + +# Resources. One capacity ledger for CPU and GPU (unified memory). +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=gpu kind=compute slots=1 prov=specified src=one-job-at-a-time-engine +resource id=dram_spec kind=bandwidth cap=273e9 prov=specified src=nvidia-dgx-spark-datasheet +resource id=dram_gpu kind=bandwidth cap=218.6e9 lo=218.6e9 hi=219e9 prov=measured src=handoff-2026-10-19-qwen38-decode-speed.md:calc:e726ff77 +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +resource id=gpu_launch kind=launch prov=measured src=M1/block2.csv + +# Ops. A CPU realization call (block1 path) feeding one GPU job (block2) whose +# fixed submit lifecycle dominates, then a CPU memcpy of 1 GB (block4, 1 thread). +op id=realize kind=compute engine=cpu t_ns=20000 lo=19400 hi=22800 prov=measured src=M1/block1.csv:path_ns_per_call +op id=gpu_job kind=compute engine=gpu t_ns=0 prov=measured src=M1/block2.csv:vecadd_65 launch_ns=40736700 launcher=gpu_launch +op id=copy1g kind=copy engine=cpu t_ns=111000000 lo=107900000 hi=116600000 prov=measured src=M1/block4.csv:gb=1,threads=1 bytes=2000000000 bw=dram_cpu +dep realize gpu_job +dep gpu_job copy1g + +# Buffers. +buffer id=src1g bytes=1000000000 cap=unified_mem first=copy1g last=copy1g +buffer id=dst1g bytes=1000000000 cap=unified_mem first=copy1g last=copy1g + +# Labelled sensitivity only: 100 W is a made-up figure, not an instrument. +energy instrument=what-if-100W boundary=wall power_w=100 prov=synthetic diff --git a/tests/dagsim/fixtures/mw_bad_elimination.oev b/tests/dagsim/fixtures/mw_bad_elimination.oev new file mode 100644 index 000000000..cc9e2a480 --- /dev/null +++ b/tests/dagsim/fixtures/mw_bad_elimination.oev @@ -0,0 +1,14 @@ +# Minimum-work accounting fixtures (parent #276 clarification). Synthetic +# numbers, labelled so; the point is the ledger, not the magnitudes. +oev version=1 +machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test +build repo=omega-mv sha=0000000000000000000000000000000000000000 +calibration id=mw taken=2026-10-19 valid_days=3650 load1=0 src=synthetic +resource id=cpu kind=compute slots=1 prov=specified src=test +resource id=mem kind=capacity cap=1000 prov=specified src=test +energy instrument=none +op id=parse kind=compute engine=cpu t_ns=10 prov=synthetic src=t +op id=execute kind=compute engine=cpu t_ns=50 prov=synthetic src=t +dep parse execute +removed op=search reason=eliminated +removed op=check reason=eliminated diff --git a/tests/dagsim/fixtures/mw_baseline.oev b/tests/dagsim/fixtures/mw_baseline.oev new file mode 100644 index 000000000..e2eaf36f8 --- /dev/null +++ b/tests/dagsim/fixtures/mw_baseline.oev @@ -0,0 +1,16 @@ +# Minimum-work accounting fixtures (parent #276 clarification). Synthetic +# numbers, labelled so; the point is the ledger, not the magnitudes. +oev version=1 +machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test +build repo=omega-mv sha=0000000000000000000000000000000000000000 +calibration id=mw taken=2026-10-19 valid_days=3650 load1=0 src=synthetic +resource id=cpu kind=compute slots=1 prov=specified src=test +resource id=mem kind=capacity cap=1000 prov=specified src=test +energy instrument=none +op id=parse kind=compute engine=cpu t_ns=10 prov=synthetic src=t +op id=search kind=compute engine=cpu t_ns=200 prov=synthetic src=t +op id=check kind=compute engine=cpu t_ns=20 prov=synthetic src=t +op id=execute kind=compute engine=cpu t_ns=50 prov=synthetic src=t +dep parse search +dep search check +dep check execute diff --git a/tests/dagsim/fixtures/mw_reuse.oev b/tests/dagsim/fixtures/mw_reuse.oev new file mode 100644 index 000000000..9e24750f3 --- /dev/null +++ b/tests/dagsim/fixtures/mw_reuse.oev @@ -0,0 +1,17 @@ +# Minimum-work accounting fixtures (parent #276 clarification). Synthetic +# numbers, labelled so; the point is the ledger, not the magnitudes. +oev version=1 +machine id=t soc=t cores=4 mem_bytes=1000 prov=specified src=test +build repo=omega-mv sha=0000000000000000000000000000000000000000 +calibration id=mw taken=2026-10-19 valid_days=3650 load1=0 src=synthetic +resource id=cpu kind=compute slots=1 prov=specified src=test +resource id=mem kind=capacity cap=1000 prov=specified src=test +energy instrument=none +op id=parse kind=compute engine=cpu t_ns=10 prov=synthetic src=t +op id=lookup kind=compute engine=cpu t_ns=5 prov=synthetic src=t +op id=check kind=compute engine=cpu t_ns=20 prov=synthetic src=t +op id=execute kind=compute engine=cpu t_ns=50 prov=synthetic src=t +dep parse lookup +dep lookup check +dep check execute +removed op=search reason=reused ref=lookup proof=rx_plan:verified-plan-digest diff --git a/tests/dagsim/fixtures/needs_arch244_trace.oev b/tests/dagsim/fixtures/needs_arch244_trace.oev new file mode 100644 index 000000000..671165072 --- /dev/null +++ b/tests/dagsim/fixtures/needs_arch244_trace.oev @@ -0,0 +1,24 @@ +# OEV1 fixture: Spark M1 hardware passport subset (omega-mv#578), pinned 2026-10-19. +# Every number below is a loaded-machine measurement (load1 15 to 29) or a datasheet +# ceiling, and says which. Nothing here was produced by running a GPU in this harness. +oev version=1 +machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +build repo=omega-mv sha=f4a9849f00000000000000000000000000000000 physics=6d7cf0d4 +calibration id=M1-20261019 taken=2026-10-19 valid_days=30 load1=24.2 src=~/yardsticks/aien-model/M1/ + +# Resources. One capacity ledger for CPU and GPU (unified memory). +resource id=cpu kind=compute slots=20 prov=specified src=nproc +resource id=gpu kind=compute slots=1 prov=specified src=one-job-at-a-time-engine +resource id=dram_spec kind=bandwidth cap=273e9 prov=specified src=nvidia-dgx-spark-datasheet +resource id=dram_gpu kind=bandwidth cap=218.6e9 lo=218.6e9 hi=219e9 prov=measured src=handoff-2026-10-19-qwen38-decode-speed.md:calc:e726ff77 +resource id=dram_cpu kind=bandwidth cap=65.4e9 lo=60.8e9 hi=69.8e9 prov=measured src=M1/block4.csv:gb=1,threads=8 +resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet +resource id=gpu_launch kind=launch prov=measured src=M1/block2.csv + +# Ops. The second op needs the aien-architecture#244 objective trace, which was +# NOT_RUN on 2026-10-19. Unknown stays unknown: this fixture must be refused. +op id=realize kind=compute engine=cpu t_ns=20000 lo=19400 hi=22800 prov=measured src=M1/block1.csv:path_ns_per_call +op id=objective_replay kind=compute engine=cpu prov=unknown src=aien-architecture#244:NOT_RUN +dep realize objective_replay + +energy instrument=none diff --git a/tests/dagsim/heldout_memcpy.sh b/tests/dagsim/heldout_memcpy.sh new file mode 100644 index 000000000..9b82b57f1 --- /dev/null +++ b/tests/dagsim/heldout_memcpy.sh @@ -0,0 +1,134 @@ +#!/bin/sh +# heldout_memcpy.sh DAGSIM_BIN EVIDENCE_DIR {predict|compare} +# +# Held-out test of the shared-bandwidth model (omega-mv#583, acceptance +# boxes 3 and 4). The DAG for k threads copying 1 GB is k independent copy +# ops that share one bandwidth resource. Fitting set: M1 block4 rows at +# k=1 (per-thread busy rate) and k=8 (shared pipe cap); both are loaded-box +# measurements from 2026-10-19. Held-out: fresh measurements at k=2,3,5,6 +# (never measured before) plus k=4 and k=16, which block4 did measure, as +# the lookup control's home ground and the out-of-envelope case. +# +# predict: writes fixtures and predictions.csv. Run BEFORE any measurement. +# compare: reads measured/*.csv, applies the precommitted gates, writes +# heldout_results.md. Controls: nearest-k lookup from block4 and a +# spec roofline that uses the 273 GB/s datasheet figure. +set -u +BIN=${1:?dagsim}; EV=${2:?evidence dir}; MODE=${3:?predict|compare} +ASOF=2026-10-20 +# fitted parameters (B/ns), from block4 1 GB rows: k=1 median 0.1117 s for 1 GB +# (lo 0.1079, hi 0.1166); k=8 read+write 65.4 GB/s median (lo 60.8, hi 69.8). +T1=0.1117; T1LO=0.1079; T1HI=0.1166 +CAP=65.4e9; CAPLO=60.8e9; CAPHI=69.8e9 +CALSRC="~/yardsticks/aien-model/M1/block4.csv"; CALID="M1-20261019-block4"; CALLOAD=14.8 +KS="2 3 5 6 4 16" +# Round 2 and later: FIT_DIR holds memcpy_k1.csv and memcpy_k8.csv from this probe on the +# same box state; T1 and CAP are refitted from them (median, min, max). PRED_SUB/MEAS_SUB +# pick the output subdirectories so rounds do not overwrite each other. +PRED_SUB=${PRED_SUB:-predictions}; MEAS_SUB=${MEAS_SUB:-measured}; PRED_CSV="$EV/${PRED_CSV:-predictions.csv}"; RESULT_MD="$EV/${RESULT_MD:-heldout_results.md}" +if [ -n "${FIT_DIR:-}" ]; then + med3() { awk -F, '!/^#/ && !/^gb/ && $2>0 {print $'"$1"'}' "$2" | sort -g | awk '{v[NR]=$1} END{n=NR; printf "%.6g %.6g %.6g", (n%2? v[(n+1)/2] : (v[n/2]+v[n/2+1])/2), v[1], v[n]}'; } + set -- $(med3 4 "$FIT_DIR/memcpy_k1.csv"); T1=$1; T1LO=$2; T1HI=$3 + set -- $(med3 5 "$FIT_DIR/memcpy_k8.csv"); CAP=${1}e9; CAPLO=${2}e9; CAPHI=${3}e9 + CALSRC="$FIT_DIR"; CALID="round2-same-state"; CALLOAD=$(sed -n 's/^# before .*loadavg=\([0-9.]*\).*/\1/p' "$FIT_DIR/memcpy_k1.csv") + echo "# refit from $FIT_DIR: T1=$T1 [$T1LO..$T1HI] s, CAP=$CAP [$CAPLO..$CAPHI] B/s, load1=$CALLOAD" +fi +mkdir -p "$EV/fixtures" "$EV/$PRED_SUB" "$EV/$MEAS_SUB" + +fixture() { # k + k=$1 + f="$EV/fixtures/${FIXPFX:-}memcpy_k$k.oev" + { + echo "# held-out fixture: $k threads copy 1 GB total; fitted from M1 block4 k=1 and k=8 only" + echo "oev version=1" + echo "machine id=spark-b87b soc=GB10 cores=20 mem_bytes=137438953472 prov=specified src=nvidia-dgx-spark-datasheet" + echo "build repo=omega-mv sha=f4a9849f00000000000000000000000000000000" + echo "calibration id=$CALID taken=2026-10-19 valid_days=30 load1=$CALLOAD src=$CALSRC" + echo "resource id=cpu kind=compute slots=20 prov=specified src=nproc" + echo "resource id=dram_cpu kind=bandwidth cap=$CAP lo=$CAPLO hi=$CAPHI prov=measured src=$CALSRC:gb=1,threads=8" + echo "resource id=unified_mem kind=capacity cap=137438953472 prov=specified src=nvidia-dgx-spark-datasheet" + i=0 + while [ $i -lt $k ]; do + t=$(awk -v t=$T1 -v k=$k 'BEGIN{printf "%.0f", t/k*1e9}') + lo=$(awk -v t=$T1LO -v k=$k 'BEGIN{printf "%.0f", t/k*1e9}') + hi=$(awk -v t=$T1HI -v k=$k 'BEGIN{printf "%.0f", t/k*1e9}') + b=$(awk -v k=$k 'BEGIN{printf "%.0f", 2e9/k}') + echo "op id=copy$i kind=copy engine=cpu t_ns=$t lo=$lo hi=$hi prov=measured src=$CALSRC:gb=1,threads=1 bytes=$b bw=dram_cpu" + i=$((i+1)) + done + echo "buffer id=src bytes=1000000000 cap=unified_mem" + echo "buffer id=dst bytes=1000000000 cap=unified_mem" + echo "energy instrument=none" + } > "$f" + echo "$f" +} + +if [ "$MODE" = predict ]; then + echo "k,pred_s,pred_lo_s,pred_hi_s,pred_GBps,lookup_GBps,spec_roofline_GBps,status" > "$PRED_CSV" + for k in $KS; do + f=$(fixture $k) + "$BIN" eval "$f" --asof $ASOF > "$EV/$PRED_SUB/memcpy_k$k.json" + st=$(grep -o '"status": "[A-Z_]*"' "$EV/$PRED_SUB/memcpy_k$k.json" | head -1 | cut -d'"' -f4) + nom=$(grep -o '"nominal": [0-9.e+]*' "$EV/$PRED_SUB/memcpy_k$k.json" | head -1 | awk '{print $2}') + lo=$(grep -o '"lo": [0-9.e+]*' "$EV/$PRED_SUB/memcpy_k$k.json" | head -1 | awk '{print $2}') + hi=$(grep -o '"hi": [0-9.e+]*' "$EV/$PRED_SUB/memcpy_k$k.json" | head -1 | awk '{print $2}') + # lookup control: block4 1 GB median GBps at the nearest measured k in log2 distance (1,4,8,16) + if [ -n "${FIT_DIR:-}" ]; then + lk=$(awk -v k=$k 'BEGIN{d1=log(k);d8=log(k/8);if(d8<0)d8=-d8;print (d1<=d8)?1:8}') + lookup=$(awk -F, '!/^#/ && !/^gb/ && $2>0 {print $5}' "$FIT_DIR/memcpy_k$lk.csv" | sort -g | awk '{v[NR]=$1} END{n=NR; if(!n){print "NA"; exit} printf "%.1f", (n%2? v[(n+1)/2] : (v[n/2]+v[n/2+1])/2)}') + else + lk=$(awk -v k=$k 'BEGIN{best=1;bd=99;for(i=1;i<=4;i++){m=(i==1?1:i==2?4:i==3?8:16);d=log(k/m);if(d<0)d=-d;if(dtt)tt=tp; printf "%.1f", 2/tt}') + awk -v k=$k -v n=$nom -v l=$lo -v h=$hi -v lk=$lookup -v sp=$spec -v st=$st 'BEGIN{printf "%d,%.4f,%.4f,%.4f,%.1f,%s,%s,%s\n", k, n/1e9, l/1e9, h/1e9, 2/(n/1e9), lk, sp, st}' >> "$PRED_CSV" + done + cat "$PRED_CSV" + exit 0 +fi + +if [ "$MODE" = compare ]; then + out="$RESULT_MD" + { + echo "# Held-out results: shared-bandwidth model vs fresh memcpy measurements" + echo + echo "Gates were precommitted in PRECOMMIT.md before any of these rows were measured. Calibration: $CALID ($CALSRC)." + echo + echo "| k | measured median GB/s (n, min..max) | predicted GB/s [hi..lo] | rel. error | covered | lookup ctrl GB/s (err) | spec roofline GB/s (err) | envelope |" + echo "|---|---|---|---|---|---|---|---|" + } > "$out" + pass_err=0; n_err=0; cover=0; n_cov=0 + for k in $KS; do + m="$EV/$MEAS_SUB/memcpy_k$k.csv" + [ -f "$m" ] || { echo "| $k | NOT_RUN | | | | | | |" >> "$out"; continue; } + stats=$(awk -F, '!/^#/ && !/^gb/ && $2>0 {print $5}' "$m" | sort -g | awk '{v[NR]=$1} END{n=NR; med=(n%2? v[(n+1)/2] : (v[n/2]+v[n/2+1])/2); printf "%.1f %d %.1f %.1f", med, n, v[1], v[n]}') + med=$(echo $stats | cut -d' ' -f1); n=$(echo $stats | cut -d' ' -f2); mn=$(echo $stats | cut -d' ' -f3); mx=$(echo $stats | cut -d' ' -f4) + row=$(awk -F, -v k=$k '$1==k' "$PRED_CSV") + ps=$(echo "$row" | cut -d, -f2); plo=$(echo "$row" | cut -d, -f3); phi=$(echo "$row" | cut -d, -f4); pg=$(echo "$row" | cut -d, -f5); lk=$(echo "$row" | cut -d, -f6); sp=$(echo "$row" | cut -d, -f7) + g_hi=$(awk -v s=$plo 'BEGIN{printf "%.1f", 2/s}'); g_lo=$(awk -v s=$phi 'BEGIN{printf "%.1f", 2/s}') + err=$(awk -v p=$pg -v m=$med 'BEGIN{printf "%+.1f%%", (p-m)/m*100}') + lerr=$(awk -v p=$lk -v m=$med 'BEGIN{printf "%+.1f%%", (p-m)/m*100}') + serr=$(awk -v p=$sp -v m=$med 'BEGIN{printf "%+.1f%%", (p-m)/m*100}') + cov=$(awk -v m=$med -v lo=$g_lo -v hi=$g_hi 'BEGIN{print (m>=lo && m<=hi)?"yes":"no"}') + env="in"; case $k in 16) env="OUT (16 threads + load above 20 cores)";; 4) env="in (lookup home ground)";; esac + echo "| $k | $med ($n, $mn..$mx) | $pg [$g_lo..$g_hi] | $err | $cov | $lk ($lerr) | $sp ($serr) | $env |" >> "$out" + case $k in 2|3|5|6) + n_err=$((n_err+1)); n_cov=$((n_cov+1)) + awk -v p=$pg -v m=$med 'BEGIN{e=(p-m)/m; if(e<0)e=-e; exit !(e<=0.25)}' && pass_err=$((pass_err+1)) + [ "$cov" = yes ] && cover=$((cover+1));; + esac + done + { + echo + echo "## Gates (precommitted)" + echo + echo "- G-err: nominal prediction within 25% of the measured median on each of k=2,3,5,6: $pass_err of $n_err passed. $( [ $pass_err -eq $n_err ] && [ $n_err -gt 0 ] && echo PASS || echo FAIL )" + echo "- G-cov: [lo..hi] interval covers the measured median on at least 3 of 4 held-out k: $cover of $n_cov covered. $( [ $cover -ge 3 ] && echo PASS || echo FAIL )" + echo "- Energy: UNMEASURED (no wall instrument integrated over these runs)." + echo + echo "Load during measurement is in the header lines of measured/*.csv; every number is a loaded-box number." + } >> "$out" + cat "$out" + exit 0 +fi +echo "mode must be predict or compare"; exit 2 diff --git a/tests/dagsim/measure.sh b/tests/dagsim/measure.sh new file mode 100644 index 000000000..8c29926a4 --- /dev/null +++ b/tests/dagsim/measure.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# measure.sh PROBE_BIN EVIDENCE_DIR [SUBDIR] (KS="1 8" env selects thread counts; PIN="5-9,15-19" pins with taskset) +# Runs the held-out memcpy rows under the GB10 lock, held only for the +# measurement (about 20 s total). Wrap the call in quiet-measure so builds +# drain first. If the GB10 lock is not free within 20 minutes, the +# spark-measure rule applies: run anyway and record the load (the header +# lines of every CSV carry it). +set -u +PROBE=${1:?probe}; EV=${2:?evidence dir}; SUB=${3:-measured}; KS=${KS:-2 3 5 6 4 16} +mkdir -p "$EV/$SUB" +runs() { + for k in $KS; do + # 12 GiB headroom rule (spark-measure): the probe takes 2 GB, so wait for 14.5 GiB, up to 10 min, else skip. + i=0 + while [ $i -lt 60 ]; do + avail=$(awk '/MemAvailable/ {print $2}' /proc/meminfo) + [ "$avail" -ge 15204352 ] && break + sleep 10; i=$((i+1)) + done + if [ "$avail" -lt 15204352 ]; then echo "# SKIPPED k=$k: MemAvailable ${avail} kB under the 12 GiB headroom rule plus 2 GB for the probe" > "$EV/$SUB/memcpy_k$k.csv"; continue; fi + if [ -n "${PIN:-}" ]; then nice -n 10 taskset -c "$PIN" "$PROBE" 1 $k 10 > "$EV/$SUB/memcpy_k$k.csv" 2>&1 + else nice -n 10 "$PROBE" 1 $k 10 > "$EV/$SUB/memcpy_k$k.csv" 2>&1; fi + done +} +exec 9>/tmp/aien-gb10.lock +if flock -w 1200 9; then + echo "gb10 lock held for the runs ($(date -u +%FT%TZ))" > "$EV/$SUB/LOCK.txt" + runs + flock -u 9 +else + echo "gb10 lock not acquired within 1200 s; ran without it ($(date -u +%FT%TZ)); load is in each CSV header" > "$EV/$SUB/LOCK.txt" + runs +fi +cat "$EV/$SUB/LOCK.txt" diff --git a/tests/dagsim/run_cli.sh b/tests/dagsim/run_cli.sh new file mode 100644 index 000000000..5b22297de --- /dev/null +++ b/tests/dagsim/run_cli.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# run_cli.sh DAGSIM_BIN [OUT_DIR] +# Reproducible CLI example for omega-mv#583: pinned fixtures in, JSON and a +# Pareto table out, byte-identical on a second run, no GPU touched. +set -u +BIN=${1:?dagsim binary} +OUT=${2:-/tmp/dagsim-cli-$$} +F=tests/dagsim/fixtures +ASOF=2026-10-20 +mkdir -p "$OUT" +fail=0 +say() { echo "run_cli: $*"; } +check() { if [ "$1" -ne 0 ]; then say "FAIL $2"; fail=1; else say "ok $2"; fi; } + +"$BIN" eval $F/m1_spark_subset.oev --asof $ASOF > "$OUT/subset.json"; rc=$? +check $rc "eval exits 0 on the pinned M1 subset" +grep -q '"status": "OK"' "$OUT/subset.json"; check $? "status OK" +grep -q '"makespan_ns": {"nominal": 151756700,' "$OUT/subset.json"; check $? "serial makespan 20000 + 40736700 + 111000000 ns" +grep -q '"makespan_ge_bounds": true' "$OUT/subset.json"; check $? "makespan is above its bounds" +grep -q '"status": "UNMEASURED"' "$OUT/subset.json"; check $? "energy UNMEASURED without an instrument" +grep -q '"gpu_executed": false' "$OUT/subset.json"; check $? "offline: no GPU execution" +grep -q '"provenance": \["measured", "specified"\]' "$OUT/subset.json"; check $? "provenance list names measured and specified only" +"$BIN" eval $F/m1_spark_subset.oev --asof $ASOF > "$OUT/subset2.json" +cmp -s "$OUT/subset.json" "$OUT/subset2.json"; check $? "second run byte-identical" + +"$BIN" eval $F/needs_arch244_trace.oev --asof $ASOF > "$OUT/unknown.json"; rc=$? +[ $rc -eq 1 ] ; check $? "unknown-trace fixture exits 1" +grep -q '"status": "REFUSED_UNKNOWN"' "$OUT/unknown.json"; check $? "unknown stays unknown (REFUSED_UNKNOWN)" +grep -q 'makespan' "$OUT/unknown.json"; [ $? -ne 0 ]; check $? "no makespan printed on refusal" + +"$BIN" eval $F/m1_spark_subset.oev --asof 2026-12-01 > "$OUT/stale.json" +grep -q '"status": "REFUSED_STALE"' "$OUT/stale.json"; check $? "30-day calibration refused at 43 days" + +"$BIN" eval $F/m1_synthetic_power.oev --asof $ASOF > "$OUT/syn.json" +grep -q '"status": "SYNTHETIC_SENSITIVITY_ONLY"' "$OUT/syn.json"; check $? "synthetic power is labelled, not ranked" +grep -q '"ranking_valid": false' "$OUT/syn.json"; check $? "energy ranking invalid on synthetic power" + +"$BIN" eval $F/m1_spark_overlap.oev --asof $ASOF > "$OUT/overlap.json" +grep -q '"status": "OK"' "$OUT/overlap.json"; check $? "overlap fixture evaluates" +# two halves sharing a 65.4 GB/s pipe: 2 GB of traffic is 30.58 ms, each half's own busy +# time is 55.5 ms, so busy time binds and both halves end together at 40.7567 + 55.5 ms. +grep -q '"makespan_ns": {"nominal": 96256700,' "$OUT/overlap.json"; check $? "split copy: busy time binds, 40756700 + 55500000 ns" + +"$BIN" pareto $F/m1_spark_subset.oev $F/m1_spark_overlap.oev $F/m1_synthetic_power.oev $F/needs_arch244_trace.oev --asof $ASOF > "$OUT/pareto.txt"; rc=$? +check $rc "pareto exits 0" +grep -q 'needs_arch244_trace.oev *REFUSED_UNKNOWN' "$OUT/pareto.txt"; check $? "refused candidate shown as refused in the table" +grep -q 'm1_spark_overlap.oev *OK .* yes$' "$OUT/pareto.txt"; check $? "faster candidate is on the front" +grep -q 'm1_spark_subset.oev *OK .* no$' "$OUT/pareto.txt"; check $? "dominated candidate is off the front" +grep -q 'Energy not measured on every row' "$OUT/pareto.txt"; check $? "pareto says energy is not ranked" + +"$BIN" diff $F/mw_baseline.oev $F/mw_reuse.oev --asof $ASOF > "$OUT/diff_reuse.json"; rc=$? +check $rc "reuse diff OK" +grep -q '"reused": 200' "$OUT/diff_reuse.json"; check $? "200 ns of search moved to the reused ledger" +"$BIN" diff $F/mw_baseline.oev $F/mw_bad_elimination.oev --asof $ASOF > "$OUT/diff_bad.json"; rc=$? +[ $rc -eq 1 ]; check $? "unproven elimination exits 1" +grep -q '"status": "REFUSED_REMOVED_REQUIRED"' "$OUT/diff_bad.json"; check $? "unproven elimination refused" +"$BIN" diff $F/mw_baseline.oev $F/mw_baseline.oev --asof $ASOF > "$OUT/diff_same.json" +grep -q '"kept": 4, "added": 0, "removed": 0' "$OUT/diff_same.json"; check $? "no-change fixture adds no nodes" + +say "outputs in $OUT" +exit $fail diff --git a/tools/dagsim/dagsim.c b/tools/dagsim/dagsim.c new file mode 100644 index 000000000..b7187d445 --- /dev/null +++ b/tools/dagsim/dagsim.c @@ -0,0 +1,751 @@ +/* + * dagsim.c -- offline resource-DAG cost evaluator (omega-mv#583). + * + * See dagsim.h and spec/offline-evidence-v1.md. The scheduler is a + * deterministic fluid simulation: compute engines have slots, bandwidth + * resources are shared equally among the ops streaming on them at any + * instant, launches are serialized per launch resource, and an op finishes + * when both its own busy time and its traffic are done (perfect overlap + * inside one op, which is the issue's stated floor max(F/P, Q/B)). Ops are + * dispatched in file order, so the same file always gives the same bytes. + */ +#include "dagsim.h" +#include "runtime/rx_costmodel.h" + +#include +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------- names */ + +const char *ds_status_name(int s) { + switch (s) { + case DS_OK: return "OK"; + case DS_REFUSED_UNKNOWN: return "REFUSED_UNKNOWN"; + case DS_REFUSED_STALE: return "REFUSED_STALE"; + case DS_REFUSED_NO_CALIBRATION: return "REFUSED_NO_CALIBRATION"; + case DS_REFUSED_CAPACITY: return "REFUSED_CAPACITY"; + case DS_REFUSED_CYCLE: return "REFUSED_CYCLE"; + case DS_REFUSED_UNSUPPORTED: return "REFUSED_UNSUPPORTED"; + case DS_REFUSED_REMOVED_REQUIRED: return "REFUSED_REMOVED_REQUIRED"; + case DS_PARSE_ERROR: return "PARSE_ERROR"; + default: return "?"; + } +} + +const char *ds_prov_name(int p) { + switch (p) { + case DS_PROV_UNKNOWN: return "unknown"; + case DS_PROV_SYNTHETIC: return "synthetic"; + case DS_PROV_FITTED: return "fitted"; + case DS_PROV_MEASURED: return "measured"; + case DS_PROV_SPECIFIED: return "specified"; + default: return "?"; + } +} + +static int prov_from_name(const char *s) { + if (!strcmp(s, "unknown")) return DS_PROV_UNKNOWN; + if (!strcmp(s, "synthetic")) return DS_PROV_SYNTHETIC; + if (!strcmp(s, "fitted")) return DS_PROV_FITTED; + if (!strcmp(s, "measured")) return DS_PROV_MEASURED; + if (!strcmp(s, "specified")) return DS_PROV_SPECIFIED; + return -1; +} + +/* days since 1970-01-01 for a civil date (Howard Hinnant's days_from_civil) */ +int ds_day_from_date(const char *s) { + int y, m, d; + if (!s || sscanf(s, "%d-%d-%d", &y, &m, &d) != 3) return -1; + y -= m <= 2; + int era = (y >= 0 ? y : y - 399) / 400; + unsigned yoe = (unsigned)(y - era * 400); + unsigned doy = (153u * (unsigned)(m + (m > 2 ? -3 : 9)) + 2u) / 5u + (unsigned)d - 1u; + unsigned doe = yoe * 365u + yoe / 4u - yoe / 100u + doy; + return era * 146097 + (int)doe - 719468; +} + +int ds_find_op(const ds_model *m, const char *id) { + for (int i = 0; i < m->n_ops; i++) if (!strcmp(m->ops[i].id, id)) return i; + return -1; +} +int ds_find_res(const ds_model *m, const char *id) { + for (int i = 0; i < m->n_res; i++) if (!strcmp(m->res[i].id, id)) return i; + return -1; +} + +/* ---------------------------------------------------------------- parse */ +/* bounded string copy; ids and sources are truncated, never overflowed */ +static void sset(char *dst, size_t cap, const char *src) { + size_t n = strlen(src); + if (n >= cap) n = cap - 1; + memcpy(dst, src, n); dst[n] = 0; +} + + +typedef struct { char key[32]; char val[DS_SRC]; int used; } kv; + +static int split_kv(char *line, char *keyword, size_t kwcap, kv *kvs, int maxkv, char *positional[], int *npos) { + int n = 0; *npos = 0; keyword[0] = 0; + char *p = strchr(line, '#'); if (p) *p = 0; + char *save = NULL; + char *tok = strtok_r(line, " \t\r\n", &save); + if (!tok) return -1; /* empty */ + snprintf(keyword, kwcap, "%s", tok); + while ((tok = strtok_r(NULL, " \t\r\n", &save))) { + char *eq = strchr(tok, '='); + if (!eq) { if (*npos < 8) positional[(*npos)++] = tok; continue; } + if (n >= maxkv) return -2; + *eq = 0; + sset(kvs[n].key, sizeof kvs[n].key, tok); + sset(kvs[n].val, sizeof kvs[n].val, eq + 1); + kvs[n].used = 0; + n++; + } + return n; +} + +static const char *get(kv *kvs, int n, const char *key) { + for (int i = 0; i < n; i++) if (!strcmp(kvs[i].key, key)) { kvs[i].used = 1; return kvs[i].val; } + return NULL; +} + +static int unused_key(kv *kvs, int n, char *out, size_t cap) { + for (int i = 0; i < n; i++) if (!kvs[i].used) { snprintf(out, cap, "%s", kvs[i].key); return 1; } + return 0; +} + +static int parse_real(const char *s, double *out) { + if (!s) return 0; + char *end; double v = strtod(s, &end); + if (end == s || *end) return 0; + if (!(v == v) || v < 0) return 0; + *out = v; return 1; +} + +#define PERR(...) do { snprintf(err, errcap, "line %d: ", lineno); size_t _l = strlen(err); snprintf(err + _l, errcap - _l, __VA_ARGS__); return DS_PARSE_ERROR; } while (0) + +static int parse_prov_src(kv *kvs, int n, int *prov, char *src, size_t srccap, int required, char *err, size_t errcap, int lineno) { + const char *p = get(kvs, n, "prov"); + const char *s = get(kvs, n, "src"); + if (!p) { if (required) PERR("prov= is required wherever a number appears"); *prov = -1; return DS_OK; } + int v = prov_from_name(p); + if (v < 0) PERR("prov=%s is not one of specified|measured|fitted|synthetic|unknown", p); + *prov = v; + if ((v == DS_PROV_MEASURED || v == DS_PROV_FITTED) && !s) PERR("prov=%s needs src=", p); + snprintf(src, srccap, "%s", s ? s : ""); + return DS_OK; +} + +int ds_parse_text(const char *text, ds_model *m, char *err, size_t errcap) { + memset(m, 0, sizeof *m); + err[0] = 0; + int lineno = 0; + const char *cur = text; + int seen_oev = 0, seen_machine = 0, seen_build = 0; + /* two-pass is not needed: ops before deps/buffers is the convention; we + * resolve references at use and require definition before use. */ + while (*cur) { + const char *nl = strchr(cur, '\n'); + size_t len = nl ? (size_t)(nl - cur) : strlen(cur); + char line[1024]; + lineno++; + if (len >= sizeof line) PERR("line too long"); + memcpy(line, cur, len); line[len] = 0; + cur = nl ? nl + 1 : cur + len; + char keyword[32]; kv kvs[24]; char *pos[8]; int npos; + int n = split_kv(line, keyword, sizeof keyword, kvs, 24, pos, &npos); + if (n == -1) continue; + if (n == -2) PERR("too many fields"); + if (!strcmp(keyword, "oev")) { + const char *v = get(kvs, n, "version"); + if (!v || strcmp(v, "1")) PERR("oev version=1 required"); + m->version = 1; seen_oev = 1; + } else if (!strcmp(keyword, "machine")) { + const char *v; + if (!(v = get(kvs, n, "id"))) PERR("machine needs id="); + sset(m->machine_id, sizeof m->machine_id, v); + if ((v = get(kvs, n, "soc"))) sset(m->soc, sizeof m->soc, v); + if ((v = get(kvs, n, "cores"))) m->cores = atoi(v); + if ((v = get(kvs, n, "mem_bytes")) && !parse_real(v, &m->mem_bytes)) PERR("bad mem_bytes"); + int prov; char src[DS_SRC]; + int rc = parse_prov_src(kvs, n, &prov, src, sizeof src, 1, err, errcap, lineno); if (rc) return rc; + seen_machine = 1; + } else if (!strcmp(keyword, "build")) { + const char *v; + if ((v = get(kvs, n, "repo"))) sset(m->repo, sizeof m->repo, v); + if (!(v = get(kvs, n, "sha")) || strlen(v) != 40) PERR("build needs sha=<40 hex>"); + sset(m->build_sha, sizeof m->build_sha, v); + if ((v = get(kvs, n, "physics"))) sset(m->physics, sizeof m->physics, v); + seen_build = 1; + } else if (!strcmp(keyword, "calibration")) { + const char *v; + if (m->has_calibration) PERR("one calibration record only"); + if (!(v = get(kvs, n, "id"))) PERR("calibration needs id="); + sset(m->cal_id, sizeof m->cal_id, v); + if (!(v = get(kvs, n, "taken")) || (m->cal_taken_day = ds_day_from_date(v)) < 0) PERR("calibration needs taken=YYYY-MM-DD"); + if (!(v = get(kvs, n, "valid_days"))) PERR("calibration needs valid_days="); + m->cal_valid_days = atoi(v); + if (!(v = get(kvs, n, "load1")) || !parse_real(v, &m->cal_load1)) PERR("calibration needs load1="); + if (!(v = get(kvs, n, "src"))) PERR("calibration needs src="); + sset(m->cal_src, sizeof m->cal_src, v); + if ((v = get(kvs, n, "model"))) sset(m->cal_model, sizeof m->cal_model, v); + m->has_calibration = 1; + } else if (!strcmp(keyword, "resource")) { + if (m->n_res >= DS_MAX_RES) PERR("too many resources (max %d)", DS_MAX_RES); + ds_resource *r = &m->res[m->n_res]; + memset(r, 0, sizeof *r); + const char *v; + if (!(v = get(kvs, n, "id"))) PERR("resource needs id="); + if (ds_find_res(m, v) >= 0) PERR("duplicate resource %s", v); + sset(r->id, sizeof r->id, v); + if (!(v = get(kvs, n, "kind"))) PERR("resource needs kind="); + if (!strcmp(v, "compute")) { + r->kind = DS_RES_COMPUTE; + if (!(v = get(kvs, n, "slots")) || (r->slots = atoi(v)) < 1) PERR("compute resource needs slots>=1"); + } else if (!strcmp(v, "bandwidth")) { + r->kind = DS_RES_BANDWIDTH; + if (!parse_real(get(kvs, n, "cap"), &r->cap) || r->cap <= 0) PERR("bandwidth resource needs cap>0"); + r->lo = r->hi = r->cap; + if ((v = get(kvs, n, "lo")) && !parse_real(v, &r->lo)) PERR("bad lo"); + if ((v = get(kvs, n, "hi")) && !parse_real(v, &r->hi)) PERR("bad hi"); + if (r->lo > r->cap || r->hi < r->cap) PERR("need lo <= cap <= hi"); + } else if (!strcmp(v, "capacity")) { + r->kind = DS_RES_CAPACITY; + if (!parse_real(get(kvs, n, "cap"), &r->cap) || r->cap <= 0) PERR("capacity resource needs cap>0"); + } else if (!strcmp(v, "launch")) { + r->kind = DS_RES_LAUNCH; + } else PERR("resource kind=%s unknown", v); + int rc = parse_prov_src(kvs, n, &r->prov, r->src, sizeof r->src, 1, err, errcap, lineno); if (rc) return rc; + m->n_res++; + } else if (!strcmp(keyword, "op")) { + if (m->n_ops >= DS_MAX_OPS) PERR("too many ops (max %d)", DS_MAX_OPS); + ds_op *o = &m->ops[m->n_ops]; + memset(o, 0, sizeof *o); + o->engine = o->bw = o->launcher = -1; + const char *v; + if (!(v = get(kvs, n, "id"))) PERR("op needs id="); + if (ds_find_op(m, v) >= 0) PERR("duplicate op %s", v); + sset(o->id, sizeof o->id, v); + if (!(v = get(kvs, n, "kind"))) PERR("op needs kind="); + if (!strcmp(v, "compute")) o->kind = DS_OP_COMPUTE; + else if (!strcmp(v, "copy")) o->kind = DS_OP_COPY; + else if (!strcmp(v, "matvec")) o->kind = DS_OP_MATVEC; + else if (!strcmp(v, "barrier")) o->kind = DS_OP_BARRIER; + else if (!strcmp(v, "storage")) o->kind = DS_OP_STORAGE; + else if (!strcmp(v, "persist")) o->kind = DS_OP_PERSIST; + else PERR("op kind=%s unknown", v); + if ((v = get(kvs, n, "engine"))) { + o->engine = ds_find_res(m, v); + if (o->engine < 0 || m->res[o->engine].kind != DS_RES_COMPUTE) PERR("engine=%s is not a compute resource defined above", v); + } + if ((v = get(kvs, n, "t_ns"))) { if (!parse_real(v, &o->t_ns)) PERR("bad t_ns"); o->has_t = 1; o->lo = o->hi = o->t_ns; } + if ((v = get(kvs, n, "lo"))) { if (!o->has_t || !parse_real(v, &o->lo) || o->lo > o->t_ns) PERR("lo needs t_ns and lo <= t_ns"); } + if ((v = get(kvs, n, "hi"))) { if (!o->has_t || !parse_real(v, &o->hi) || o->hi < o->t_ns) PERR("hi needs t_ns and hi >= t_ns"); } + if ((v = get(kvs, n, "bytes"))) { + if (!parse_real(v, &o->bytes)) PERR("bad bytes"); + const char *b = get(kvs, n, "bw"); + if (!b || (o->bw = ds_find_res(m, b)) < 0 || m->res[o->bw].kind != DS_RES_BANDWIDTH) PERR("bytes= needs bw="); + } + if ((v = get(kvs, n, "launch_ns"))) { + if (!parse_real(v, &o->launch_ns)) PERR("bad launch_ns"); + const char *l = get(kvs, n, "launcher"); + if (!l || (o->launcher = ds_find_res(m, l)) < 0 || m->res[o->launcher].kind != DS_RES_LAUNCH) PERR("launch_ns= needs launcher="); + } + if ((v = get(kvs, n, "M"))) o->M = (uint32_t)strtoul(v, NULL, 10); + if ((v = get(kvs, n, "N"))) o->N = (uint32_t)strtoul(v, NULL, 10); + if ((v = get(kvs, n, "core"))) o->core = (uint32_t)strtoul(v, NULL, 10); + if ((v = get(kvs, n, "arm"))) o->arm = (uint32_t)strtoul(v, NULL, 10); + if (o->kind == DS_OP_MATVEC && !o->has_t && (o->M == 0 || o->N == 0)) PERR("matvec needs M= and N= (or t_ns=)"); + if (o->kind != DS_OP_BARRIER && o->engine < 0) PERR("op %s needs engine=", o->id); + int required = o->has_t || o->bytes > 0 || o->launch_ns > 0 || o->kind == DS_OP_MATVEC; + int rc = parse_prov_src(kvs, n, &o->t_prov, o->src, sizeof o->src, required, err, errcap, lineno); if (rc) return rc; + if (o->t_prov < 0) o->t_prov = DS_PROV_SPECIFIED; /* a costless barrier: ordering only */ + if (!o->has_t && o->kind != DS_OP_MATVEC && o->t_prov == DS_PROV_UNKNOWN) { /* fine: explicitly unknown */ } + m->n_ops++; + } else if (!strcmp(keyword, "dep")) { + if (npos != 2 || n != 0) PERR("dep "); + if (m->n_deps >= DS_MAX_DEPS) PERR("too many deps"); + int a = ds_find_op(m, pos[0]), b = ds_find_op(m, pos[1]); + if (a < 0 || b < 0) PERR("dep names an op not defined above: %s %s", pos[0], pos[1]); + m->deps[m->n_deps].from = a; m->deps[m->n_deps].to = b; m->n_deps++; + } else if (!strcmp(keyword, "buffer")) { + if (m->n_buf >= DS_MAX_BUF) PERR("too many buffers"); + ds_buffer *b = &m->buf[m->n_buf]; + memset(b, 0, sizeof *b); b->first = b->last = -1; + const char *v; + if (!(v = get(kvs, n, "id"))) PERR("buffer needs id="); + sset(b->id, sizeof b->id, v); + if (!parse_real(get(kvs, n, "bytes"), &b->bytes)) PERR("buffer needs bytes="); + if (!(v = get(kvs, n, "cap")) || (b->cap = ds_find_res(m, v)) < 0 || m->res[b->cap].kind != DS_RES_CAPACITY) PERR("buffer needs cap="); + if ((v = get(kvs, n, "first")) && (b->first = ds_find_op(m, v)) < 0) PERR("first=%s not an op", v); + if ((v = get(kvs, n, "last")) && (b->last = ds_find_op(m, v)) < 0) PERR("last=%s not an op", v); + m->n_buf++; + } else if (!strcmp(keyword, "sync")) { + /* a barrier op that depends on every listed op */ + if (m->n_ops >= DS_MAX_OPS) PERR("too many ops"); + const char *v, *list; + if (!(v = get(kvs, n, "id"))) PERR("sync needs id="); + if (ds_find_op(m, v) >= 0) PERR("duplicate op %s", v); + if (!(list = get(kvs, n, "ops"))) PERR("sync needs ops=a,b,..."); + ds_op *o = &m->ops[m->n_ops]; + memset(o, 0, sizeof *o); + o->engine = o->bw = o->launcher = -1; o->kind = DS_OP_BARRIER; o->t_prov = DS_PROV_SPECIFIED; + sset(o->id, sizeof o->id, v); + int self = m->n_ops++; + char tmp[DS_SRC]; sset(tmp, sizeof tmp, list); + char *save = NULL; + for (char *t = strtok_r(tmp, ",", &save); t; t = strtok_r(NULL, ",", &save)) { + int a = ds_find_op(m, t); + if (a < 0 || a == self) PERR("sync lists unknown op %s", t); + if (m->n_deps >= DS_MAX_DEPS) PERR("too many deps"); + m->deps[m->n_deps].from = a; m->deps[m->n_deps].to = self; m->n_deps++; + } + } else if (!strcmp(keyword, "energy")) { + const char *v; + if (m->has_energy) PERR("one energy record only"); + if (!(v = get(kvs, n, "instrument"))) PERR("energy needs instrument="); + sset(m->instrument, sizeof m->instrument, v); + if ((v = get(kvs, n, "boundary"))) sset(m->boundary, sizeof m->boundary, v); + const char *j = get(kvs, n, "joules"), *pw = get(kvs, n, "power_w"); + int prov = -1; char src[DS_SRC]; + int rc = parse_prov_src(kvs, n, &prov, src, sizeof src, j || pw ? 1 : 0, err, errcap, lineno); if (rc) return rc; + m->energy_prov = prov; + if (j) { + if (!strcmp(m->instrument, "none") || !m->boundary[0]) PERR("joules= needs a named instrument and boundary="); + if (prov != DS_PROV_MEASURED) PERR("joules= must be prov=measured with src="); + if (!parse_real(j, &m->joules)) PERR("bad joules"); + } + if (pw) { + if (prov != DS_PROV_SYNTHETIC) PERR("power_w= is allowed only as prov=synthetic (a sensitivity figure); measured power must be integrated into joules= by the instrument"); + if (!parse_real(pw, &m->power_w)) PERR("bad power_w"); + } + m->has_energy = 1; + } else if (!strcmp(keyword, "removed")) { + if (m->n_removed >= DS_MAX_REMOVED) PERR("too many removed records"); + ds_removed *r = &m->removed[m->n_removed]; + memset(r, 0, sizeof *r); + const char *v; + if (!(v = get(kvs, n, "op"))) PERR("removed needs op="); + sset(r->op, sizeof r->op, v); + if (ds_find_op(m, v) >= 0) PERR("removed op %s is still present in this DAG", v); + if (!(v = get(kvs, n, "reason"))) PERR("removed needs reason="); + if (!strcmp(v, "eliminated")) r->reason = DS_RM_ELIMINATED; + else if (!strcmp(v, "reused")) r->reason = DS_RM_REUSED; + else if (!strcmp(v, "unchanged_dep")) r->reason = DS_RM_UNCHANGED_DEP; + else if (!strcmp(v, "deferred")) r->reason = DS_RM_DEFERRED; + else if (!strcmp(v, "moved")) r->reason = DS_RM_MOVED; + else if (!strcmp(v, "shared")) r->reason = DS_RM_SHARED; + else if (!strcmp(v, "lookup")) r->reason = DS_RM_LOOKUP; + else PERR("removed reason=%s unknown", v); + if ((v = get(kvs, n, "ref"))) sset(r->ref, sizeof r->ref, v); + if ((v = get(kvs, n, "proof"))) sset(r->proof, sizeof r->proof, v); + m->n_removed++; + } else PERR("unknown record '%s'", keyword); + char bad[32]; + if (unused_key(kvs, n, bad, sizeof bad)) PERR("unknown field %s= on '%s'", bad, keyword); + } + lineno = 0; + if (!seen_oev) PERR("missing 'oev version=1'"); + if (!seen_machine) PERR("missing machine record"); + if (!seen_build) PERR("missing build record"); + if (!m->has_energy) PERR("missing energy record (use instrument=none for UNMEASURED)"); + return DS_OK; +} + +int ds_parse_file(const char *path, ds_model *m, char *err, size_t errcap) { + FILE *fp = fopen(path, "r"); + if (!fp) { snprintf(err, errcap, "cannot open %s", path); return DS_PARSE_ERROR; } + fseek(fp, 0, SEEK_END); long n = ftell(fp); fseek(fp, 0, SEEK_SET); + if (n < 0 || n > (1 << 20)) { fclose(fp); snprintf(err, errcap, "file size out of range"); return DS_PARSE_ERROR; } + char *buf = malloc((size_t)n + 1); + if (!buf) { fclose(fp); snprintf(err, errcap, "out of memory"); return DS_PARSE_ERROR; } + size_t got = fread(buf, 1, (size_t)n, fp); buf[got] = 0; fclose(fp); + int rc = ds_parse_text(buf, m, err, errcap); + free(buf); + return rc; +} + +/* ---------------------------------------------------------------- evaluate */ + +/* resolved per-op numbers for one evaluation mode */ +typedef struct { double t, launch, bytes, cap; int prov; } ds_num; /* cap in B/ns */ + +static double res_cap(const ds_resource *r, int mode) { + if (mode < 0) return r->lo; + if (mode > 0) return r->hi; + return r->cap; +} + +static int refuse(ds_result *r, int status, const char *fmt, const char *a, const char *b) { + memset(r, 0, sizeof *r); + r->status = status; + snprintf(r->reason, sizeof r->reason, fmt, a ? a : "", b ? b : ""); + return status; +} + +static int resolve(const ds_model *m, const ds_opts *o, ds_num *num, ds_result *r) { + int any_cal = 0; + for (int i = 0; i < m->n_res; i++) { + if (m->res[i].prov == DS_PROV_UNKNOWN) return refuse(r, DS_REFUSED_UNKNOWN, "resource %s has prov=unknown; unknown stays unknown%s", m->res[i].id, ""); + if (m->res[i].prov == DS_PROV_MEASURED || m->res[i].prov == DS_PROV_FITTED) any_cal = 1; + } + for (int i = 0; i < m->n_ops; i++) { + const ds_op *op = &m->ops[i]; + ds_num *x = &num[i]; + memset(x, 0, sizeof *x); + x->prov = op->t_prov; + x->launch = op->launch_ns; + x->bytes = op->bytes; + x->cap = op->bw >= 0 ? res_cap(&m->res[op->bw], o->mode) * 1e-9 : 0; /* B/s -> B/ns */ + if (op->kind == DS_OP_MATVEC && !op->has_t) { + const RxCostModel *cm = (const RxCostModel *)o->costmodel; + if (!cm) return refuse(r, DS_REFUSED_UNKNOWN, "op %s is a matvec with no rx_costmodel blob supplied (calibration model=)%s", op->id, ""); + RxCmFeatures f; memset(&f, 0, sizeof f); + f.op = RX_CM_OP_MATVEC; f.M = op->M; f.N = op->N; + f.state_bytes = ((uint64_t)op->M * op->N + op->M + op->N) * 8u; + f.cache_bytes = 1u << 20; f.core = op->core; f.eligible = 1u << op->arm; f.current_arm = op->arm; + RxCmPrediction p; rx_cm_predict(cm, &f, op->arm, &p); + if (!p.known || p.n == 0) return refuse(r, DS_REFUSED_UNKNOWN, "op %s: rx_costmodel has no known cell for this (op, core, pressure) and arm; measure it first%s", op->id, ""); + double q = o->interval_q > 0 && o->interval_q < 1 ? o->interval_q : 0.9; + double k = rx_cm_t_quantile(q, p.dof); + double l2 = p.mean_log2_ps + (o->mode < 0 ? k * p.sd_log2 : o->mode > 0 ? -k * p.sd_log2 : 0); + x->t = pow(2.0, l2) / 1000.0; /* ps -> ns */ + x->prov = DS_PROV_FITTED; + any_cal = 1; + } else { + if (op->t_prov == DS_PROV_UNKNOWN) return refuse(r, DS_REFUSED_UNKNOWN, "op %s has prov=unknown (%s); unknown stays unknown", op->id, op->src[0] ? op->src : "no source"); + x->t = o->mode < 0 ? op->hi : o->mode > 0 ? op->lo : op->t_ns; + if (op->t_prov == DS_PROV_MEASURED || op->t_prov == DS_PROV_FITTED) any_cal = 1; + } + if (op->engine < 0 && op->kind != DS_OP_BARRIER) return refuse(r, DS_REFUSED_UNSUPPORTED, "op %s has no engine%s", op->id, ""); + if (op->launcher >= 0 && op->engine < 0) return refuse(r, DS_REFUSED_UNSUPPORTED, "op %s: launch without an engine%s", op->id, ""); + } + if (any_cal) { + if (!m->has_calibration) return refuse(r, DS_REFUSED_NO_CALIBRATION, "measured or fitted values need a calibration record naming when and under what load they were taken%s%s", "", ""); + int asof = o->asof_day; + if (asof <= 0) asof = (int)(time(NULL) / 86400); + if (asof > m->cal_taken_day + m->cal_valid_days) { + char d[64]; snprintf(d, sizeof d, "asof is %d day(s) past the validity envelope", asof - m->cal_taken_day - m->cal_valid_days); + return refuse(r, DS_REFUSED_STALE, "calibration %s is stale: %s", m->cal_id, d); + } + } + return DS_OK; +} + +/* Kahn topological order; returns 0 on a cycle */ +static int topo(const ds_model *m, int *order) { + int indeg[DS_MAX_OPS] = {0}; + for (int i = 0; i < m->n_deps; i++) indeg[m->deps[i].to]++; + int n = 0, head = 0; + for (int i = 0; i < m->n_ops; i++) if (indeg[i] == 0) order[n++] = i; + while (head < n) { + int u = order[head++]; + for (int i = 0; i < m->n_deps; i++) if (m->deps[i].from == u && --indeg[m->deps[i].to] == 0) order[n++] = m->deps[i].to; + } + return n == m->n_ops; +} + +enum { ST_WAIT = 0, ST_READY, ST_LAUNCH, ST_RUN, ST_DONE }; +enum { BLK_NONE = 0, BLK_SLOT, BLK_LAUNCHER }; + +int ds_eval(const ds_model *m, const ds_opts *o, ds_result *r) { + memset(r, 0, sizeof *r); + if (m->n_ops == 0) return refuse(r, DS_REFUSED_UNSUPPORTED, "empty DAG%s%s", "", ""); + ds_num num[DS_MAX_OPS]; + int rc = resolve(m, o, num, r); + if (rc) return rc; + int order[DS_MAX_OPS]; + if (!topo(m, order)) return refuse(r, DS_REFUSED_CYCLE, "dependency cycle%s%s", "", ""); + /* a buffer that never fits */ + for (int i = 0; i < m->n_buf; i++) + if (m->buf[i].bytes > m->res[m->buf[i].cap].cap) + return refuse(r, DS_REFUSED_CAPACITY, "buffer %s alone exceeds capacity %s", m->buf[i].id, m->res[m->buf[i].cap].id); + + /* provenance mask */ + for (int i = 0; i < m->n_ops; i++) r->prov_mask |= 1u << num[i].prov; + for (int i = 0; i < m->n_res; i++) { + int used = 0; + for (int j = 0; j < m->n_ops; j++) if (m->ops[j].engine == i || m->ops[j].bw == i || m->ops[j].launcher == i) used = 1; + for (int j = 0; j < m->n_buf; j++) if (m->buf[j].cap == i) used = 1; + if (used) r->prov_mask |= 1u << m->res[i].prov; + } + + /* ---- fluid simulation ---- */ + int state[DS_MAX_OPS] = {0}, blocked[DS_MAX_OPS] = {0}, npred[DS_MAX_OPS] = {0}, done_pred[DS_MAX_OPS] = {0}; + double rem_t[DS_MAX_OPS], rem_b[DS_MAX_OPS], rem_l[DS_MAX_OPS], run_start[DS_MAX_OPS], bytes_end[DS_MAX_OPS]; + int free_slots[DS_MAX_RES], launcher_busy[DS_MAX_RES] = {0}; + for (int i = 0; i < m->n_res; i++) free_slots[i] = m->res[i].slots; + for (int i = 0; i < m->n_deps; i++) npred[m->deps[i].to]++; + for (int i = 0; i < m->n_ops; i++) { + rem_t[i] = num[i].t; rem_b[i] = num[i].bytes; rem_l[i] = num[i].launch; + run_start[i] = bytes_end[i] = -1; + r->n_ops++; + r->total_bytes += num[i].bytes; r->total_busy_ns += num[i].t; r->total_launch_ns += num[i].launch; + } + double t = 0; + int remaining = m->n_ops, guard = 0; + while (remaining > 0) { + if (++guard > 8 * DS_MAX_OPS + 16) return refuse(r, DS_REFUSED_UNSUPPORTED, "scheduler did not converge%s%s", "", ""); + /* deps satisfied -> ready */ + for (int i = 0; i < m->n_ops; i++) if (state[i] == ST_WAIT && done_pred[i] == npred[i]) { state[i] = ST_READY; r->ready_ns[i] = t; } + /* dispatch in file order */ + for (int i = 0; i < m->n_ops; i++) { + if (state[i] != ST_READY) continue; + const ds_op *op = &m->ops[i]; + if (op->engine >= 0 && free_slots[op->engine] <= 0) { blocked[i] = BLK_SLOT; continue; } + if (op->launcher >= 0 && rem_l[i] > 0 && launcher_busy[op->launcher]) { blocked[i] = BLK_LAUNCHER; continue; } + if (op->engine >= 0) free_slots[op->engine]--; + r->start_ns[i] = t; + if (op->launcher >= 0 && rem_l[i] > 0) { launcher_busy[op->launcher] = 1; state[i] = ST_LAUNCH; } + else { state[i] = ST_RUN; run_start[i] = t; } + } + /* next event */ + int active[DS_MAX_RES] = {0}; + for (int i = 0; i < m->n_ops; i++) if (state[i] == ST_RUN && rem_b[i] > 0) active[m->ops[i].bw]++; + double dt = -1; int any = 0; + for (int i = 0; i < m->n_ops; i++) { + if (state[i] == ST_LAUNCH) { any = 1; if (dt < 0 || rem_l[i] < dt) dt = rem_l[i]; } + else if (state[i] == ST_RUN) { + any = 1; + /* next event for this op: the earlier of its two progress bars */ + double d = -1; + if (rem_t[i] > 0) d = rem_t[i]; + if (rem_b[i] > 0) { + double share = num[i].cap / active[m->ops[i].bw]; + double db = rem_b[i] / share; + if (d < 0 || db < d) d = db; + } + if (d < 0) d = 0; + if (dt < 0 || d < dt) dt = d; + } + } + if (!any) return refuse(r, DS_REFUSED_UNSUPPORTED, "no op can make progress (slots=0 or all blocked)%s%s", "", ""); + if (dt < 0) dt = 0; + t += dt; + const double eps = 1e-9; + for (int i = 0; i < m->n_ops; i++) { + if (state[i] == ST_LAUNCH) { + rem_l[i] -= dt; + if (rem_l[i] <= eps) { rem_l[i] = 0; launcher_busy[m->ops[i].launcher] = 0; state[i] = ST_RUN; run_start[i] = t; } + } else if (state[i] == ST_RUN) { + if (rem_t[i] > 0) { rem_t[i] -= dt; if (rem_t[i] <= eps) rem_t[i] = 0; } + if (rem_b[i] > 0) { + double share = num[i].cap / active[m->ops[i].bw]; + rem_b[i] -= share * dt; + if (rem_b[i] <= eps * (num[i].bytes > 1 ? num[i].bytes : 1)) { rem_b[i] = 0; bytes_end[i] = t; } + } + if (rem_t[i] <= 0 && rem_b[i] <= 0) { + state[i] = ST_DONE; r->end_ns[i] = t; remaining--; + if (m->ops[i].engine >= 0) free_slots[m->ops[i].engine]++; + for (int d = 0; d < m->n_deps; d++) if (m->deps[d].from == i) done_pred[m->deps[d].to]++; + if (num[i].bytes > 0) { + double ideal = num[i].bytes / num[i].cap; + double actual = (bytes_end[i] >= 0 ? bytes_end[i] : t) - run_start[i]; + r->op_contention_ns[i] = actual - ideal > 0 ? actual - ideal : 0; + } + } + } + } + if (t > r->makespan_ns) r->makespan_ns = t; + } + + /* ---- bounds ---- */ + double cp[DS_MAX_OPS]; + for (int k = 0; k < m->n_ops; k++) { + int i = order[k]; + double floor_ = num[i].t; + if (num[i].bytes > 0 && num[i].bytes / num[i].cap > floor_) floor_ = num[i].bytes / num[i].cap; + floor_ += num[i].launch; + r->op_floor_ns[i] = floor_; + double best = 0; + for (int d = 0; d < m->n_deps; d++) if (m->deps[d].to == i && cp[m->deps[d].from] > best) best = cp[m->deps[d].from]; + cp[i] = best + floor_; + if (cp[i] > r->bound_critical_path_ns) r->bound_critical_path_ns = cp[i]; + } + r->bound_ns = r->bound_critical_path_ns; + for (int i = 0; i < m->n_res; i++) { + double w = 0; + for (int j = 0; j < m->n_ops; j++) { + if (m->res[i].kind == DS_RES_BANDWIDTH && m->ops[j].bw == i) w += num[j].bytes / num[j].cap; + if (m->res[i].kind == DS_RES_COMPUTE && m->ops[j].engine == i) w += (num[j].t + num[j].launch) / m->res[i].slots; + if (m->res[i].kind == DS_RES_LAUNCH && m->ops[j].launcher == i) w += num[j].launch; + } + r->bound_resource_ns[i] = w; + if (w > r->bound_ns) r->bound_ns = w; + } + + /* ---- capacity ledger: frees before allocations at the same instant ---- */ + for (int c = 0; c < m->n_res; c++) { + if (m->res[c].kind != DS_RES_CAPACITY) continue; + double live = 0, peak = 0, peak_at = 0; + /* event list */ + double et[2 * DS_MAX_BUF]; double ev[2 * DS_MAX_BUF]; int en = 0; + for (int b = 0; b < m->n_buf; b++) { + if (m->buf[b].cap != c) continue; + double s = m->buf[b].first >= 0 ? r->start_ns[m->buf[b].first] : 0; + double e = m->buf[b].last >= 0 ? r->end_ns[m->buf[b].last] : r->makespan_ns; + et[en] = s; ev[en] = m->buf[b].bytes; en++; + et[en] = e; ev[en] = -m->buf[b].bytes; en++; + } + /* insertion sort by time, frees (negative) first on ties; stable */ + for (int i = 1; i < en; i++) { + double kt = et[i], kv_ = ev[i]; int j = i - 1; + while (j >= 0 && (et[j] > kt || (et[j] == kt && ev[j] > 0 && kv_ < 0))) { et[j + 1] = et[j]; ev[j + 1] = ev[j]; j--; } + et[j + 1] = kt; ev[j + 1] = kv_; + } + for (int i = 0; i < en; i++) { live += ev[i]; if (live > peak) { peak = live; peak_at = et[i]; } } + r->peak_live_bytes[c] = peak; r->peak_live_at_ns[c] = peak_at; + if (peak > m->res[c].cap + 1e-9) { + char names[160] = ""; size_t L = 0; + for (int b = 0; b < m->n_buf && L < sizeof names - 8; b++) { + if (m->buf[b].cap != c) continue; + double s = m->buf[b].first >= 0 ? r->start_ns[m->buf[b].first] : 0; + double e = m->buf[b].last >= 0 ? r->end_ns[m->buf[b].last] : r->makespan_ns; + if (s <= peak_at && e > peak_at) { snprintf(names + L, sizeof names - L, "%s%s", L ? "," : "", m->buf[b].id); L = strlen(names); } + } + char what[200]; snprintf(what, sizeof what, "%.0f B live at t=%.0f ns (%s) exceeds", peak, peak_at, names); + int st = refuse(r, DS_REFUSED_CAPACITY, "%s %s", what, m->res[c].id); + return st; + } + } + + /* ---- attribution along the schedule's critical chain ---- */ + int cur = 0; + for (int i = 1; i < m->n_ops; i++) if (r->end_ns[i] > r->end_ns[cur]) cur = i; + double accounted = 0; + int chain[DS_MAX_OPS]; int nc = 0; + while (cur >= 0 && nc < DS_MAX_OPS) { + chain[nc++] = cur; + const ds_op *op = &m->ops[cur]; + double runtime = r->end_ns[cur] - (run_start[cur] >= 0 ? run_start[cur] : r->start_ns[cur]); + r->attr_ns[DS_ATTR_LAUNCH] += num[cur].launch; + accounted += num[cur].launch; + if (op->kind == DS_OP_BARRIER) r->attr_ns[DS_ATTR_SYNC] += runtime; + else if (num[cur].bytes > 0) { + double ideal = num[cur].bytes / num[cur].cap; + double actual = ideal + r->op_contention_ns[cur]; + if (num[cur].t >= actual) r->attr_ns[DS_ATTR_COMPUTE] += runtime; + else { r->attr_ns[DS_ATTR_BANDWIDTH] += ideal; r->attr_ns[DS_ATTR_CONTENTION] += r->op_contention_ns[cur]; if (runtime > actual) r->attr_ns[DS_ATTR_RESIDUAL] += runtime - actual; } + } else r->attr_ns[DS_ATTR_COMPUTE] += runtime; + accounted += runtime; + /* predecessor: the dep that finished last */ + int pred = -1; + for (int d = 0; d < m->n_deps; d++) if (m->deps[d].to == cur && (pred < 0 || r->end_ns[m->deps[d].from] > r->end_ns[pred])) pred = m->deps[d].from; + double gap = r->start_ns[cur] - (pred >= 0 ? r->end_ns[pred] : 0); + if (gap > 0) { + if (blocked[cur] == BLK_SLOT) r->attr_ns[DS_ATTR_SERIALIZATION] += gap; + else if (blocked[cur] == BLK_LAUNCHER) r->attr_ns[DS_ATTR_LAUNCH] += gap; + else r->attr_ns[DS_ATTR_RESIDUAL] += gap; + accounted += gap; + } + cur = pred; + } + for (int i = 0; i < nc; i++) r->critical_path[i] = chain[nc - 1 - i]; + r->n_critical = nc; + double leftover = r->makespan_ns - accounted; + if (fabs(leftover) > 1e-6) r->attr_ns[DS_ATTR_RESIDUAL] += leftover; + + /* ---- energy ---- */ + if (m->has_energy && m->joules > 0 && strcmp(m->instrument, "none")) { r->energy_measured = 1; r->energy_j = m->joules; } + else if (m->has_energy && m->power_w > 0 && m->energy_prov == DS_PROV_SYNTHETIC) { r->energy_synthetic = 1; r->energy_j = m->power_w * r->makespan_ns * 1e-9; r->prov_mask |= 1u << DS_PROV_SYNTHETIC; } + r->synthetic = (r->prov_mask & (1u << DS_PROV_SYNTHETIC)) ? 1 : 0; + r->status = DS_OK; + return DS_OK; +} + +int ds_eval_interval(const ds_model *m, const ds_opts *o, ds_result *nominal, double *lo_ns, double *hi_ns) { + ds_opts x = *o; x.mode = 0; + int rc = ds_eval(m, &x, nominal); + *lo_ns = *hi_ns = 0; + if (rc) return rc; + ds_result tmp; + x.mode = +1; if (ds_eval(m, &x, &tmp) == DS_OK) *lo_ns = tmp.makespan_ns; + x.mode = -1; if (ds_eval(m, &x, &tmp) == DS_OK) *hi_ns = tmp.makespan_ns; + return rc; +} + +double ds_counterfactual(const ds_model *m, const ds_opts *o, int res_index) { + if (res_index < 0 || res_index >= m->n_res) return -DS_REFUSED_UNSUPPORTED; + ds_model *c = malloc(sizeof *c); + if (!c) return -DS_REFUSED_UNSUPPORTED; + *c = *m; + ds_resource *r = &c->res[res_index]; + switch (r->kind) { + case DS_RES_BANDWIDTH: r->cap *= 2; r->lo *= 2; r->hi *= 2; break; + case DS_RES_COMPUTE: r->slots *= 2; break; + case DS_RES_LAUNCH: for (int i = 0; i < c->n_ops; i++) if (c->ops[i].launcher == res_index) c->ops[i].launch_ns = 0; break; + case DS_RES_CAPACITY: r->cap *= 2; break; + } + ds_result res; ds_opts x = *o; x.mode = 0; + int rc = ds_eval(c, &x, &res); + free(c); + return rc == DS_OK ? res.makespan_ns : -(double)rc; +} + +/* ---------------------------------------------------------------- diff */ + +static int in_changed(const char *list, const char *id) { + if (!list) return 0; + const char *p = list; size_t L = strlen(id); + while (*p) { + const char *q = strchr(p, ','); size_t n = q ? (size_t)(q - p) : strlen(p); + if (n == L && !strncmp(p, id, L)) return 1; + if (!q) break; + p = q + 1; + } + return 0; +} + +int ds_diff_models(const ds_model *b, const ds_model *t, const ds_opts *o, ds_diff *d) { + memset(d, 0, sizeof *d); + for (int i = 0; i < t->n_ops; i++) if (ds_find_op(b, t->ops[i].id) < 0) d->n_added++; + for (int i = 0; i < b->n_ops; i++) { + int j = ds_find_op(t, b->ops[i].id); + if (j >= 0) { + d->n_kept++; + if (b->ops[i].t_ns != t->ops[j].t_ns || b->ops[i].bytes != t->ops[j].bytes) + snprintf(d->reason, sizeof d->reason, "op %s kept but its demand changed; trace conservation broken", b->ops[i].id); + continue; + } + d->n_removed++; + /* find its removed record(s) */ + int found = 0; const ds_removed *rec = NULL; + for (int k = 0; k < t->n_removed; k++) if (!strcmp(t->removed[k].op, b->ops[i].id)) { found++; rec = &t->removed[k]; } + if (found == 0) { d->required_removed = 1; snprintf(d->reason, sizeof d->reason, "op %s vanished without a removed record", b->ops[i].id); return DS_REFUSED_REMOVED_REQUIRED; } + if (found > 1) { d->double_counted = 1; snprintf(d->reason, sizeof d->reason, "op %s removed %d times (double counted)", b->ops[i].id, found); return DS_REFUSED_REMOVED_REQUIRED; } + /* consumers of the removed op in the baseline that still exist */ + int has_consumer = 0; + for (int k = 0; k < b->n_deps; k++) if (b->deps[k].from == i && ds_find_op(t, b->ops[b->deps[k].to].id) >= 0) has_consumer = 1; + int ok = 1; + switch (rec->reason) { + case DS_RM_ELIMINATED: if (has_consumer && !rec->proof[0]) ok = 0; break; + case DS_RM_REUSED: case DS_RM_LOOKUP: case DS_RM_MOVED: if (!rec->ref[0] || ds_find_op(t, rec->ref) < 0) ok = 0; break; + case DS_RM_UNCHANGED_DEP: if (!rec->ref[0] || ds_find_op(b, rec->ref) < 0 || in_changed(o ? o->changed : NULL, rec->ref)) ok = 0; break; + case DS_RM_DEFERRED: if (has_consumer) ok = 0; break; + case DS_RM_SHARED: + if (!rec->ref[0] || ds_find_op(t, rec->ref) < 0) ok = 0; + for (int k = 0; k < t->n_removed; k++) if (!strcmp(t->removed[k].op, rec->ref)) { d->double_counted = 1; ok = 0; } + break; + } + if (!ok) { + d->required_removed = 1; + snprintf(d->reason, sizeof d->reason, "op %s: removal reason %d not supported by its evidence (ref=%s proof=%s changed=%s)", + b->ops[i].id, rec->reason, rec->ref, rec->proof, o && o->changed ? o->changed : ""); + return DS_REFUSED_REMOVED_REQUIRED; + } + double w = b->ops[i].t_ns + b->ops[i].launch_ns; + if (b->ops[i].bytes > 0 && b->ops[i].bw >= 0) { double tb = b->ops[i].bytes / (b->res[b->ops[i].bw].cap * 1e-9); if (tb > b->ops[i].t_ns) w = tb + b->ops[i].launch_ns; } + d->removed_ns[rec->reason] += w; + } + /* removed records that name ops never in the baseline are fabricated savings */ + for (int k = 0; k < t->n_removed; k++) if (ds_find_op(b, t->removed[k].op) < 0) { + d->double_counted = 1; + snprintf(d->reason, sizeof d->reason, "removed record for %s, which was never in the baseline", t->removed[k].op); + return DS_REFUSED_REMOVED_REQUIRED; + } + return DS_OK; +} diff --git a/tools/dagsim/dagsim.h b/tools/dagsim/dagsim.h new file mode 100644 index 000000000..a409b588b --- /dev/null +++ b/tools/dagsim/dagsim.h @@ -0,0 +1,166 @@ +/* + * dagsim.h -- offline resource-DAG cost evaluator (omega-mv#583). + * + * Reads an OEV1 file (spec/offline-evidence-v1.md) and composes the per-op + * costs it carries, or that rx_costmodel predicts for matvec ops, into a + * whole-DAG schedule under finite resources: compute slots, shared + * bandwidth (processor sharing), serialized launches, one capacity ledger, + * dependencies and barriers. It never executes anything. It refuses rather + * than guess: unknown provenance, stale calibration, capacity overflow, + * unsupported constructs and cycles are all refusals with a reason. + * + * Host only. No GPU, no authority, no generation store. + */ +#ifndef DAGSIM_H +#define DAGSIM_H + +#include +#include + +#define DS_MAX_OPS 256 +#define DS_MAX_RES 32 +#define DS_MAX_BUF 256 +#define DS_MAX_DEPS 1024 +#define DS_MAX_REMOVED 256 +#define DS_ID 40 +#define DS_SRC 128 + +enum ds_prov { DS_PROV_UNKNOWN = 0, DS_PROV_SYNTHETIC, DS_PROV_FITTED, DS_PROV_MEASURED, DS_PROV_SPECIFIED }; +enum ds_res_kind { DS_RES_COMPUTE = 1, DS_RES_BANDWIDTH, DS_RES_CAPACITY, DS_RES_LAUNCH }; +enum ds_op_kind { DS_OP_COMPUTE = 1, DS_OP_COPY, DS_OP_MATVEC, DS_OP_BARRIER, DS_OP_STORAGE, DS_OP_PERSIST }; +enum ds_removed_reason { DS_RM_ELIMINATED = 1, DS_RM_REUSED, DS_RM_UNCHANGED_DEP, DS_RM_DEFERRED, DS_RM_MOVED, DS_RM_SHARED, DS_RM_LOOKUP }; + +enum ds_status { + DS_OK = 0, + DS_REFUSED_UNKNOWN, /* an op or resource with prov=unknown feeds the result */ + DS_REFUSED_STALE, /* asof is past calibration taken + valid_days */ + DS_REFUSED_NO_CALIBRATION, /* measured/fitted values but no calibration record */ + DS_REFUSED_CAPACITY, /* peak live bytes exceed a capacity resource */ + DS_REFUSED_CYCLE, + DS_REFUSED_UNSUPPORTED, /* construct the evaluator does not model */ + DS_REFUSED_REMOVED_REQUIRED, /* a remaining op depends on removed work without a valid derivation */ + DS_PARSE_ERROR +}; + +typedef struct { + char id[DS_ID]; + int kind; + int slots; /* compute */ + double cap, lo, hi; /* bandwidth (B/s) or capacity (B) */ + int prov; + char src[DS_SRC]; +} ds_resource; + +typedef struct { + char id[DS_ID]; + int kind; + int engine; /* resource index or -1 */ + double t_ns, lo, hi; /* own busy time */ + int t_prov; + int has_t; + double bytes; + int bw; /* bandwidth resource index or -1 */ + double launch_ns; + int launcher; /* launch resource index or -1 */ + uint32_t M, N, core, arm; /* matvec */ + char src[DS_SRC]; +} ds_op; + +typedef struct { char id[DS_ID]; double bytes; int cap; int first, last; } ds_buffer; +typedef struct { int from, to; } ds_dep; +typedef struct { char op[DS_ID]; int reason; char ref[DS_ID]; char proof[DS_SRC]; } ds_removed; + +typedef struct { + int version; + char machine_id[DS_ID], soc[DS_ID]; + int cores; + double mem_bytes; + char build_sha[48], physics[48], repo[DS_ID]; + int has_calibration; + char cal_id[DS_ID]; + int cal_taken_day; /* days since 1970-01-01 */ + int cal_valid_days; + double cal_load1; + char cal_src[DS_SRC], cal_model[DS_SRC]; + int n_res, n_ops, n_buf, n_deps, n_removed; + ds_resource res[DS_MAX_RES]; + ds_op ops[DS_MAX_OPS]; + ds_buffer buf[DS_MAX_BUF]; + ds_dep deps[DS_MAX_DEPS]; + ds_removed removed[DS_MAX_REMOVED]; + /* energy */ + char instrument[DS_ID], boundary[DS_ID]; + int energy_prov; + double joules, power_w; + int has_energy; +} ds_model; + +typedef struct { + int asof_day; /* days since epoch; 0 = today */ + int mode; /* 0 nominal, -1 pessimistic (lo bandwidth, hi time), +1 optimistic */ + const void *costmodel; /* const RxCostModel* or NULL */ + double interval_q; /* for rx_costmodel intervals, e.g. 0.9 */ + const char *changed; /* diff only: comma list of baseline ops whose inputs changed */ +} ds_opts; + +enum { DS_ATTR_COMPUTE = 0, DS_ATTR_BANDWIDTH, DS_ATTR_CONTENTION, DS_ATTR_LAUNCH, DS_ATTR_SERIALIZATION, DS_ATTR_SYNC, DS_ATTR_RESIDUAL, DS_ATTR_N }; + +typedef struct { + int status; + char reason[256]; + double makespan_ns; + double start_ns[DS_MAX_OPS], end_ns[DS_MAX_OPS], ready_ns[DS_MAX_OPS]; + double op_contention_ns[DS_MAX_OPS]; /* extra traffic time due to sharing */ + double op_floor_ns[DS_MAX_OPS]; /* launch + max(t, bytes/cap) */ + double bound_critical_path_ns; + double bound_resource_ns[DS_MAX_RES]; /* per resource work bound */ + double bound_ns; /* max of all bounds */ + double peak_live_bytes[DS_MAX_RES]; /* per capacity resource */ + double peak_live_at_ns[DS_MAX_RES]; + double attr_ns[DS_ATTR_N]; + int critical_path[DS_MAX_OPS], n_critical; + uint32_t prov_mask; /* bit per ds_prov that fed the result */ + int synthetic; + /* conservation: what went in is what was scheduled */ + int n_ops; + double total_bytes, total_busy_ns, total_launch_ns; + /* energy */ + int energy_measured; /* 1: joules from a named instrument */ + int energy_synthetic; /* 1: E = P*T from a synthetic power figure */ + double energy_j; +} ds_result; + +/* Parse. Returns DS_OK or DS_PARSE_ERROR with the line and reason in `err`. */ +int ds_parse_file(const char *path, ds_model *m, char *err, size_t errcap); +int ds_parse_text(const char *text, ds_model *m, char *err, size_t errcap); + +/* Evaluate deterministically. Fills every field of `r` or sets a refusal. */ +int ds_eval(const ds_model *m, const ds_opts *o, ds_result *r); + +/* Three-point interval: nominal, lo (optimistic) and hi (pessimistic) makespan. + * Returns the nominal status; lo/hi are 0 when any point refused. */ +int ds_eval_interval(const ds_model *m, const ds_opts *o, ds_result *nominal, double *lo_ns, double *hi_ns); + +/* Counterfactual sensitivity: makespan with one resource doubled (bandwidth cap x2, + * compute slots x2, launch cost 0). Returns the new makespan or a negative status. */ +double ds_counterfactual(const ds_model *m, const ds_opts *o, int res_index); + +/* Minimum-work accounting: compare a baseline and a transformed model by stable op + * ids. Sums removed work by reason and detects double-counted shared work and removal + * of required work. */ +typedef struct { + double removed_ns[8]; /* by ds_removed_reason */ + int n_removed, n_added, n_kept; + int double_counted; /* an op removed with reason=shared appears twice or refs a missing op */ + int required_removed; /* a removed op without a valid derivation still has consumers */ + char reason[256]; +} ds_diff; +int ds_diff_models(const ds_model *baseline, const ds_model *transformed, const ds_opts *o, ds_diff *d); + +const char *ds_status_name(int s); +const char *ds_prov_name(int p); +int ds_day_from_date(const char *yyyy_mm_dd); +int ds_find_op(const ds_model *m, const char *id); +int ds_find_res(const ds_model *m, const char *id); + +#endif /* DAGSIM_H */ diff --git a/tools/dagsim/dagsim_cli.c b/tools/dagsim/dagsim_cli.c new file mode 100644 index 000000000..fb279f904 --- /dev/null +++ b/tools/dagsim/dagsim_cli.c @@ -0,0 +1,222 @@ +/* + * dagsim_cli -- reproducible command line for the offline resource-DAG + * evaluator (omega-mv#583). No GPU, no execution: it reads OEV1 files and + * prints JSON. Every number it prints names the provenance it came from. + * + * dagsim eval FILE [--asof YYYY-MM-DD] [--model BLOB] + * dagsim pareto FILE... [--asof YYYY-MM-DD] [--model BLOB] + * dagsim diff BASELINE TRANSFORMED [--changed a,b,...] + */ +#include "dagsim.h" +#include "runtime/rx_costmodel.h" + +#include +#include +#include +#include + +static void jstr(const char *s) { + putchar('"'); + for (; *s; s++) { + if (*s == '"' || *s == '\\') { putchar('\\'); putchar(*s); } + else if ((unsigned char)*s < 0x20) printf("\\u%04x", *s); + else putchar(*s); + } + putchar('"'); +} +static void jnum(double v) { if (v == floor(v) && fabs(v) < 1e15) printf("%.0f", v); else printf("%.6g", v); } + +static int load_model(const char *path, RxCostModel *cm) { + FILE *fp = fopen(path, "rb"); + if (!fp) return 0; + size_t cap = rx_cm_blob_size(); + uint8_t *buf = malloc(cap); + if (!buf) { fclose(fp); return 0; } + size_t got = fread(buf, 1, cap, fp); + fclose(fp); + int ok = rx_cm_deserialize(cm, buf, got) == RX_CM_OK; + free(buf); + return ok; +} + +static const char *attr_name[DS_ATTR_N] = { "compute", "bandwidth", "contention", "launch", "serialization", "sync", "residual" }; +static const char *res_kind_name(int k) { + switch (k) { case DS_RES_COMPUTE: return "compute"; case DS_RES_BANDWIDTH: return "bandwidth"; case DS_RES_CAPACITY: return "capacity"; case DS_RES_LAUNCH: return "launch"; default: return "?"; } +} + +static void emit_result_json(const char *path, const ds_model *m, const ds_opts *o, const ds_result *r, double lo, double hi) { + printf("{\n \"schema\": \"oev1\", \"tool\": \"dagsim\", \"file\": "); jstr(path); + printf(",\n \"machine\": "); jstr(m->machine_id); + printf(", \"build_sha\": "); jstr(m->build_sha); + printf(",\n \"calibration\": {\"id\": "); jstr(m->has_calibration ? m->cal_id : ""); + printf(", \"taken_day\": %d, \"valid_days\": %d, \"load1\": ", m->cal_taken_day, m->cal_valid_days); jnum(m->cal_load1); + printf(", \"src\": "); jstr(m->cal_src); printf("},\n \"asof_day\": %d,\n", o->asof_day); + printf(" \"status\": "); jstr(ds_status_name(r->status)); printf(", \"reason\": "); jstr(r->reason); + printf(",\n \"provenance\": ["); int first = 1; + for (int p = 0; p <= DS_PROV_SPECIFIED; p++) if (r->prov_mask & (1u << p)) { if (!first) printf(", "); jstr(ds_prov_name(p)); first = 0; } + printf("], \"synthetic\": %d, \"offline\": true, \"gpu_executed\": false", r->synthetic); + if (r->status != DS_OK) { printf("\n}\n"); return; } + printf(",\n \"makespan_ns\": {\"nominal\": "); jnum(r->makespan_ns); printf(", \"lo\": "); jnum(lo); printf(", \"hi\": "); jnum(hi); + printf(", \"interval_known\": %s}", (lo > 0 && hi > 0) ? "true" : "false"); + printf(",\n \"bounds_ns\": {\"critical_path\": "); jnum(r->bound_critical_path_ns); printf(", \"max\": "); jnum(r->bound_ns); printf(", \"resources\": {"); + for (int i = 0; i < m->n_res; i++) { if (i) printf(", "); jstr(m->res[i].id); printf(": "); jnum(r->bound_resource_ns[i]); } + printf("}, \"makespan_ge_bounds\": %s}", r->makespan_ns + 1e-6 >= r->bound_ns ? "true" : "false"); + printf(",\n \"ops\": ["); + for (int i = 0; i < m->n_ops; i++) { + printf("%s\n {\"id\": ", i ? "," : ""); jstr(m->ops[i].id); + printf(", \"start_ns\": "); jnum(r->start_ns[i]); printf(", \"end_ns\": "); jnum(r->end_ns[i]); + printf(", \"floor_ns\": "); jnum(r->op_floor_ns[i]); printf(", \"contention_ns\": "); jnum(r->op_contention_ns[i]); + printf(", \"prov\": "); jstr(ds_prov_name(m->ops[i].kind == DS_OP_MATVEC && !m->ops[i].has_t ? DS_PROV_FITTED : m->ops[i].t_prov)); + printf(", \"src\": "); jstr(m->ops[i].src); printf("}"); + } + printf("\n ],\n \"critical_path\": ["); + for (int i = 0; i < r->n_critical; i++) { if (i) printf(", "); jstr(m->ops[r->critical_path[i]].id); } + printf("],\n \"peak_live_bytes\": {"); + first = 1; + for (int i = 0; i < m->n_res; i++) if (m->res[i].kind == DS_RES_CAPACITY) { + if (!first) printf(", "); + first = 0; + jstr(m->res[i].id); printf(": {\"bytes\": "); jnum(r->peak_live_bytes[i]); printf(", \"at_ns\": "); jnum(r->peak_live_at_ns[i]); printf(", \"cap\": "); jnum(m->res[i].cap); printf("}"); + } + printf("},\n \"attribution_ns\": {"); + for (int i = 0; i < DS_ATTR_N; i++) { if (i) printf(", "); jstr(attr_name[i]); printf(": "); jnum(r->attr_ns[i]); } + printf("},\n \"energy\": {\"status\": "); + jstr(r->energy_measured ? "MEASURED" : r->energy_synthetic ? "SYNTHETIC_SENSITIVITY_ONLY" : "UNMEASURED"); + printf(", \"joules\": "); if (r->energy_measured || r->energy_synthetic) jnum(r->energy_j); else printf("null"); + printf(", \"instrument\": "); jstr(m->instrument); printf(", \"boundary\": "); jstr(m->boundary); + printf(", \"ranking_valid\": %s}", r->energy_measured ? "true" : "false"); + printf(",\n \"conservation\": {\"n_ops\": %d, \"total_bytes\": ", r->n_ops); jnum(r->total_bytes); + printf(", \"total_busy_ns\": "); jnum(r->total_busy_ns); printf(", \"total_launch_ns\": "); jnum(r->total_launch_ns); + printf(", \"instrument_overhead_ns\": null}"); + /* counterfactual sensitivities, ranked by how much they could move the makespan, + * weighted by how uncertain the resource's own figure is */ + printf(",\n \"sensitivities\": ["); + double score[DS_MAX_RES]; int idx[DS_MAX_RES]; double cf[DS_MAX_RES]; double width[DS_MAX_RES]; + for (int i = 0; i < m->n_res; i++) { + cf[i] = ds_counterfactual(m, o, i); + width[i] = m->res[i].kind == DS_RES_BANDWIDTH && m->res[i].cap > 0 ? (m->res[i].hi - m->res[i].lo) / m->res[i].cap : 0; + if (m->res[i].prov == DS_PROV_SPECIFIED) width[i] = 1.0; /* a datasheet number is not a measurement */ + score[i] = cf[i] >= 0 ? fabs(r->makespan_ns - cf[i]) * (width[i] > 0 ? width[i] : 0.05) : 0; + idx[i] = i; + } + for (int a = 1; a < m->n_res; a++) { + int k = idx[a]; int b = a - 1; + while (b >= 0 && score[idx[b]] < score[k]) { idx[b + 1] = idx[b]; b--; } + idx[b + 1] = k; + } + for (int a = 0; a < m->n_res; a++) { + int i = idx[a]; + printf("%s\n {\"resource\": ", a ? "," : ""); jstr(m->res[i].id); + printf(", \"kind\": "); jstr(res_kind_name(m->res[i].kind)); + printf(", \"makespan_if_doubled_ns\": "); if (cf[i] >= 0) jnum(cf[i]); else printf("null"); + printf(", \"delta_ns\": "); if (cf[i] >= 0) jnum(r->makespan_ns - cf[i]); else printf("null"); + printf(", \"interval_width_frac\": "); jnum(width[i]); + printf(", \"decision_score\": "); jnum(score[i]); + printf(", \"next_experiment\": "); + if (m->res[i].kind == DS_RES_BANDWIDTH) jstr(m->res[i].prov == DS_PROV_SPECIFIED ? "measure this bandwidth on this DAG's shapes (datasheet figure, never attained)" : "repeat the bandwidth receipt on a quiet box to tighten lo/hi"); + else if (m->res[i].kind == DS_RES_LAUNCH) jstr("measure launch with the device context held open (M1 block2 follow-up)"); + else if (m->res[i].kind == DS_RES_COMPUTE) jstr("measure the critical op at the next larger shape"); + else jstr("none: capacity is a ledger, not a rate"); + printf("}"); + } + printf("\n ],\n \"unresolved_residual_ns\": "); jnum(r->attr_ns[DS_ATTR_RESIDUAL]); + printf(",\n \"note\": \"loaded-box calibration (load1 above); bounds are floors, not predictions; no performance claim from this simulation alone\"\n}\n"); +} + +static int cmd_eval(const char *path, const ds_opts *o) { + ds_model *m = malloc(sizeof *m); char err[256]; + if (!m) return 2; + if (ds_parse_file(path, m, err, sizeof err) != DS_OK) { + printf("{\"schema\": \"oev1\", \"tool\": \"dagsim\", \"file\": "); jstr(path); printf(", \"status\": \"PARSE_ERROR\", \"reason\": "); jstr(err); printf("}\n"); + free(m); return 1; + } + ds_result *r = malloc(sizeof *r); double lo, hi; + if (!r) { free(m); return 2; } + int rc = ds_eval_interval(m, o, r, &lo, &hi); + emit_result_json(path, m, o, r, lo, hi); + free(r); free(m); + return rc == DS_OK ? 0 : 1; +} + +typedef struct { const char *path; int status; double t, lo, hi, peak, e; int e_meas, e_syn, front; char reason[256]; } prow; + +static int cmd_pareto(int n, const char **paths, const ds_opts *o) { + prow rows[64]; if (n > 64) n = 64; + int all_energy = 1; + for (int k = 0; k < n; k++) { + prow *p = &rows[k]; memset(p, 0, sizeof *p); p->path = paths[k]; + ds_model *m = malloc(sizeof *m); ds_result *r = malloc(sizeof *r); char err[256]; + if (!m || !r) return 2; + if (ds_parse_file(paths[k], m, err, sizeof err) != DS_OK) { p->status = DS_PARSE_ERROR; snprintf(p->reason, sizeof p->reason, "%s", err); free(m); free(r); all_energy = 0; continue; } + p->status = ds_eval_interval(m, o, r, &p->lo, &p->hi); + snprintf(p->reason, sizeof p->reason, "%s", r->reason); + if (p->status == DS_OK) { + p->t = r->makespan_ns; + for (int i = 0; i < m->n_res; i++) if (m->res[i].kind == DS_RES_CAPACITY && r->peak_live_bytes[i] > p->peak) p->peak = r->peak_live_bytes[i]; + p->e = r->energy_j; p->e_meas = r->energy_measured; p->e_syn = r->energy_synthetic; + if (!p->e_meas) all_energy = 0; + } else all_energy = 0; + free(m); free(r); + } + /* non-dominated on (time, peak bytes[, measured joules]) among OK rows */ + for (int a = 0; a < n; a++) { + if (rows[a].status != DS_OK) continue; + rows[a].front = 1; + for (int b = 0; b < n; b++) { + if (a == b || rows[b].status != DS_OK) continue; + int le = rows[b].t <= rows[a].t && rows[b].peak <= rows[a].peak && (!all_energy || rows[b].e <= rows[a].e); + int lt = rows[b].t < rows[a].t || rows[b].peak < rows[a].peak || (all_energy && rows[b].e < rows[a].e); + if (le && lt) { rows[a].front = 0; break; } + } + } + printf("# dagsim pareto: objectives = seconds, peak bytes%s. Energy %s.\n", all_energy ? ", joules" : "", + all_energy ? "measured on every row and part of the dominance test" : "not measured on every row: shown, never ranked"); + printf("# %-36s %-24s %14s %14s %14s %12s %-14s %s\n", "file", "status", "seconds", "lo_s", "hi_s", "peak_bytes", "energy", "front"); + for (int k = 0; k < n; k++) { + prow *p = &rows[k]; + char e[32]; + if (p->e_meas) snprintf(e, sizeof e, "%.3f J", p->e); else if (p->e_syn) snprintf(e, sizeof e, "syn %.3f J", p->e); else snprintf(e, sizeof e, "UNMEASURED"); + if (p->status == DS_OK) + printf(" %-36s %-24s %14.6f %14.6f %14.6f %12.0f %-14s %s\n", p->path, "OK", p->t * 1e-9, p->lo * 1e-9, p->hi * 1e-9, p->peak, e, p->front ? "yes" : "no"); + else + printf(" %-36s %-24s %14s %14s %14s %12s %-14s %s # %s\n", p->path, ds_status_name(p->status), "-", "-", "-", "-", "-", "refused", p->reason); + } + return 0; +} + +static int cmd_diff(const char *a, const char *b, const ds_opts *o) { + ds_model *ma = malloc(sizeof *ma), *mb = malloc(sizeof *mb); char err[256]; ds_diff d; + if (!ma || !mb) return 2; + if (ds_parse_file(a, ma, err, sizeof err) != DS_OK) { fprintf(stderr, "%s: %s\n", a, err); return 1; } + if (ds_parse_file(b, mb, err, sizeof err) != DS_OK) { fprintf(stderr, "%s: %s\n", b, err); return 1; } + int rc = ds_diff_models(ma, mb, o, &d); + static const char *rn[8] = { "", "eliminated", "reused", "unchanged_dep", "deferred", "moved", "shared", "lookup" }; + printf("{\"tool\": \"dagsim diff\", \"baseline\": "); jstr(a); printf(", \"transformed\": "); jstr(b); + printf(", \"status\": "); jstr(ds_status_name(rc)); printf(", \"reason\": "); jstr(d.reason); + printf(", \"kept\": %d, \"added\": %d, \"removed\": %d, \"double_counted\": %d, \"required_removed\": %d, \"removed_ns\": {", d.n_kept, d.n_added, d.n_removed, d.double_counted, d.required_removed); + for (int i = 1; i < 8; i++) { if (i > 1) printf(", "); jstr(rn[i]); printf(": "); jnum(d.removed_ns[i]); } + printf("}, \"changed\": "); jstr(o->changed ? o->changed : ""); printf("}\n"); + free(ma); free(mb); + return rc == DS_OK ? 0 : 1; +} + +int main(int argc, char **argv) { + if (argc < 3) { fprintf(stderr, "usage: dagsim eval FILE | pareto FILE... | diff BASE TRANSFORMED [--asof YYYY-MM-DD] [--model BLOB] [--changed a,b]\n"); return 2; } + ds_opts o; memset(&o, 0, sizeof o); o.interval_q = 0.9; + RxCostModel *cm = NULL; + const char *files[64]; int nf = 0; + for (int i = 2; i < argc; i++) { + if (!strcmp(argv[i], "--asof") && i + 1 < argc) { o.asof_day = ds_day_from_date(argv[++i]); if (o.asof_day < 0) { fprintf(stderr, "bad --asof\n"); return 2; } } + else if (!strcmp(argv[i], "--model") && i + 1 < argc) { cm = malloc(sizeof *cm); if (!cm || !load_model(argv[++i], cm)) { fprintf(stderr, "cannot load rx_costmodel blob %s\n", argv[i]); return 2; } o.costmodel = cm; } + else if (!strcmp(argv[i], "--changed") && i + 1 < argc) o.changed = argv[++i]; + else if (nf < 64) files[nf++] = argv[i]; + } + if (o.asof_day == 0) { fprintf(stderr, "dagsim: --asof YYYY-MM-DD is required so the run is reproducible (calibration validity is checked against it)\n"); return 2; } + int rc; + if (!strcmp(argv[1], "eval") && nf == 1) rc = cmd_eval(files[0], &o); + else if (!strcmp(argv[1], "pareto") && nf >= 1) rc = cmd_pareto(nf, files, &o); + else if (!strcmp(argv[1], "diff") && nf == 2) rc = cmd_diff(files[0], files[1], &o); + else { fprintf(stderr, "usage: dagsim eval FILE | pareto FILE... | diff BASE TRANSFORMED\n"); rc = 2; } + free(cm); + return rc; +} diff --git a/tools/dagsim/memcpy_probe.c b/tools/dagsim/memcpy_probe.c new file mode 100644 index 000000000..3c1ec3b9b --- /dev/null +++ b/tools/dagsim/memcpy_probe.c @@ -0,0 +1,60 @@ +/* + * memcpy_probe -- held-out measurement for the shared-bandwidth model + * (omega-mv#583). CPU only, no GPU. Copies GB gigabytes once per rep using + * THREADS threads, each on its own contiguous slice, and prints the same CSV + * shape as M1 block4 (omega-mv#577) so the two can be compared directly. + * + * memcpy_probe GB THREADS REPS + * + * Header lines carry load average and MemAvailable before and after, so a + * loaded-box number is never quoted as a quiet-box number. + */ +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +typedef struct { char *dst; const char *src; size_t n; } slice; +static void *worker(void *p) { slice *s = p; memcpy(s->dst, s->src, s->n); return NULL; } + +static double now(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec + ts.tv_nsec * 1e-9; } +static void sysline(const char *tag) { + char load[128] = "?", mem[256] = "?"; + FILE *f = fopen("/proc/loadavg", "r"); if (f) { if (fgets(load, sizeof load, f)) load[strcspn(load, "\n")] = 0; fclose(f); } + f = fopen("/proc/meminfo", "r"); + if (f) { char l[256]; while (fgets(l, sizeof l, f)) if (!strncmp(l, "MemAvailable:", 13)) { snprintf(mem, sizeof mem, "%s", l + 13); mem[strcspn(mem, "\n")] = 0; break; } fclose(f); } + time_t t = time(NULL); char ts[64]; strftime(ts, sizeof ts, "%Y-%m-%dT%H:%M:%S%z", localtime(&t)); + printf("# %s %s loadavg=%s MemAvailable=%s\n", tag, ts, load, mem); +} + +int main(int argc, char **argv) { + if (argc != 4) { fprintf(stderr, "usage: memcpy_probe GB THREADS REPS\n"); return 2; } + double gb = atof(argv[1]); int k = atoi(argv[2]), reps = atoi(argv[3]); + if (gb <= 0 || k < 1 || k > 64 || reps < 1) return 2; + size_t n = (size_t)(gb * 1e9); + char *src = malloc(n), *dst = malloc(n); + if (!src || !dst) { fprintf(stderr, "alloc failed\n"); return 3; } + memset(src, 1, n); memset(dst, 2, n); /* touch every page before timing */ + printf("# omega-mv#583 memcpy_probe; cmd=memcpy_probe %s %s %s; bytes_copied=%zu (read+write counted twice below, as in M1 block4)\n", argv[1], argv[2], argv[3], n); + sysline("before"); + { /* instrument overhead: one timer read, so the reader knows what the stamps cost */ + double a = now(); for (int i = 0; i < 1000; i++) (void)now(); double b = now(); + printf("# timer=CLOCK_MONOTONIC overhead_ns_per_read=%.1f (1000 reads)\n", (b - a) * 1e9 / 1000.0); + } + printf("gb,threads,rep,seconds,GBps_read_plus_write\n"); + for (int r = 0; r < reps; r++) { + pthread_t th[64]; slice sl[64]; + size_t per = n / (size_t)k; + double t0 = now(); + for (int i = 0; i < k; i++) { sl[i].dst = dst + (size_t)i * per; sl[i].src = src + (size_t)i * per; sl[i].n = (i == k - 1) ? n - (size_t)i * per : per; pthread_create(&th[i], NULL, worker, &sl[i]); } + for (int i = 0; i < k; i++) pthread_join(th[i], NULL); + double dt = now() - t0; + printf("%g,%d,%d,%.4f,%.1f\n", gb, k, r, dt, 2.0 * n / dt / 1e9); + fflush(stdout); + } + sysline("after"); + free(src); free(dst); + return 0; +}