Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

perf(layer-stream): pack the pinned arenas largest-first when that page-locks less (#1713)

Alpamys Makazhan60ab2fdb1d5c
diff --git a/benchmarks/gate-1702-arena-packing.md b/benchmarks/gate-1702-arena-packing.md
new file mode 100644
index 00000000..b3fe6edb
--- /dev/null
+++ b/benchmarks/gate-1702-arena-packing.md
@@ -0,0 +1,195 @@
+<!--
+Working measurement record, published verbatim. The decision rule in §2 and the
+protocol in §3 were written in issue #1702 on 2026-10-07, before any run of the
+speed series, and are copied here unchanged: a rule written after the numbers
+are in is not a rule.
+
+Hardware: RTX 5070 Laptop GPU (Blackwell sm_120, 8151 MiB, driver 616.92),
+Intel i9-14900HX, 31.7 GB DDR5-5600, Samsung PM9B1 NVMe (C:). Windows 11 Pro
+10.0.26200.
+Stack: Python 3.12.10, torch 2.14.0+cu130, transformers 5.17.0, peft 0.20.0,
+bitsandbytes 0.50.2, accelerate 1.15.0.
+Soup: branch perf/pinned-arena-packing-1702 on main 7016df2b; soup_cli.__file__
+is stamped into every run's result.
+Harness: benchmarks/harness/issue1702_arena_pack_gate.py, one process per run,
+through stream_probe.build (the shipped shard_checkpoint -> build_streamed_model
+path). Its schedule and rule are held by tests/test_issue1702_arena_pack_gate.py.
+-->
+
+# Gate record — largest-first packing of the pinned arenas (#1702)
+
+**Status (2026-10-07): memory saving confirmed, strict control passed, speed series run:
+NO DIFFERENCE measurable at +/-15.1%.**
+On `main` plus the change, the Qwen3-8B NF4 RAM tier page-locks 6,442,450,944 bytes
+where the in-order plan page-locks 8,589,934,592, and three deterministic optimizer
+steps are byte-identical between the two plans (§4). The speed series (§5) completed 40
+of 40 runs: the RAM tier's mean difference is +1.96%, inside the band of +/-15.13% the
+control set, so by the rule written beforehand no speed-up and no slow-down is claimed.
+The band is wide; the series cannot exclude a change smaller than that.
+
+---
+
+## 0. The question
+
+`plan_pinned_arenas` now also plans stable first-fit decreasing and returns it when it
+page-locks strictly fewer bytes than the in-order walk. On the RAM tier that changes
+where every tensor of the store lives: a layer's tensors are no longer neighbours in
+one arena. The host-to-device copies are per tensor and each tensor is still one
+contiguous page-locked view, so no effect on the step time is expected. Expected is
+not measured. Does the packed layout change the training step time?
+
+## 1. What is settled without a timing
+
+| | in-order plan | packed plan |
+|---|---:|---:|
+| Qwen3-8B NF4 RAM tier, arenas | 4 x 2 GiB | 3 x 2 GiB |
+| page-locked bytes | 8,589,934,592 | 6,442,450,944 |
+| store bytes (1,154 tensors) | 6,073,035,760 | 6,073,035,760 |
+| peak process RSS, 3-step run | 10.85 GB | 8.71 GB |
+| peak VRAM allocated / reserved | 2.807 / 3.047 GB | 2.807 / 3.047 GB |
+| Qwen3-8B NF4 disk tier, page-locked staging | 4,294,967,296 | 4,294,967,296 (same plan) |
+
+The first three rows are also arithmetic, and are tested without a GPU
+(`tests/test_issue1702_pinned_arena_packing.py`). The other rows are from the four
+runs of §4.
+
+## 2. The decision rule (from #1702, written before any run)
+
+1. Failed runs are never dropped. Each is listed with its error and counted against
+ its arm. A seed/mode block with a failed run has no `d`. A mode with fewer than 4 of
+ 5 `d` is INCONCLUSIVE.
+2. Noise band `b` = the larger of 3% and the largest `|d|` seen in the control.
+3. If the control's mean `d` is outside +/-3%, the series is INCONCLUSIVE: the box was
+ not quiet or the order did not cancel. No speed statement is made. One repeat in
+ another window is allowed, and both series are published.
+4. Otherwise, with `m` = the mean `d` on the RAM tier:
+ - `m < -b`: slower. The number goes in the PR and the change is decided as a trade of
+ speed for 2 GiB of page-locked memory.
+ - `m > +b`: faster, reported with the number.
+ - anything else: no difference measurable at +/-`b`; the PR claims memory only.
+5. Nothing is tuned after the results are seen: no dropped seed, no extra run beyond the
+ one declared repeat.
+
+`d = mean(packed) / mean(in-order) - 1` per seed and mode, over that block's two runs
+per arm, on input tokens per second across the 10 measured steps (5,120 positions
+divided by the sum of the 10 CUDA-synchronized step times).
+
+## 3. The protocol (from #1702, written before any run)
+
+- **Recipe.** Qwen/Qwen3-8B (revision `b968826d9c46dd6066d109eabc6255188de91218`), NF4
+ with double quantization, bf16 compute, LoRA r16 (alpha 32, dropout 0) on
+ `q_proj`/`v_proj`, `PagedAdamW8bit` at 2e-4, batch 1, 512-token blocks, 5 warm-up and
+ 10 measured optimizer steps, two GPU layer buffers, read-ahead 2, a
+ 4,000,000,000-byte per-process allocator cap. Seeds 3 / 17 / 29 / 43 / 59.
+- **Data.** 32 blocks of 512 tokens from WikiText-2 raw v1, tokenized without special
+ tokens; a run takes the first 15. The file is not in the repository (sha256
+ `663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee`). Without
+ `--batches` the harness draws seeded random token ids instead and says so in the
+ result.
+- **Arms.** `in-order`: the planner's largest-first walk is pointed at its in-order walk
+ inside the process, so the candidate can never win and the plan is the one from
+ before #1702. `packed`: the shipped planner. No config field exists for this.
+- **Modes.** RAM tier: the subject. Disk tier with direct I/O: the negative control.
+ Its plan is the same in both arms, so a difference between its arms is noise or run
+ order.
+- **Order.** One series, every run a fresh process. Per seed and mode the four runs go
+ A B B A; the next seed starts with the other arm and the other mode.
+ 5 seeds x 2 modes x 4 runs = 40 runs
+ (`python benchmarks/harness/issue1702_arena_pack_gate.py` prints the list).
+- **Validity.** A RAM run that does not show 8,589,934,592 page-locked bytes in the
+ in-order arm or 6,442,450,944 in the packed arm, or a control whose arms page-lock
+ different amounts, is a harness fault and voids the series. A run whose staging is
+ not page-locked, a control run that is not reading with direct I/O, and a run with
+ no result after 15 minutes (it is stopped) are failed runs.
+- **Power** (added 2026-10-07, before any run of the series). A rehearsal of the driver
+ on Qwen2.5-1.5B found the laptop on battery: a step took 0.83 s there against 0.31 s
+ on AC. The driver does not start a series on battery power and stops one when the
+ box goes on battery; a series with any run stamped on battery, before or after, is
+ INCONCLUSIVE and counts as the one allowed repeat.
+- **The box.** Nothing else runs for the whole series: no test suite, no other GPU job.
+ RAM in use, commit charge and AC power are stamped before and after every run.
+
+```bash
+python benchmarks/harness/issue1702_arena_pack_gate.py --mode series \
+ --weights $MODEL --shards $SHARDS --batches $BATCHES --out $OUT
+```
+
+## 4. Strict control: byte-identical (2026-10-07)
+
+Three optimizer steps, one seed (3), `torch.use_deterministic_algorithms(True)` and
+`CUBLAS_WORKSPACE_CONFIG=:4096:8`, one fresh process per arm and mode. After every step
+the run takes the SHA-256 of the full logits, the loss, all 144 LoRA gradients and all
+144 updated adapter tensors: 290 digests per step, 870 per run.
+
+| mode | in-order | packed | digests equal |
+|---|---:|---:|---|
+| RAM tier, page-locked bytes | 8,589,934,592 | 6,442,450,944 | 870 of 870 |
+| disk tier (direct I/O), page-locked bytes | 4,294,967,296 | 4,294,967,296 | 870 of 870 |
+
+All four runs give the same digest of digests,
+`1b127f4880e4f35d07609a1c503728e17ac22e2f0ea0f69f81ba62f023e04140`: the two plans agree
+with each other, and the RAM tier agrees with the disk tier. Losses over the three
+steps: 2.699491, 3.197587, 3.101483 in every run.
+Summary file: `benchmarks/results/probe-rtx5070/issue1702/strict.json`.
+
+```bash
+python benchmarks/harness/issue1702_arena_pack_gate.py --mode strict \
+ --weights $MODEL --shards $SHARDS --batches $BATCHES --seed 3 --out $OUT
+```
+
+This is a statement about three steps under deterministic execution. It shows the two
+layouts hand the same bytes to the same computation. It is not a claim about default
+(non-deterministic) execution or about a long run.
+
+## 5. Speed series: NO DIFFERENCE measurable at +/-15.1% (2026-10-07)
+
+One series, 16:40Z-17:16Z (35.6 minutes), at `4e692d31`, in a declared window with no
+test suite and no other GPU job on the box. 40 of 40 runs completed; no failed run and
+no harness fault. Every stamp shows AC power; before the runs 13.3-16.5 GB of RAM was
+available and the commit charge was 52.6-56.8%. The Windows Search service was running.
+Files: `benchmarks/results/probe-rtx5070/issue1702/series.jsonl` (one line per run, in
+run order) and `verdict.json`.
+
+| seed | RAM tier `d` | control `d` |
+|---:|---:|---:|
+| 3 | -2.71% | +3.03% |
+| 17 | +4.75% | -0.39% |
+| 29 | -1.41% | +9.69% |
+| 43 | +3.58% | -0.34% |
+| 59 | +5.61% | -15.13% |
+| mean (sample SD) | **+1.96%** (3.77%) | -0.63% (9.09%) |
+
+By §2: the control's mean is -0.63%, inside +/-3%, so the series stands (rule 3). The
+noise band `b` is 15.13%, the largest `|d|` in the control (rule 2). The RAM tier's mean
+`d` of +1.96% is inside +/-15.13% (rule 4): **no difference measurable at +/-15.13%.
+The PR claims memory only.** No repeat is due: the rule allows one only after an
+inconclusive series.
+
+| mode, arm (10 runs each) | tokens/s, mean (SD) | median step | store build | peak RSS | page-locked bytes |
+|---|---:|---:|---:|---:|---:|
+| RAM, in-order | 515.8 (30.7) | 0.972 s | 11.5 s | 10.84 GB | 8,589,934,592 |
+| RAM, packed | 525.5 (31.5) | 0.963 s | 9.0 s | 8.69 GB | 6,442,450,944 |
+| disk, in-order | 273.1 (24.2) | 1.866 s | 1.7 s | 6.13 GB | 4,294,967,296 |
+| disk, packed | 270.6 (22.2) | 1.882 s | 1.5 s | 6.12 GB | 4,294,967,296 |
+
+Peak VRAM was 2.807 GB allocated and 3.047 GB reserved in every run.
+
+**What this resolution means.** The band is wide because the control ran in two
+regimes. 15 of its 20 runs have a median step of 1.86-2.01 s and 5 have 1.62-1.64 s:
+the first three runs of seed 29 (one in-order, two packed) and the first and last runs
+of seed 59 (both in-order). A block split between the two regimes gives +9.69% and
+-15.13%; the other three blocks are within about 3%. The plan is the same in both arms
+on the disk tier, so this is the box and not the change, which is what a control is
+for. The RAM tier shows no such split (its median steps span 0.875-1.102 s, and its
+five `d` span -2.71% to +5.61%), but the rule takes the band from the control and the
+rule was written first. So: this series cannot exclude a change of less than 15% in
+either direction, and it shows none.
+
+## 6. What this record does not show
+
+- A physical 4 GB card: the card has 8 GB and the runs are under a software allocator
+ cap, which does not bound the CUDA context, the driver or page-locked memory.
+- Any model other than Qwen3-8B. The planner tests cover two Qwen2.5-14B geometries as
+ arithmetic only (about 7% less page-locked memory on each).
+- That a page-lock refusal becomes less likely. The packed plan asks Windows for 2 GiB
+ less, and that is all that is known.
diff --git a/benchmarks/harness/issue1702_arena_pack_gate.py b/benchmarks/harness/issue1702_arena_pack_gate.py
new file mode 100644
index 00000000..94ef02af
--- /dev/null
+++ b/benchmarks/harness/issue1702_arena_pack_gate.py
@@ -0,0 +1,725 @@
+#!/usr/bin/env python3
+"""Speed gate for the largest-first pinned-arena plan (#1702): in-order vs packed, A B B A.
+
+The record is ``benchmarks/gate-1702-arena-packing.md``. Its plan and decision rule were
+written in issue #1702 before any run; this script runs that plan and applies that rule,
+and decides nothing else.
+
+Two arms, each a fresh process through the shipped streaming path (``stream_probe.build``):
+
+ in-order the plan before #1702. Made inside the process by pointing the planner's
+ largest-first walk at its in-order walk, so the candidate can never win.
+ No config field exists for this and none is added.
+ packed the shipped planner.
+
+Two modes: the RAM tier is the subject; the disk tier (direct I/O) is the negative control,
+because its plan is the same in both arms and any difference there is noise or run order.
+
+Per seed and mode the four runs go A B B A, and the next seed starts with the other arm.
+Every result is appended to ``series.jsonl`` the moment it exists.
+
+ --mode plan print the schedule and exit (the default; touches nothing)
+ --mode series run the schedule, then print the verdict
+ --mode strict 3 deterministic optimizer steps per arm and mode, SHA-256 of every
+ step's logits, loss, gradients and updated adapter tensors, compared
+ --mode verdict re-apply the rule to an existing ``series.jsonl``
+ --mode trial one run (what ``series`` and ``strict`` spawn)
+
+The driver modes import no torch: the driver must not hold VRAM or page-locked memory
+while a trial runs. A machine without CUDA is an intentional skip and exits 0.
+
+Typical invocation::
+
+ python benchmarks/harness/issue1702_arena_pack_gate.py --mode series \
+ --weights D:/models/Qwen3-8B --shards D:/shards/qwen3-8b-nf4 \
+ --out benchmarks/results/probe-rtx5070/arena-pack
+"""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import os
+import statistics
+import subprocess
+import sys
+import time
+import traceback
+from pathlib import Path
+from typing import Any, Dict, List, Optional, Sequence, Tuple
+
+HERE = Path(__file__).resolve().parent
+ARMS = ("in-order", "packed")
+SUBJECT, CONTROL = "ram", "disk"
+SEEDS = (3, 17, 29, 43, 59)
+#: The rule's floor for the noise band, and the bound on the control's own mean.
+NOISE_FLOOR = 0.03
+#: A mode with fewer differences than this (of five seeds) is inconclusive.
+MIN_BLOCKS = 4
+#: The allocator cap the 2026-09-28 experiment ran under, kept for comparability.
+ALLOCATOR_CAP_BYTES = 4_000_000_000
+#: Page-locked bytes each arm must show on the RAM tier for Qwen3-8B NF4 (#1702).
+EXPECTED_SUBJECT_PINNED = {"in-order": 8 * 2**30, "packed": 6 * 2**30}
+
+
+# ==========================================================================
+# The schedule and the rule: pure, tested on CPU (tests/test_issue1702_arena_pack_gate.py)
+# ==========================================================================
+def schedule(
+ seeds: Sequence[int] = SEEDS, modes: Sequence[str] = (SUBJECT, CONTROL)
+) -> List[Dict[str, Any]]:
+ """A B B A per seed and mode; the first arm and the first mode alternate by seed."""
+ runs: List[Dict[str, Any]] = []
+ for position, seed in enumerate(seeds):
+ first, second = ARMS if position % 2 == 0 else ARMS[::-1]
+ ordered = list(modes) if position % 2 == 0 else list(modes)[::-1]
+ for mode in ordered:
+ for repeat, arm in enumerate((first, second, second, first)):
+ runs.append(
+ {
+ "name": f"seed{seed:02d}-{mode}-{repeat}-{arm}",
+ "seed": seed,
+ "mode": mode,
+ "arm": arm,
+ "repeat": repeat,
+ }
+ )
+ return runs
+
+
+def block_difference(rows: Sequence[Dict[str, Any]]) -> Optional[float]:
+ """``mean(packed) / mean(in-order) - 1`` for one seed and mode.
+
+ None unless both arms have their two completed runs: a failed run costs its block,
+ it is never averaged around.
+ """
+ by_arm = {
+ arm: [float(r["tok_per_s"]) for r in rows if r["arm"] == arm and r.get("status") == "ok"]
+ for arm in ARMS
+ }
+ if any(len(values) != 2 for values in by_arm.values()):
+ return None
+ return statistics.fmean(by_arm["packed"]) / statistics.fmean(by_arm["in-order"]) - 1.0
+
+
+def mode_differences(rows: Sequence[Dict[str, Any]], mode: str) -> Dict[int, Optional[float]]:
+ seeds = sorted({row["seed"] for row in rows if row["mode"] == mode})
+ return {
+ seed: block_difference([r for r in rows if r["mode"] == mode and r["seed"] == seed])
+ for seed in seeds
+ }
+
+
+def arena_faults(
+ rows: Sequence[Dict[str, Any]], expected: Dict[str, int] = EXPECTED_SUBJECT_PINNED
+) -> List[str]:
+ """Runs whose page-locked bytes show the arm switch did not do what the arm says."""
+ faults = []
+ control: Dict[int, set] = {}
+ for row in rows:
+ if row.get("status") != "ok":
+ continue
+ pinned = row.get("pinned_bytes")
+ if row["mode"] == SUBJECT and pinned != expected[row["arm"]]:
+ faults.append(
+ f"{row['name']}: {pinned} bytes page-locked, the {row['arm']} arm "
+ f"must show {expected[row['arm']]}"
+ )
+ if row["mode"] == CONTROL:
+ control.setdefault(row["seed"], set()).add(pinned)
+ for seed, seen in sorted(control.items()):
+ if len(seen) > 1:
+ faults.append(f"seed {seed} control: the arms page-locked {sorted(seen)}, not one size")
+ return faults
+
+
+def runs_on_battery(rows: Sequence[Dict[str, Any]]) -> List[str]:
+ """Runs whose stamp before or after says the box was not on AC power.
+
+ Measured on this laptop: a Qwen2.5-1.5B step takes 0.31 s on AC and 0.83 s on battery.
+ A stamp that could not be read (None, or no stamp at all) accuses nobody.
+ """
+ stamps = ("box_before", "box_after")
+ return [
+ row["name"]
+ for row in rows
+ if any((row.get(key) or {}).get("on_ac_power") is False for key in stamps)
+ ]
+
+
+def decide(
+ rows: Sequence[Dict[str, Any]],
+ *,
+ expected: Dict[str, int] = EXPECTED_SUBJECT_PINNED,
+ floor: float = NOISE_FLOOR,
+ min_blocks: int = MIN_BLOCKS,
+) -> Dict[str, Any]:
+ """The rule of issue #1702, in the order it is written there."""
+ subject = mode_differences(rows, SUBJECT)
+ control = mode_differences(rows, CONTROL)
+ failures = {
+ arm: [r["name"] for r in rows if r["arm"] == arm and r.get("status") != "ok"]
+ for arm in ARMS
+ }
+ out: Dict[str, Any] = {
+ "subject_differences": subject,
+ "control_differences": control,
+ "failed_runs": failures,
+ "floor": floor,
+ }
+ faults = arena_faults(rows, expected)
+ if faults:
+ return {**out, "verdict": "VOID", "reason": "harness fault: " + "; ".join(faults)}
+ on_battery = runs_on_battery(rows)
+ if on_battery:
+ return {
+ **out,
+ "verdict": "INCONCLUSIVE",
+ "reason": (
+ f"{len(on_battery)} run(s) started or ended on battery power, first "
+ f"{on_battery[0]}: the GPU is power-limited there, so the box was not quiet"
+ ),
+ }
+ subject_d = [value for value in subject.values() if value is not None]
+ control_d = [value for value in control.values() if value is not None]
+ for label, values in (("control", control_d), ("RAM tier", subject_d)):
+ if len(values) < min_blocks:
+ return {
+ **out,
+ "verdict": "INCONCLUSIVE",
+ "reason": f"the {label} has {len(values)} differences, fewer than {min_blocks}",
+ }
+ control_mean = statistics.fmean(control_d)
+ band = max(floor, max(abs(value) for value in control_d))
+ mean = statistics.fmean(subject_d)
+ out.update(
+ control_mean=control_mean,
+ control_sd=statistics.stdev(control_d),
+ band=band,
+ subject_mean=mean,
+ subject_sd=statistics.stdev(subject_d),
+ )
+ if abs(control_mean) > floor:
+ return {
+ **out,
+ "verdict": "INCONCLUSIVE",
+ "reason": (
+ f"the control's mean difference is {control_mean:+.2%}, outside +/-{floor:.0%}: "
+ "the box was not quiet or the order did not cancel"
+ ),
+ }
+ if mean < -band:
+ return {**out, "verdict": "SLOWER", "reason": f"{mean:+.2%} is below -{band:.2%}"}
+ if mean > band:
+ return {**out, "verdict": "FASTER", "reason": f"{mean:+.2%} is above +{band:.2%}"}
+ return {
+ **out,
+ "verdict": "NO DIFFERENCE",
+ "reason": f"{mean:+.2%} is inside +/-{band:.2%}",
+ }
+
+
+def compare_strict(results: Sequence[Dict[str, Any]]) -> Dict[str, Any]:
+ """Per mode: are the two arms' per-step digests equal, and how many were compared."""
+ out: Dict[str, Any] = {}
+ for mode in (SUBJECT, CONTROL):
+ by_arm = {r["arm"]: r for r in results if r["mode"] == mode}
+ if set(by_arm) != set(ARMS) or any(r.get("status") != "ok" for r in by_arm.values()):
+ out[mode] = {"exact": False, "reason": "an arm is missing or failed"}
+ continue
+ first, second = (by_arm[arm]["digests"] for arm in ARMS)
+ compared = sum(len(step) for step in first)
+ out[mode] = {
+ "exact": bool(first) and first == second,
+ "steps": len(first),
+ "digests_per_step": compared // max(1, len(first)),
+ }
+ return out
+
+
+# ==========================================================================
+# The box, read without torch
+# ==========================================================================
+def box_stamp() -> Dict[str, Any]:
+ """RAM in use, commit charge and AC power. Windows; elsewhere whatever psutil gives."""
+ stamp: Dict[str, Any] = {"unix": time.time()}
+ try:
+ import psutil
+
+ memory = psutil.virtual_memory()
+ stamp.update(ram_used_percent=memory.percent, ram_available_bytes=memory.available)
+ except Exception as exc: # the stamp is context, never a reason to stop a series
+ stamp["psutil_error"] = repr(exc)
+ if sys.platform == "win32":
+ import ctypes
+
+ class MemoryStatus(ctypes.Structure):
+ _fields_ = [("dwLength", ctypes.c_ulong), ("dwMemoryLoad", ctypes.c_ulong)] + [
+ (name, ctypes.c_ulonglong)
+ for name in (
+ "ullTotalPhys",
+ "ullAvailPhys",
+ "ullTotalPageFile",
+ "ullAvailPageFile",
+ "ullTotalVirtual",
+ "ullAvailVirtual",
+ "ullAvailExtendedVirtual",
+ )
+ ]
+
+ class PowerStatus(ctypes.Structure):
+ _fields_ = [
+ ("ACLineStatus", ctypes.c_ubyte),
+ ("BatteryFlag", ctypes.c_ubyte),
+ ("BatteryLifePercent", ctypes.c_ubyte),
+ ("SystemStatusFlag", ctypes.c_ubyte),
+ ("BatteryLifeTime", ctypes.c_ulong),
+ ("BatteryFullLifeTime", ctypes.c_ulong),
+ ]
+
+ memory_status = MemoryStatus()
+ memory_status.dwLength = ctypes.sizeof(MemoryStatus)
+ if ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(memory_status)):
+ limit = memory_status.ullTotalPageFile
+ stamp["commit_percent"] = 100.0 * (limit - memory_status.ullAvailPageFile) / limit
+ power = PowerStatus()
+ if ctypes.windll.kernel32.GetSystemPowerStatus(ctypes.byref(power)):
+ stamp["on_ac_power"] = power.ACLineStatus == 1
+ return stamp
+
+
+# ==========================================================================
+# One run
+# ==========================================================================
+def use_in_order_plan() -> None:
+ """Make the planner return the plan it returned before #1702, for this process."""
+ import soup_cli.utils.layer_stream_runtime as runtime
+
+ runtime._plan_largest_first = runtime._plan_in_order
+
+
+def _digest(tensor: Any) -> str:
+ import torch
+
+ flat = tensor.detach().to("cpu").contiguous().reshape(-1)
+ return hashlib.sha256(flat.view(torch.uint8).numpy().tobytes()).hexdigest()
+
+
+def _load_blocks(args: argparse.Namespace, vocab_size: int, device: str) -> Tuple[List[Any], str]:
+ import torch
+
+ count = args.warmup + args.steps
+ if args.batches:
+ raw = Path(args.batches).read_bytes()
+ rows = json.loads(raw)["train"]
+ blocks = [torch.tensor(row, dtype=torch.long, device=device).unsqueeze(0) for row in rows]
+ if any(tuple(block.shape) != (1, args.seq) for block in blocks):
+ raise ValueError(f"{args.batches}: every training block must hold {args.seq} tokens")
+ return blocks, "file sha256 " + hashlib.sha256(raw).hexdigest()
+ generator = torch.Generator().manual_seed(args.input_seed)
+ ids = torch.randint(0, vocab_size, (count, 1, args.seq), generator=generator)
+ return [row.to(device) for row in ids], f"random ids, input seed {args.input_seed}"
+
+
+def run_trial(args: argparse.Namespace) -> int:
+ out = Path(args.out)
+ out.parent.mkdir(parents=True, exist_ok=True)
+ result: Dict[str, Any] = {
+ "status": "started",
+ "name": out.stem,
+ "seed": args.seed,
+ "mode": args.tier,
+ "arm": args.arm,
+ "strict": args.strict,
+ "pid": os.getpid(),
+ "started_unix": time.time(),
+ }
+
+ def save() -> None:
+ out.write_text(json.dumps(result, indent=1, default=str) + "\n", encoding="utf-8")
+
+ save()
+ started = time.perf_counter()
+ runtime_handle = None
+ try:
+ import torch
+
+ if not torch.cuda.is_available():
+ print("SKIP: CUDA is required")
+ result["status"] = "skipped"
+ return 0
+ sys.path.insert(0, str(HERE))
+ import bitsandbytes as bnb
+ import stream_probe
+
+ import soup_cli
+ from soup_cli.utils.layer_stream import resolve_stream_dtype
+
+ result["soup_cli"] = soup_cli.__file__
+ result["torch"] = torch.__version__
+ if args.arm == "in-order":
+ use_in_order_plan()
+ if args.strict:
+ if os.environ.get("CUBLAS_WORKSPACE_CONFIG") != ":4096:8":
+ raise RuntimeError(
+ "--strict needs CUBLAS_WORKSPACE_CONFIG=:4096:8 in the environment"
+ )
+ torch.use_deterministic_algorithms(True)
+ torch.set_num_threads(4)
+ torch.manual_seed(args.seed)
+ device = "cuda"
+ total = torch.cuda.get_device_properties(0).total_memory
+ torch.cuda.set_per_process_memory_fraction(min(1.0, args.cap_bytes / total))
+ try:
+ oversized = torch.empty(args.cap_bytes + 256_000_000, dtype=torch.uint8, device=device)
+ except torch.OutOfMemoryError:
+ pass
+ else:
+ del oversized
+ if args.cap_bytes + 256_000_000 <= total:
+ raise RuntimeError("the allocator cap did not refuse an over-budget allocation")
+ torch.cuda.empty_cache()
+ result["cap_bytes"] = args.cap_bytes
+ result["import_and_cuda_s"] = time.perf_counter() - started
+
+ build_args = argparse.Namespace(
+ weights=args.weights,
+ shards=args.shards,
+ quant="nf4",
+ tier=args.tier,
+ buffers=2,
+ read_ahead=2,
+ no_pin=False,
+ seed=args.seed,
+ lora_r=16,
+ lora_targets="q_proj,v_proj",
+ lazy_shard_handles=False,
+ control_sync_source=False,
+ )
+ dtype = resolve_stream_dtype(device)
+ model, runtime_handle, config, _index, weights_dir, shard_dir, shard_s, build_s = (
+ stream_probe.build(build_args, device, dtype)
+ )
+ torch.cuda.synchronize()
+ stats = runtime_handle.stats()
+ source = runtime_handle.source
+ result.update(
+ dtype=dtype,
+ weights_dir=str(weights_dir),
+ shard_dir=str(shard_dir),
+ shard_s=shard_s,
+ build_s=build_s,
+ pinned=bool(stats["pinned"]),
+ pinned_bytes=stats.get("pinned_bytes"),
+ store_bytes=stats.get("store_bytes"),
+ arena_sizes=list(getattr(source, "arena_sizes", ()) or ()),
+ source_class=type(source).__name__,
+ direct_io=getattr(source, "direct_io", None),
+ )
+ save()
+ if not stats["pinned"]:
+ raise RuntimeError("the host staging is pageable: the page-lock was refused")
+ if args.tier == "disk" and result["direct_io"] is not True:
+ raise RuntimeError("the disk tier is not reading with direct I/O: not the control")
+
+ trainable = {n: p for n, p in model.named_parameters() if p.requires_grad}
+ result["trainable_tensors"] = len(trainable)
+ optimizer = bnb.optim.PagedAdamW8bit(list(trainable.values()), lr=2e-4)
+ blocks, result["data"] = _load_blocks(args, int(config.vocab_size), device)
+ model.train()
+
+ def one_step(ids: Any) -> Dict[str, Any]:
+ torch.cuda.synchronize()
+ tick = time.perf_counter()
+ optimizer.zero_grad(set_to_none=True)
+ output = model(input_ids=ids, labels=ids, use_cache=False)
+ output.loss.backward()
+ digests = None
+ if args.strict:
+ digests = [_digest(output.logits), _digest(output.loss)]
+ digests += [_digest(trainable[name].grad) for name in sorted(trainable)]
+ optimizer.step()
+ torch.cuda.synchronize()
+ seconds = time.perf_counter() - tick
+ if digests is not None:
+ digests += [_digest(trainable[name]) for name in sorted(trainable)]
+ return {"seconds": seconds, "loss": float(output.loss.detach()), "digests": digests}
+
+ warmup = [one_step(blocks[index % len(blocks)]) for index in range(args.warmup)]
+ torch.cuda.reset_peak_memory_stats()
+ steps = [
+ one_step(blocks[(args.warmup + index) % len(blocks)]) for index in range(args.steps)
+ ]
+ seconds = [step["seconds"] for step in steps]
+ result.update(
+ warmup_s=[step["seconds"] for step in warmup],
+ step_s=seconds,
+ losses=[step["loss"] for step in warmup + steps],
+ median_step_s=statistics.median(seconds),
+ tok_per_s=args.steps * args.seq / sum(seconds),
+ peak_allocated_bytes=torch.cuda.max_memory_allocated(),
+ peak_reserved_bytes=torch.cuda.max_memory_reserved(),
+ )
+ if args.strict:
+ result["digests"] = [step["digests"] for step in warmup + steps]
+ try:
+ import psutil
+
+ info = psutil.Process().memory_info()
+ result["peak_rss_bytes"] = getattr(info, "peak_wset", None) or info.rss
+ except Exception as exc:
+ result["peak_rss_error"] = repr(exc)
+ result["status"] = "ok"
+ return 0
+ except Exception as exc:
+ result.update(
+ status="failed",
+ error_type=type(exc).__name__,
+ error=str(exc).splitlines()[0][:400] if str(exc) else "",
+ traceback=traceback.format_exc(),
+ )
+ print(result["traceback"])
+ return 1
+ finally:
+ if runtime_handle is not None:
+ try:
+ runtime_handle.close()
+ except Exception as exc:
+ result["close_error"] = repr(exc)
+ result["total_wall_s"] = time.perf_counter() - started
+ save()
+
+
+# ==========================================================================
+# The driver
+# ==========================================================================
+def _spawn(args: argparse.Namespace, run: Dict[str, Any], *, strict: bool) -> Dict[str, Any]:
+ out_dir = Path(args.out)
+ out_dir.mkdir(parents=True, exist_ok=True)
+ target = out_dir / f"{'strict-' if strict else ''}{run['name']}.json"
+ command = [
+ sys.executable,
+ str(Path(__file__).resolve()),
+ "--mode",
+ "trial",
+ "--weights",
+ args.weights,
+ "--tier",
+ run["mode"],
+ "--arm",
+ run["arm"],
+ "--seed",
+ str(run["seed"]),
+ "--warmup",
+ str(0 if strict else args.warmup),
+ "--steps",
+ str(3 if strict else args.steps),
+ "--seq",
+ str(args.seq),
+ "--input-seed",
+ str(args.input_seed),
+ "--cap-bytes",
+ str(args.cap_bytes),
+ "--out",
+ str(target),
+ ]
+ if args.shards:
+ command += ["--shards", args.shards]
+ if args.batches:
+ command += ["--batches", args.batches]
+ environment = dict(os.environ)
+ if strict:
+ command.append("--strict")
+ environment["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
+ before = box_stamp()
+ # A result left by an earlier run of the same name must never be read as this one's.
+ target.unlink(missing_ok=True)
+ code: Optional[int] = None
+ timed_out = False
+ with open(target.with_suffix(".log"), "w", encoding="utf-8") as log:
+ try:
+ code = subprocess.run(
+ command,
+ stdout=log,
+ stderr=subprocess.STDOUT,
+ env=environment,
+ timeout=args.run_timeout_s,
+ ).returncode
+ except subprocess.TimeoutExpired:
+ # subprocess.run has already killed the child; the run is a failed run.
+ timed_out = True
+ try:
+ row = json.loads(target.read_text(encoding="utf-8"))
+ except (OSError, ValueError) as exc:
+ row = {"status": "failed", "error": f"no result file: {exc!r}"}
+ if timed_out:
+ row.update(
+ status="failed", error=f"stopped after {args.run_timeout_s:.0f} s without a result"
+ )
+ elif row.get("status") == "started":
+ row["status"] = "failed"
+ row.setdefault("error", "the process ended without a result")
+ row.update(run, returncode=code, box_before=before, box_after=box_stamp())
+ return row
+
+
+def run_series(args: argparse.Namespace) -> int:
+ out_dir = Path(args.out)
+ out_dir.mkdir(parents=True, exist_ok=True)
+ journal = out_dir / "series.jsonl"
+ if journal.exists():
+ print(f"{journal} exists: a series is never appended to or re-run in place")
+ return 2
+ rows = []
+ runs = schedule()
+ for position, run in enumerate(runs, start=1):
+ if box_stamp().get("on_ac_power") is False:
+ # Power-limited steps are not the steps the plan measures: do not time them.
+ print(f"the box is on battery power before run {position}: the series stops here")
+ if not rows:
+ return 2
+ break
+ row = _spawn(args, run, strict=False)
+ rows.append(row)
+ with open(journal, "a", encoding="utf-8") as handle:
+ handle.write(json.dumps(row, default=str) + "\n")
+ figure = f"{row['tok_per_s']:.1f} tok/s" if row.get("status") == "ok" else row.get("error")
+ print(f"[{position:2d}/{len(runs)}] {run['name']:<28} {row.get('status'):<7} {figure}")
+ if row.get("status") == "skipped":
+ print("SKIP: CUDA is required")
+ return 0
+ time.sleep(args.settle_s)
+ return print_verdict(rows, out_dir, expected_pinned(args))
+
+
+def expected_pinned(args: argparse.Namespace) -> Dict[str, int]:
+ return {"in-order": args.expect_in_order_bytes, "packed": args.expect_packed_bytes}
+
+
+def print_verdict(rows: Sequence[Dict[str, Any]], out_dir: Path, expected: Dict[str, int]) -> int:
+ verdict = decide(rows, expected=expected)
+ (out_dir / "verdict.json").write_text(json.dumps(verdict, indent=1) + "\n", encoding="utf-8")
+ for label, key in (("RAM tier", "subject_differences"), ("control", "control_differences")):
+ shown = ", ".join(
+ f"seed {seed}: {'n/a' if value is None else format(value, '+.2%')}"
+ for seed, value in verdict[key].items()
+ )
+ print(f"{label:<9} {shown}")
+ print(f"VERDICT {verdict['verdict']}: {verdict['reason']}")
+ return 0
+
+
+def run_strict(args: argparse.Namespace) -> int:
+ out_dir = Path(args.out)
+ results = []
+ for mode in (SUBJECT, CONTROL):
+ for arm in ARMS:
+ run = {"name": f"seed{args.seed:02d}-{mode}-{arm}", "seed": args.seed, "mode": mode}
+ row = _spawn(args, {**run, "arm": arm}, strict=True)
+ results.append(row)
+ print(f"strict {run['name']:<24} {row.get('status')}")
+ if row.get("status") == "skipped":
+ print("SKIP: CUDA is required")
+ return 0
+ outcome = compare_strict(results)
+ # Equal digests mean something only if the RAM tier's two arms ran two different plans.
+ faults = arena_faults(results, expected_pinned(args))
+ summary = {
+ "faults": faults,
+ **{
+ mode: {
+ **outcome[mode],
+ "pinned_bytes": {
+ row["arm"]: row.get("pinned_bytes") for row in results if row["mode"] == mode
+ },
+ # One line per arm for the record; the per-step digests stay in the run files.
+ "sha256_of_digests": {
+ row["arm"]: hashlib.sha256(
+ "".join(d for step in row.get("digests") or [] for d in step).encode()
+ ).hexdigest()
+ for row in results
+ if row["mode"] == mode
+ },
+ }
+ for mode in outcome
+ },
+ }
+ (out_dir / "strict.json").write_text(json.dumps(summary, indent=1) + "\n", encoding="utf-8")
+ for mode, entry in outcome.items():
+ pinned = summary[mode]["pinned_bytes"]
+ print(f"STRICT {mode}: {'byte-identical' if entry['exact'] else 'DIFFERENT'} {pinned}")
+ for fault in faults:
+ print(f"FAULT {fault}")
+ return 0 if not faults and all(entry["exact"] for entry in outcome.values()) else 3
+
+
+def parse_args(argv: Optional[Sequence[str]] = None) -> argparse.Namespace:
+ parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
+ parser.add_argument(
+ "--mode", choices=("plan", "series", "strict", "verdict", "trial"), default="plan"
+ )
+ parser.add_argument("--weights", help="model id or checkpoint path")
+ parser.add_argument("--shards", default=None, help="shard cache dir (default: soup's own)")
+ parser.add_argument(
+ "--batches",
+ default=None,
+ help='JSON with a "train" list of token-id blocks; default: seeded random ids',
+ )
+ parser.add_argument("--out", default="arena-pack-gate", help="result folder (or file, trial)")
+ parser.add_argument("--tier", choices=(SUBJECT, CONTROL), default=SUBJECT)
+ parser.add_argument("--arm", choices=ARMS, default="packed")
+ parser.add_argument("--seed", type=int, default=3)
+ parser.add_argument("--input-seed", type=int, default=17)
+ parser.add_argument("--warmup", type=int, default=5)
+ parser.add_argument("--steps", type=int, default=10)
+ parser.add_argument("--seq", type=int, default=512)
+ parser.add_argument("--cap-bytes", type=int, default=ALLOCATOR_CAP_BYTES)
+ parser.add_argument("--settle-s", type=float, default=5.0, help="pause between runs")
+ parser.add_argument(
+ "--run-timeout-s",
+ type=float,
+ default=900.0,
+ help="a run with no result after this long is stopped and counted as failed",
+ )
+ parser.add_argument(
+ "--expect-in-order-bytes",
+ type=int,
+ default=EXPECTED_SUBJECT_PINNED["in-order"],
+ help="page-locked bytes the RAM tier must show in the in-order arm (Qwen3-8B NF4: 8 GiB)",
+ )
+ parser.add_argument(
+ "--expect-packed-bytes",
+ type=int,
+ default=EXPECTED_SUBJECT_PINNED["packed"],
+ help="page-locked bytes the RAM tier must show in the packed arm (Qwen3-8B NF4: 6 GiB)",
+ )
+ parser.add_argument("--strict", action="store_true", help="trial only: deterministic + digests")
+ args = parser.parse_args(argv)
+ if args.mode in ("series", "strict", "trial") and not args.weights:
+ parser.error(f"--mode {args.mode} needs --weights")
+ if args.steps < 1 or args.warmup < 0 or args.seq < 2:
+ parser.error("--steps must be >= 1, --warmup >= 0 and --seq >= 2")
+ return args
+
+
+def main(argv: Optional[Sequence[str]] = None) -> int:
+ args = parse_args(argv)
+ if args.mode == "trial":
+ return run_trial(args)
+ if args.mode == "series":
+ return run_series(args)
+ if args.mode == "strict":
+ return run_strict(args)
+ if args.mode == "verdict":
+ journal = Path(args.out) / "series.jsonl"
+ lines = journal.read_text(encoding="utf-8").splitlines()
+ rows = [json.loads(line) for line in lines if line]
+ return print_verdict(rows, Path(args.out), expected_pinned(args))
+ for position, run in enumerate(schedule(), start=1):
+ print(f"{position:2d} {run['name']}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/benchmarks/results/probe-rtx5070/issue1702/series.jsonl b/benchmarks/results/probe-rtx5070/issue1702/series.jsonl
new file mode 100644
index 00000000..3a51e808
--- /dev/null
+++ b/benchmarks/results/probe-rtx5070/issue1702/series.jsonl
@@ -0,0 +1,40 @@
+{"status": "ok", "name": "seed03-ram-0-in-order", "seed": 3, "mode": "ram", "arm": "in-order", "strict": false, "pid": 24636, "started_unix": 1791391236.9217775, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.380262400023639, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.007024600054137409, "build_s": 13.957683099899441, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.271390399895608, 0.996214900049381, 0.9541673000203446, 0.9333510999567807, 0.9249475999968126], "step_s": [0.959667699993588, 1.0557696999749169, 1.1921046000206843, 0.9511442000512034, 0.9741011000005528, 0.9505658000707626, 0.9844236000208184, 0.916351499967277, 0.9337965999729931, 0.9236200000159442], "losses": [2.699490547180176, 3.20009446144104, 3.1049201488494873, 2.9974663257598877, 3.0227863788604736, 2.7401669025421143, 3.113218069076538, 2.8091278076171875, 2.43411922454834, 2.2289910316467285, 2.798285961151123, 2.439479351043701, 2.278092384338379, 2.888902425765991, 2.4676220417022705], "median_step_s": 0.9554059500223957, "tok_per_s": 520.2435292428718, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832281600, "total_wall_s": 45.64218510000501, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791391236.8543167, "ram_used_percent": 61.1, "ram_available_bytes": 13245984768, "commit_percent": 54.74320778820292, "on_ac_power": true}, "box_after": {"unix": 1791391285.1971478, "ram_used_percent": 55.9, "ram_available_bytes": 15037677568, "commit_percent": 54.911489197000606, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-ram-1-packed", "seed": 3, "mode": "ram", "arm": "packed", "strict": false, "pid": 27808, "started_unix": 1791391290.299909, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.971695699961856, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.012572200037539005, "build_s": 13.893821600009687, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.773786999983713, 1.0491575999185443, 1.0349392999196425, 1.0707367999712005, 0.9604935999959707], "step_s": [0.9059617000166327, 0.9279220000607893, 1.2332733999937773, 1.082658400060609, 1.013258200022392, 1.1323210999835283, 1.0630437000654638, 1.090725899906829, 1.0454276000382379, 0.970054000033997], "losses": [2.699490547180176, 3.1989223957061768, 3.1035361289978027, 2.998501777648926, 3.021235466003418, 2.7376697063446045, 3.1130428314208984, 2.8080997467041016, 2.4360761642456055, 2.226008653640747, 2.7955994606018066, 2.439516305923462, 2.279207229614258, 2.8905484676361084, 2.466057300567627], "median_step_s": 1.0542356500518508, "tok_per_s": 489.2664309820732, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8775217152, "total_wall_s": 50.89391600003, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791391290.2015977, "ram_used_percent": 56.0, "ram_available_bytes": 14984880128, "commit_percent": 55.14481440294124, "on_ac_power": true}, "box_after": {"unix": 1791391344.0787766, "ram_used_percent": 55.6, "ram_available_bytes": 15121559552, "commit_percent": 54.72591298346275, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-ram-2-packed", "seed": 3, "mode": "ram", "arm": "packed", "strict": false, "pid": 30428, "started_unix": 1791391349.3267608, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 10.187794699915685, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.009942300035618246, "build_s": 6.557489800034091, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.543325599981472, 0.9601642999332398, 0.9477534999605268, 0.9598425999283791, 0.9424880999140441], "step_s": [0.9433039999566972, 0.9380486999871209, 1.1542974000331014, 0.9494449000339955, 0.9264935000101104, 0.9041962999617681, 0.9332798999967054, 0.9067430999130011, 0.9604454000946134, 1.0048049999168143], "losses": [2.699490547180176, 3.1997275352478027, 3.1001760959625244, 2.995988368988037, 3.0243451595306396, 2.7438859939575195, 3.117678642272949, 2.8090322017669678, 2.437654733657837, 2.227640390396118, 2.795269727706909, 2.435903787612915, 2.2822113037109375, 2.886929988861084, 2.46940016746521], "median_step_s": 0.9406763499719091, "tok_per_s": 532.16599397051, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8687755264, "total_wall_s": 43.05294339999091, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791391349.0861468, "ram_used_percent": 55.4, "ram_available_bytes": 15180935168, "commit_percent": 54.58781006753984, "on_ac_power": true}, "box_after": {"unix": 1791391395.0893474, "ram_used_percent": 55.2, "ram_available_bytes": 15249108992, "commit_percent": 54.39008311054729, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-ram-3-in-order", "seed": 3, "mode": "ram", "arm": "in-order", "strict": false, "pid": 39060, "started_unix": 1791391400.2091968, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.794379500090145, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006175199989229441, "build_s": 11.86417379998602, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.445580499945208, 0.9495788000058383, 0.9305182999232784, 0.9205342000350356, 0.9440269999904558], "step_s": [0.9460232999408618, 0.9435463000554591, 1.179109700024128, 0.934837399981916, 0.9436761999968439, 0.9345171999884769, 0.9484401999507099, 0.9540384000865743, 0.939472800004296, 0.9437562000239268], "losses": [2.699490547180176, 3.200275182723999, 3.1021416187286377, 2.9995734691619873, 3.0243217945098877, 2.7380614280700684, 3.1163341999053955, 2.810027599334717, 2.4358255863189697, 2.230788469314575, 2.7929887771606445, 2.4365344047546387, 2.2804980278015137, 2.8899333477020264, 2.468366861343384], "median_step_s": 0.9437162000103854, "tok_per_s": 529.6140250536426, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832650240, "total_wall_s": 46.62721509998664, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791391400.1106286, "ram_used_percent": 54.9, "ram_available_bytes": 15350427648, "commit_percent": 54.16239283709975, "on_ac_power": true}, "box_after": {"unix": 1791391449.850137, "ram_used_percent": 53.7, "ram_available_bytes": 15783550976, "commit_percent": 53.97847751655211, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-disk-0-in-order", "seed": 3, "mode": "disk", "arm": "in-order", "strict": false, "pid": 32648, "started_unix": 1791391454.9686997, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.67071480001323, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.013887800043448806, "build_s": 2.613033999921754, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.302977800020017, 2.0184343000873923, 1.8940992000279948, 1.9240463000023738, 2.0826684000203386], "step_s": [2.087844700086862, 1.970941299921833, 2.1905779999215156, 1.9668432000325993, 2.005567399901338, 2.00342930003535, 2.061667799949646, 1.9937620999990031, 1.9441570000490174, 2.1016674999846146], "losses": [2.699490547180176, 3.1966230869293213, 3.1024413108825684, 2.9967286586761475, 3.022564172744751, 2.742462158203125, 3.116014003753662, 2.806671142578125, 2.434450387954712, 2.2245051860809326, 2.7950403690338135, 2.436337947845459, 2.2802932262420654, 2.8887062072753906, 2.4675774574279785], "median_step_s": 2.004498349968344, "tok_per_s": 251.88844630300295, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6202462208, "total_wall_s": 54.99765200004913, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791391454.8747823, "ram_used_percent": 53.7, "ram_available_bytes": 15780085760, "commit_percent": 53.99861668459131, "on_ac_power": true}, "box_after": {"unix": 1791391512.3333135, "ram_used_percent": 53.7, "ram_available_bytes": 15773949952, "commit_percent": 53.95527208453098, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-disk-1-packed", "seed": 3, "mode": "disk", "arm": "packed", "strict": false, "pid": 28360, "started_unix": 1791391517.4040847, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.294008300057612, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006096199969761074, "build_s": 1.5970184999750927, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.021885000052862, 1.7497302999254316, 1.7549707000143826, 1.775055899983272, 1.8809762001037598], "step_s": [1.7517166000325233, 2.0198823999380693, 1.8002826999872923, 1.9835754999658093, 1.994653300032951, 2.099240900017321, 2.0285768000176176, 1.936654799967073, 1.9888278999133036, 2.0543976000044495], "losses": [2.699490547180176, 3.1983449459075928, 3.099494695663452, 2.9939863681793213, 3.021946907043457, 2.7402076721191406, 3.1155471801757812, 2.8061835765838623, 2.436840772628784, 2.2267708778381348, 2.7957990169525146, 2.438366174697876, 2.2735769748687744, 2.8894741535186768, 2.464353084564209], "median_step_s": 1.9917405999731272, "tok_per_s": 260.45629654150866, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124240896, "total_wall_s": 47.6006716999691, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791391517.3353472, "ram_used_percent": 54.2, "ram_available_bytes": 15597486080, "commit_percent": 54.14802981107914, "on_ac_power": true}, "box_after": {"unix": 1791391566.867737, "ram_used_percent": 54.0, "ram_available_bytes": 15666671616, "commit_percent": 53.965445894628914, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-disk-2-packed", "seed": 3, "mode": "disk", "arm": "packed", "strict": false, "pid": 48336, "started_unix": 1791391571.9436426, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.348736200015992, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006090800045058131, "build_s": 1.5345567000331357, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.570676599978469, 1.9143157999496907, 2.018109699944034, 2.00751330005005, 2.0398514000698924], "step_s": [1.8018484000349417, 1.802163299988024, 2.0376246999949217, 1.794908900046721, 1.8240236000856385, 1.9526153999613598, 2.0417480000760406, 2.0417435000417754, 1.935046499944292, 2.094547599903308], "losses": [2.699490547180176, 3.1982674598693848, 3.1041383743286133, 2.996710777282715, 3.023146629333496, 2.7440357208251953, 3.1153836250305176, 2.8107340335845947, 2.4364140033721924, 2.227733612060547, 2.796837329864502, 2.437790870666504, 2.2776036262512207, 2.890249013900757, 2.4660613536834717], "median_step_s": 1.943830949952826, "tok_per_s": 264.9243763267321, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124531712, "total_wall_s": 48.58823830005713, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791391571.870649, "ram_used_percent": 53.9, "ram_available_bytes": 15692333056, "commit_percent": 53.86253104760388, "on_ac_power": true}, "box_after": {"unix": 1791391622.706839, "ram_used_percent": 52.8, "ram_available_bytes": 16076169216, "commit_percent": 54.07661141250006, "on_ac_power": true}}
+{"status": "ok", "name": "seed03-disk-3-in-order", "seed": 3, "mode": "disk", "arm": "in-order", "strict": false, "pid": 17292, "started_unix": 1791391627.7820942, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.3366229000967, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006607199902646244, "build_s": 1.555597300059162, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.1043121999828145, 2.0671100000618026, 2.03829619998578, 1.8528850000584498, 2.071507400018163], "step_s": [1.9466897000093013, 2.030102699995041, 2.2735534999519587, 1.8882819000864401, 1.9981219000183046, 1.7824684999650344, 1.8349135000025854, 1.9998268999624997, 1.9831937999697402, 2.102829199982807], "losses": [2.699490547180176, 3.195124626159668, 3.1000795364379883, 2.997715473175049, 3.0250604152679443, 2.7418317794799805, 3.1150171756744385, 2.8070507049560547, 2.43627667427063, 2.2258946895599365, 2.797285795211792, 2.4373271465301514, 2.281562089920044, 2.888153553009033, 2.4679794311523438], "median_step_s": 1.9906578499940224, "tok_per_s": 258.06475546401344, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6125416448, "total_wall_s": 48.76494800008368, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791391627.7100358, "ram_used_percent": 52.9, "ram_available_bytes": 16036241408, "commit_percent": 54.101955160192794, "on_ac_power": true}, "box_after": {"unix": 1791391678.6558506, "ram_used_percent": 53.6, "ram_available_bytes": 15811493888, "commit_percent": 53.98561868398371, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-disk-0-packed", "seed": 17, "mode": "disk", "arm": "packed", "strict": false, "pid": 16688, "started_unix": 1791391683.731037, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.352646799990907, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0073241000063717365, "build_s": 1.5098154000006616, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.091652699979022, 2.0590971999336034, 1.9810656000627205, 2.117697900044732, 1.9632294999901205], "step_s": [2.0168810999020934, 1.961818699957803, 2.1841031000949442, 1.9573719999752939, 1.9429726999951527, 1.9624161999672651, 1.9424150000559166, 1.8540175999514759, 1.9155943000223488, 2.009542700019665], "losses": [2.699490547180176, 3.1976568698883057, 3.099860191345215, 2.9978299140930176, 3.0240724086761475, 2.7398910522460938, 3.1160690784454346, 2.8068957328796387, 2.434882164001465, 2.227246046066284, 2.794210433959961, 2.434471607208252, 2.2787961959838867, 2.887113332748413, 2.4667036533355713], "median_step_s": 1.9595953499665484, "tok_per_s": 259.2781390748618, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6123896832, "total_wall_s": 48.57233830005862, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791391683.6582692, "ram_used_percent": 53.6, "ram_available_bytes": 15804051456, "commit_percent": 54.05940402318042, "on_ac_power": true}, "box_after": {"unix": 1791391734.4002311, "ram_used_percent": 53.6, "ram_available_bytes": 15813554176, "commit_percent": 53.94082164308983, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-disk-1-in-order", "seed": 17, "mode": "disk", "arm": "in-order", "strict": false, "pid": 35712, "started_unix": 1791391739.4775124, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.79455120000057, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.007006899919360876, "build_s": 1.5469383000163361, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.19613269995898, 1.9466331000439823, 1.9485998000018299, 1.9697407999774441, 1.9451112999813631], "step_s": [1.9463708000257611, 1.9897173999343067, 2.226269599981606, 2.0157820000313222, 1.9474619999527931, 1.9424601000500843, 1.9312023000093177, 1.923062999965623, 1.9389275000430644, 1.7896205999422818], "losses": [2.699490547180176, 3.2003674507141113, 3.100822687149048, 2.994769811630249, 3.026313066482544, 2.741440534591675, 3.115062952041626, 2.8085052967071533, 2.4332053661346436, 2.2263712882995605, 2.7981367111206055, 2.4327478408813477, 2.2793633937835693, 2.8871660232543945, 2.466298818588257], "median_step_s": 1.9444154500379227, "tok_per_s": 260.5481904420122, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124482560, "total_wall_s": 48.888426999910735, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791391739.4040806, "ram_used_percent": 54.0, "ram_available_bytes": 15669817344, "commit_percent": 54.31908834054466, "on_ac_power": true}, "box_after": {"unix": 1791391790.075881, "ram_used_percent": 53.1, "ram_available_bytes": 15995518976, "commit_percent": 54.01254935777235, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-disk-2-in-order", "seed": 17, "mode": "disk", "arm": "in-order", "strict": false, "pid": 27672, "started_unix": 1791391795.1516428, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.347490299958736, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006585100083611906, "build_s": 1.5703673000680283, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.112583699985407, 1.9411751999286935, 1.9723395999753848, 2.0258439000463113, 2.065262999967672], "step_s": [1.944276100024581, 2.2098759999498725, 1.9788056999677792, 1.9845299000153318, 1.9890672999899834, 1.9206439999397844, 1.9750050000147894, 1.9190438999794424, 1.9313810000894591, 1.8782040999503806], "losses": [2.699490547180176, 3.197953224182129, 3.103311538696289, 2.99550461769104, 3.024949312210083, 2.7407140731811523, 3.114315986633301, 2.8052423000335693, 2.4331841468811035, 2.224565029144287, 2.7966959476470947, 2.4348511695861816, 2.2746200561523438, 2.8887135982513428, 2.4666576385498047], "median_step_s": 1.9596405500196852, "tok_per_s": 259.4923387178025, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6125072384, "total_wall_s": 48.565656399936415, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791391795.0784247, "ram_used_percent": 52.8, "ram_available_bytes": 16087261184, "commit_percent": 53.96292429595957, "on_ac_power": true}, "box_after": {"unix": 1791391845.7186444, "ram_used_percent": 52.1, "ram_available_bytes": 16333344768, "commit_percent": 53.95027595703411, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-disk-3-packed", "seed": 17, "mode": "disk", "arm": "packed", "strict": false, "pid": 40196, "started_unix": 1791391850.795598, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.179387000040151, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.011157199973240495, "build_s": 1.5985389000270516, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [6.935798899969086, 3.3174194999737665, 2.2630792000563815, 2.133041499997489, 1.975461499998346], "step_s": [1.9901439000386745, 1.9529011000413448, 2.2300543999299407, 1.9728346000192687, 1.98559319996275, 1.9827332000713795, 1.8787548000691459, 1.9030773000558838, 1.9513605000684038, 1.9404435999458656], "losses": [2.699490547180176, 3.198047637939453, 3.1032063961029053, 2.9940099716186523, 3.022916793823242, 2.7383787631988525, 3.114365816116333, 2.8065741062164307, 2.4360547065734863, 2.226107120513916, 2.793923854827881, 2.4364781379699707, 2.2821590900421143, 2.8891921043395996, 2.4678151607513428], "median_step_s": 1.9628678500303067, "tok_per_s": 258.7440243622237, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124281856, "total_wall_s": 51.638488800032064, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791391850.7236183, "ram_used_percent": 52.1, "ram_available_bytes": 16308187136, "commit_percent": 54.01513147480977, "on_ac_power": true}, "box_after": {"unix": 1791391904.5100582, "ram_used_percent": 52.3, "ram_available_bytes": 16246771712, "commit_percent": 54.09057770699669, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-ram-0-packed", "seed": 17, "mode": "ram", "arm": "packed", "strict": false, "pid": 33672, "started_unix": 1791391909.5841331, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.092027900042012, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0059807999059557915, "build_s": 12.439434400061145, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [2.9170143000083044, 0.9018058999208733, 0.9004176999442279, 0.8927010999759659, 0.8997309000696987], "step_s": [0.8909496000269428, 0.9256754000671208, 1.1338565000332892, 0.8946466000052169, 0.8933783000102267, 0.9117961999727413, 0.8917513999622315, 0.8999922000803053, 0.8864842000184581, 0.8893760000355542], "losses": [2.699490547180176, 3.199337959289551, 3.1037580966949463, 2.9969141483306885, 3.0247530937194824, 2.7313613891601562, 3.1171579360961914, 2.8066582679748535, 2.4357855319976807, 2.2259504795074463, 2.7952990531921387, 2.433875560760498, 2.2850186824798584, 2.8884105682373047, 2.4680209159851074], "median_step_s": 0.8940124500077218, "tok_per_s": 555.4406583996338, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8686243840, "total_wall_s": 41.03103910002392, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791391909.513689, "ram_used_percent": 52.6, "ram_available_bytes": 16154849280, "commit_percent": 54.510333107891206, "on_ac_power": true}, "box_after": {"unix": 1791391952.6709473, "ram_used_percent": 52.0, "ram_available_bytes": 16348278784, "commit_percent": 54.062900640001914, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-ram-1-in-order", "seed": 17, "mode": "ram", "arm": "in-order", "strict": false, "pid": 31552, "started_unix": 1791391957.7441843, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.558359800023027, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0065796999260783195, "build_s": 10.163835000013933, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.076374299940653, 0.9213986000977457, 0.9205252000829205, 0.9239545000018552, 0.9111129000084475], "step_s": [0.9135340000502765, 0.9071212999988347, 1.1747454000869766, 0.905062299920246, 0.9051321001024917, 0.9281819000607356, 0.9277475000126287, 0.9239775999449193, 0.9233034999342635, 0.9084003000753], "losses": [2.699490547180176, 3.1975510120391846, 3.0997326374053955, 2.9994089603424072, 3.0231058597564697, 2.7416329383850098, 3.1194164752960205, 2.8054661750793457, 2.4335598945617676, 2.2258036136627197, 2.7937400341033936, 2.4339892864227295, 2.2772998809814453, 2.8898656368255615, 2.4647350311279297], "median_step_s": 0.91841874999227, "tok_per_s": 543.6856806856595, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832093184, "total_wall_s": 42.812963900039904, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791391957.6739416, "ram_used_percent": 52.0, "ram_available_bytes": 16349536256, "commit_percent": 54.10532401601504, "on_ac_power": true}, "box_after": {"unix": 1791392003.2650971, "ram_used_percent": 51.7, "ram_available_bytes": 16463831040, "commit_percent": 53.914428910350644, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-ram-2-in-order", "seed": 17, "mode": "ram", "arm": "in-order", "strict": false, "pid": 34728, "started_unix": 1791392008.3908966, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 10.217018599971198, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.013746599899604917, "build_s": 10.243043299997225, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.9495137000922114, 0.9649938000366092, 0.935315000009723, 0.915375400101766, 0.9326274999184534], "step_s": [0.9144838999491185, 0.916418100008741, 1.1748901000246406, 0.8956176000647247, 0.9307443000143394, 0.9358980000251904, 0.9226610000478104, 0.8981977000366896, 0.9356057000113651, 0.9364243000745773], "losses": [2.699490547180176, 3.197079658508301, 3.100200891494751, 2.9972078800201416, 3.023120164871216, 2.7389426231384277, 3.11574125289917, 2.8057055473327637, 2.43658709526062, 2.22822904586792, 2.7973504066467285, 2.435711145401001, 2.2809791564941406, 2.886957883834839, 2.4672789573669434], "median_step_s": 0.9267026500310749, "tok_per_s": 541.1724015837888, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10948096000, "total_wall_s": 47.166181799955666, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791392008.2870133, "ram_used_percent": 51.5, "ram_available_bytes": 16531410944, "commit_percent": 53.74234829289115, "on_ac_power": true}, "box_after": {"unix": 1791392057.8462727, "ram_used_percent": 53.7, "ram_available_bytes": 15760674816, "commit_percent": 54.27575718901056, "on_ac_power": true}}
+{"status": "ok", "name": "seed17-ram-3-packed", "seed": 17, "mode": "ram", "arm": "packed", "strict": false, "pid": 19616, "started_unix": 1791392062.958358, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.780741999973543, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.012321599991992116, "build_s": 9.140762700000778, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [2.762603700044565, 0.8802569999825209, 0.877336599980481, 0.8801614000694826, 0.8784511000849307], "step_s": [0.8765054000541568, 0.8748003999935463, 0.9395450999727473, 0.8817662000656128, 0.8786772999446839, 0.8748922999948263, 0.869369599968195, 0.8685457999818027, 0.8744398000417277, 0.8744717000517994], "losses": [2.699490547180176, 3.193402051925659, 3.1020922660827637, 2.9971320629119873, 3.022153377532959, 2.7423925399780273, 3.115795135498047, 2.8071374893188477, 2.4348394870758057, 2.228060483932495, 2.7944579124450684, 2.436889886856079, 2.2774674892425537, 2.8878061771392822, 2.4633543491363525], "median_step_s": 0.8748463499941863, "tok_per_s": 580.9590490090537, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8685494272, "total_wall_s": 43.22444209991954, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791392062.8529084, "ram_used_percent": 58.1, "ram_available_bytes": 14272880640, "commit_percent": 56.76040603252472, "on_ac_power": true}, "box_after": {"unix": 1791392107.6808872, "ram_used_percent": 56.3, "ram_available_bytes": 14888681472, "commit_percent": 55.30842917313485, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-ram-0-in-order", "seed": 29, "mode": "ram", "arm": "in-order", "strict": false, "pid": 31100, "started_unix": 1791392112.772068, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 7.6221888000145555, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.006790699902921915, "build_s": 7.964124900056049, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [2.620689900009893, 0.8847883000271395, 0.8897932999534532, 0.8933038000250235, 0.8930944000603631], "step_s": [0.8905453999759629, 0.8906367999734357, 0.9580297999782488, 0.8875855000223964, 0.893292999942787, 0.9027461999794468, 0.936701999977231, 0.909815700026229, 0.8941432000137866, 0.9063643999397755], "losses": [2.699490547180176, 3.1987602710723877, 3.104763984680176, 2.9975175857543945, 3.0237538814544678, 2.7427496910095215, 3.122096061706543, 2.810715436935425, 2.4427483081817627, 2.22961688041687, 2.797370433807373, 2.4376027584075928, 2.283754348754883, 2.8879568576812744, 2.4684791564941406], "median_step_s": 0.8984446999966167, "tok_per_s": 564.5069351767823, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832515072, "total_wall_s": 35.72885850002058, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791392112.685761, "ram_used_percent": 56.2, "ram_available_bytes": 14912024576, "commit_percent": 55.22745559666471, "on_ac_power": true}, "box_after": {"unix": 1791392150.9309664, "ram_used_percent": 55.5, "ram_available_bytes": 15161221120, "commit_percent": 54.00176363973066, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-ram-1-packed", "seed": 29, "mode": "ram", "arm": "packed", "strict": false, "pid": 21972, "started_unix": 1791392156.0286689, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.983877699938603, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.009754700004123151, "build_s": 7.827031800057739, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.0132735000224784, 1.014298800029792, 0.9919040999375284, 1.0131285999668762, 1.0069804000668228], "step_s": [0.9553436000132933, 0.9760264999931678, 1.1816961999284104, 0.9257871001027524, 0.9241352999815717, 0.9020747999893501, 0.9527231999672949, 0.9178705000085756, 0.9739235999295488, 0.9470890000229701], "losses": [2.699490547180176, 3.1975040435791016, 3.104811191558838, 2.9951202869415283, 3.0261001586914062, 2.7450859546661377, 3.1222591400146484, 2.812887668609619, 2.440331220626831, 2.2281951904296875, 2.7966299057006836, 2.4381871223449707, 2.276721954345703, 2.891871929168701, 2.4644739627838135], "median_step_s": 0.9499060999951325, "tok_per_s": 530.2034869239743, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8686120960, "total_wall_s": 44.19327950000297, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791392155.9351635, "ram_used_percent": 55.2, "ram_available_bytes": 15264403456, "commit_percent": 53.879529984766855, "on_ac_power": true}, "box_after": {"unix": 1791392202.6046963, "ram_used_percent": 55.7, "ram_available_bytes": 15097937920, "commit_percent": 54.07388136167404, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-ram-2-packed", "seed": 29, "mode": "ram", "arm": "packed", "strict": false, "pid": 45988, "started_unix": 1791392207.7137382, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.166930299950764, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.010451899957843125, "build_s": 5.886373699991964, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.2625964999897406, 0.9349571999628097, 0.9134690999053419, 0.9411682999925688, 0.920230400050059], "step_s": [0.9291679000016302, 0.9189428000245243, 1.1982311999890953, 0.9303335000295192, 0.9083606000058353, 0.9028819999657571, 0.9213373999809846, 0.9141853000037372, 0.9106339999707416, 0.9226501000812277], "losses": [2.699490547180176, 3.197474718093872, 3.0989902019500732, 2.9980316162109375, 3.0244863033294678, 2.7457826137542725, 3.119868755340576, 2.8101110458374023, 2.4412829875946045, 2.230424404144287, 2.7976999282836914, 2.4388957023620605, 2.2767300605773926, 2.8879599571228027, 2.4655001163482666], "median_step_s": 0.9201401000027545, "tok_per_s": 541.4136615217222, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8684781568, "total_wall_s": 41.15160899993498, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791392207.6096938, "ram_used_percent": 55.5, "ram_available_bytes": 15164526592, "commit_percent": 53.89527148472671, "on_ac_power": true}, "box_after": {"unix": 1791392251.4985902, "ram_used_percent": 55.4, "ram_available_bytes": 15184846848, "commit_percent": 53.92528187102352, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-ram-3-in-order", "seed": 29, "mode": "ram", "arm": "in-order", "strict": false, "pid": 16572, "started_unix": 1791392256.605945, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.893739799968898, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.003888100036419928, "build_s": 9.134064899990335, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.171328999917023, 0.9903592000482604, 0.9701635000528768, 0.9632611999986693, 0.9489827000070363], "step_s": [0.965878100018017, 0.9702409999445081, 1.26423580001574, 0.9365356999915093, 0.9702283999649808, 0.952040100004524, 0.9342985000694171, 0.9429690999677405, 0.9216180000221357, 0.9415132999420166], "losses": [2.699490547180176, 3.1943812370300293, 3.102614164352417, 2.9972972869873047, 3.0234975814819336, 2.7441508769989014, 3.123157262802124, 2.8117499351501465, 2.438659906387329, 2.228123903274536, 2.7997047901153564, 2.437985420227051, 2.280569076538086, 2.889247417449951, 2.4658403396606445], "median_step_s": 0.9475045999861322, "tok_per_s": 522.4725441730168, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832224256, "total_wall_s": 39.84114859998226, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791392256.5237033, "ram_used_percent": 55.8, "ram_available_bytes": 15054942208, "commit_percent": 54.16750327706963, "on_ac_power": true}, "box_after": {"unix": 1791392299.4050715, "ram_used_percent": 55.7, "ram_available_bytes": 15093325824, "commit_percent": 54.29327389443364, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-disk-0-in-order", "seed": 29, "mode": "disk", "arm": "in-order", "strict": false, "pid": 41132, "started_unix": 1791392304.5066435, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 10.156925500021316, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.01252410002052784, "build_s": 1.8355938999447972, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.84657850000076, 1.9909299000864848, 1.7503091999096796, 1.6237396000651643, 1.6594021000200883], "step_s": [1.6262712000170723, 1.7480867999838665, 1.644640399958007, 1.6486501999897882, 1.6046982000116259, 1.6135056000202894, 1.612930899951607, 1.6246315999887884, 1.607783899991773, 1.6088449999224395], "losses": [2.699490547180176, 3.197244644165039, 3.1029422283172607, 2.9980359077453613, 3.0228383541107178, 2.744014024734497, 3.1202991008758545, 2.8087384700775146, 2.4429233074188232, 2.2280569076538086, 2.7967426776885986, 2.4353697299957275, 2.278024196624756, 2.8895070552825928, 2.4647984504699707], "median_step_s": 1.619068600004539, "tok_per_s": 313.34065334951066, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6123696128, "total_wall_s": 50.61257330002263, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791392304.4132423, "ram_used_percent": 55.6, "ram_available_bytes": 15113039872, "commit_percent": 54.34289895624643, "on_ac_power": true}, "box_after": {"unix": 1791392356.2632558, "ram_used_percent": 56.8, "ram_available_bytes": 14702374912, "commit_percent": 54.99962411369169, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-disk-1-packed", "seed": 29, "mode": "disk", "arm": "packed", "strict": false, "pid": 41148, "started_unix": 1791392361.3361914, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.9781925000716, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0035567000741139054, "build_s": 1.3166035999311134, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.1616169000044465, 1.640186999924481, 1.77173459995538, 1.627083000028506, 1.6224569999612868], "step_s": [1.619560100021772, 1.7949379000347108, 1.6935056999791414, 1.6247315000509843, 1.610737800016068, 1.6283472999930382, 1.6413317000260577, 1.6294778999872506, 1.6184265000047162, 1.6132816999452189], "losses": [2.699490547180176, 3.197514057159424, 3.1028859615325928, 2.994426727294922, 3.0267741680145264, 2.7455737590789795, 3.1229164600372314, 2.809999465942383, 2.436662197113037, 2.231046676635742, 2.7980058193206787, 2.4388792514801025, 2.2823548316955566, 2.889352321624756, 2.4696009159088135], "median_step_s": 1.6265394000220113, "tok_per_s": 310.78638600853265, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6126682112, "total_wall_s": 38.334001400042325, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791392361.2644045, "ram_used_percent": 56.9, "ram_available_bytes": 14684127232, "commit_percent": 55.086360383654174, "on_ac_power": true}, "box_after": {"unix": 1791392400.838904, "ram_used_percent": 54.4, "ram_available_bytes": 15531343872, "commit_percent": 54.58559106071082, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-disk-2-packed", "seed": 29, "mode": "disk", "arm": "packed", "strict": false, "pid": 35832, "started_unix": 1791392405.9126155, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.970710599911399, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0036452000495046377, "build_s": 1.3355531000997871, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.3886744999326766, 1.61788640008308, 1.7460065999766812, 1.6180902000050992, 1.629084900021553], "step_s": [1.627396299969405, 1.623149499995634, 1.7669528999831527, 1.6222804000135511, 1.6100766999879852, 1.6195600000210106, 1.6192784999730065, 1.6438122999388725, 1.6182467000326142, 1.6174625999992713], "losses": [2.699490547180176, 3.2021541595458984, 3.103294849395752, 2.9945974349975586, 3.0224640369415283, 2.7459254264831543, 3.120105743408203, 2.8115077018737793, 2.440463066101074, 2.2301104068756104, 2.797935962677002, 2.440136194229126, 2.2836291790008545, 2.8902053833007812, 2.466501235961914], "median_step_s": 1.6209202000172809, "tok_per_s": 312.8013481314566, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6123855872, "total_wall_s": 38.420252199983224, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791392405.8404443, "ram_used_percent": 54.6, "ram_available_bytes": 15479193600, "commit_percent": 54.53796982930727, "on_ac_power": true}, "box_after": {"unix": 1791392445.5067885, "ram_used_percent": 54.5, "ram_available_bytes": 15485624320, "commit_percent": 54.49876737532779, "on_ac_power": true}}
+{"status": "ok", "name": "seed29-disk-3-in-order", "seed": 29, "mode": "disk", "arm": "in-order", "strict": false, "pid": 48576, "started_unix": 1791392450.5817852, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 7.930224100011401, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.00700360001064837, "build_s": 1.6008324000285938, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.28289109992329, 1.894439100055024, 1.8837387999519706, 1.8995055999839678, 1.9412624000106007], "step_s": [2.051095200004056, 2.275855000014417, 2.0545063000172377, 1.9434247999452055, 1.9419206999009475, 2.0310972000006586, 1.8908156999386847, 1.9573627000208944, 2.0248223999515176, 1.8934127000393346], "losses": [2.699490547180176, 3.196938991546631, 3.1026813983917236, 2.9984545707702637, 3.023667097091675, 2.747117757797241, 3.120258092880249, 2.810575485229492, 2.443493604660034, 2.229480028152466, 2.795121431350708, 2.436339855194092, 2.280247926712036, 2.891576051712036, 2.466708183288574], "median_step_s": 1.991092549986206, "tok_per_s": 255.17943607620444, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6123827200, "total_wall_s": 48.44214339996688, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791392450.5089548, "ram_used_percent": 54.9, "ram_available_bytes": 15350022144, "commit_percent": 54.65324387194367, "on_ac_power": true}, "box_after": {"unix": 1791392500.9089816, "ram_used_percent": 56.0, "ram_available_bytes": 15003246592, "commit_percent": 54.11738061978609, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-disk-0-packed", "seed": 43, "mode": "disk", "arm": "packed", "strict": false, "pid": 29380, "started_unix": 1791392505.9972498, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.60247739998158, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.007018800009973347, "build_s": 1.6264755999436602, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.964629100053571, 1.9537680000066757, 2.0011825999245048, 1.7941663999808952, 1.8891150000272319], "step_s": [1.764229299966246, 1.9176266000140458, 2.1914010000182316, 1.8508672000607476, 1.8453893000259995, 2.0309923999011517, 2.0448283000150695, 2.0108984999824315, 1.8139592000516132, 1.7297145000193268], "losses": [2.699490547180176, 3.1950228214263916, 3.102966547012329, 2.9953198432922363, 3.02313494682312, 2.742197036743164, 3.116103172302246, 2.8098020553588867, 2.440145492553711, 2.2281060218811035, 2.793902635574341, 2.438633680343628, 2.282290458679199, 2.8907008171081543, 2.4679272174835205], "median_step_s": 1.8842469000373967, "tok_per_s": 266.6679680611446, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124572672, "total_wall_s": 48.07404219999444, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791392505.9122384, "ram_used_percent": 55.3, "ram_available_bytes": 15232110592, "commit_percent": 53.80025764686564, "on_ac_power": true}, "box_after": {"unix": 1791392555.556587, "ram_used_percent": 56.7, "ram_available_bytes": 14759866368, "commit_percent": 55.22970822480933, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-disk-1-in-order", "seed": 43, "mode": "disk", "arm": "in-order", "strict": false, "pid": 8884, "started_unix": 1791392560.6383843, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.556991599965841, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0065113999880850315, "build_s": 1.5734082999406382, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.9018971000332385, 1.7744712000712752, 2.161252800025977, 1.9168017000192776, 1.9358530000317842], "step_s": [1.9534021000145003, 2.1638397000497207, 1.9804033000255004, 2.0401093000546098, 1.8871036999626085, 1.947476499946788, 1.9553701999830082, 2.5676779999630526, 2.1019547999603674, 2.0744145000353456], "losses": [2.699490547180176, 3.1957149505615234, 3.0986669063568115, 2.9949944019317627, 3.0210318565368652, 2.740791082382202, 3.1136486530303955, 2.807612895965576, 2.4375226497650146, 2.226978063583374, 2.796501874923706, 2.4340600967407227, 2.2804319858551025, 2.8893680572509766, 2.4650559425354004], "median_step_s": 2.010256300040055, "tok_per_s": 247.6809887828093, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6123421696, "total_wall_s": 47.53414239990525, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791392560.559489, "ram_used_percent": 59.3, "ram_available_bytes": 13869207552, "commit_percent": 56.261378293728995, "on_ac_power": true}, "box_after": {"unix": 1791392610.268932, "ram_used_percent": 55.7, "ram_available_bytes": 15094882304, "commit_percent": 54.31052162933199, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-disk-2-in-order", "seed": 43, "mode": "disk", "arm": "in-order", "strict": false, "pid": 8344, "started_unix": 1791392615.342863, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.59893059998285, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0035864999517798424, "build_s": 1.3215638999827206, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.2594130999641493, 1.647985199932009, 1.6193154000211507, 1.8920174000086263, 1.765861300053075], "step_s": [1.6193721999879926, 1.7591048999456689, 1.7015503000002354, 1.712108200066723, 1.8474427999462932, 1.908907699980773, 1.8990770999807864, 1.9159530999604613, 1.877536699990742, 1.8811472000088543], "losses": [2.699490547180176, 3.1936593055725098, 3.1000561714172363, 2.9966180324554443, 3.0242865085601807, 2.7427663803100586, 3.1165363788604736, 2.8064558506011963, 2.435298442840576, 2.227041482925415, 2.7997655868530273, 2.434710741043091, 2.2807304859161377, 2.89302921295166, 2.4659366607666016], "median_step_s": 1.8624897499685176, "tok_per_s": 282.5264009630102, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124916736, "total_wall_s": 43.72557639994193, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791392615.2728996, "ram_used_percent": 55.8, "ram_available_bytes": 15055917056, "commit_percent": 54.18245131398153, "on_ac_power": true}, "box_after": {"unix": 1791392660.8365343, "ram_used_percent": 56.4, "ram_available_bytes": 14847512576, "commit_percent": 54.8808198329182, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-disk-3-packed", "seed": 43, "mode": "disk", "arm": "packed", "strict": false, "pid": 47312, "started_unix": 1791392665.939821, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.810314700007439, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.00892690010368824, "build_s": 1.7858882000437006, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.423246199963614, 2.0185092999599874, 1.8157989999745041, 1.8218599999090657, 1.8465760999824852], "step_s": [1.8991481999401003, 2.0306736999191344, 2.211888000019826, 1.8990294999675825, 2.011164900031872, 1.9464172999141738, 1.9578296999679878, 1.8628299999982119, 1.8640977999893948, 1.877885999972932], "losses": [2.699490547180176, 3.1975021362304688, 3.102980613708496, 2.993018388748169, 3.0228967666625977, 2.7430388927459717, 3.116676092147827, 2.8079276084899902, 2.438087224960327, 2.2272791862487793, 2.7954890727996826, 2.4320247173309326, 2.284184455871582, 2.891150951385498, 2.466473340988159], "median_step_s": 1.922782749927137, "tok_per_s": 261.74577654519567, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6125195264, "total_wall_s": 49.13338310003746, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791392665.8399827, "ram_used_percent": 57.8, "ram_available_bytes": 14383624192, "commit_percent": 55.28239282634093, "on_ac_power": true}, "box_after": {"unix": 1791392717.0991955, "ram_used_percent": 56.2, "ram_available_bytes": 14916313088, "commit_percent": 54.77422681396748, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-ram-0-packed", "seed": 43, "mode": "ram", "arm": "packed", "strict": false, "pid": 40552, "started_unix": 1791392722.1804621, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.480085200048052, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.007503399974666536, "build_s": 10.493493200046942, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.25798179989215, 0.9532456999877468, 0.9417276999447495, 1.0058709000004455, 0.9683120000408962], "step_s": [0.9726492000045255, 1.0297916000708938, 1.2283844000194222, 0.9581469999393448, 0.9638049999484792, 0.9985621001105756, 0.9256473000859842, 0.910495400079526, 0.9018944000126794, 0.9035571001004428], "losses": [2.699490547180176, 3.1972134113311768, 3.102504014968872, 2.99658203125, 3.0231096744537354, 2.739903688430786, 3.117818832397461, 2.81115984916687, 2.435227394104004, 2.2274959087371826, 2.794419527053833, 2.437396287918091, 2.282618284225464, 2.891021490097046, 2.469644069671631], "median_step_s": 0.960975999943912, "tok_per_s": 522.8259744442843, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8685965312, "total_wall_s": 43.00956480007153, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791392722.1041582, "ram_used_percent": 56.4, "ram_available_bytes": 14842294272, "commit_percent": 54.733995547730906, "on_ac_power": true}, "box_after": {"unix": 1791392767.7308297, "ram_used_percent": 56.0, "ram_available_bytes": 15000793088, "commit_percent": 54.445336380590064, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-ram-1-in-order", "seed": 43, "mode": "ram", "arm": "in-order", "strict": false, "pid": 40084, "started_unix": 1791392772.8006725, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.950561600038782, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.011579300044104457, "build_s": 12.932884400011972, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.4918745999457315, 0.9951313000638038, 1.0738561999751255, 1.0394076000666246, 0.9298100000014529], "step_s": [0.9448419000254944, 1.113875100039877, 1.3328576000640169, 1.0013481000205502, 1.066981800016947, 1.116854100022465, 1.0209840999450535, 1.0215814999537542, 1.0561973999720067, 0.9904958999250084], "losses": [2.699490547180176, 3.1962602138519287, 3.1010117530822754, 2.997450828552246, 3.022517681121826, 2.7426908016204834, 3.1182875633239746, 2.8105874061584473, 2.437565565109253, 2.229414224624634, 2.7965846061706543, 2.4380202293395996, 2.2771520614624023, 2.8925576210021973, 2.4657437801361084], "median_step_s": 1.0388894499628805, "tok_per_s": 480.02921427863, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10831917056, "total_wall_s": 53.10613560001366, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791392772.7371914, "ram_used_percent": 57.5, "ram_available_bytes": 14475706368, "commit_percent": 54.94125078556204, "on_ac_power": true}, "box_after": {"unix": 1791392828.7952404, "ram_used_percent": 57.4, "ram_available_bytes": 14516961280, "commit_percent": 54.891410547329464, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-ram-2-in-order", "seed": 43, "mode": "ram", "arm": "in-order", "strict": false, "pid": 22692, "started_unix": 1791392833.8973167, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 10.717541299993172, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.00822000007610768, "build_s": 12.547860500053503, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.196417700033635, 1.0301194000057876, 1.0396149000152946, 1.058009700034745, 1.0613425000337884], "step_s": [1.0340401999419555, 1.0693549999268726, 1.2889560000039637, 1.0218290999764577, 0.991598500055261, 1.049139800015837, 1.067821400007233, 0.994861299986951, 1.0496626999229193, 1.1002878000726923], "losses": [2.699490547180176, 3.1974480152130127, 3.1011180877685547, 2.9963462352752686, 3.0250470638275146, 2.744133949279785, 3.1174309253692627, 2.8092758655548096, 2.4386298656463623, 2.2249786853790283, 2.7948970794677734, 2.434080123901367, 2.27988600730896, 2.8923494815826416, 2.4683985710144043], "median_step_s": 1.0494012499693781, "tok_per_s": 479.9601723089948, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10833920000, "total_wall_s": 53.72622539999429, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791392833.7983108, "ram_used_percent": 57.0, "ram_available_bytes": 14655795200, "commit_percent": 54.62127672507945, "on_ac_power": true}, "box_after": {"unix": 1791392890.6872292, "ram_used_percent": 56.5, "ram_available_bytes": 14809780224, "commit_percent": 54.34546090049449, "on_ac_power": true}}
+{"status": "ok", "name": "seed43-ram-3-packed", "seed": 43, "mode": "ram", "arm": "packed", "strict": false, "pid": 25928, "started_unix": 1791392895.7823346, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 11.043508899980225, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0101208999985829, "build_s": 11.77978619991336, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.9986292000394315, 0.9969191000564024, 1.1072102000471205, 1.0527054000413045, 0.975945399957709], "step_s": [1.1409938000142574, 1.028140899958089, 1.1859315999317914, 0.9822155000874773, 1.0663880000356585, 1.1369903999147937, 1.1986598999937996, 1.175654000020586, 0.9377740999916568, 1.0057531000347808], "losses": [2.699490547180176, 3.200662612915039, 3.101872682571411, 3.0002529621124268, 3.0231454372406006, 2.7447779178619385, 3.1155998706817627, 2.8088297843933105, 2.4390697479248047, 2.2266082763671875, 2.7969958782196045, 2.436943292617798, 2.282975673675537, 2.8925414085388184, 2.4668362140655518], "median_step_s": 1.101689199975226, "tok_per_s": 471.51995091698956, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8685703168, "total_wall_s": 53.2286424000049, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791392895.6944573, "ram_used_percent": 56.5, "ram_available_bytes": 14827765760, "commit_percent": 54.30650724425038, "on_ac_power": true}, "box_after": {"unix": 1791392951.8161047, "ram_used_percent": 56.8, "ram_available_bytes": 14715613184, "commit_percent": 54.417376894544326, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-ram-0-in-order", "seed": 59, "mode": "ram", "arm": "in-order", "strict": false, "pid": 24292, "started_unix": 1791392956.9194334, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 11.05554159998428, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.008755499962717295, "build_s": 13.068514699931256, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.902798400027677, 1.152911499957554, 1.0486450999742374, 1.0498315000440925, 1.0299596999539062], "step_s": [1.11190949997399, 1.233775999979116, 1.3802322000265121, 1.16743030003272, 1.0173079000087455, 0.9911837000399828, 0.9534379000542685, 1.0374982000794262, 0.9581096000038087, 0.9353343999246135], "losses": [2.699490547180176, 3.198429822921753, 3.1053221225738525, 2.9959073066711426, 3.023897171020508, 2.737008571624756, 3.120739698410034, 2.8109467029571533, 2.4400999546051025, 2.2327253818511963, 2.798675298690796, 2.4402618408203125, 2.2830283641815186, 2.889054536819458, 2.4689369201660156], "median_step_s": 1.0274030500440858, "tok_per_s": 474.6797434453822, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10830970880, "total_wall_s": 55.38555579993408, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791392956.821225, "ram_used_percent": 57.9, "ram_available_bytes": 14351417344, "commit_percent": 54.95712004652114, "on_ac_power": true}, "box_after": {"unix": 1791393015.4126306, "ram_used_percent": 56.2, "ram_available_bytes": 14914482176, "commit_percent": 55.50097172326322, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-ram-1-packed", "seed": 59, "mode": "ram", "arm": "packed", "strict": false, "pid": 16564, "started_unix": 1791393020.507928, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 10.410861399956048, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.010111300041899085, "build_s": 8.391949099954218, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [2.725512000033632, 0.9360815000254661, 0.9469969999045134, 0.9677991999778897, 0.8857574999565259], "step_s": [0.9508945000125095, 1.0908239000709727, 1.2495431000133976, 0.9377710999688134, 0.9106627999572083, 0.9671654000412673, 0.9556765999877825, 0.8870330000063404, 0.8900662999367341, 0.8892800000030547], "losses": [2.699490547180176, 3.196460247039795, 3.1024763584136963, 2.998258113861084, 3.0281763076782227, 2.743988275527954, 3.1223015785217285, 2.8103935718536377, 2.441685676574707, 2.2274467945098877, 2.7972099781036377, 2.442394256591797, 2.2783007621765137, 2.8904800415039062, 2.469989776611328], "median_step_s": 0.9443327999906614, "tok_per_s": 526.2661977567359, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8685207552, "total_wall_s": 45.14785579999443, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791393020.4174128, "ram_used_percent": 56.1, "ram_available_bytes": 14940078080, "commit_percent": 55.38743926477445, "on_ac_power": true}, "box_after": {"unix": 1791393067.1096475, "ram_used_percent": 53.5, "ram_available_bytes": 15832387584, "commit_percent": 54.480174787805794, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-ram-2-packed", "seed": 59, "mode": "ram", "arm": "packed", "strict": false, "pid": 45256, "started_unix": 1791393072.2129726, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 7.316291099996306, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.003685500007122755, "build_s": 3.6359231000533327, "pinned": true, "pinned_bytes": 6442450944, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.201542599941604, 0.9948360999114811, 0.8775176999624819, 0.8741616000188515, 0.9284214000217617], "step_s": [1.0196629000129178, 0.9847050999524072, 1.2175182999344543, 0.9598574999254197, 0.9977281000465155, 1.0346380999544635, 1.0434248000383377, 0.964992200024426, 0.9326285000424832, 0.9793194000376388], "losses": [2.699490547180176, 3.1978542804718018, 3.101600408554077, 2.998776912689209, 3.027517080307007, 2.744532346725464, 3.1238014698028564, 2.8079845905303955, 2.440190553665161, 2.229196548461914, 2.794325828552246, 2.4351375102996826, 2.2792396545410156, 2.8898839950561523, 2.4703004360198975], "median_step_s": 0.9912165999994613, "tok_per_s": 505.20624408627515, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 8686665728, "total_wall_s": 31.69845390005503, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791393072.1145008, "ram_used_percent": 54.3, "ram_available_bytes": 15571144704, "commit_percent": 54.624867481584594, "on_ac_power": true}, "box_after": {"unix": 1791393106.1092343, "ram_used_percent": 56.0, "ram_available_bytes": 14995488768, "commit_percent": 56.389374642185146, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-ram-3-in-order", "seed": 59, "mode": "ram", "arm": "in-order", "strict": false, "pid": 23064, "started_unix": 1791393111.2254024, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.871945600025356, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.010053299949504435, "build_s": 12.993804799974896, "pinned": true, "pinned_bytes": 8589934592, "store_bytes": 6073035760, "arena_sizes": [2147483648, 2147483648, 2147483648, 2147483648], "source_class": "RamSource", "direct_io": null, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.156246500089765, 0.9618868000106886, 0.9464963000500575, 0.954852299997583, 0.9450655999826267], "step_s": [1.002039200044237, 1.0377827999182045, 1.1481553999474272, 0.9457222999772057, 0.9877913000527769, 0.9495088999392465, 0.9520617000525817, 1.0997436000034213, 1.053122700075619, 1.022501099971123], "losses": [2.699490547180176, 3.200347900390625, 3.1028482913970947, 2.995739698410034, 3.0246753692626953, 2.742635726928711, 3.1226937770843506, 2.8083953857421875, 2.4394021034240723, 2.231907844543457, 2.795440673828125, 2.437685966491699, 2.28191876411438, 2.8887534141540527, 2.4690093994140625], "median_step_s": 1.01227015000768, "tok_per_s": 502.0381080271398, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 10832994304, "total_wall_s": 46.89748020004481, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791393111.1158876, "ram_used_percent": 54.8, "ram_available_bytes": 15399301120, "commit_percent": 55.705234664006724, "on_ac_power": true}, "box_after": {"unix": 1791393161.002514, "ram_used_percent": 55.9, "ram_available_bytes": 15010664448, "commit_percent": 54.762950224718146, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-disk-0-in-order", "seed": 59, "mode": "disk", "arm": "in-order", "strict": false, "pid": 27260, "started_unix": 1791393166.100729, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 9.1903178000357, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.05230679991655052, "build_s": 1.407958700088784, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.215656500076875, 1.9820868000388145, 1.8965119000058621, 1.8664458999410272, 1.7808509999886155], "step_s": [1.9226843999931589, 2.245508199906908, 1.6761165000498295, 1.651959899929352, 1.612707299995236, 1.6830997000215575, 1.627847999916412, 1.6184253999963403, 1.6039150999858975, 1.6233101999387145], "losses": [2.699490547180176, 3.1974501609802246, 3.1026251316070557, 2.997016668319702, 3.025007963180542, 2.7383477687835693, 3.120798110961914, 2.8114542961120605, 2.439046621322632, 2.230447292327881, 2.795576810836792, 2.437445640563965, 2.278846263885498, 2.888056516647339, 2.4678709506988525], "median_step_s": 1.639903949922882, "tok_per_s": 296.5438503520567, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124900352, "total_wall_s": 46.45439389999956, "repeat": 0, "returncode": 0, "box_before": {"unix": 1791393166.006514, "ram_used_percent": 55.3, "ram_available_bytes": 15234285568, "commit_percent": 54.51974707625678, "on_ac_power": true}, "box_after": {"unix": 1791393213.6844363, "ram_used_percent": 51.9, "ram_available_bytes": 16373088256, "commit_percent": 52.29275854690826, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-disk-1-packed", "seed": 59, "mode": "disk", "arm": "packed", "strict": false, "pid": 34280, "started_unix": 1791393218.7546117, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 6.861993700033054, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.0036935999523848295, "build_s": 1.3085600000340492, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [3.1963321999646723, 1.6070428000530228, 1.6117481999099255, 1.7352069999324158, 1.6031353999860585], "step_s": [1.6165826000506058, 2.6534241000190377, 1.8255211999639869, 1.9752047000220045, 1.9819727999856696, 1.9946918999776244, 2.10334349994082, 2.0549467999953777, 2.3739470000145957, 1.990138699999079], "losses": [2.699490547180176, 3.2011823654174805, 3.1003482341766357, 2.997555732727051, 3.0232300758361816, 2.7438459396362305, 3.1212925910949707, 2.8115577697753906, 2.4378340244293213, 2.2286903858184814, 2.7965500354766846, 2.4395906925201416, 2.28096342086792, 2.8892252445220947, 2.468550205230713], "median_step_s": 1.9924152999883518, "tok_per_s": 248.90891724158018, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6128168960, "total_wall_s": 42.15814469999168, "repeat": 1, "returncode": 0, "box_before": {"unix": 1791393218.6854143, "ram_used_percent": 52.4, "ram_available_bytes": 16229175296, "commit_percent": 52.56975784180203, "on_ac_power": true}, "box_after": {"unix": 1791393263.1082547, "ram_used_percent": 53.7, "ram_available_bytes": 15782051840, "commit_percent": 53.2738352601261, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-disk-2-packed", "seed": 59, "mode": "disk", "arm": "packed", "strict": false, "pid": 20624, "started_unix": 1791393268.1878972, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.562728699995205, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.00703899993095547, "build_s": 1.6716895999852568, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.147826900007203, 1.9690871000057086, 1.8141304000746459, 1.9948378999251872, 2.027485999977216], "step_s": [1.9641040000133216, 2.1277856999076903, 2.192881499999203, 1.9264677000464872, 1.8862936000805348, 1.8691201000474393, 1.899048799998127, 1.8645199000602588, 1.9592174999415874, 1.854983799974434], "losses": [2.699490547180176, 3.1987149715423584, 3.1032447814941406, 2.9976108074188232, 3.022491455078125, 2.740821599960327, 3.1217329502105713, 2.8106045722961426, 2.4457061290740967, 2.2347803115844727, 2.7947330474853516, 2.441946268081665, 2.2841691970825195, 2.8921992778778076, 2.4699044227600098], "median_step_s": 1.912758250022307, "tok_per_s": 261.9673195145659, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124244992, "total_wall_s": 49.18642160005402, "repeat": 2, "returncode": 0, "box_before": {"unix": 1791393268.1126523, "ram_used_percent": 53.3, "ram_available_bytes": 15906652160, "commit_percent": 52.7980869202458, "on_ac_power": true}, "box_after": {"unix": 1791393319.3707256, "ram_used_percent": 52.9, "ram_available_bytes": 16031633408, "commit_percent": 52.417823116644854, "on_ac_power": true}}
+{"status": "ok", "name": "seed59-disk-3-in-order", "seed": 59, "mode": "disk", "arm": "in-order", "strict": false, "pid": 38956, "started_unix": 1791393324.4436495, "soup_cli": "C:\\Users\\user\\projects\\soup-wt\\9c-arena-pack\\src\\soup_cli\\__init__.py", "torch": "2.14.0+cu130", "cap_bytes": 4000000000, "import_and_cuda_s": 8.812715200008824, "dtype": "bfloat16", "weights_dir": "C:\\Users\\user\\Soup Experimental\\experiments\\models\\Qwen3-8B", "shard_dir": "C:/Users/user/projects/soup-wt/9c-data/shards-q8", "shard_s": 0.00716499995905906, "build_s": 1.6815227000042796, "pinned": true, "pinned_bytes": 4294967296, "store_bytes": 2688414776, "arena_sizes": [], "source_class": "AsyncDiskSource", "direct_io": true, "trainable_tensors": 144, "data": "file sha256 663f28bf9bf8307a9018c3bf4281d58d053fa55752de01f160101bc83cb0a8ee", "warmup_s": [4.151205400004983, 1.8998959999298677, 1.6661833999678493, 1.60665740002878, 1.6252921000123024], "step_s": [1.7240417998982593, 1.95216939994134, 1.65376490005292, 1.630314499954693, 1.6371567000169307, 1.6181553000351414, 1.7386333999456838, 1.596916600014083, 1.6083390000276268, 1.603885899996385], "losses": [2.699490547180176, 3.1946206092834473, 3.1013283729553223, 2.9973971843719482, 3.0252320766448975, 2.7407050132751465, 3.1214425563812256, 2.8093152046203613, 2.439180374145508, 2.229322910308838, 2.7950010299682617, 2.442157745361328, 2.277951955795288, 2.888650417327881, 2.466346263885498], "median_step_s": 1.6337355999858119, "tok_per_s": 305.42770990128423, "peak_allocated_bytes": 2807058944, "peak_reserved_bytes": 3047161856, "peak_rss_bytes": 6124355584, "total_wall_s": 45.457323600072414, "repeat": 3, "returncode": 0, "box_before": {"unix": 1791393324.3736243, "ram_used_percent": 53.2, "ram_available_bytes": 15940014080, "commit_percent": 52.676512243067585, "on_ac_power": true}, "box_after": {"unix": 1791393371.0461123, "ram_used_percent": 53.1, "ram_available_bytes": 15974232064, "commit_percent": 52.79537704220914, "on_ac_power": true}}
diff --git a/benchmarks/results/probe-rtx5070/issue1702/strict.json b/benchmarks/results/probe-rtx5070/issue1702/strict.json
new file mode 100644
index 00000000..8f768fda
--- /dev/null
+++ b/benchmarks/results/probe-rtx5070/issue1702/strict.json
@@ -0,0 +1,29 @@
+{
+ "faults": [],
+ "ram": {
+ "exact": true,
+ "steps": 3,
+ "digests_per_step": 290,
+ "pinned_bytes": {
+ "in-order": 8589934592,
+ "packed": 6442450944
+ },
+ "sha256_of_digests": {
+ "in-order": "1b127f4880e4f35d07609a1c503728e17ac22e2f0ea0f69f81ba62f023e04140",
+ "packed": "1b127f4880e4f35d07609a1c503728e17ac22e2f0ea0f69f81ba62f023e04140"
+ }
+ },
+ "disk": {
+ "exact": true,
+ "steps": 3,
+ "digests_per_step": 290,
+ "pinned_bytes": {
+ "in-order": 4294967296,
+ "packed": 4294967296
+ },
+ "sha256_of_digests": {
+ "in-order": "1b127f4880e4f35d07609a1c503728e17ac22e2f0ea0f69f81ba62f023e04140",
+ "packed": "1b127f4880e4f35d07609a1c503728e17ac22e2f0ea0f69f81ba62f023e04140"
+ }
+ }
+}
diff --git a/benchmarks/results/probe-rtx5070/issue1702/verdict.json b/benchmarks/results/probe-rtx5070/issue1702/verdict.json
new file mode 100644
index 00000000..e42b978a
--- /dev/null
+++ b/benchmarks/results/probe-rtx5070/issue1702/verdict.json
@@ -0,0 +1,28 @@
+{
+ "subject_differences": {
+ "3": -0.02707522485084024,
+ "17": 0.04751001626997842,
+ "29": -0.014133045927685606,
+ "43": 0.035788456886771236,
+ "59": 0.05605978255433719
+ },
+ "control_differences": {
+ "3": 0.03025271936281082,
+ "17": -0.0038811700426312212,
+ "29": 0.09686138755430829,
+ "43": -0.0033829123738524647,
+ "59": -0.15132828444396484
+ },
+ "failed_runs": {
+ "in-order": [],
+ "packed": []
+ },
+ "floor": 0.03,
+ "control_mean": -0.006295651988665885,
+ "control_sd": 0.09086519755627212,
+ "band": 0.15132828444396484,
+ "subject_mean": 0.0196299969865122,
+ "subject_sd": 0.03770557449441231,
+ "verdict": "NO DIFFERENCE",
+ "reason": "+1.96% is inside +/-15.13%"
+}
diff --git a/changelog.d/0.75.1/1713.changed.md b/changelog.d/0.75.1/1713.changed.md
new file mode 100644
index 00000000..bf9c1af6
--- /dev/null
+++ b/changelog.d/0.75.1/1713.changed.md
@@ -0,0 +1 @@
+- **Layer streaming page-locks less memory for a pinned RAM store whose largest tensors come last (#1702 in #1713).** The store is pinned in power-of-two arenas (#901), and the planner filled them in allocation order, looking only at the arena it opened last. A Qwen3-8B NF4 store is 3.58 GB of decoder tensors followed by two 1.24 GB vocabulary matrices; neither matrix fit behind the decoder, so each opened a 2 GiB arena of its own and 8 GiB was page-locked for a 6.07 GB store. `plan_pinned_arenas` now also plans the arenas largest tensor first and uses that layout only when it page-locks strictly fewer bytes: the same store takes 6 GiB (8,589,934,592 -> 6,442,450,944 bytes, measured on an RTX 5070 Laptop), and peak process RSS in a three-step run went from 10.85 GB to 8.71 GB. A store that gains nothing, including the disk tier's staging on the measured geometries, is laid out exactly as before, and there is no new config field. Three deterministic optimizer steps are byte-identical between the two layouts (logits, loss, 144 gradients, 144 updated adapter tensors). This is a memory change, not a speed claim: a 40-run A/B on the same box (old and new layout alternating, the disk tier as the control) found no difference in step speed at its resolution of +/-15%. The record is `benchmarks/gate-1702-arena-packing.md`.
diff --git a/docs/performance-and-quantization.md b/docs/performance-and-quantization.md
index faa3e837..5d0ee2a4 100644
--- a/docs/performance-and-quantization.md
+++ b/docs/performance-and-quantization.md
@@ -511,7 +511,7 @@ The tradeoff: **1.43× slower than resident training**, measured at 0.5B — the
Quantising the streamed base to NF4 makes the RAM store ~4× smaller. That matters for two reasons, and the second is the bigger one:
1. A bigger model fits in host RAM at all — an 8B base is ~3.6 GB of NF4 instead of ~16 GB of bf16.
-2. **The store fits under the machine's page-locked memory ceiling.** Pinned host memory is what lets `copy_(non_blocking=True)` actually overlap with compute. The reference box topped out at ~7.1 GB of page-locked memory, so a 5.55 GB bf16 3B base fell back to pageable and lost overlap; the 1.43 GB NF4 store pins, and utilisation goes from 79.3% to 100%. **That ceiling was mostly Soup's own accounting, not the box's** (#901): torch's caching host allocator rounds every pinned request *up to the next power of two*, and the store used to be pinned one tensor at a time, so a store cost 1.7–1.9× its size in page-locked memory (measured: 6.82 GB of Qwen2.5-14B NF4 decoder tensors cost 11.83 GB). The store is now pinned in a few power-of-two arenas with every tensor a view — the 9.93 GB 14B NF4 store page-locks as exactly 10 GiB — and the ready line prints the real figure (`9.93 GB pinned RAM store (10.74 GB page-locked)`).
+2. **The store fits under the machine's page-locked memory ceiling.** Pinned host memory is what lets `copy_(non_blocking=True)` actually overlap with compute. The reference box topped out at ~7.1 GB of page-locked memory, so a 5.55 GB bf16 3B base fell back to pageable and lost overlap; the 1.43 GB NF4 store pins, and utilisation goes from 79.3% to 100%. **That ceiling was mostly Soup's own accounting, not the box's** (#901): torch's caching host allocator rounds every pinned request *up to the next power of two*, and the store used to be pinned one tensor at a time, so a store cost 1.7–1.9× its size in page-locked memory (measured: 6.82 GB of Qwen2.5-14B NF4 decoder tensors cost 11.83 GB). The store is now pinned in a few power-of-two arenas with every tensor a view — the 9.93 GB 14B NF4 store page-locks as exactly 10 GiB — and the ready line prints the real figure (`9.93 GB pinned RAM store (10.74 GB page-locked)`). Since #1702 the arenas are filled largest tensor first whenever that page-locks fewer bytes: a 6.07 GB Qwen3-8B NF4 store, whose two 1.24 GB vocabulary matrices each used to open a 2 GiB arena of their own behind the decoder, page-locks 6 GiB where it took 8 GiB. A store that gains nothing is laid out exactly as before.
The base is quantised **once, offline**, one tensor at a time, and cached. The shard cache is keyed to the quantisation, the dtype, the quantisation device and a fingerprint of the source checkpoint, so switching `none` ⇄ `4bit` — or retraining a base in place — re-shards rather than silently streaming the wrong bytes.
diff --git a/src/soup_cli/utils/layer_stream_runtime.py b/src/soup_cli/utils/layer_stream_runtime.py
index 2baaa060..ce4000ce 100644
--- a/src/soup_cli/utils/layer_stream_runtime.py
+++ b/src/soup_cli/utils/layer_stream_runtime.py
@@ -557,8 +557,20 @@ def plan_pinned_arenas(
) -> ArenaPlan:
"""Pack ``sizes`` (bytes, allocation order) into power-of-two arenas.
- First-fit into the current arena, else open the next; a tensor never
- straddles two arenas, because it has to be one contiguous view.
+ Two layouts are planned. The in-order walk puts each tensor into the arena
+ opened last, else opens the next. The largest-first walk (stable first-fit
+ decreasing) is returned ONLY when it page-locks strictly fewer bytes; on a
+ tie the in-order plan comes back, placement for placement. Either way
+ ``placements`` is indexed in the order the sizes were given, and a tensor
+ never straddles two arenas, because it has to be one contiguous view.
+
+ The in-order walk alone strands the space in front of a large tensor that
+ arrives late (#1702). A Qwen3-8B NF4 store is 3.58 GB of decoder tensors
+ followed by two 1.24 GB vocabulary matrices; neither fits behind the
+ decoder, so each opened a 2 GiB arena of its own: 8 GiB page-locked for a
+ 6.07 GB store. Largest-first puts the two matrices down first and the
+ decoder fills in around them: 6 GiB. The test is bytes, not arena count —
+ after the trim a sorted layout can hold as many arenas and MORE bytes.
The arena capacity is the power of two above FOUR times the store's largest
tensor, floored at ``arena_bytes`` and capped at
@@ -591,6 +603,13 @@ def plan_pinned_arenas(
return ArenaPlan(arena_sizes=(), placements=(), requested_bytes=0)
ceiling = max(arena_bytes, PINNED_ARENA_MAX_BYTES)
capacity = min(max(arena_bytes, _next_power_of_two(4 * max(sizes))), ceiling)
+ in_order = _plan_in_order(sizes, capacity, align)
+ largest_first = _plan_largest_first(sizes, capacity, align)
+ return largest_first if largest_first.pinned_bytes < in_order.pinned_bytes else in_order
+
+
+def _plan_in_order(sizes: Sequence[int], capacity: int, align: int) -> ArenaPlan:
+ """Allocation order: each tensor into the arena opened last, else a new one."""
fills: List[int] = []
capacities: List[int] = []
placements: List[Tuple[int, int]] = []
@@ -612,6 +631,34 @@ def plan_pinned_arenas(
)
+def _plan_largest_first(sizes: Sequence[int], capacity: int, align: int) -> ArenaPlan:
+ """Largest tensor first, each into the FIRST arena with room, else a new one.
+
+ The sort is stable, so equal sizes keep their allocation order. Each
+ placement is written back at the tensor's ORIGINAL index: both sources read
+ the plan in allocation order, whatever order the arenas were filled in.
+ """
+ fills: List[int] = []
+ capacities: List[int] = []
+ placements: List[Tuple[int, int]] = [(0, 0)] * len(sizes)
+ for original, size in sorted(enumerate(sizes), key=lambda item: -item[1]):
+ for arena, fill in enumerate(fills):
+ start = -(-fill // align) * align
+ if start + size <= capacities[arena]:
+ placements[original] = (arena, start)
+ fills[arena] = start + size
+ break
+ else:
+ placements[original] = (len(fills), 0)
+ fills.append(size)
+ capacities.append(max(capacity, _next_power_of_two(size)))
+ return ArenaPlan(
+ arena_sizes=tuple(max(align, _next_power_of_two(fill)) for fill in fills),
+ placements=tuple(placements),
+ requested_bytes=sum(sizes),
+ )
+
+
class RamSource:
"""The base held in CPU RAM, allocated ONCE and filled by ``copy_``.
diff --git a/tests/test_issue1702_arena_pack_gate.py b/tests/test_issue1702_arena_pack_gate.py
new file mode 100644
index 00000000..9d983081
--- /dev/null
+++ b/tests/test_issue1702_arena_pack_gate.py
@@ -0,0 +1,473 @@
+"""#1702 — the speed gate's schedule and decision rule, pinned on CPU.
+
+``benchmarks/harness/issue1702_arena_pack_gate.py`` runs the plan written in issue #1702
+before any measurement: in-order vs packed arenas, A B B A per seed, the RAM tier as the
+subject and the disk tier as the negative control. The rule was fixed in advance, so the
+code that applies it must not be free to drift: these tests hold every branch of it.
+The runs themselves need a CUDA box and are recorded in ``benchmarks/gate-1702-*.md``.
+"""
+
+from __future__ import annotations
+
+import importlib.util
+import json
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+
+_HARNESS = (
+ Path(__file__).resolve().parents[1] / "benchmarks" / "harness" / "issue1702_arena_pack_gate.py"
+)
+
+
+def _load_harness():
+ spec = importlib.util.spec_from_file_location("issue1702_arena_pack_gate", _HARNESS)
+ assert spec is not None and spec.loader is not None
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+gate = _load_harness()
+
+GiB = 2**30
+SEEDS = (3, 17, 29, 43, 59)
+
+
+def _rows(subject, control, *, base: float = 400.0):
+ """A full series whose per-seed differences are the ones given (None = a failed run)."""
+ wanted = {gate.SUBJECT: dict(zip(SEEDS, subject)), gate.CONTROL: dict(zip(SEEDS, control))}
+ rows = []
+ for run in gate.schedule():
+ difference = wanted[run["mode"]][run["seed"]]
+ row = dict(run, status="ok", tok_per_s=base, pinned_bytes=4 * GiB)
+ if run["mode"] == gate.SUBJECT:
+ row["pinned_bytes"] = gate.EXPECTED_SUBJECT_PINNED[run["arm"]]
+ if difference is None:
+ # The block's first packed run, whichever order the block runs in.
+ if run["arm"] == "packed" and run["repeat"] in (0, 1):
+ row.update(status="failed", error="cuMemHostAlloc", tok_per_s=None)
+ elif run["arm"] == "packed":
+ row["tok_per_s"] = base * (1.0 + difference)
+ rows.append(row)
+ return rows
+
+
+QUIET = (0.01, -0.01, 0.005, -0.005, 0.0)
+
+
+class TestTheSchedule:
+ def test_it_is_forty_runs_with_unique_names(self):
+ runs = gate.schedule()
+ assert len(runs) == 40
+ assert len({run["name"] for run in runs}) == 40
+
+ def test_every_block_is_a_b_b_a_and_the_first_arm_alternates_by_seed(self):
+ runs = gate.schedule()
+ for position, seed in enumerate(SEEDS):
+ for mode in (gate.SUBJECT, gate.CONTROL):
+ arms = [r["arm"] for r in runs if r["seed"] == seed and r["mode"] == mode]
+ first = gate.ARMS[position % 2]
+ other = gate.ARMS[1 - position % 2]
+ assert arms == [first, other, other, first], (seed, mode)
+
+ def test_a_block_is_never_interleaved_with_another(self):
+ runs = gate.schedule()
+ blocks = [(run["seed"], run["mode"]) for run in runs]
+ assert blocks == [block for block in dict.fromkeys(blocks) for _ in range(4)]
+
+ def test_the_mode_that_goes_first_alternates_by_seed(self):
+ runs = gate.schedule()
+ firsts = [next(r["mode"] for r in runs if r["seed"] == seed) for seed in SEEDS]
+ assert firsts == ["ram", "disk", "ram", "disk", "ram"]
+
+
+class TestTheDifference:
+ def test_it_is_the_ratio_of_the_two_arm_means(self):
+ rows = [
+ {"arm": "in-order", "status": "ok", "tok_per_s": 390.0},
+ {"arm": "packed", "status": "ok", "tok_per_s": 420.0},
+ {"arm": "packed", "status": "ok", "tok_per_s": 400.0},
+ {"arm": "in-order", "status": "ok", "tok_per_s": 410.0},
+ ]
+ assert gate.block_difference(rows) == pytest.approx(0.025)
+
+ def test_a_block_with_a_failed_run_has_no_difference(self):
+ """Even one that timed its steps before it died: failed is failed."""
+ rows = [
+ {"arm": "in-order", "status": "ok", "tok_per_s": 390.0},
+ {"arm": "packed", "status": "failed", "tok_per_s": 405.0},
+ {"arm": "packed", "status": "ok", "tok_per_s": 400.0},
+ {"arm": "in-order", "status": "ok", "tok_per_s": 410.0},
+ ]
+ assert gate.block_difference(rows) is None
+
+ def test_a_block_with_a_missing_run_has_no_difference(self):
+ rows = [
+ {"arm": "in-order", "status": "ok", "tok_per_s": 390.0},
+ {"arm": "packed", "status": "ok", "tok_per_s": 400.0},
+ {"arm": "in-order", "status": "ok", "tok_per_s": 410.0},
+ ]
+ assert gate.block_difference(rows) is None
+
+
+class TestTheRule:
+ def test_inside_the_band_is_no_difference(self):
+ verdict = gate.decide(_rows((0.02, -0.02, 0.01, 0.0, -0.01), QUIET))
+ assert verdict["verdict"] == "NO DIFFERENCE"
+ assert verdict["band"] == pytest.approx(0.03)
+ assert verdict["subject_mean"] == pytest.approx(0.0)
+
+ def test_below_the_band_is_slower(self):
+ verdict = gate.decide(_rows((-0.05, -0.04, -0.06, -0.05, -0.05), QUIET))
+ assert verdict["verdict"] == "SLOWER"
+ assert verdict["subject_mean"] == pytest.approx(-0.05)
+
+ def test_above_the_band_is_faster(self):
+ verdict = gate.decide(_rows((0.05, 0.04, 0.06, 0.05, 0.05), QUIET))
+ assert verdict["verdict"] == "FASTER"
+
+ def test_the_band_widens_to_the_largest_control_difference(self):
+ """A control that swings 5% either way says 4% is noise on this box today."""
+ control = (0.05, -0.05, 0.0, 0.0, 0.0)
+ verdict = gate.decide(_rows((-0.04,) * 5, control))
+ assert verdict["band"] == pytest.approx(0.05)
+ assert verdict["verdict"] == "NO DIFFERENCE"
+ assert gate.decide(_rows((-0.04,) * 5, QUIET))["verdict"] == "SLOWER"
+
+ def test_exactly_on_the_band_is_not_outside_it(self):
+ """1/16 is exact in binary, so the mean sits ON the band, not a rounding error off."""
+ control = (0.0625, -0.0625, 0.0, 0.0, 0.0)
+ verdict = gate.decide(_rows((-0.0625,) * 5, control))
+ assert verdict["band"] == 0.0625
+ assert verdict["subject_mean"] == -0.0625
+ assert verdict["verdict"] == "NO DIFFERENCE"
+ faster = gate.decide(_rows((0.0625,) * 5, control))
+ assert faster["subject_mean"] == 0.0625
+ assert faster["verdict"] == "NO DIFFERENCE"
+
+ def test_a_control_that_is_not_centred_makes_the_series_inconclusive(self):
+ verdict = gate.decide(_rows((-0.2,) * 5, (-0.05, -0.04, -0.03, -0.04, -0.04)))
+ assert verdict["verdict"] == "INCONCLUSIVE"
+ assert "the box was not quiet" in verdict["reason"]
+
+ def test_a_failed_run_is_listed_against_its_arm_and_costs_its_block(self):
+ verdict = gate.decide(_rows((0.0, None, 0.0, 0.0, 0.0), QUIET))
+ assert verdict["subject_differences"][17] is None
+ assert verdict["failed_runs"]["packed"] == ["seed17-ram-0-packed"]
+ assert verdict["failed_runs"]["in-order"] == []
+ assert verdict["verdict"] == "NO DIFFERENCE"
+
+ @pytest.mark.parametrize(
+ ("subject", "control", "needle"),
+ [
+ ((0.0, None, None, 0.0, 0.0), QUIET, "the RAM tier has 3 differences"),
+ ((0.0,) * 5, (0.0, None, None, 0.0, 0.0), "the control has 3 differences"),
+ ],
+ )
+ def test_fewer_than_four_blocks_is_inconclusive(self, subject, control, needle):
+ verdict = gate.decide(_rows(subject, control))
+ assert verdict["verdict"] == "INCONCLUSIVE"
+ assert needle in verdict["reason"]
+
+ def test_a_ram_run_with_the_wrong_arenas_voids_the_series(self):
+ rows = _rows((0.0,) * 5, QUIET)
+ target = next(r for r in rows if r["mode"] == gate.SUBJECT and r["arm"] == "in-order")
+ target["pinned_bytes"] = 6 * GiB # the arm switch did nothing
+ verdict = gate.decide(rows)
+ assert verdict["verdict"] == "VOID"
+ assert "the in-order arm must show 8589934592" in verdict["reason"]
+
+ def test_control_arms_that_page_lock_differently_void_the_series(self):
+ rows = _rows((0.0,) * 5, QUIET)
+ target = next(r for r in rows if r["mode"] == gate.CONTROL and r["arm"] == "packed")
+ target["pinned_bytes"] = 2 * GiB
+ verdict = gate.decide(rows)
+ assert verdict["verdict"] == "VOID"
+ assert "seed 3 control" in verdict["reason"]
+
+ def test_the_verdict_is_json(self):
+ json.dumps(gate.decide(_rows((0.0,) * 5, QUIET)))
+
+ @pytest.mark.parametrize("stamp", ["box_before", "box_after"])
+ def test_one_run_on_battery_makes_the_series_inconclusive(self, stamp):
+ """Measured on this laptop: a step is 2.6x slower on battery (0.83 s against 0.31 s)."""
+ rows = _rows((-0.2,) * 5, QUIET)
+ for row in rows:
+ row["box_before"] = {"on_ac_power": True}
+ row["box_after"] = {"on_ac_power": True}
+ assert gate.decide(rows)["verdict"] == "SLOWER"
+ rows[7][stamp] = {"on_ac_power": False}
+ verdict = gate.decide(rows)
+ assert verdict["verdict"] == "INCONCLUSIVE"
+ assert "battery power, first seed03-disk-3-in-order" in verdict["reason"]
+
+ def test_a_stamp_that_could_not_be_read_accuses_nobody(self):
+ rows = _rows((-0.2,) * 5, QUIET)
+ rows[0]["box_before"] = {"on_ac_power": None}
+ rows[1]["box_before"] = {}
+ assert gate.runs_on_battery(rows) == []
+ assert gate.decide(rows)["verdict"] == "SLOWER"
+
+
+class TestTheStrictComparison:
+ @staticmethod
+ def _result(mode, arm, digests, status="ok"):
+ return {"mode": mode, "arm": arm, "status": status, "digests": digests}
+
+ def test_equal_digests_are_exact(self):
+ steps = [["a", "b"], ["c", "d"], ["e", "f"]]
+ results = [self._result(m, a, steps) for m in ("ram", "disk") for a in gate.ARMS]
+ outcome = gate.compare_strict(results)
+ assert outcome["ram"] == {"exact": True, "steps": 3, "digests_per_step": 2}
+ assert outcome["disk"]["exact"] is True
+
+ def test_one_different_digest_is_not_exact(self):
+ steps = [["a", "b"], ["c", "d"]]
+ results = [self._result(m, a, steps) for m in ("ram", "disk") for a in gate.ARMS]
+ results[1] = self._result("ram", "packed", [["a", "b"], ["c", "X"]])
+ outcome = gate.compare_strict(results)
+ assert outcome["ram"]["exact"] is False
+ assert outcome["disk"]["exact"] is True
+
+ def test_a_failed_or_missing_arm_is_not_exact(self):
+ steps = [["a"]]
+ results = [
+ self._result("ram", "in-order", steps),
+ self._result("ram", "packed", steps, status="failed"),
+ self._result("disk", "in-order", steps),
+ ]
+ outcome = gate.compare_strict(results)
+ assert outcome["ram"]["exact"] is False
+ assert outcome["disk"]["exact"] is False
+
+ def test_no_digests_at_all_is_not_exact(self):
+ results = [self._result(m, a, []) for m in ("ram", "disk") for a in gate.ARMS]
+ assert gate.compare_strict(results)["ram"]["exact"] is False
+
+
+class TestTheInOrderArm:
+ def test_it_brings_back_the_plan_from_before_1702(self, monkeypatch):
+ import soup_cli.utils.layer_stream_runtime as runtime
+ from tests.test_issue1702_pinned_arena_packing import _QWEN3_8B_STORE_BYTES
+
+ # Registered first, so the harness's process-wide switch is undone after the test.
+ monkeypatch.setattr(runtime, "_plan_largest_first", runtime._plan_largest_first)
+ packed = runtime.plan_pinned_arenas(_QWEN3_8B_STORE_BYTES).pinned_bytes
+ gate.use_in_order_plan()
+ in_order = runtime.plan_pinned_arenas(_QWEN3_8B_STORE_BYTES).pinned_bytes
+ assert {"in-order": in_order, "packed": packed} == gate.EXPECTED_SUBJECT_PINNED
+
+
+class TestTheDriver:
+ def test_the_default_mode_prints_the_schedule_and_imports_no_torch(self):
+ code = (
+ "import importlib.util, sys\n"
+ f"spec = importlib.util.spec_from_file_location('gate', r'{_HARNESS}')\n"
+ "module = importlib.util.module_from_spec(spec)\n"
+ "spec.loader.exec_module(module)\n"
+ "code = module.main([])\n"
+ "print('TORCH' if 'torch' in sys.modules else 'LIGHT')\n"
+ "sys.exit(code)\n"
+ )
+ done = subprocess.run([sys.executable, "-c", code], capture_output=True, text=True)
+ assert done.returncode == 0, done.stderr
+ # "<position> <name>" per run, then the marker: every second token is a run name.
+ *listed, marker = done.stdout.split()
+ assert marker == "LIGHT"
+ assert listed[1::2] == [run["name"] for run in gate.schedule()]
+
+ @pytest.mark.parametrize("mode", ["series", "strict", "trial"])
+ def test_a_run_mode_without_weights_is_refused_by_name(self, mode, capsys):
+ with pytest.raises(SystemExit) as raised:
+ gate.parse_args(["--mode", mode])
+ assert raised.value.code == 2
+ assert f"--mode {mode} needs --weights" in capsys.readouterr().err
+
+ def test_an_existing_series_is_never_appended_to(self, tmp_path, capsys, monkeypatch):
+ def no_spawn(*_args, **_kwargs):
+ raise AssertionError("a run was started over an existing series")
+
+ monkeypatch.setattr(gate, "_spawn", no_spawn)
+ (tmp_path / "series.jsonl").write_text("{}\n", encoding="utf-8")
+ args = gate.parse_args(["--mode", "series", "--weights", "x", "--out", str(tmp_path)])
+ assert gate.run_series(args) == 2
+ assert "never appended to" in capsys.readouterr().out
+ assert (tmp_path / "series.jsonl").read_text(encoding="utf-8") == "{}\n"
+
+ def test_a_series_is_not_started_on_battery_power(self, tmp_path, capsys, monkeypatch):
+ def no_spawn(*_args, **_kwargs):
+ raise AssertionError("a run was timed on battery power")
+
+ monkeypatch.setattr(gate, "_spawn", no_spawn)
+ monkeypatch.setattr(gate, "box_stamp", lambda: {"on_ac_power": False})
+ args = gate.parse_args(["--mode", "series", "--weights", "x", "--out", str(tmp_path)])
+ assert gate.run_series(args) == 2
+ assert "the box is on battery power before run" in capsys.readouterr().out
+ assert not (tmp_path / "series.jsonl").exists()
+
+ def test_a_series_stops_when_the_box_goes_on_battery(self, tmp_path, capsys, monkeypatch):
+ power = iter([True, True, False])
+ monkeypatch.setattr(gate, "box_stamp", lambda: {"on_ac_power": next(power)})
+ def canned(_args, run, *, strict):
+ pinned = gate.EXPECTED_SUBJECT_PINNED[run["arm"]]
+ return dict(run, status="ok", tok_per_s=400.0, pinned_bytes=pinned)
+
+ monkeypatch.setattr(gate, "_spawn", canned)
+ args = gate.parse_args(
+ ["--mode", "series", "--weights", "x", "--out", str(tmp_path), "--settle-s", "0"]
+ )
+ assert gate.run_series(args) == 0
+ out = capsys.readouterr().out
+ assert "the series stops here" in out
+ assert "VERDICT INCONCLUSIVE" in out
+ journal = (tmp_path / "series.jsonl").read_text(encoding="utf-8").splitlines()
+ assert [json.loads(line)["name"] for line in journal] == [
+ run["name"] for run in gate.schedule()[:2]
+ ]
+
+ def test_the_verdict_mode_re_applies_the_rule_to_a_saved_series(self, tmp_path, capsys):
+ rows = _rows((-0.05,) * 5, QUIET)
+ (tmp_path / "series.jsonl").write_text(
+ "".join(json.dumps(row) + "\n" for row in rows), encoding="utf-8"
+ )
+ assert gate.main(["--mode", "verdict", "--out", str(tmp_path)]) == 0
+ assert "VERDICT SLOWER" in capsys.readouterr().out
+ saved = json.loads((tmp_path / "verdict.json").read_text(encoding="utf-8"))
+ assert saved["verdict"] == "SLOWER"
+
+ def test_a_trial_on_a_machine_without_cuda_is_a_skip(self, tmp_path, monkeypatch, capsys):
+ torch = pytest.importorskip("torch")
+ monkeypatch.setattr(torch.cuda, "is_available", lambda: False)
+ out = tmp_path / "trial.json"
+ assert gate.main(["--mode", "trial", "--weights", "x", "--out", str(out)]) == 0
+ assert "SKIP: CUDA is required" in capsys.readouterr().out
+ assert json.loads(out.read_text(encoding="utf-8"))["status"] == "skipped"
+
+
+class TestTheStrictDriver:
+ """``--mode strict`` with the four runs replaced by canned results."""
+
+ @staticmethod
+ def _run(monkeypatch, tmp_path, *, ram_pinned, packed_digest="b"):
+ def canned(_args, run, *, strict):
+ assert strict is True
+ pinned = ram_pinned[run["arm"]] if run["mode"] == gate.SUBJECT else 4 * GiB
+ last = packed_digest if (run["mode"], run["arm"]) == ("ram", "packed") else "b"
+ return dict(run, status="ok", pinned_bytes=pinned, digests=[["a", last]] * 3)
+
+ monkeypatch.setattr(gate, "_spawn", canned)
+ tmp_path.mkdir(exist_ok=True)
+ code = gate.main(["--mode", "strict", "--weights", "x", "--out", str(tmp_path)])
+ return code, json.loads((tmp_path / "strict.json").read_text(encoding="utf-8"))
+
+ def test_two_different_plans_with_equal_digests_pass(self, monkeypatch, tmp_path, capsys):
+ code, summary = self._run(
+ monkeypatch, tmp_path, ram_pinned=gate.EXPECTED_SUBJECT_PINNED
+ )
+ assert code == 0
+ assert summary["faults"] == []
+ assert summary["ram"]["exact"] is True
+ assert summary["ram"]["pinned_bytes"] == {"in-order": 8 * GiB, "packed": 6 * GiB}
+ assert "STRICT ram: byte-identical" in capsys.readouterr().out
+
+ def test_equal_digests_from_one_and_the_same_plan_prove_nothing(
+ self, monkeypatch, tmp_path, capsys
+ ):
+ same = {"in-order": 6 * GiB, "packed": 6 * GiB}
+ code, summary = self._run(monkeypatch, tmp_path, ram_pinned=same)
+ assert code == 3
+ assert summary["ram"]["exact"] is True
+ assert "the in-order arm must show 8589934592" in summary["faults"][0]
+ assert "FAULT seed03-ram-in-order" in capsys.readouterr().out
+
+ def test_a_different_digest_fails_the_control(self, monkeypatch, tmp_path, capsys):
+ code, summary = self._run(
+ monkeypatch, tmp_path, ram_pinned=gate.EXPECTED_SUBJECT_PINNED, packed_digest="X"
+ )
+ assert code == 3
+ assert summary["ram"]["exact"] is False
+ assert summary["disk"]["exact"] is True
+ assert "STRICT ram: DIFFERENT" in capsys.readouterr().out
+
+
+class TestOneSpawnedRun:
+ """``_spawn`` with the child process replaced: what the driver makes of each ending."""
+
+ RUN = {"name": "seed03-ram-0-in-order", "seed": 3, "mode": "ram", "arm": "in-order"}
+
+ @staticmethod
+ def _args(tmp_path, *extra):
+ return gate.parse_args(
+ ["--mode", "series", "--weights", "w", "--out", str(tmp_path), *extra]
+ )
+
+ @staticmethod
+ def _child(monkeypatch, *, write=None, returncode=0, raises=None):
+ seen = {}
+
+ def fake_run(command, *, stdout, stderr, env, timeout):
+ seen.update(command=command, env=env, timeout=timeout)
+ if raises is not None:
+ raise raises
+ if write is not None:
+ target = Path(command[command.index("--out") + 1])
+ target.write_text(json.dumps(write), encoding="utf-8")
+ return subprocess.CompletedProcess(command, returncode)
+
+ monkeypatch.setattr(gate.subprocess, "run", fake_run)
+ return seen
+
+ def test_a_finished_run_keeps_its_result_and_gains_the_schedule_fields(
+ self, tmp_path, monkeypatch
+ ):
+ seen = self._child(monkeypatch, write={"status": "ok", "tok_per_s": 400.0})
+ row = gate._spawn(self._args(tmp_path), self.RUN, strict=False)
+ assert row["status"] == "ok" and row["tok_per_s"] == 400.0
+ assert (row["seed"], row["mode"], row["arm"]) == (3, "ram", "in-order")
+ assert row["returncode"] == 0
+ assert "unix" in row["box_before"] and "unix" in row["box_after"]
+ command = seen["command"]
+ assert command[command.index("--arm") + 1] == "in-order"
+ assert command[command.index("--tier") + 1] == "ram"
+ assert "--strict" not in command
+ assert seen["timeout"] == 900.0
+
+ def test_a_strict_run_is_three_steps_no_warm_up_and_deterministic_cublas(
+ self, tmp_path, monkeypatch
+ ):
+ seen = self._child(monkeypatch, write={"status": "ok"})
+ gate._spawn(self._args(tmp_path), self.RUN, strict=True)
+ command = seen["command"]
+ assert "--strict" in command
+ assert command[command.index("--warmup") + 1] == "0"
+ assert command[command.index("--steps") + 1] == "3"
+ assert seen["env"]["CUBLAS_WORKSPACE_CONFIG"] == ":4096:8"
+
+ def test_a_run_that_hangs_is_stopped_and_counted_as_failed(self, tmp_path, monkeypatch):
+ hang = subprocess.TimeoutExpired(cmd="trial", timeout=30)
+ self._child(monkeypatch, raises=hang)
+ row = gate._spawn(self._args(tmp_path, "--run-timeout-s", "30"), self.RUN, strict=False)
+ assert row["status"] == "failed"
+ assert row["error"] == "stopped after 30 s without a result"
+ assert row["returncode"] is None
+
+ def test_a_child_that_dies_mid_run_is_failed_not_started(self, tmp_path, monkeypatch):
+ self._child(monkeypatch, write={"status": "started"}, returncode=1)
+ row = gate._spawn(self._args(tmp_path), self.RUN, strict=False)
+ assert row["status"] == "failed"
+ assert row["error"] == "the process ended without a result"
+ assert row["returncode"] == 1
+
+ def test_an_earlier_result_of_the_same_name_is_never_read_as_this_run(
+ self, tmp_path, monkeypatch
+ ):
+ stale = tmp_path / "seed03-ram-0-in-order.json"
+ stale.write_text(json.dumps({"status": "ok", "tok_per_s": 999.0}), encoding="utf-8")
+ self._child(monkeypatch, returncode=1) # the child writes nothing this time
+ row = gate._spawn(self._args(tmp_path), self.RUN, strict=False)
+ assert row["status"] == "failed"
+ assert "no result file" in row["error"]
+ assert "tok_per_s" not in row
diff --git a/tests/test_issue1702_pinned_arena_packing.py b/tests/test_issue1702_pinned_arena_packing.py
new file mode 100644
index 00000000..3b7c6236
--- /dev/null
+++ b/tests/test_issue1702_pinned_arena_packing.py
@@ -0,0 +1,395 @@
+"""#1702 — the pinned store's arenas are packed largest-first when that page-locks less.
+
+``plan_pinned_arenas`` walked the tensors in allocation order and only ever looked at
+the arena it opened last. A Qwen3-8B NF4 store is 3.58 GB of decoder tensors followed
+by two 1.24 GB vocabulary matrices: neither fits behind the decoder, so each opened a
+2 GiB arena of its own and 8 GiB was page-locked for a 6.07 GB store. Measured
+2026-09-28 on an RTX 5070 Laptop (torch 2.14.0+cu130, ``main`` at d7a4f7a7 plus this
+change): the RAM tier's arenas went from 8,589,934,592 to 6,442,450,944 bytes, and
+three deterministic optimizer steps were byte-identical before and after.
+
+The planner now also plans stable first-fit decreasing and returns it ONLY when it
+page-locks strictly fewer bytes. A tie keeps the in-order plan, placement for
+placement, so a store that gains nothing is laid out exactly as before.
+
+Everything but the last class is arithmetic, or pageable CPU memory, and needs no GPU.
+"""
+
+from __future__ import annotations
+
+import functools
+import hashlib
+import random
+from itertools import pairwise
+
+import pytest
+
+import soup_cli.utils.layer_stream_runtime as runtime
+from soup_cli.utils.layer_stream_runtime import plan_pinned_arenas
+
+GiB = 2**30
+SECTOR = 4096
+
+
+def _nf4_sizes(parameters: int) -> list:
+ """One NF4 double-quant linear: packed nibbles, absmax, nested absmax, nested offset."""
+ return [parameters // 2, parameters // 64, parameters // 16384 * 4, 4]
+
+
+#: One Qwen3-8B decoder layer in the runtime's module order: q / k / v / o, the q and k
+#: norms, gate / up / down, the two layernorms. 32 tensors, 99.5 MB.
+_QWEN3_8B_LAYER_BYTES = (
+ _nf4_sizes(4096 * 4096)
+ + _nf4_sizes(1024 * 4096) * 2
+ + _nf4_sizes(4096 * 4096)
+ + [128 * 2] * 2
+ + _nf4_sizes(12288 * 4096) * 3
+ + [4096 * 2] * 2
+)
+#: The whole RAM-tier store: 36 layers, then the embedding and the untied head in bf16.
+_QWEN3_8B_STORE_BYTES = _QWEN3_8B_LAYER_BYTES * 36 + [151936 * 4096 * 2] * 2
+
+#: Qwen3-8B on the disk tier: two decoder staging slots, then the two vocabulary regions.
+_QWEN3_8B_DISK_REGIONS = [99_553_280] * 2 + [1_244_663_808] * 2
+
+
+def _in_order(sizes, **kwargs):
+ """The plan before #1702, through the public function: the candidate cannot win."""
+ with pytest.MonkeyPatch.context() as patch:
+ patch.setattr(runtime, "_plan_largest_first", runtime._plan_in_order)
+ return plan_pinned_arenas(sizes, **kwargs)
+
+
+def _assert_arena_layout(plan, sizes, *, align: int) -> None:
+ assert plan.requested_bytes == sum(sizes)
+ assert len(plan.placements) == len(sizes)
+ assert all(size > 0 and size & (size - 1) == 0 for size in plan.arena_sizes)
+ spans = []
+ for (arena, offset), size in zip(plan.placements, sizes):
+ assert 0 <= arena < len(plan.arena_sizes)
+ assert offset >= 0 and offset % align == 0, (offset, align)
+ assert offset + size <= plan.arena_sizes[arena]
+ if size:
+ spans.append((arena, offset, offset + size))
+ spans.sort()
+ for (left_arena, _lo, left_end), (right_arena, right_start, _hi) in pairwise(spans):
+ if left_arena == right_arena:
+ assert left_end <= right_start
+
+
+def small_arenas(monkeypatch):
+ """A 1 KiB ceiling, so a hand-sized list of tensors spans several arenas."""
+ monkeypatch.setattr(runtime, "PINNED_ARENA_MAX_BYTES", 1024)
+ return {"arena_bytes": 256, "align": 16}
+
+
+class TestTheQwen3Store:
+ """The geometry the saving was measured on, as arithmetic."""
+
+ def test_the_geometry_is_the_measured_store(self):
+ assert len(_QWEN3_8B_LAYER_BYTES) == 32
+ assert len(_QWEN3_8B_STORE_BYTES) == 1154
+ assert sum(_QWEN3_8B_STORE_BYTES) == 6_073_035_760
+
+ def test_in_allocation_order_it_page_locked_four_arenas(self):
+ plan = _in_order(_QWEN3_8B_STORE_BYTES)
+ assert plan.arena_sizes == (2**31,) * 4
+ assert plan.pinned_bytes == 8 * GiB
+ # Each vocabulary matrix alone in an arena, behind a decoder it could not follow.
+ assert plan.placements[-2:] == ((2, 0), (3, 0))
+
+ def test_late_vocabulary_weights_reuse_the_decoder_arenas_slack(self):
+ plan = plan_pinned_arenas(_QWEN3_8B_STORE_BYTES)
+ assert plan.arena_sizes == (2**31,) * 3
+ assert plan.pinned_bytes == 6 * GiB
+ assert plan.pinned_bytes == 6_442_450_944
+ assert plan.placements[-2:] == ((0, 0), (1, 0))
+ _assert_arena_layout(plan, _QWEN3_8B_STORE_BYTES, align=runtime.PINNED_ARENA_ALIGN)
+
+ def test_the_14b_stores_of_issue_901_pack_tighter_too(self):
+ from tests.test_issue901_pinned_arenas import _QWEN14B_NF4_LAYER_BYTES
+
+ nf4 = _QWEN14B_NF4_LAYER_BYTES * 48
+ assert _in_order(nf4).pinned_bytes == 7_381_975_040
+ assert plan_pinned_arenas(nf4).pinned_bytes == 6_845_104_128
+ bf16 = ([141_557_760] * 3 + [52_428_800] * 2 + [10_485_760] * 2 + [10_240] * 2) * 48
+ assert _in_order(bf16).pinned_bytes == 28_991_029_248
+ packed = plan_pinned_arenas(bf16)
+ assert packed.pinned_bytes == 26_843_545_600
+ # The request size did not grow: still the 1 GiB the bf16 store already asked for.
+ assert set(packed.arena_sizes) == {2**30}
+ _assert_arena_layout(packed, bf16, align=runtime.PINNED_ARENA_ALIGN)
+
+
+class TestATieKeepsTheInOrderPlan:
+ def test_equal_cost_disk_staging_retains_original_placements(self):
+ """Either order costs two 2 GiB arenas, so nothing about the disk tier moves."""
+ sizes = _QWEN3_8B_DISK_REGIONS
+ plan = plan_pinned_arenas(sizes, align=SECTOR)
+ assert plan.arena_sizes == (2**31, 2**31)
+ assert plan.placements == ((0, 0), (0, sizes[0]), (0, sizes[0] * 2), (1, 0))
+ assert plan == _in_order(sizes, align=SECTOR)
+
+ def test_the_70b_disk_staging_is_unchanged(self):
+ sizes = [441434112, 441434112, 536875008, 536875008]
+ assert plan_pinned_arenas(sizes, align=SECTOR) == _in_order(sizes, align=SECTOR)
+
+ def test_the_same_arena_count_is_not_a_saving_when_the_trim_rounds_up(self, small_arenas):
+ """Largest-first needs four arenas here as well, but its last one holds 334 bytes
+ and trims to 512 where the in-order one holds 249 and trims to 256."""
+ sizes = [503, 94, 121, 250, 345, 211, 444, 170, 138, 578, 142, 105]
+ candidate = runtime._plan_largest_first(sizes, 1024, 16)
+ assert candidate.arena_sizes == (1024, 1024, 1024, 512)
+ plan = plan_pinned_arenas(sizes, **small_arenas)
+ assert plan.arena_sizes == (1024, 1024, 1024, 256)
+ assert plan.placements == (
+ *((0, 0), (0, 512), (0, 608), (0, 736)),
+ *((1, 0), (1, 352), (1, 576)),
+ *((2, 0), (2, 176), (2, 320)),
+ *((3, 0), (3, 144)),
+ )
+
+ def test_a_single_arena_store_is_left_alone(self):
+ sizes = [3_000_000, 700_000, 5, 12_345_678, 1, 0, 999_999]
+ assert plan_pinned_arenas(sizes) == _in_order(sizes)
+
+
+class TestThePackedLayout:
+ def test_placements_stay_indexed_by_allocation_order(self, small_arenas):
+ """Bytes written through the plan come back through the plan: the tensor at
+ index 6 is the first one placed, and is still the one read at index 6."""
+ sizes = [256] * 6 + [600, 600, 4, 0]
+ assert _in_order(sizes, **small_arenas).pinned_bytes == 3584
+ plan = plan_pinned_arenas(sizes, **small_arenas)
+ assert plan.pinned_bytes == 3072
+ assert plan.placements[6] == (0, 0)
+ assert plan.placements[7] == (1, 0)
+ _assert_arena_layout(plan, sizes, align=16)
+ arenas = [bytearray(size) for size in plan.arena_sizes]
+ payloads = [bytes([index + 1]) * size for index, size in enumerate(sizes)]
+ for payload, (arena, offset) in zip(payloads, plan.placements):
+ arenas[arena][offset : offset + len(payload)] = payload
+ for payload, (arena, offset) in zip(payloads, plan.placements):
+ assert bytes(arenas[arena][offset : offset + len(payload)]) == payload
+
+ def test_equal_sizes_keep_their_allocation_order(self, small_arenas):
+ sizes = [256] * 6 + [600, 600, 4, 0]
+ plan = plan_pinned_arenas(sizes, **small_arenas)
+ equal = list(plan.placements[:6])
+ assert equal == sorted(equal)
+ assert plan == plan_pinned_arenas(list(sizes), **small_arenas)
+
+ @pytest.mark.parametrize("align", [1, 256, 4096])
+ def test_zero_byte_and_oversized_tensors_keep_their_contracts(self, align):
+ """A tensor past the 2 GiB ceiling still gets an arena that fits it, and the
+ small ones now fill that arena's tail instead of opening one of their own."""
+ sizes = [4, 0, 2**31 + 1, 0, 2**31 + 33, 1, 0]
+ assert len(_in_order(sizes, align=align).arena_sizes) == 3
+ plan = plan_pinned_arenas(sizes, align=align)
+ assert plan.arena_sizes == (2**32, 2**32)
+ _assert_arena_layout(plan, sizes, align=align)
+
+ def test_every_plan_is_valid_and_never_costs_more_than_the_in_order_one(self, small_arenas):
+ rng = random.Random(1702)
+
+ def draw() -> int:
+ # Half the tensors tiny or empty, a third ordinary, a sixth past the ceiling.
+ kind = rng.randrange(6)
+ if kind < 3:
+ return (0, 1, 4)[kind]
+ return rng.randint(1, 700) if kind < 5 else rng.randint(900, 2600)
+
+ packed = kept = 0
+ for _case in range(400):
+ sizes = [draw() for _ in range(rng.randint(1, 40))]
+ align = rng.choice((1, 16, 64))
+ plan = plan_pinned_arenas(sizes, arena_bytes=256, align=align)
+ before = _in_order(sizes, arena_bytes=256, align=align)
+ _assert_arena_layout(plan, sizes, align=align)
+ assert plan.pinned_bytes <= before.pinned_bytes, sizes
+ if plan.pinned_bytes == before.pinned_bytes:
+ assert plan == before, sizes
+ kept += 1
+ else:
+ packed += 1
+ # Both branches are exercised, or the loop above proves nothing about one of them.
+ assert packed >= 100 and kept >= 20, (packed, kept)
+
+
+# ==========================================================================
+# The disk tier reads the same plan (CPU: pageable memory stands in for the arenas)
+# ==========================================================================
+def _aligned_arena(size: int, off_by: int = 0):
+ """``size`` bytes whose first byte sits ``off_by`` past a sector boundary."""
+ torch = pytest.importorskip("torch")
+ buffer = torch.empty(size + 2 * SECTOR, dtype=torch.uint8)
+ pad = (off_by - buffer.data_ptr()) % SECTOR
+ return buffer[pad : pad + size]
+
+
+def sector_arenas(monkeypatch):
+ """Staging planned at a 4-sector ceiling, so eight small regions span three arenas."""
+ monkeypatch.setattr(runtime, "PINNED_ARENA_MAX_BYTES", 4 * SECTOR)
+ monkeypatch.setattr(
+ runtime, "plan_pinned_arenas", functools.partial(plan_pinned_arenas, arena_bytes=4 * SECTOR)
+ )
+
+
+def _stage(monkeypatch, region_sizes, *, off_by: int):
+ import soup_cli.utils.async_disk_source as disk
+
+ allocated = []
+
+ def allocate(size: int):
+ allocated.append(size)
+ return _aligned_arena(size, off_by)
+
+ monkeypatch.setattr(disk, "_allocate_pinned_arena", allocate)
+ source = disk.AsyncDiskSource.__new__(disk.AsyncDiskSource)
+ source.pinned = True
+ arenas, regions = source._allocate_staging(region_sizes)
+ return source, arenas, regions, allocated
+
+
[email protected]("sector_arenas")
+class TestTheDiskTierStagesAPackedPlan:
+ #: Six one-sector regions, then two of three sectors. In order: 4 + 2 + 4 + 4
+ #: sectors of arena. Largest-first: three arenas of 4, every one exactly full.
+ REGIONS = [SECTOR] * 6 + [3 * SECTOR, 3 * SECTOR]
+
+ def test_the_fixture_selects_the_packed_plan(self):
+ before = _in_order(self.REGIONS, arena_bytes=4 * SECTOR, align=SECTOR)
+ assert [size // SECTOR for size in before.arena_sizes] == [4, 2, 4, 4]
+ plan = plan_pinned_arenas(self.REGIONS, arena_bytes=4 * SECTOR, align=SECTOR)
+ assert [size // SECTOR for size in plan.arena_sizes] == [4, 4, 4]
+
+ def test_each_region_is_carved_at_its_own_index(self, monkeypatch):
+ source, arenas, regions, allocated = _stage(monkeypatch, self.REGIONS, off_by=0)
+ assert allocated == [4 * SECTOR] * 3
+ assert source.pinned_bytes == 12 * SECTOR
+ assert [region.numel() for region in regions] == self.REGIONS
+ assert all(region.data_ptr() % SECTOR == 0 for region in regions)
+ # The first three-sector region was placed first, and is still region 6.
+ assert regions[6].data_ptr() == arenas[0].data_ptr()
+ assert regions[7].data_ptr() == arenas[1].data_ptr()
+ spans = sorted((r.data_ptr(), r.data_ptr() + r.numel()) for r in regions)
+ assert all(end <= start for (_, end), (start, _) in pairwise(spans))
+
+ def test_a_full_packed_arena_off_a_sector_boundary_takes_the_next_size_up(self, monkeypatch):
+ """#1531 meets #1702: a packed arena has no slack to shift in, so a base that
+ comes back 512 bytes off a sector boundary costs the next power of two, exactly
+ as an in-order arena that happens to be full does. The regions stay aligned."""
+ source, arenas, regions, allocated = _stage(monkeypatch, self.REGIONS, off_by=512)
+ assert allocated == [4 * SECTOR, 8 * SECTOR] * 3
+ assert [arena.numel() for arena in arenas] == [8 * SECTOR] * 3
+ assert source.pinned_bytes == 24 * SECTOR
+ assert [region.numel() for region in regions] == self.REGIONS
+ assert all(region.data_ptr() % SECTOR == 0 for region in regions)
+ spans = sorted((r.data_ptr(), r.data_ptr() + r.numel()) for r in regions)
+ assert all(end <= start for (_, end), (start, _) in pairwise(spans))
+
+
+# ==========================================================================
+# Real hardware: a store that DOES select the packed plan
+# ==========================================================================
+def _release_packed_fixture_pinned_cache():
+ yield
+ # The test's locals are gone by teardown: hand its cached arenas back, so the
+ # hardware tests that run after it do not inherit them.
+ import gc
+
+ import torch
+
+ from soup_cli.utils.layer_stream_runtime import release_cached_pinned_memory
+
+ torch.cuda.synchronize()
+ gc.collect()
+ release_cached_pinned_memory()
+
+
[email protected]("_release_packed_fixture_pinned_cache")
+class TestOnRealHardware:
+ def test_a_packed_store_is_bit_identical_pinned_and_copies_to_the_gpu(
+ self, tmp_path, monkeypatch
+ ):
+ """Every hardware fixture of #901 fits one arena or ties, so none of them runs
+ a reordered plan. This one does: six 256 KiB tensors, then two of 600 KiB and a
+ scalar, under a 1 MiB ceiling. In order: 1 MiB + 512 KiB + 1 MiB + 1 MiB.
+ Largest-first: three arenas of 1 MiB."""
+ import torch
+ from safetensors import safe_open
+ from safetensors.torch import save_file
+
+ from soup_cli.utils.layer_shard import layer_shard_path
+
+ monkeypatch.setattr(runtime, "PINNED_ARENA_MAX_BYTES", 2**20)
+ arena_floor = 2**18
+ expected_sizes = [2**18] * 6 + [600 * 1024, 600 * 1024, 4]
+ assert _in_order(expected_sizes, arena_bytes=arena_floor).pinned_bytes == 7 * 2**19
+ plan = plan_pinned_arenas(expected_sizes, arena_bytes=arena_floor)
+ assert plan.arena_sizes == (2**20, 2**20, 2**20)
+ assert plan.requested_bytes == 2_801_668
+ assert plan.placements[6] == (0, 0)
+ assert plan.placements[0] != (0, 0)
+
+ weights = {
+ "a_00_packed": torch.arange(2**18, dtype=torch.int64).remainder(251).to(torch.uint8),
+ "a_01_absmax": torch.linspace(-1.0, 1.0, 2**16, dtype=torch.float32),
+ "a_02_norm": torch.arange(2**17, dtype=torch.int32).remainder(997).to(torch.bfloat16),
+ "a_03_packed": torch.full((2**18,), 37, dtype=torch.uint8),
+ "a_04_absmax": torch.linspace(0.25, 2.0, 2**16, dtype=torch.float32),
+ "a_05_norm": torch.full((2**17,), 3.25, dtype=torch.bfloat16),
+ "z_00_vocab": torch.arange(300 * 1024, dtype=torch.int32)
+ .remainder(97)
+ .to(torch.bfloat16)
+ .reshape(600, 512),
+ "z_01_matrix": torch.arange(150 * 1024, dtype=torch.float32).reshape(300, 512) * 0.125,
+ "z_02_nested_offset": torch.tensor(0.03125, dtype=torch.float32),
+ }
+ shard_dir = tmp_path / "shards"
+ shard_dir.mkdir()
+ path = layer_shard_path(str(shard_dir), 0)
+ save_file(weights, path)
+ with open(path, "rb") as handle:
+ source_hash = hashlib.sha256(handle.read()).hexdigest()
+ spec = runtime.RamSource.spec_from_shard(str(shard_dir))
+ assert list(spec) == list(weights)
+ actual_sizes = [weights[name].numel() * weights[name].element_size() for name in spec]
+ assert actual_sizes == expected_sizes
+
+ torch.cuda.init()
+ torch.cuda.synchronize()
+ before = int(torch.cuda.host_memory_stats()["active_bytes.current"])
+ source = runtime.RamSource(str(shard_dir), 1, spec, pin=True, arena_bytes=arena_floor)
+ after = int(torch.cuda.host_memory_stats()["active_bytes.current"])
+ assert source.pinned_bytes == plan.pinned_bytes == after - before
+ assert source.arena_sizes == plan.arena_sizes
+ assert source.nbytes == sum(expected_sizes)
+
+ spans = []
+ storages = set()
+ with safe_open(path, framework="pt", device="cpu") as handle:
+ for name in spec:
+ got = source.get(0, name)
+ expected = handle.get_tensor(name)
+ assert got.device.type == "cpu" and got.is_pinned()
+ assert got.shape == expected.shape and got.dtype == expected.dtype
+ assert got.is_contiguous()
+ assert got.data_ptr() % runtime.PINNED_ARENA_ALIGN == 0
+ # Flattened first, so the 0-dim sidecar can be reinterpreted as bytes too.
+ expected_bytes = expected.reshape(-1).view(torch.uint8)
+ assert torch.equal(got.reshape(-1).view(torch.uint8), expected_bytes), name
+ storages.add(got.untyped_storage().data_ptr())
+ spans.append((got.data_ptr(), got.data_ptr() + got.numel() * got.element_size()))
+ copied = got.to(device="cuda", non_blocking=True)
+ torch.cuda.synchronize()
+ assert torch.equal(copied.cpu().reshape(-1).view(torch.uint8), expected_bytes), name
+ assert len(storages) == 3
+ spans.sort()
+ assert all(end <= next_start for (_, end), (next_start, _) in pairwise(spans))
+ with open(path, "rb") as handle:
+ assert hashlib.sha256(handle.read()).hexdigest() == source_hash
diff --git a/tests/test_issue901_pinned_arenas.py b/tests/test_issue901_pinned_arenas.py
index 2999df59..d867e43b 100644
--- a/tests/test_issue901_pinned_arenas.py
+++ b/tests/test_issue901_pinned_arenas.py
@@ -114,15 +114,17 @@ class TestPlanPinnedArenas:
the alternative, an arena sized by whatever tensor opened it, packed a
bf16 14B store one projection per arena. Hand-derived on the reviewer's
shape at a size where the last arena's tail does not dominate: 1000 x
- 8 MiB plus one 300 MiB outlier -> 2 GiB capacity; arenas 0-2 take 256
- tensors each, arena 3 takes the remaining 232 (1856 MiB) and cannot fit
- the outlier, which opens arena 4 alone and is trimmed to 512 MiB."""
+ 8 MiB plus one 300 MiB outlier -> 2 GiB capacity. In allocation order
+ arenas 0-2 took 256 tensors each, arena 3 the remaining 232 (1856 MiB),
+ and the outlier opened arena 4 alone, trimmed to 512 MiB. Largest-first
+ (#1702) puts the outlier down first: 218 tensors fill arena 0 behind it,
+ arenas 1-3 take 256 each, and the last 14 (112 MiB) trim to 128 MiB."""
from soup_cli.utils.layer_stream_runtime import plan_pinned_arenas
sizes = [8 * MiB] * 1000 + [300 * MiB]
plan = plan_pinned_arenas(sizes)
- assert plan.arena_sizes == (2**31, 2**31, 2**31, 2**31, 2**29)
- assert plan.placements[-1] == (4, 0)
+ assert plan.arena_sizes == (2**31, 2**31, 2**31, 2**31, 2**27)
+ assert plan.placements[-1] == (0, 0)
assert plan.pinned_bytes <= 1.10 * sum(sizes), plan.pinned_bytes / sum(sizes)
def test_the_last_arena_is_trimmed_to_what_it_holds(self):