Repository navigation
[Do not merge] Test torchao - #1377
Closed
jerryzh168 wants to merge 1 commit into
Closed
jerryzh168 wants to merge 1 commit into
jerryzh168 wants to merge 1 commit into
Conversation
merrymercy
marked this pull request as draft
September 22, 2024 08:41
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 13, 2026
…metic that separates the boots
Step 1 of the user's desk order (13.09.), and the prerequisite for the ledger
replay: the W11 gate needs a recorded cushion, and until now the only place it
existed was the v3 sampler's CSV.
THE FORM THAT WAS ORDERED FIRST IS NOT THE GATE, measured against both boots:
predicted_run_peak + FLOOR <= bound
xsn31/2 90.66 + 1.50 = 92.16 <= 94.43 -> funds
xsn31/3 90.66 + 1.50 = 92.16 <= 94.43 -> funds <-- and W98 fired
Both pass, so it is a floor (kept, from the previous commit) and not this gate.
What consumed the cushion is PINNED SHM, not predicted peak: sgl-project#1374's Option 1
sizing took the bounce 7.79 -> 15.75 GiB (5 lanes x 24 slots x 128 MiB), and
xsn31/2 cushion_min 6.99 - (15.75 - 7.79) = -0.97 < 1.50
(the boot then measured cushion=0.20 and latched)
TWO PRODUCERS, both hermetic and both executed against the real evidence:
* `cushion_min_from_sampler(csv)` -- the MINIMUM of the v3 sampler's own
`cushion_gib` column. A mean hides the dip that fires the latch; a
last-sample reading hides it whenever the boot recovered. Measured on
weg2xsn31's own file: 916 samples, min 0.05 GiB. Returns None -- NEVER 0.0
-- when the column is absent, because "no measurement" must not read as
"no cushion left" and refuse every arm on a box whose sampler was not
armed.
* `cushion_headroom_gib(cushion_min, bounce_now, bounce_then)` -- the W11
arithmetic. None in, None out: without a recorded cushion there is no
prediction and the caller says "not measurable" rather than inventing one.
REPLAY, executed: xsn31/3 -> -0.97, REFUSED; xsn31/2 -> 6.99, funds; absent
sampler -> None. The peak+floor form is kept in the test as a MEASUREMENT, so
the corrected formula cannot quietly drift back to the one that would have
passed xsn31/3.
34 passed across the two 1377 files plus the 1360 deviation and 1361
provenance suites. ruff: host_ledger.py 6 findings, exactly the base's 6; the
new test file clean.
NEXT, per the order: the sidecar/record promotion of this minimum (so the ARM
can read it without the CSV), then the ledger replay over every record with
both invariants, then pyright, then the CPU whole-boot probe. The lane knob
comes after the probe, and no BOOT-KANDIDAT goes out before all of it is green.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 13, 2026
…e record, through one named seam
STEP 2 of the desk order: the W11 gate needs a RECORDED cushion, and the only
place the number existed was the v3 sampler's CSV.
ONE NAMED SEAM, not a second path convention. `ENV_HOSTSAMPLE_CSV`
("WEG2_HOSTSAMPLE_CSV") is published by whoever ARMS the sampler and read by
whoever writes the record. The convention
`<evidence>/<tag>_<date>/hostsample_<tag>.csv` is therefore never re-derived in
a second place -- re-deriving it is exactly how a reader and a writer come to
describe two different boots.
* `cushion_min_of_this_boot()` -- the env seam, returning None when the
sampler was not armed.
* `flip_ratchet_record(..., cushion_min_gib=...)` -- the field rides with the
ratchet, in the same entry, written at the same moment.
* front.py fills it from the one producer at the one call site.
None STAYS a verdict of its own. A boot without the sampler has no cushion
measurement, and the arm must say "not measurable" rather than fund on an
invented number or refuse on a 0 that would lock out every unsampled box.
EXECUTED END TO END: env unset -> None; env set to weg2xsn31's own CSV -> 0.05
GiB (916 samples); the record then carries `cushion_min_gib=0.046` beside
`flip_ratchet_gib=-0.964`.
LEDGER REPLAY over the recorded boots, with the verdict table:
boot cushion bounce predicted verdict
weg2xsn28 6.99 7.79 6.99 fund 6.99 >= 1.50
weg2xsn29 6.99 7.79 6.99 fund
weg2xsn30 6.99 7.79 6.99 fund
weg2xsn31/2 6.99 7.79 6.99 fund
weg2xsn31/3 6.99 15.75 -0.97 REFUSE -0.97 < 1.50
i.e. every boot at the old bounce funds and only the Option-1 sizing refuses,
which is the separation the ordered `peak + floor` form could not make. The
6.99 is the operator's measured minimum for xsn31/2; my own read of xsn31/3's
sampler is 0.05, the boot that latched.
STATED PLAINLY: 0 of the 213 existing samples carry `cushion_min_gib`, because
the field is new. The gate is armed and has no history yet -- it starts
measuring from the next boot, and until then an arm on this box answers "not
measurable" rather than pretending. The one external wiring step left is for
the arm script to export WEG2_HOSTSAMPLE_CSV beside the sampler it already
starts; without it the field stays None and the gate stays honest rather than
wrong.
25 passed across the two 1377 files and the 1360 deviation suite. ruff: 7
findings on host_ledger.py + front.py, exactly the base's 7.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 13, 2026
… the desk runs the REAL launcher, not a rebuild
Walls 6 (W48 bootstrap predicate), 7 (widest_layer_terms signature -> TypeError
in choose_host_ledger) and 9 (same_form_candidates) all lived in the LAUNCHER,
before the first rank. A lane probe cannot see them structurally, and those
three cost three windows. Running the REAL launcher at the desk needed exactly
one thing it did not have: recorded cards.
THE SEAM IS IN `list_devices()`, NOT IN `resolve_cards()`, AND THAT CORRECTION
IS THE COMMIT. I first reported `launcher.py:1593 resolve_cards()` as "the only
consumer" of `list_devices`. That was unchecked and wrong -- I had verified it
as the one CARD-LIST producer and then wrote it as the one READER, which is a
different statement. Measured on this tree: 45 files import `registry.nvml`,
23 `list_devices()` call sites outside video_enhance, five of them on the boot
path (`rig_fingerprint`, `card_totals_from_nvml`, `_device_infos`,
`_real_cards`, `_cards_from_homogeneous_node`). A replay point in the caller
alone would hand the launcher recorded cards while those five kept reading the
RUNNING machine -- one boot, two machines, the seam invisible until metal.
That is DRY-RUN-MISST-LIVE-BOX verbatim. One seam, all readers.
PROVEN, not argued: `test_a_second_boot_path_reader_sees_the_same_cards` drives
`arbiter.card_totals_from_nvml()` under the armed seam and gets the same three
cards. Had the seam sat in `resolve_cards`, that reader would still be on the
live box.
The sieve that separates the readers matters too and is recorded:
`video_enhance/probes.py:593` imports `list_devices` from `video_enhance.nvml`,
NOT from `registry.nvml` -- same name, different module, the same collision
that had me reporting 6/10 instead of 2/16 on get_bool_env_var this morning.
DESIGN: unset -> None, never [] (an empty list is a legitimate answer on a
GPU-less box, and conflating the two makes a desk run look like a machine
without cards instead of an unconfigured one). The recorded rows become the
SAME `DeviceInfo` the live path builds -- one type, one field set, no consumer
can tell the paths apart, and it is not a second implementation of the list.
EXECUTED: the REAL `launcher.main(--dry-run)` against three recorded cards now
runs through residue sweep, credit-counter sweep, the NVML->CUDA ordinal map
(5090 32607 MiB + 2x 3080 20480 MiB, from the recording), the L2 derivation and
the scheduling-knob solve, and then refuses BY NAME:
W71 Weg2XchgResidencyUnarmable: --weg2-weight-source exchange needs a
per-card census (--weg2-xchg-census <path>) and none was given
which is the launcher telling me my invocation was incomplete -- the B4m
fixture carries that census file -- and is exactly the "every refusal by name
is a finding" behaviour this probe is for. Not a defect; the next argv.
4 passed in the new file, 11 with the cushion gate. ruff clean on both.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 13, 2026
…11b's cushion breach Wand 11b (sgl-project#1377) is the open host blocker for the goal-question boot: the bounce prices 5 measured lanes x 3.00 GiB + 0.75 GiB staging = 15.75 GiB on xsn31/3's own checkpoint (front.log:111 xchg_bounce=15.75, front.log:106 lanes=5 source=measured), and the sleep-leg cushion floor (1.50 GiB) latches at 0.20 (W98 Weg2HostRateLatched) because that growth ate the room. sgl-project#1370 made the bounce PRICED HONESTLY; it did not make it SMALLER. ONE SOURCE, the --xchg-bounce-depth shape (48adc00) reused rather than a second publication path: `BounceTerms.lanes_concurrent` (0 = "not stated", byte-identical -- the same convention `max_tag_bytes` already uses two fields over) caps how many of `n_lanes` price at once through a new `lanes_priced` property; `total_bytes` reads that property instead of `n_lanes` directly. The field rides `_TERM_FIELDS`, so P, D and the host ledger recompute the identical capped total from the published inputs, never a second formula. `checkpoint_census.widest_layer_terms` and `launcher.choose_host_ledger` / `xchg_bounce_terms_for_arm` pass it through unchanged; `main()` resolves the CLI value exactly once (`xchg_bounce.resolve_lanes_concurrent`) and hands the same resolved int to both the ranks' publication call and the ledger's own call, so the two sides cannot disagree about which values are refused. REFUSAL, NOT SILENT DEGRADATION: `--xchg-lanes-concurrent 0` (or negative) is refused (W103 Weg2XchgLanesConcurrentInvalid) rather than folded into the same 0 sentinel BounceTerms uses for "unset" -- collapsing them would run every lane concurrently while the argv says the opposite. W103 is the next free number after a tree-wide census (`grep -rhoE 'W[0-9]+'` tops out at W102); W52/W53/W54/W56/W58 are a documented collision class (sgl-project#1265/sgl-project#1306) of guessed digits, so this one is taken from the census. NAMED AND COUNTED, NEVER SILENT: `WEG2-XCHG-LANES-CONCURRENT lanes_concurrent= lanes_total= lanes_priced= serialised=` is appended to the arm's own line list (appended, not inserted, so lines[0..2]'s existing positional readers are untouched) so a boot can put a number beside the flip-time cost of serialising the lanes this cap does not price. THE COMPUTED EFFECT, on xsn31/3's own geometry (largest tag 2907 MiB, 128 MiB slots -> 24 slots/lane -> 3072 MiB/lane, 0.75 GiB staging, 5 measured lanes): concurrent=2 charges 2 x 3.00 + 0.75 = 6.75 GiB (a 9.00 GiB reduction from the measured 15.75); concurrent=1 charges 3.75 GiB (12.00 GiB reduction). Against xsn31/3's own cushion_min=0.20 (floor 1.50): 0.20 - (-9.00) = 9.20 >= 1.50 at concurrent=2, and 0.20 - (-12.00) = 12.20 >= 1.50 at concurrent=1 -- the invariant holds with wide margin either way, using the boot record's own linear-tracking method (6.99 -> 0.20 explained by the +7.96 GiB bounce growth). NOTE: depth (1 vs 2) changes NOTHING on this checkpoint -- Option 1's tag-need (23 slots + 1 shadow = 24) dominates the depth floor (2 or 3) at both depth=1 and depth=2, so the entire saving here comes from lanes_concurrent alone, not from --xchg-bounce-depth. HONESTY GATE, NAMED HERE NOT BUILT: this commit wires the cap through PRICING only. `weight_updater.py`'s per-rank leg driver still allocates a buffer for every lane it owns unconditionally -- no cross-process concurrency permit exists yet, so a real boot's tmpfs usage may still reach `lanes_total`'s worth even though the ledger now charges `lanes_priced`. A WEG2-XCHG-LANES-CONCURRENT-CAVEAT line names this explicitly whenever a cap actually serialises lanes, pointing at the same 3-way measurement (sgl-project#1358: tmpfs holders, cgroup d_shmem, host-slot lines) that must confirm the real peak before this ARM number is trusted. Tests: test_weg2_xchg_lanes_concurrent_1385.py, 23 cases (hermetic, CUDA_VISIBLE_DEVICES=""), covering the default byte-identical path, the cap actually shrinking the charge (the mutant guard for the OOM direction -- manually verified: reverting `lanes_priced` to `n_lanes` in `total_bytes` fails 3 tests immediately, restored after), refusal for N<1, the W103 census-not-guess check, the named/counted log line (source and execution smoke through a real fake checkpoint), and the one-source property (single `resolve_lanes_concurrent(` call in `main`, both call sites take the same resolved value). test_weg2_widest_layer_census_1332b.py's line-count assertion updated 3->4 for the new appended line (positional indices unchanged). 193 tests green across the full bounce/lane/ledger neighbour suite plus the new file; ruff clean. Default is byte-identical: lanes_concurrent=0 is the "not stated" sentinel, `lanes_priced` returns `n_lanes` unchanged, and no existing caller passes the new keyword.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…e()'s ARM point cushion_headroom_gib (sgl-project#1377) was calibrated and tested (test_weg2_cushion_gate_1377.py) but had zero production call sites: choose()'s existing cushion_ok is predicted_run_peak + FLOOR <= bound, which its own docstring already measured as funding BOTH weg2xsn31/2 and /3 (92.16 <= 94.43 either way) -- W98 fired on /3 anyway, because what consumed the cushion was PINNED SHM bounce growth (7.79 -> 15.75 GiB), not the predicted peak. Adds choose()'s new optional prior_cushion_min_gib/prior_bounce_gib (None by default, byte-identical for every existing caller), folds a new headroom_ok into `ok` via AND only (can tighten, never loosen an existing verdict), and prints cushion_headroom= on the ARM line ALWAYS -- measured or "not measured" -- with its one-term-model/non-monotonic-twice caveat on the same line, so a GREEN reading can never be misread as clearance. RED (negative headroom) is a violated necessary condition and may refuse (W105-guarded both-or-neither on the two new args, folded into the existing W20/W21 refusal text as a new "CUSHION HEADROOM" binding reason, same convention as the existing "CUSHION FLOOR" reason). Wired end-to-end: host_ledger.choose -> launcher.choose_host_ledger (two new forwarded params) -> new --prior-cushion-min-gib/--prior-bounce-gib CLI flags, operator-supplied like --host-riegel-gib (no automatic prior-boot sidecar exists yet). Tests (test_weg2_cushion_headroom_gate_1378_stage2.py, 17 cases, all hermetic CVD=""): red-first reproduction of the xsn31/2->3 transition on a specimen that provably passes both EXISTING single-boot checks (peak_ok, cushion_ok) so the refusal is proven new; green-stays-fundable-and-is-not-a-clearance; printed-line-carries-number-and-caveat-together (funded and refused cases); both-or-neither; structural AND-only conjunction guard; CLI/wrapper plumbing. Manually verified the required danger-direction mutant (dropping "and headroom_ok" from the ok= expression): 4 of 17 tests go red, confirming the wiring enforces refusal rather than only printing an unenforced number; restored, diff empty. Pre-existing failures unrelated to this change, observed in the same run (shm-residue/live-subprocess tests contending with a concurrent live boot on this box, and the v3-sampler-reading test's rig-only CSV): retry() exceed maximum number of retries -- none touch host_ledger.choose or launcher.py's changed lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
not for land
repro error: python3 -m sglang.bench_latency --model meta-llama/Meta-Llama-3-8B --batch-size 1 --input 128 --output 8 --enable-torch-compile --torchao-config int4wo-128