Skip to content

Test the case when max_new_tokens is very large - #1038

Merged
Ying1123 merged 3 commits into
mainfrom
pr-test-constrained-memory
Aug 11, 2024
Merged

Ying1123 merged 3 commits into
mainfrom
pr-test-constrained-memory

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

No description provided.

@Ying1123
Ying1123 enabled auto-merge (squash) August 11, 2024 23:26
@Ying1123
Ying1123 merged commit d84c5e7 into main Aug 11, 2024
@Ying1123
Ying1123 deleted the pr-test-constrained-memory branch August 11, 2024 23:41
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…osts

THE OBJECTION THIS ANSWERS IS THIS MODULE'S OWN. `arm_process_trace` passes no
`max_entries` on purpose: sgl-project#602's capture came back exactly full at 100000,
holding its final 10.7 seconds, and a ring that wraps SILENTLY turns "this post
has no allocation event" into an untrue statement. That argument is about
SILENCE, not about caps, and it stops applying the moment the wrap is COUNTED.

A cap became necessary with sgl-project#1054's held-open window. The ring then grows for
the life of the process on a swapless box that has already host-OOM-killed
serving WITHOUT foreign load (sgl-project#1038: oom_kill 6->7 across one boot death), where
serving carries oom_score_adj=500 and is therefore the preferred victim -- so
the cgroup counter would name the victim and never the cause. A diagnostic boot
that kills the box measures nothing.

THE DROP COUNT IS DERIVED, NOT GUESSED, and this is the part that makes the cap
admissible. torch reports no drops, but
`memory_stats()["allocation.all.allocated"]` is a monotone count of every
allocation the process has made. Sampled at arm time and again at each dump, the
difference is how many events the ring was OFFERED; everything past the cap fell
out of it. `ring_loss_report()` prints that with every snapshot, beside the
artifact's path, so a reader opening the pickle six boots from now does not have
to reconstruct whether it wrapped. Three states, never two: a complete window, a
named number of dropped events, or UNKNOWN when torch's counter was unreadable
-- and UNKNOWN is never rendered as "none dropped", because an unmeasurable
loss is not an absent loss.

Scope kept honest in both directions:
* Uncapped remains the DEFAULT and is still called the better record. The cap is
  opt-in, for the one configuration that needs it.
* A malformed cap value falls back to UNCAPPED, never to a zero-entry ring --
  the failure mode of `int(raw)` on a typo would otherwise be a silently empty
  trace that looks like a boot which allocated nothing.
* The module docstring's "max_entries is therefore never capped here" is
  corrected in place rather than left to contradict the code.
* The ring is BYCATCH for this campaign anyway: the load-bearing artifacts are
  the snapshots at the corridor guard's first dip and in the crash handler,
  whose per-block stacks come from the live allocator's segments, not from the
  ring.

Launcher side (uncommitted, /spinning/gpu-arb): the diagnostic branch arms ONE
rank by default -- rank 0, the rank boot 24 died on -- rather than all three, so
one uncapped-by-default post does not become three; caps the ring at 3,000,000
entries; and runs `devtools/diag_host_preflight.sh` first, which prices the ring
against `free -g` and the sgl-project#721 16 GiB floor and REFUSES the launch rather than
discovering the shortfall by dying. Measured now: 109 GiB available, ring bound
1 GiB at that cap, 92 GiB headroom. The pre-flight states what it does NOT cover
-- it prices the ring only, not the serving posts and not the unmeasured
transient the boot exists to measure, so a PASS is not a promise that this boot
cannot host-OOM.

FUTURE CHECK: `devtools/check_1054_memory_truth.py` grew four assertions --
uncapped by default, cap read when set, malformed cap falls back to uncapped,
and UNKNOWN never rendered as zero drops. 15/15 green.

EVIDENCE TIER: DESK-PROVEN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants