Skip to content

[Feature] Support LoRA path renaming and add LoRA serving benchmarks - #1433

Merged
Ying1123 merged 2 commits into
mainfrom
lora_bench
Sep 15, 2024
Merged

Ying1123 merged 2 commits into
mainfrom
lora_bench

Conversation

@Ying1123

@Ying1123 Ying1123 commented Sep 15, 2024 •

Copy link
Copy Markdown
Contributor

This PR supports LoRA path renaming. See example below:

# launch server
python -m sglang.launch_server --model mistralai/Mistral-7B-Instruct-v0.3 --lora-paths /home/ying/test_lora lora1=/home/ying/test_lora_1 lora2=/home/ying/test_lora_2 --disable-radix --disable-cuda-graph --max-loras-per-batch 4
# send requests
# lora_path[i] specifies the LoRA used for text[i], so make sure they have the same length
# use None to specify base-only prompt, e.x. "lora_path": [None, "/home/ying/test_lora"]
import json
import requests

url = "http://127.0.0.1:30000"
json_data = {
        "text": ["prompt 1", "prompt 2", "prompt 3", "prompt 4", "prompt 5", "prompt 6", "prompt7"],
        "sampling_params": {"max_new_tokens": 32},
        "lora_path": ["/home/ying/test_lora", "lora1", "lora2", "lora1", "lora2", None, None],
}
response = requests.post(
        url + "/generate",
        json=json_data,
)
print(json.dumps(response.json()))

What has been done:

  • Initial LoRA support [Feature] Initial support for multi-LoRA serving #1307
    This PR gives initial multi-LoRA serving support. Currently, it supports LoRA on attention (qkvo) and mlp (gate, up, down) linear layers. It supports dynamic loading and offloading, but it does not support unified memory. The memory pool for LoRA adapters is pre-allocated. Please use a smaller --mem-frac to launch server with larger --max-loras-per-batch.
  • Misc: path renaming (this PR)

You can expect the items below in the follow-up PRs.

  • OpenAI compatible API
  • compatibility with cuda graph
  • compatibility with radix attention
  • fully sharded LoRAs with tensor parallelism
  • performance optimization
  • memory optimization
  • support LoRAs with different ranks
  • add triton backend
  • test cases enhancement

References:
S-LoRA: Serving Thousands of Concurrent LoRA Adapters
Punica: Multi-Tenant LoRA Serving

@Ying1123 Ying1123 changed the title Add LoRA serving benchmark Support LoRA path renaming and add LoRA serving benchmarks Sep 15, 2024
@Ying1123 Ying1123 changed the title Support LoRA path renaming and add LoRA serving benchmarks [Feature] Support LoRA path renaming and add LoRA serving benchmarks Sep 15, 2024
@Ying1123
Ying1123 merged commit 3796339 into main Sep 15, 2024
@Ying1123
Ying1123 deleted the lora_bench branch September 15, 2024 19:46
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
… L2 arena is priced. The ledger never carried the shm arena files (24.96 GiB KV + 1.56 GiB draft + 11.7 GiB mamba = 37.19 GiB on this model) while it still charged the 1 GB rings and the 600 MiB anchors that sgl-project#1430 shrank to 0.05 GB / 100 MiB: new term arena_gib (in the arm sum and the terms line), rings/anchors priced at their REAL fallback sizes (staging_gb / anchor_mib), all derived by the launcher from config.json and the same environment the ranks get (blob size cross-checked against the arena file: 78,446,592 B). Mamba arena 160 slots so the whole term fits the measured headroom. (2) the L3 return path: a page or blob that left the arena for the disk is read straight into a fresh slot and completed (arena_fill_from_disk), wired into the KV, draft and mamba read sites; before this the arena was a write-only sink and every evicted page was recomputed. Tests: 1432 (2), 1433 (2), 1361, 1235, 1397 wiring, 1427 green.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…cht läuft, hält über den Flip keine Arena-Referenz -- Ordnung statt Pin, L3-Kopie im Hintergrund, Referenz erst beim Wake, Host-Zeilen nach dem Load-back zurück (Worker-Spiegel per R12 STATE)

rc12s dkrnfh91dprbar1dauer09271719, D-TP0 17:32:40 (tmp/r989/befund_248_park_l2_pinnt.md): ARENA-REF-HOLDERS n=7 tree=1231 tree_in_use=3982 sum=5213 own_held=5213 -- ein SCHLAFENDES D hielt 5213 von 5461 KV-Arena-Slots per Referenz: die Schlaf-Vorabholung (sgl-project#1443/sgl-project#1455) von 2 Geparkten (1292 Seiten) und 3 im Schlaf eingetroffenen Wartenden (3921). P fand "no free slot" (17:32:21-58, 17:35:18-25), BACKUP-REFUSED arena_claim, parent_unbacked-Kaskade, 4 leere 200 (W50 re-route impossible). Einen Weg "gehalten -> L3 -> frei" gab es nicht (Arena-Eviction nimmt nur Unreferenzierte, der Claim gibt ohne I/O frei, L3 hielt 96 MiB). Nach dem Wake hielt D die geladenen Spannen weiter als tree=5213 bis zum nächsten Reset; auf den Form-A-Workern wuchs derselbe Bestand als byteless Spiegelzeilen im festen 353573-Zeilen-Pool bis zum Reset (sgl-project#249: R12 SHADOW-OWN-EVICT-REFUSED n=1->592, Vote-MIN -> sgl-project#915 TRUNCATED -> W88).

Fix (Form, keine Reserve, keine größere Arena; Schalter SGLANG_WEG2_ENABLE_PARK_L3, Default an, nur Gruppe D; aus = alter Pfad):
1. Referenz erst beim Wake (weg2.park_l3): der Dormant-Hold-Intake schlägt nur nach (P-Kette auf den Request), keine Store-Lesung, keine Referenz, kein Pin im Schlaf. Die Lesung läuft bei sgl-project#1443 DORMANT-RELEASE in Hold-Reihenfolge auf jedem Rang (issue_deferred_reads), das sgl-project#1471-Settle gibt frei, wenn komplett.
2. Park als Ordnung: park_running markiert jeden Geparkten (handoff_pending Rolle "park", Kette in der Marke, mark_park); keep_for liest pending + park, Parks zuerst.
3. L3-Kopie im Hintergrund: Thread weg2-park-demote (D, attn-Rang 0, nie Scheduler-Thread) kopiert gehaltene Seiten per HiCacheFile.arena_copy_to_disk nach L3 OHNE Freigabe -- über den bestehenden Evictor (reserve/commit/abort, 150-GB-Kappe), kein eigener Größen-, Sweep- oder Verzeichnispfad.
4. Claim in drei Stufen, weiter ohne I/O (arena_pool._evict_for_claim): (i) unreferenziert+ungehalten, (ii) gehalten MIT L3-Kopie (frei, arena_fill_from_disk liest zurück), (iii) gehalten ohne Kopie -> benannt HANDOFF-LOST / PARK-LOST. sgl-project#1427 ARENA-DROP nennt stages=i:,ii:,iii:.
5. Nach dem Load-back gibt TP0 die KV-Host-Zeilen des geladenen Pfads zurück (park_l3.release_loaded_host aus loading_check; Seite bleibt COMPLETE in der Arena, Mamba-Anker bleibt), mit R12 STATE je Knoten -> die Worker-Spiegelzeilen gehen beim nächsten Broadcast mit. form_a_host_shadow._reconcile lässt dabei den Anker stehen, wenn TP0 ihn hält (vorher riss ein KV-Verdikt den Anker mit -> SHADOW-SHORT im nächsten Zyklus).
6. PA-Naht (TEILPARKEN_notiz_0927.md §5): handoff_pending.keep_role(rid, "park", page_range=(a,b), page_keys=, page_size=) -> Zahl der Seiten aus [a,b), die zuerst in die Demotion gehen (rang-gleich); keep_role(rid, None) idempotent; keep_state(rid, tree=None) -> {device, l2, l3, pages}; register_pool. Wirft nie.
Instrument: sgl-project#248 HOLD-LOOKUP, WAKE-READ, PARK-MARK, PARK-DEMOTE, KEEP-ROLE, LOADED-HOST-RELEASE; HOLDERS park_kept/handoff_kept.

Tests: test_weg2_park_l3_248 (17: Hold ohne Referenz, Wake-Lesung + Settle, Park-Marke, Claim-Stufen, L3 bytegleich zurück, Demotion ohne Freigabe, 3 Ränge gleiche Keep-Liste, keep_role/keep_state/Teilpark), test_park_l3_loaded_host_r12_248 (5: Metall-Form Load-back -> TP0 und Worker (0,1), Worker-Pool ohne Ratsche über 5 Park/Resume-Zyklen, Worker gibt nie selbst frei, Host-Lock/Host-Blatt bleiben, Schalter aus/Gruppe P = alt). Rot auf 27e1d90738, grün mit Fix. Nachbarsuiten: siehe Bericht, 0 neue Rote.

Metall-Abnahme: own_held(D) im Schlaf ~0; 0x no free slot / BACKUP-REFUSED arena_claim über >=3 Park-Zyklen bei Stau >=5; PARK-DEMOTE vorhanden, Rückkehr per sgl-project#1433 L3->L2 fill digest=match; W50 re-route impossible = 0; LOADED-HOST-RELEASE nach Load-back; R12 SHADOW-OWN-EVICT-REFUSED ohne Ratsche; Flipzeit gegen rc12t prüfen (Wake-Lesung statt Schlaf-Lesung).
(cherry picked from commit 3a339b714dc8b3ba6079ce149cf0442995fd4977)
(cherry picked from commit b606ec3b7283ea679b5f06aa01bec1789b9aed59)
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…uppe nennt die Seitengroesse ihrer Arena (_page_bytes), statt AttributeError

rc12z (786d2f6, D-Log Z. 125604 ff., 01:33:06, TP0; dazu P PP0):
_arena_page_get fragt fuer eine Seite, die nicht mehr in der L2-Arena liegt
(ARENA-EVICT auf Platte), arena_fill_from_disk(pool.arena, [stem],
int(pool._page_bytes)). Auf D-TP0 (Form-A-Host) und allen P-Stufen ist
mem_pool_host eine HostPoolGroup: arena delegiert sie an den Anker-Pool,
_page_bytes nicht -> __getattr__ -> AttributeError: _page_bytes -> #1033d
PREFETCH IO REFUSED. weg2-24-93 (69937 Tok): TP0 completed_local=0,
TP1/TP2 (nackte Arena-Pools) 69568, shortfall 69888 -> W88 -> W50-REROUTE
ueber P -> P PP0 derselbe Fehler -> voller 70k-Prefill. Jeder auf Platte
verdraengte Praefix kam auf TP0 und P nie zurueck (seit sgl-project#1433).

Fix: HostPoolGroup._page_bytes als Property auf den Anker-Pool -- denselben,
dessen arena die Gruppe liefert (eine Mamba-Arena hat eine eigene
Seitengroesse und wird hier nie genannt). Die Draft-Stelle
(cache_controller dpool._page_bytes) liest einen nackten Arena-Pool
(_build_draft_host_pool), keine Gruppe; weitere private Lesungen ueber die
Gruppe im Arena-Lese-/Fill-Pfad gibt es nicht (grep pool\._ in
cache_controller/hybrid_cache_controller/hicache_storage/weg2: nur
_page_bytes und handoff_pending pool._stems, letzteres auf Komponenten-Pools).

Test test_arena_l3_fill_group_rc12z (2, echte C-Arena + ArenaMHAHostPool
in HostPoolGroup + _arena_page_get, Seiten publiziert, aus der Arena
verdraengt, L3-Fill liefert Slots): rot auf 786d2f6 mit genau
'AttributeError: _page_bytes', gruen mit Fix (8/8 Seiten zurueck, Fill mit
64 B = Seitengroesse des Anker-Pools).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…lform (array statt list) -- Admit(0) fuer alle, wenn PP0s Anker am told fehlt

rc12z2 (e8a2cd2, P-Log Z. 226312-226760, 03:26:31-41, rid weg2-44-76):
PP0 las 47168 Tokens (8x 'sgl-project#1433 L3->L2 fill' -- der Rueckweg, den Runde 4
erst oeffnete), klemmte told auf den Store-Anker 37952 (sgl-project#1416 ANCHOR-CLAMP)
und schickte ihn. Beim Zulassen:
  PP0 'sgl-project#904 ... reached=37952 refused=37952 why=MambaComponent:absent'
      -> '[sgl-project#928 anchor] REFUSING resume' -> Zulassung bei 0
  PP2 dasselbe -> 0
  PP1 'sgl-project#988 LOADBACK ... anchor_depth=37952 mamba_restored' -> 37952
PP1 bekam PP0s Zeilen 32768..49152 zu seinem Batch 70720..79688:
'sgl-project#1233 W27 PP WIDTH DIVERGENCE REFUSED ... cause=START-SPLIT', P tot.

Genau dafuer gibt es TF (weg2_told_fidelity, Default an): vor dem Admit
fragt PP0 den eigenen Baum, kann er am told nicht fortsetzen, geht told=0
mit PF-Fallback-Marke an ALLE Stufen (jede gibt ihren Read frei, alle
prefillen ab 0). Auf NF lief TF nie: '#TF told-fidelity probe skipped ...
AssertionError((<class 'array.array'>, <class 'list'>))' 10 von 10 auf
diesem Boot -- _probe_key baute den Schluessel als list, der Baum
vergleicht array('q')-Schluessel (RadixKey.match: assert type(t0) is
type(t1)). Keine Aussage -> Admit blieb 37952, waehrend PP0 selbst 0 nahm.

Fix (kein Schalter, bestehende Vereinbarung): _probe_key baut array('q').
Die #1416d-Klemme teilt den Schluessel; ein Array-Schluessel hasht dieselben
Seiten (compute_node_hash_values hasht die Array-Schluessel des Baums).

Test test_told_fidelity_array_key_rc12z2 (4; Fake-Baum vergleicht mit dem
ECHTEN RadixKey.match gegen einen Array-Knoten, told 37952, Bigram): 3 rot
auf e8a2cd2 (genau 'AssertionError((array.array, list))', Verdikt
(37952, None) statt (0, 0)), gruen mit Fix; Hash-Gleichheit list/array
gruen auf beiden. Die TF-Suite 0927 mass nur len(key) und erreichte den
Vergleicher nie.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
… 16 parallel page reads and one completion; the write-behind is quiet while a load is queued

User 28.09.: "das lesen muss schneller gehen. lesen kostet fast keine energie. neurechnen hingegen sehr viel".
27B boots 28.09. (releasedraft 13:40, parkdraft 14:21): 13 prefill gaps > 2 s on an awake P with work queued,
231 s in all -- 195 s store read (#1416e PACED-TOLD told=16383 own_read=15.40s, told=26543 19.64s, told=41982
24.06s; 1.4-3.2k tokens/s against P's 6-8.5k prefill), 29 s a load queued behind the L3 write-behind
(WEG2-LOAD-DEVICE weg2-1-17 queue_ms=17016 read_ms=227 beside six WRITE-BEHIND passes of ~1.4 s).

Measured on the 27B store (445k 32-KiB pages, NVMe pool, random sample) with this repo's pageio:
1 page/call 10.2k pages/s, 1 call 11.7k/s, 8 threads 62k/s, 16 threads 106k/s, 32 threads 115k/s. The disk was
never the limit: _arena_page_get sent every non-L2 page alone through arena_fill_from_disk (stat, claim, read,
complete, ref, log line "sgl-project#1433 ... 1 of 1 pages"; ARENA-GET ref_ms~745 per 1024 pages).

- cache_controller._arena_page_get: every page past the complete lead that is not in the L2 goes to the L3 in
  ONE fill per ARENA-GET batch; the prefix is walked exactly as before (ends at the first page nothing gives or
  the first failed reference) -- same page count, same group told. The draft-page path batches the same way.
- hicache_storage.arena_fill_from_disk: one claim_slots for the batch (arena-full retried as one claim after one
  eviction), l3_read_pages_parallel (pageio releases the GIL; strided groups on a store-path ThreadPool,
  SGLANG_HICACHE_L3_READ_THREADS default 16, 1 = the serial single call), one complete_slots, one free_slots.
  sgl-project#1433 line names threads, ms, pages_per_s.
- l3_write_behind: quiet ("load") while a store->host load is queued or in flight; the cache controller
  registers storage_loads_pending (prefetch queue + aux buffer + op in flight; weak, a broken probe never
  closes the gate). The pass re-checks the gate every 64 pages.

Before/after on the real store, same kind of sample (8000 pages each, cold first run):
  per-page path (as before) 9.3k pages/s cold, 32.4k warm; batch+16 threads 67.9k cold, 102k warm.
Hermetic microbench (same 2000 pages, page cache): 36.7k -> 130k pages/s.

Tests: test_l3_fast_read_0928.py (5: batch == n single fills with one claim/one completion and the bytes in the
slots; parallel == serial status and bytes, env 1 = serial; _arena_page_get same prefix and one fill per batch;
a failed reference still ends the prefix; microbench >= 2x), test_weg2_hicache_never_slow_0928.py (4: gate quiet
while a load is queued, controller census, broken probe, dead controller). Red on 96f4667 (7 of 9), green here.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 1, 2026
…asses over the sgl-project#243/sgl-project#248 keep (z30y12 epoch 50: six park resumes W31, 381k tokens to P)

Metal z30y12 (df1f815, 30.09.): P PP0 "ARENA-EVICT n=11 want=256" at
23:35:32 (the L3 fill / arena write callers floor want at 256 slots); 3 s
later the MAMBA arena read "ARENA-REF-CENSUS arena-78446592.bin slots=112
complete=0" on every P rank, D's MAMBA census went park_kept=6/12 -> 0/12.
At the 23:35:44 wake all six D-parked requests read their KV back
("HiCache prefetch success ... loaded=53503") but no anchor ("[sgl-project#904
match-census] verdict=refused ... refusers=MambaComponent:53503
why=MambaComponent:absent"), the X gate priced each whole (X-GATE-TERMS
head=0 store=0 floor=0 -> W31) and W50-REROUTE sent 381501 tokens to P --
the flip of epoch 50. weg2-35-112 came through 4 s later with uncached=150
after one anchor page was filled back from L3 (sgl-project#1433, TP1 23:35:47). The
second collapse (D TP0-2 "ARENA-EVICT want=256" 23:42:10, MAMBA complete
110 -> 8) has the same shape.

Root: HiCacheFile._arena_evict_to_disk evicts min(want, every unreferenced
complete slot) with only the pins kept. want >= 256 is larger than the
112-slot MAMBA arena, and the sgl-project#248 park / sgl-project#243 hand-off pages are kept by
ORDER, not by reference -- so one round took them all. The claim path
(_evict_for_claim) has passed over that keep since sgl-project#243/sgl-project#248; the clock evict
never did.

Fix: (1) want is capped at an eighth of the arena's slots (FULL/draft arenas:
90112, i.e. unchanged for every caller; MAMBA: 14); (2) the host pools register
themselves on the backend at bind (register_keep_pool), and the clock evict
passes the pool's handoff_pending.keep_for keys as keep_lo (stage i only:
kept pages are never its candidates).

Tests (CUDA_VISIBLE_DEVICES="" nice -n 19 ionice -c3):
test_evict_keep_mamba_arena_0930.py (real ShmArena): base 2 failed (the
unregistered case is behavioural: 8 of 8 slots evicted), fix 2 passed. Mutant A
(keep_lo dropped): 1 failed (the parked anchor leaves L2). Mutant B (cap
dropped): 2 failed. Affected files (park_l3_248, arena_reset_release_h81,
prefix_trace_in, probe_hold_257, w3_arena_spill, arena_host_pool_1424,
arena_l3_fill_group_rc12z, arena_l3_fill_1433, l3_reuse_after_restart,
hicache_shm_arena_1404, mamba_arena_displace_h19, new file): 94 passed,
4 failed -- the same 4 fail on the base df1f815/92c9c18020 sources
(arena_host_pool_1424 x3, arena_l3_fill_group_rc12z x1), not touched here.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 1, 2026
…miss -- the P followers reach one store depth (z30y14 root)

z30y14 (27B image 02adfaa, 01.10. 03:15:38Z, sgl-project#1400 STORE-TOLD MISMATCH
rid=weg2-64-273 told=97631 own_prefix=93858). The store VIEW was the same on
every rank: PP1 and PP2 both logged ARENA-EVICT n=2 want=256 need=88 at
03:15:36 -- need = len(full) of arena_fill_from_disk's first claim, so all 88
L3 candidates had passed the rank's stat (the shared sgl-project#1459 L3 stem index).
What diverged was the CONCURRENT FILL: both followers filled the same 88
canonical pages at the same second, and arena_fill_from_disk treated a claim
answered status 1 (JOIN: arena.c "write your extents, then complete") as a
miss that ends the prefix. Each rank stopped at the other's first claim --
"sgl-project#1433 L3->L2 fill: 5 of 5" / "12 of 12", "ARENA-FREE reason=
l3fill_past_prefix slots=59" / "55" -- and reached 95684 / 95716 tokens,
while PP0, reading alone one pass earlier, reached 97631. The join's open
writer was also never resolved, and claims given back past the prefix were
freed whole (free_slots) even when the other rank had joined them (#1427r).

The frozen follower census (PP1/PP2 and TP1/TP2: the same file count and
0 B sibling at every wake; NF y6b 66664 files) is NOT a stale read view:
LRUFileEvictor.rescan returns the attach-time census for a non-owner by
design (no walk; rescan_eviction_index docstring). The wake line now says
owner=yes / owner=no (attach-time census reprinted, reads ask sgl-project#1459).

Fix (shared modules, NF-portable):
- python/sglang/srt/mem_cache/hicache_storage.py arena_fill_from_disk: a
  status-1 join with a slot is read and completed like a fresh claim (the
  whole page from the same file; the second completer gets status 2 =
  usable); unread claims (past the prefix, failed read) go back through
  arena.release_claims (frees only a sole claimant), new helper
  _release_fill_claims; a join refused at completion is not freed by the
  joiner; the sgl-project#1433 line counts joined=.
- python/sglang/srt/managers/scheduler_components/weight_updater.py: the
  WEG2-STORE-RESCAN line names owner vs non-owner (appended field only).
PF (d0fd844) stays on as the safety net.

Tests (CUDA_VISIBLE_DEVICES="", real shm arena + real files):
- new test/registered/unit/mem_cache/test_l3fill_join_z30y14.py: red on
  d0fd844 (3 failed: the prefix ends at the other rank's first claim
  [5..], the two followers' depths differ, the joined page is not read),
  green here (4 passed).
- changed area: L3 fill / fast read / probe hold / anchor drop / park L3 /
  substages 59 passed + 1 pre-existing failure (rc12z double lacks prefix=,
  same on d0fd844); test_arena_* family: the same 4 pre-existing failures
  before and after, all else passed; rescan/wake suites 35 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
…or room instead of ending the prefix

NF h8 2b27c61 (boot 1014_115938), P: of 10 boot-start requests 9
loaded exactly their store depth; weg2-0-10 (1853 pages in the store,
presence 118592) loaded 56320 -- the whole 8 % (62272 of 750464 tokens).

Not a missing file. PP0 12:04:14: the 1024-page batch had 47 pages in
the arena, filled 837 from disk ('sgl-project#1433 837 of 837'), and 140 stems found
the shared arena FULL (ARENA-PRESENT complete 0 -> 6484 of 6485 in 27 s
of boot-start reads; 'ARENA-EVICT need=140', every slot referenced by a
read or pinned by a running load-back). Those stems got no slot and
ended the prefix at 884 pages; the room came back within seconds
(complete 5981 at 12:04:45).

Fix: after the fill read its own claims, the stems that are still FULL
are evicted + claimed again every 25 ms, at most
SGLANG_WEG2_L3FILL_ROOM_WAIT_MS=1500 (prefetch io threads only; 0 = the
old form); what gets a slot is read at once, the prefix is cut on what
landed. Own claims past a FULL stem are no longer freed unread.

The sgl-project#1472 READ-TRACE no-file lines come from
_collect_existing_component_keys, which asks every component for every
key (mamba is sparse by design); no unlink in this boot (store file
count 47055 -> 47792, monotone), and _stat_stems already strikes a
no-file stem from the L3 index and the evictor.

Tests: py_compile OK; test_l3fill_join_wait_0930.py (+2: full arena
waits for room, thread gate).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
…'s progress, not a fixed bound

NF h16 a2cfc77 (boot 1014_151524), P 15:34:27-32, weg2-10-86 (92784
tokens): PP0 and PP1 each waited the fixed 5-s JOIN-WAIT on 190 stems
held by PP1's own l3fill claims ('holders=[1904/1ms/pid778/l3fill...]',
pid778 = PP1, 'still_claimed=190 waited_ms=5001/5005'). At 5 s PP1's
stale reap broke them and read them itself ('sgl-project#1433 190 of 190 ...
ms=5111'); PP0 had given up 4 ms earlier and found them freshly
re-claimed ('ARENA-GET MISS find=(slot=1904,state=1)'), its read ended at
65536, sgl-project#257 cut the claim to 65280 -- uniform on all three stages (PP0
told 65280, PP2 W27-UNIFORM re-read to 65280, 'sgl-project#969 EXTENT 65280..' on
every rank) -- and 26624 tokens were re-prefilled.

_await_fill_joins: any of its stems completing, or a pending claim taken
over / re-claimed (slot or generation moved, claim_info), is progress and
restarts the idle clock; the wait ends when nothing moved for
max(bound, SGLANG_WEG2_L3FILL_STALE_CLAIM_S) -- the caller's existing stale
reap then breaks a stalled or dead holder's claim and reads the page
itself -- or at the emergency cap SGLANG_WEG2_L3FILL_JOIN_CAP_S (60 s)
however much moves.

_await_fill_room: same rule (slots still coming = progress, idle bound =
the room bound, the same cap), and each round's fresh claims are read AT
ONCE instead of after the whole wait -- a claim held unread through the
rest of a room wait is what a peer's JOIN-WAIT sits on.

SGLANG_WEG2_L3FILL_JOIN_LIVENESS (default on); 0 = the fixed bounds.

Tests: test_l3fill_join_wait_0930.py +5 (a holder that keeps completing
is waited for past the bound; liveness off ends early; a holder that
never moves ends at the idle bound, not the cap; a stalled holder is
reaped after the stale age and read; room wait keeps going while slots
come); two bounded-miss tests pin STALE_CLAIM_S=0: 16 passed; 1433,
stale_claim_reap, joined_owner, l3_fast_read, anchor_bypass: 27 passed.
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.

1 participant