Skip to content

Adjust InputeMetadata and ScheduleBatch - #981

Merged
hnyls2002 merged 13 commits into
mainfrom
refactor-inputmetadata
Aug 8, 2024
Merged

hnyls2002 merged 13 commits into
mainfrom
refactor-inputmetadata

Conversation

@hnyls2002

Copy link
Copy Markdown
Collaborator

Thank you for your contribution, we really appreciate it. The following instructions will help improve your pull request and make it easier to receive feedback. If there are any items you don't understand, don't worry. Just submit the pull request and ask the maintainers for help.

Motivation

Make schedule batch more specific with scheduling and input metadata more specific with forward info.

Checklist

  1. Ensure pre-commit pre-commit run --all-files or other linting tools are used to fix potential lint issues.
  2. Confirm that modifications are covered by complete unit tests. If not, please add more unit tests for correctness.
  3. Modify documentation as needed, such as docstrings or example tutorials.

@hnyls2002
hnyls2002 force-pushed the refactor-inputmetadata branch 2 times, most recently from e4240f9 to 426e0b7 Compare August 8, 2024 03:20
@hnyls2002
hnyls2002 force-pushed the refactor-inputmetadata branch from 426e0b7 to 557492c Compare August 8, 2024 03:23
@hnyls2002
hnyls2002 force-pushed the refactor-inputmetadata branch from 15ba79a to 46ef149 Compare August 8, 2024 06:30
@hnyls2002
hnyls2002 force-pushed the refactor-inputmetadata branch from 46ef149 to 1e6c735 Compare August 8, 2024 06:31
@hnyls2002 hnyls2002 mentioned this pull request Aug 8, 2024
@hnyls2002
hnyls2002 merged commit 1ac304e into main Aug 8, 2024
@hnyls2002
hnyls2002 deleted the refactor-inputmetadata branch August 8, 2024 08:11
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 28, 2026
…it travels

Boot-2 ring wedge (R3a root H3): the output ring's intermediate-hop
predicates serve the LAGGED slot -- the sender forwards on `if pp_outputs:`
(what it took off the wire last iteration), the receiver reads its own
`mbs[next_mb_id]`, committed passes earlier -- and sgl-project#951's launched posting
is a SAME-SLOT closure that cannot retract a batch already resident there.
The uncovered path is the void relay: `pp_void_relay_stop_rank` derives its
stop from the RETRACTION structure, so a void that names no retraction
(sgl-project#944's zero-offer escape: a rank that lost the request retracts nothing
and launches nothing) was forwarded to a rank whose slot for it was empty,
taken off the wire by that rank's next ADMISSION receive, stashed, and
served POSITIONALLY to a healthy later generation's receive -- which
`_pp_absorb_void_output` then emptied on one rank only, leaving the ring
one message short for ever. PP2 sat in `_do_recv` unbounded because sgl-project#971's
busy wire kept the sgl-project#789 gate early-returning (consumed<posted); boot 1
only survived on a counter another defect had frozen.

Fix: the launched CHAIN -- the same per-hop statement sgl-project#951 consumes, kept
per generation. `_PP_LAUNCHED_CHAIN_KEY` accumulates one bool per rank on
the admission decision (PP0 starts it, every hop appends its own
`mbs[mb_id] is not None`, the last rank records without sending, sgl-project#796),
rides back on the slot's output/void via
`pp_output_payload_with_return_trip`, and `pp_void_forward_payload`
consults `pp_void_relay_launched_verdict`: a void travels exactly to the
ranks whose own admission-time statement says they launched, never to its
source. Absent chain falls back to the legacy rule byte for byte. Log-only
`sgl-project#978 STALE VOID` tripwire in `_pp_absorb_void_output`.

Red-first, measured 2026-08-28 against the unfixed tree
(TheLaggedSlotIsBeyondTheLaunchedPosting):
test_the_launched_chain_relay_stop_closes_the_lagged_slot FAILED -- stuck
[0,1,2], PP2 parked in output_exchange, PP1 event `pass=7 void_absorbed
slot=2` against hazard slot 1 (the mispair), with sgl-project#951 wired in AND
CHAN_DICT counters armed (the readiness gate ran and early-returned:
boot-2 fidelity, not boot-1's frozen-counter accident). Count check:
1 failed, 1 passed of 2. After the fix: 2 passed; the wedge stays
measurable via fix_off (spawn worker forces the verdict back to legacy --
mutant on the hazard direction, reproduces the wedge). The verdict pure
function is pinned exhaustively over rings 2..8; three boundary mutants
(hand back to source / read own entry / short chain forwards) all fall.

Suites: neighbor baseline before == after. Before: 95 passed (801, 791b,
795, 797, 951, idle-void, void-send families, 262s). After: 100 collected,
99 passed + 1 failed, the 1 a harness-stub interface drift in
test_pp_retracted_pass_void_797.py (local recorder lacking the new kwarg;
repaired, no assertion touched; file then 31 passed). ruff: only the one
finding already present on HEAD; codespell clean.

sgl-project#981 boundary, checked before push (CPG_DERIVATION_0828 (b)): this fix's
predicate does NOT stand on the `_pp_output_expected_incoming` memo. The
chain's write (decision recv), reset (top-of-body block) and consumption
(decision send) all live inside full body iterations; the resume-slot
jump's `continue` sits before the reset block but consumes nothing before
the next full body resets. The by-slot chain is written only at a slot's
admission and read while that generation is resident. K3's ungated
admission recv and the clear-site-behind-skip fragility remain sgl-project#981.
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