Repository navigation
Conversation
6bb6ed0 to
167173d
Compare
167173d to
0793613
Compare
|
Tests are failing due to github flashinfer download failure. |
|
what is the motivation for this? I guess it cannot improve the overall speed |
|
can you also add a unit test for data parallelism https://github.com/sgl-project/sglang/tree/main/test#test-backend-runtime? |
If you have an unbalanced workload, with relatively short input/output pairs, it's easy to end up in a state where one worker is running a huge number of requests, and the other worker is mostly idle. This is because the first worker is able to accept the request before the next request comes through, so it will keep being assigned as the queues remain at zero. Making this change does improve overall throughput in the above situation. I would rather schedule based on number of running requests which I'm looking into now. |
|
ok, so there is something wrong with the original implementation. Please add a unit test for DP and we can merge this. |
|
Hi @qeternity, I added a unit test for data parallelism here #1489. I think the current shortest queue implementation is wrong. Could you help us fix it by defining the queue length as " the number of running requests + the number of queue requests in the actual server" instead of the current multiprocessing queue? I will close this for now and wait for your new PR. |
|
@merrymercy I had originally looked at doing that, but it's going to require a fair but of refactoring to expose the currently running requests in addition to the mp queue (I think). I just haven't had time to look at it more closely. |
…ntil the admission pops it (xsn167: the host-only span was evicted between completion and admission under pool pressure; the walk reached 4314 of 98550, accepted 0, W50 -> requeue -> P recompute). Tests: span_pin_1417 (2), 1233, 1175: 13 passed; 1068 is red at the base too (10, Sockel).
…t-gesperrten Mamba-Anker nicht mehr als S3-Luecke -- NF-Abnahme rc11b, D-TP1/TP2 tot 19:30:47Z unter Agentenlast Befund (D-Log boot_weg2_dkrnfh91bar1rc11b09261915, TP1; TP2 gleich): 19:30:47 sgl-project#1423 INSERT-PLACED req=weg2-16- matched=2560 inserted=12480 deepest=249 19:30:47 sgl-project#1423 INSERT-PLACED req=weg2-16- matched=15040 inserted=128 deepest=250 19:30:47 Sanity check FAILED: mamba host LRU: +S3={249}, +lru=set() Debug-Hold-Dump der werfenden Frame: s3_ids={249,250,245,247}, host_lru_ids={250,245,247}. Wurzel: die Reihenfolge einer Prefetch-Vollendung (check_prefetch_progress) ist _insert_helper_host -> _pin_prefetched_span (sgl-project#1417, host-Lock der eingefuegten Kette bis die Zulassung sie abholt) -> commit_hicache_transfer(PREFETCH). weg2-16-31 pinnt seine Kette bis 249 VOR dem Mamba-Commit (Mamba-Lock uebersprungen, host_value noch None), der Commit haengt 249 in die Mamba-Host-LRU. weg2-16-38 verlaengert denselben Praefix um 250 und pinnt 250 -> 249 -> ...; jetzt hat 249 einen Host-Anker, und acquire_component_lock(lock_host=True) nimmt ihn aus der Host-LRU -- gewollt, ein gesperrter Anker ist kein Verdraengungskandidat. Beide warten auf die Zulassung, der Rang ist idle, sanity_check (unified_radix_cache.py, PART 3) zaehlt 249 als S3-Knoten ohne LRU-Eintrag und wirft. Die S3-Regel ist die von upstream, geschrieben fuer einen Baum ohne Host-Locks ueber einen Pass hinaus; die sgl-project#1417-Pins halten bis zur Zulassung. Nicht R12: die Worker wendeten nur No-op-Verdikte an (kv_dropped=0 anchor_dropped=0). Fix: der S3-Abgleich trennt die beiden Zustaende des Lock-Protokolls -- ungesperrte Host-Anker muessen in der Host-LRU stehen, gesperrte duerfen es NICHT (neue Meldung "host-locked node(s) on the host LRU"). Keine Pruefung abgeschwaecht, eine hinzu. Kein Schalter. Tests: test_prefetch_pin_host_lru_sanity_1417b (5, echter UnifiedRadixCache FULL+MAMBA auf CPU, echte Insert/Pin/Mamba-Commit/Lock/Sanity): auf 2a7f992 2 rot (die Metall-Meldung "+S3={42}, +lru=set()" und die fehlende Gegenpruefung), mit Fix 5/5 gruen. Betroffene Suiten (62 Dateien mit sanity_check/host_lru/form_a_host_shadow/ mamba_component/_pin_prefetched_span/host_lock_ref, je Datei ein pytest unter incg.sh, Basis 2a7f992 gegen Fix): 0 neue Rote; 46 Altlasten identisch auf beiden Seiten; test_mamba_unittest und test_unified_radix_cache_unittest sprengen die 3-GiB-Cgroup auf BEIDEN Seiten (rc=137) und sind so nicht beurteilt.
…ins mit dem Baum zurueck -- rc12 zweiter Tod 23:12:47Z "H-leaf extra: [62, 64, 60, 63]" + "4 stale nodes in host_leaves" Befund (Dauerlauf dkrnfh91bar1dauer09262302, 530fb71, D-Log, alle drei Raenge gleich): 23:11:26-29 fuegen die Prefetches weg2-0-7/-0-8/-1-1/-2-1 unter Knoten 59 ein (deepest 60/62/63/64; 61 = Split darueber) und sgl-project#1417 pinnt sie fuer die gehaltenen Requests. 23:12:45 park_running (wait-bound-60s, gehalten u. a. weg2-0-7, -0-8), danach der Sleep-Flush zweimal (RESET-RELEASE skipped_in_use=5 = die gepinnten Knoten). _reset_full baut einen neuen Baum mit frischen Leaf-Sets, liess aber _prefetch_span_pins stehen. Die Admission der gehaltenen Requests unpinnt ueber pop_prefetch_loaded_tokens -> dec_host_lock_ref(alter Knoten) -> _update_evictable_leaf_sets und legt die Host-Blaetter des toten Baums in das Leaf-Set des neuen -> Idle-Sanity toetet alle Raenge. Nicht #1417b (der aendert nur die S3-Regel der Mamba-Host-LRU); der Gather-OOM davor machte D nur langsam genug fuer den Park. Fix: _reset_full unpinnt alle sgl-project#1417-Pins, solange der alte Baum noch gilt und VOR der H81-Arena-Freigabe (die host-gesperrte Knoten ueberspringt -- deren Referenzen gehen jetzt ebenfalls zurueck). Pins ohne Flush bleiben wie bisher bis zur Admission. Kein Schalter. Tests test_prefetch_pin_across_reset_rc12.py (3, echter UnifiedRadixCache ueber die #1417b-Fixture): 2 rot auf 530fb71 (stale Leaf nach Flush + Admission; Pins ueberleben den Flush), 3 gruen; #1417b 5/5. Betroffene Suiten (54 mem_cache/managers-Dateien mit reset/sanity/Pins) Basis gegen Fix: 0 neue Rote (Altlasten 1157, 861, 938, 943b, 0828, 905 identisch).
…ins mit dem Baum zurueck -- rc12 zweiter Tod 23:12:47Z "H-leaf extra: [62, 64, 60, 63]" + "4 stale nodes in host_leaves" Befund (Dauerlauf dkrnfh91bar1dauer09262302, 530fb71, D-Log, alle drei Raenge gleich): 23:11:26-29 fuegen die Prefetches weg2-0-7/-0-8/-1-1/-2-1 unter Knoten 59 ein (deepest 60/62/63/64; 61 = Split darueber) und sgl-project#1417 pinnt sie fuer die gehaltenen Requests. 23:12:45 park_running (wait-bound-60s, gehalten u. a. weg2-0-7, -0-8), danach der Sleep-Flush zweimal (RESET-RELEASE skipped_in_use=5 = die gepinnten Knoten). _reset_full baut einen neuen Baum mit frischen Leaf-Sets, liess aber _prefetch_span_pins stehen. Die Admission der gehaltenen Requests unpinnt ueber pop_prefetch_loaded_tokens -> dec_host_lock_ref(alter Knoten) -> _update_evictable_leaf_sets und legt die Host-Blaetter des toten Baums in das Leaf-Set des neuen -> Idle-Sanity toetet alle Raenge. Nicht #1417b (der aendert nur die S3-Regel der Mamba-Host-LRU); der Gather-OOM davor machte D nur langsam genug fuer den Park. Fix: _reset_full unpinnt alle sgl-project#1417-Pins, solange der alte Baum noch gilt und VOR der H81-Arena-Freigabe (die host-gesperrte Knoten ueberspringt -- deren Referenzen gehen jetzt ebenfalls zurueck). Pins ohne Flush bleiben wie bisher bis zur Admission. Kein Schalter. Tests test_prefetch_pin_across_reset_rc12.py (3, echter UnifiedRadixCache ueber die #1417b-Fixture): 2 rot auf 530fb71 (stale Leaf nach Flush + Admission; Pins ueberleben den Flush), 3 gruen; #1417b 5/5. Betroffene Suiten (54 mem_cache/managers-Dateien mit reset/sanity/Pins) Basis gegen Fix: 0 neue Rote (Altlasten 1157, 861, 938, 943b, 0828, 905 identisch).
…ssion, like its KV chain (sgl-project#1417) -- z30y15 weg2-12-56 told=0 re-prefill z30y15 P PP0 04:21:39Z, rid weg2-12-56: the read brought the mamba anchor at 16383 (#1028B FETCH CAP anchors_in_range=(4, 16382)), the insert named the end node (sgl-project#1423 INSERT-PLACED matched=16383 deepest=107) and the mamba PREFETCH commit attached the anchor there. But check_prefetch_progress takes the sgl-project#1417 pin BEFORE the components' commit: at pin time the node carried no mamba host value, so its mamba lock was skipped (skip_lock_node_ids), and the commit left the fresh anchor UNLOCKED on the mamba host LRU. The 112-slot mamba arena evicted it within the second (sgl-project#1427 ARENA-DROP slot_bytes= 78446592 at 04:21:39), PP0's told-fidelity probe found no state (pp0_admissible=0) and sent told=0 with acks {1: 16383, 2: 16383}; PP1/PP2 "sgl-project#928 REFUSING ... best_value_len=0"; P re-prefilled 16383 tokens. Fix (unified_radix_cache.check_prefetch_progress): after the components' PREFETCH commit, a request whose span was pinned re-takes the pin -- the anchor is now host-locked with its chain until pop_prefetch_loaded_tokens / release_aborted_request release it (unchanged release path). Not touched: a read without a pinned span (declined / host_span_unclaimed). On P "0x PREFETCH-ANCHOR-ATTACH" is no defect by itself: that line is the branch for an end node WITHOUT a Full host copy (the D case); P's end node had one and the anchor attaches silently. Tests (CUDA_VISIBLE_DEVICES="", real check_prefetch_progress, real FULL+MAMBA tree): new test_prefetch_anchor_pin_z30y15.py red on 38c1d66 (2 failed: host_lock_ref 0, drive_host_eviction strips the anchor), green here (3 passed incl. the admission releasing the pin). Neighbours (1417 pin/sanity/reset, 1424h2, 1157, 257, 937/939/905, p4b, 257iii, anchor attach 0930 x2): pass, except 905 double-free retry test which fails identically on the base. mem_cache prefetch/radix sweep: 221 failed / 765 passed identically with and without the fix (pre-existing scaffold failures).
…ss a kept told verdict, and acks only what it can resume (N1 dkr27browauthoritybar1fs10010740 PP1 sgl-project#968 death) N1 boot (image 32fc268 = 341d089 + L1,5 shadow), PP1 07:46:29Z, rid weg2-10-16: PP0 PF TOLD-ACKED told=17406 acks={1: 17406, 2: 17406}, PP0 sgl-project#988 LOADBACK mamba_restored; PP1 "sgl-project#1423 INSERT-PLACED matched=17406 deepest=122", "H91 STORE-TOLD KEPT told=17406 credit=0" (not seated in the told visit), then "[sgl-project#928 anchor] REFUSING resume ... match_tokens=17406 best_value_len=0", "sgl-project#1175 UNDER-COVERAGE local=0 scheduled=17406", 19 s, "sgl-project#968 PREFIX MATERIALISATION SHORTFALL" -> group stop. (a) Root: weg2_store_told.admission popped the credit with pop_prefetch_loaded_tokens, which also released the sgl-project#1417 span pin -- and the recurrent anchor ANCHOR-PIN (341d089) keeps under it. A request the adder does not seat in that visit (H91 KEPT) then waits with its anchor unlocked on the mamba host LRU. Now the credit is popped and the pin stays (_pop_credit_keep_pin); p_intake.settle_told releases it together with the kept verdict when the request leaves the queue; an abort releases it as before. (b) Riegel: the follower's PF ack (weg2_told_fallback.own_prefix) named its KV depth. It now asks the told-fidelity probe (the sgl-project#928 rule read-only): KV without a recurrent state at its end acks the resumable depth ("PF TOLD-ACK UNRESUMABLE"), PP0 sees own != told and answers told=0 for EVERY rank -- a rank-agreed re-prefill instead of a 19 s wait and a group death. No probe = no verdict (the KV count stands). Tests (CUDA_VISIBLE_DEVICES="", real check_prefetch_progress + real FULL+MAMBA tree, array keys): new test_told_anchor_pin_ack_n1_1001.py red on 341d089 (2 failed: host_lock_ref 0 after the told admission; KV-only follower acks 16 of 16), green here (3 passed incl. "anchored follower acks told" = no false fallback). Changed area (pin 1417 x3, anchor pin, PF x2, told 1400/1416e/1416f/TF x2/TK x2/SL, shortread, dual x2, p_intake/h91): 261 passed; 1 failure (test_weg2_p_intake_h91a source-text assertion) fails identically on 341d089.
…oberhalb einer offenen told-Spanne ist kein W3-Spill-Kandidat Der sgl-project#1417-Span-Pin host-lockt deepest..unter stop_at; der gematchte Kopf darueber war ungeschuetzt. Ein geraeteresidenter Kopfknoten verlor seine Host-Kopie an den W3-Spill (l3_present); eine Geraeteverdraengung vor der Admission liess die told-Tiefe kurz werden (pp0_admissible unter told). Jetzt: UnifiedRadixCache._told_head_ids() = die Knoten von stop_at (Elter des obersten gepinnten Knotens) bis zur Wurzel fuer jede offene Spanne; _w3_arena_spill (Geraeterunde, Zeile kept_told=) und w3_room_set (_device_candidate, decide und apply) nehmen sie nicht. Freigabe mit dem Pin (Admission/Abort/Reset). Tests: test_weg2_told_head_a7_1016.py 3 gruen (Repro auf echter C-Arena: Kette a0..a7, told offen fuer a3..a7, Spill fuer alle Seiten, danach Geraeteverdraengung des Kopfs -> Kopf behaelt Host-Kopie und die erreichbare Tiefe bleibt = told; beide Pfade Geraeterunde/Room-Set; nach dem Unpin wieder Kandidat); auf fd344ad rot 3. Mutanten: Filter Geraeterunde weg ROT 1, Filter Room-Set weg ROT 1. Regression 25 Dateien (Span-Pin, told, W3, F1, read_room): Kopf 161/0 rot, Basis 158/0 rot.
Motivation
When using the shortest queue scheduler, if node is not saturated and all queues are zero, the first worker will be continuously selected. The first worker can continue accepting requests keeping the queue at zero, leaving other workers under utilized.
Modifications
If all queue lengths are zero during shortest queue scheduling, fallback to round robin to ensure utilization of other workers.