Repository navigation
Sequence Parallel - #1041
Closed
ZYHowell wants to merge 44 commits into
Closed
Sequence Parallel#1041ZYHowell wants to merge 44 commits into
ZYHowell wants to merge 44 commits into
Conversation
Sequence Parallel system setup
* update layout * bug fix
* test: test cases of combining multiple attention kernel calls to implement a sequence parallel kernel. Verified with 2 sp workers * fix: simplify flashinfer kernel initialization (begin_forward() and end_forward()) * test: add logic for sp worker 1 which is basically the same but with different orders of kernel calls * chore: format tweak * feat: a general seq parallel attention kernel that achieves workload balance * fix: minor tweak loop iteration within ring attention * feat [radix_attention]: seq_parallel kernel with sync communication. TODO: turn communication into async fashion and overlap it with computation * test: update test cases for seq parallel attn kernel. Need to disable kv cache management before testing because we haven't implemented kv cache management for seq parallel yet * chore [radix_attention]: format tweak * feat: async communication within ring attention * fix [parallel_utils]: add missed files * fix [infer_batch]: set default values for newly added sp-related metadata * fix [bench_latency]: minor fixes to input args * feat [parallel_utils]: get actual tp rank and size when both TP and SP are enabled * feat [linear]: add QKVParallelLinear * feat [llama2]: update llama model to use our QKVParallelLinear * feat [model_runner]: initialize model parallel with sequence parallel * fix [infer_batch]: 1. a minor issue when calling get_prefill_indices; 2. flashinfer intialization args * fix [bench_latency]: load model with sp_rank * feat [radix_attention]: automatically dispatch to seq-parallel attn kernel when sp_size > 1 * debug: stash current debug changes * fix [radix_attention]: reshape q tensor before running the kernel * bug fix for sp layout types * fix: adjust tensor layout. TODO: fix many dirty hacks and hardcoded values * fix [wip]: disable p2p communication within ring attention for now. TODO: fix the bug that causes communication hang. * chore [bench_latency]: disable decode for now since we haven't supported it * upstream with correct prefill sp layout * fix early exit on decode SP * chore: tweak format * update layout * bug fix * fix [linear, radix_attention]: fix q head indexes per SP worker to align with GQA setting. * fix [infer_batch]: set up flashinfer kernels for the batch size > 1 case * chore: tweak format * fix [radix_attention]: revert commented-out kv cache store operations in normal attention * fix: adjust k, v tensor shape to align with both TP and SP setting * chore [llama2]: minor adjustment * fix: update bench_latency to evenly distribute each sequence across all SP workers to avoid the layout issue * test: update test cases to align with current kernel in args * fix [model_runner]: initialize TokenToKVPool with correct num_heads and enable KV cache store in SP attention * chore [radix_attention]: clean up comments * fix [model_runner]: correct num_heads in memory profiling as well to avoid OOM * fix [infer_batch]: adopt SP KV cache allocation * feat [linear]: correctly partition q proj along the num_heads dimension with GQA * chore [llama2]: clean up stable variables * feat [infer_batch]: adjust positions to SP layout when preparing input_metadata * feat [infer_batch]: use dedicate paged attn kernel for cross-SP-shard attn * feat [parallel_state]: creat sequence parallel comm groups * test [sp_comm_group]: simple test case with sp_size = 2 * doc [parallel_state]: doc string for our SP group organization * fix [infer_batch]: add padding zeros to positions tensor and out_cache_loc to fix positional encoding and KV cache store * feat [radix_attn, infer_batch]: create masks for padded sequences and now attn works for unevenly-distributed sequenses too * chore [bench_latency]: revert original prompts * fix [parallel_state]: rename "actual" to "kv" * refactor [radix_attention]: unified two cases with differnt comm-comp tradeoffs * chore: rename "actual_tp_[size|rank]" to "kv_tp_[size|rank]" * fix [infer_batch]: ensure prefix_lens is not None in init_flashinfer_args * fix [infer_batch]: only pad positions and out_cache_loc for prefill * chore [linear]: clean up and revise comments * chore [parallel_state]: revise comments * chore [linear]: revise comments and class names * chore [radix_attention]: add defensive checks --------- Co-authored-by: ZYHowell <[email protected]>
…e flashinfer decode kernel (#6)
Contributor
|
@ZYHowell Thanks for your contribution! May you rebase the latest main branch and resolve the conflicts? Thanks! |
15 of 29 tasks
… llama weight load
…avoid it in update_flashinfer_indices
…ialization. TODO: init SP parameters correctly
* test: test cases of combining multiple attention kernel calls to implement a sequence parallel kernel. Verified with 2 sp workers * fix: simplify flashinfer kernel initialization (begin_forward() and end_forward()) * test: add logic for sp worker 1 which is basically the same but with different orders of kernel calls * chore: format tweak * feat: a general seq parallel attention kernel that achieves workload balance * fix: minor tweak loop iteration within ring attention * feat [radix_attention]: seq_parallel kernel with sync communication. TODO: turn communication into async fashion and overlap it with computation * test: update test cases for seq parallel attn kernel. Need to disable kv cache management before testing because we haven't implemented kv cache management for seq parallel yet * chore [radix_attention]: format tweak * feat: async communication within ring attention * fix [parallel_utils]: add missed files * fix [infer_batch]: set default values for newly added sp-related metadata * fix [bench_latency]: minor fixes to input args * feat [parallel_utils]: get actual tp rank and size when both TP and SP are enabled * feat [linear]: add QKVParallelLinear * feat [llama2]: update llama model to use our QKVParallelLinear * feat [model_runner]: initialize model parallel with sequence parallel * fix [infer_batch]: 1. a minor issue when calling get_prefill_indices; 2. flashinfer intialization args * fix [bench_latency]: load model with sp_rank * feat [radix_attention]: automatically dispatch to seq-parallel attn kernel when sp_size > 1 * debug: stash current debug changes * fix [radix_attention]: reshape q tensor before running the kernel * bug fix for sp layout types * fix: adjust tensor layout. TODO: fix many dirty hacks and hardcoded values * fix [wip]: disable p2p communication within ring attention for now. TODO: fix the bug that causes communication hang. * chore [bench_latency]: disable decode for now since we haven't supported it * upstream with correct prefill sp layout * fix early exit on decode SP * chore: tweak format * update layout * bug fix * fix [linear, radix_attention]: fix q head indexes per SP worker to align with GQA setting. * fix [infer_batch]: set up flashinfer kernels for the batch size > 1 case * chore: tweak format * fix [radix_attention]: revert commented-out kv cache store operations in normal attention * fix: adjust k, v tensor shape to align with both TP and SP setting * chore [llama2]: minor adjustment * fix: update bench_latency to evenly distribute each sequence across all SP workers to avoid the layout issue * test: update test cases to align with current kernel in args * fix [model_runner]: initialize TokenToKVPool with correct num_heads and enable KV cache store in SP attention * chore [radix_attention]: clean up comments * fix [model_runner]: correct num_heads in memory profiling as well to avoid OOM * fix [infer_batch]: adopt SP KV cache allocation * feat [linear]: correctly partition q proj along the num_heads dimension with GQA * chore [llama2]: clean up stable variables * feat [infer_batch]: adjust positions to SP layout when preparing input_metadata * feat [infer_batch]: use dedicate paged attn kernel for cross-SP-shard attn * feat [parallel_state]: creat sequence parallel comm groups * test [sp_comm_group]: simple test case with sp_size = 2 * doc [parallel_state]: doc string for our SP group organization * fix [infer_batch]: add padding zeros to positions tensor and out_cache_loc to fix positional encoding and KV cache store * feat [radix_attn, infer_batch]: create masks for padded sequences and now attn works for unevenly-distributed sequenses too * chore [bench_latency]: revert original prompts * fix [parallel_state]: rename "actual" to "kv" * refactor [radix_attention]: unified two cases with differnt comm-comp tradeoffs * chore: rename "actual_tp_[size|rank]" to "kv_tp_[size|rank]" * fix [infer_batch]: ensure prefix_lens is not None in init_flashinfer_args * fix [infer_batch]: only pad positions and out_cache_loc for prefill * chore [linear]: clean up and revise comments * chore [parallel_state]: revise comments * chore [linear]: revise comments and class names * chore [radix_attention]: add defensive checks --------- Co-authored-by: ZYHowell <[email protected]>
Collaborator
|
moved to #1436 |
hhhh1252023
pushed a commit
to hhhh1252023/sglang_public
that referenced
this pull request
Jul 28, 2026
Porting GPU Use Cases
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
… it without admission BOOT-8 ROOT, MEASURED. The extent was derived inside `build_pp_admission_decision`, reached only from `_get_new_batch_prefill_raw`'s tail -- after an admission loop with eight `continue` branches and an `if len(can_run_list) == 0: return` above it. On the passes where a host hit was live, the holder was skipped at scheduler.py's `prefetch_pending` branch before the adder ever saw it, the list came back empty, the method returned, and NO decision was built: 09:13:52 PP0/PP1/PP2 sgl-project#788 PP-ADMISSION verdict=DECLINE n_reqs=0 queue=1 reason=loop_skips(prefetch_pending=1(first=f7f997c0...)) 09:13:54 PP0/PP1/PP2 sgl-project#968 LOAD-BACK DEFERRED rid=f7f997c0... (kv=4618) ... holds no PP0 extent for it yet The chain fed itself: hit present -> prefetch pending -> skipped -> empty list -> no decision -> no extent -> deferral. `sgl-project#1040 EXTENT STATE-ALIGN` read 0 in the whole log while its sibling emitter logged 9 times, which is what localised this. TWO HALVES, both mechanism-agnostic on purpose. 1. CHOICE MOVES TO THE WRITER. `stamp_state_aligned_extent` runs at the two sites that write `Req.host_hit_length` -- `Req.init_next_round_input` and `match_prefix_for_req` -- both unpacking one `match_prefix` result. `Req.__init__` only zeroes the field and `truncate_prefix_to` is dead (0 callers, 0 name reads), so a request CANNOT hold a hit without passing one of them. Every `can_run_list` filler (`add_one_req`, `add_chunked_req`, `add_one_req_ignore_eos`, the dllm pair, `_add_scheduled_req`) must match before it is executable, so the match dominates all six. The dominator argument is made over the WRITERS deliberately: the call graph cannot carry it -- `call_path add_chunked_req -> match_prefix_for_req` walks past 156 unresolved edges and finds nothing, which is a bounded negative and proves nothing. The row builder now READS the stamped field on both branches and derives nothing. 2. PUBLICATION DECOUPLES FROM ADMISSION. `_publish_pp_decision_1041` is the one publisher and BOTH exits of `_get_new_batch_prefill_raw` go through it, including the empty-list return that boot 8 died on. Everything the loop SAW and did not admit rides as an `admitted=False` FACT CARRIER. Collected at ONE site at the top of the loop, before any skip -- appending inside each skip branch would be the per-path retrofit this slice exists to avoid, and would have missed the second, still-unproven decline mechanism exactly as the first was missed. CARRIER SAFETY IS STRUCTURAL, NOT CAREFUL. `forwarded_schedule` already filters `e.admitted and not e.retracted`, so a carrier can never enter `_pp_scheduled_extents` and therefore never reaches the sgl-project#791 membership compare (scheduler.py:10508/:10522) -- the PPScheduleRefused-storm direction is closed at the source. `reconcile_pp_admission_decision` passes it through verbatim; `forwarded_last_chunk`/`forwarded_fill_carry` key on `fill_len`, which it does not carry; `apply_pp_load_back_row` stamps it by rid, which is its whole purpose, and an unheld rid is already a counted no-op there. STANDING INSTRUMENT. `sgl-project#1041 EXTENT POPULATION seen/published/delta` per pass. `delta != 0` means a request held an extent and no entry carried it, i.e. a bypass. The three legitimate differences are structural and produce no delta: no host hit stamps no extent, `pp_size<=1` never reaches the publisher, and an unheld rid is the receiver's counter. A future bypass is now loud instead of a silent zero that costs a boot to read. CHECK (speed mode: one matched check). devtools/check_1041_factcarrier.py, hermetic, CUDA-free. Named failure class: non-admitted entries reaching readers that iterate the decision, dangerous direction a PPScheduleRefused storm. The three pinned directions: (1) carrier passes without refusal and is absent from forwarded_schedule / last_chunk / effective while still delivering its extent through reconcile and apply; (2) a real membership violation STILL refuses -- an admitted rid the rank does not hold is still nameable as MISSING, pinned so the gate cannot go quiet; (3) unknown rid raises nothing and stamps nothing. 20/20 PASS. sgl-project#1040 check re-run green (no regression), py_compile + import smoke, ruff clean on the edited congruence module. cell_1039: adds `sgl-project#1041 EXTENT POPULATION` delta==0 and PPScheduleRefused==0 as acceptance criteria, both voiding the PASS branch.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…ole filler BOOT 9 MEASURED THE DETECTOR LYING GREEN. Every emission read `seen=0 published=0 delta=0` beside `admitted=1`: a pass that admitted a request while the counter claimed to have seen nothing, and reported delta=0 for it. Root: `_seen_this_pass` collects only what the WAITING-QUEUE LOOP visited, but `add_chunked_req` (scheduler.py:9878) fills `can_run_list` BEFORE that loop runs. A pass serving only chunked continuations therefore visits nothing, and a detector whose denominator excludes an entire `can_run_list` filler cannot detect that filler's bypass -- the exact denominator trap this instrument was built to prevent, reproduced inside the instrument. Population is now the UNION of what the loop visited and what was admitted, so every filler is inside the denominator. Fact carriers are derived from the same union, so a touched-but-not-admitted request cannot fall out of publication either. Both matched checks re-run green. This is an instrument correctness fix; the sgl-project#968 application term is untouched and still open.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…ess match stops erasing BOOT 10 MEASURED THE ERASER. `sgl-project#1041 EXTENT POPULATION seen=0 published=0 delta=0 admitted=1` stood beside `sgl-project#1040 ... rid=... extent=4618` for the same rids: the field was stamped with a real extent and reached the publisher empty. Cause was inside the fix itself -- `stamp_state_aligned_extent` nulled the field on every match WITHOUT a host hit, so writer and reader were separated by an ordinary intervening match. That is the deleter-between-writer-and-reader shape the pre-boot lifecycle table exists to catch, reproduced inside the mechanism meant to close it. THE TABLE IS NOW THE CONTRACT, not a comment beside it. Four transitions, the only writes to `pp_load_back_extent`, each counted: set a match WITH a host hit chooses an extent hitless_noop a match WITHOUT a hit -- NO-OP, never a clear, always counted spend the row carried it (`_spend_for_entry`, at the row build) retract `reset_for_retract` voids it `_spend_for_entry` is one expression used by all three entry paths, so no branch can publish without spending and none can spend without publishing -- the two-populations defect this slice removes, kept out of its own fix. Spend at the row build rather than at apply: the field does not travel the rank hop, and never clearing would let one hit republish forever (the stale-HIGH republish e0bc960 already paid for). `hitless_noop` IS ALSO THE DISCRIMINATOR for boot 10's unstamped rid (364e5b59: DEFERRED x3 with kv=4618, zero stamps). Two hypotheses were checked and BOTH REFUTED at the tree before adding it: the stamp is present on BOTH `host_hit_length` writers (schedule_policy.py:366, schedule_batch.py:1717), and the log rate limit suppressed nothing (cumulative `n=5` per rank IS the total, matching 5 emitted lines per rank). So either the stamp ran with a zero hit -- it will appear in `hitless_noop` -- or a third path sets `host_hit_length` without passing either writer, and it will appear nowhere. The counter decides in boot 11 instead of another round of inference. CHECK: devtools/check_1042_lifecycle.py, hermetic. Named failure class: a write path emptying the field outside the two sanctioned deleters. Replays the exact boot-10 sequence (stamp 4618 -> hitless match) and pins that the value SURVIVES and the no-op is counted; pins spend clearing exactly once and a second build republishing nothing; pins retract clearing and double-retract not double counting; pins that all four transitions are counted rather than silent. 15/15 PASS. sgl-project#1040 and sgl-project#1041 checks re-run green. ruff clean on the edited module. cell_1039: reports the sgl-project#1042 cumulative counters and treats `hitless_noop == 0` as "contract untested by this window", never as "contract holds".
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…enumeration THE DENOMINATOR HAS NOW BEEN WRONG TWICE IN THE SAME CLASS, so this closes the class instead of writing a third hand-list. `_seen_this_pass` alone missed `add_chunked_req` (which fills `can_run_list` BEFORE the loop). The union with `admitted_list` still missed every request that HOLDS an extent without being touched by this pass -- boot 11 measured it exactly: the deferring rids carried `extent=4618` and `extent=1295` with `hitless=0`, while the publisher counted `seen=0 published=0 admitted=1`. STRUCTURAL STATEMENT, and it is the user's amendment finally landing whole: the extent is a property of the REQUEST, so every pass-scoped population is wrong by construction. `holders_with_unspent_extent` is DERIVED, not enumerated afresh: it builds on `phase_flip_runtime._live_reqs`, the residency authority the CUTOVER itself uses, which covers `running_mbs`, `last_mbs`, `running_batch`, `last_batch` and `chunked_req`. One deviation, declared rather than silent: `waiting_queue` is added, because the cutover authority answers "what holds POOL ROWS I must move" while this answers "what holds a FACT I must publish" -- and a queued request holds the second but not the first. That queued request IS the boot-8 population. THE #858b LAST_MBS WARNING WAS CHECKED, NOT BELIEVED, AND IS STALE. W30 added that route to the authority (phase_flip_runtime.py:1346-1347) after `ResidentCarryError` measured the gap on all three ranks, under the explicit rule "fix it at the one authority, not at the consumers". Deriving inherits that fix rather than re-opening the hole. sgl-project#1041's `seen` is widened through the SAME function that builds the carriers, so the instrument and the publication can no longer measure different populations -- which is the precise defect the instrument exists to catch. CHECK: devtools/check_1043_holders.py -- a PLANT TEST, not a list assertion. One request carrying an unspent extent is planted at EVERY holding site (running_mbs, last_mbs, running_batch, last_batch, chunked_req, waiting_queue) and each must reach the population; negative controls pin that a held request with no extent or a zero extent is not a carrier; identity dedup pins that one Req on six routes is carried once; a bare scheduler yields empty rather than raising. Direction E plants a request in an UNWIRED route and asserts it is MISSED -- documenting the authority's real limit as a contract (a new route must be added to the authority and planted here) instead of pretending coverage is automatic. That direction is what makes this a class closure: it rings on the day someone builds a seventh holding site. 13/13 PASS; sgl-project#1040/sgl-project#1041/sgl-project#1042 re-run green; ruff clean.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…he consumer Boot 12 read `sgl-project#1041 EXTENT POPULATION seen=0 published=1 delta=-1 admitted=2`. `published=1` is real progress -- a row carried an extent for the first time -- but `delta=-1` is an artifact of my own instrument, not a bypass. `_spend_for_entry` clears the field DURING `build_pp_admission_decision`, and `seen` was counted AFTER that call. So the detector counted what the consumer had left over rather than what was there when the pass began: every successful publication necessarily drove `seen` down and `delta` negative. That is the same defect class for the third time -- a population measured against the wrong denominator -- and this time inside the detector's own timing rather than its membership. `seen` is now sampled from `_touched` BEFORE the build runs. Checks 1040/1041/1042/1043 all re-run green; ruff clean.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…sive Boot 13 overlay, PP0: `sgl-project#1042 set` at 10:14:33, 10:15:04, 10:15:04 against `sgl-project#1041 EXTENT POPULATION` at 10:14:15, 10:14:21, 10:14:21, 10:14:54, 10:14:54 -- ZERO intersection, and the hitless matches (10:14:15, :15, :21) sit exactly on the publisher's timestamps. It reads as a clean time disjunction: on the passes the publisher runs, matches carry no hit; on the passes matches carry a hit, the publisher is not seen. IT IS NOT YET A PROOF, AND THE BOUND IS MY OWN INSTRUMENT. `sgl-project#1041` emitted only on the first five publisher calls, so "no emission after 10:14:54" cannot separate "the publisher did not run" from "it ran and was not printed". An overlay drawn from a rate-limited sample is a statement about the sample, not about the pass stream -- the same denominator error this campaign has now paid for at membership, at timing, and here at sampling. So the emission is now unconditional whenever holders exist. Volume stays bounded because holders are rare (3 sets per rank in boot 13), and the next overlay either shows the publisher coexisting with holders or proves it never does. No behaviour changes; this is an instrument-honesty fix only. THE HOIST IS DESIGNED BUT DELIBERATELY NOT BUILT IN THIS COMMIT -- see the handover: it relocates the one publisher to the per-pass loop, and it has four downstream consumers of `_pp_admission_last_built_decision` that must move with it. Relocating the hottest loop's publisher on a bounded reading is exactly the shape this campaign keeps paying for; it waits for the decisive overlay. Checks 1040/1041/1042/1043 re-run green.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…s; delete the load-back delivery chain OPTION A, in the hard form. Two edits that only work together: the memory-axis watchman moves onto the group availability floor FIRST, and only then does the delivery chain come out. sgl-project#1045 -- THE FLOOR IS PUBLISHED UNCONDITIONALLY ON A GROUP. It used to stay None whenever availability happened to be equal that iteration, and `unified_radix_cache`'s load-back fell into a RANK-LOCAL memory decision when it was None, guarded only by the delivery signal `pp_load_back_told`. A watchman on one axis was hanging off the delivery of another, and it stood down exactly when nothing looked wrong. PRICE VERIFIED BEFORE BUILDING, per the no-new-collective rule: at the live path (scheduler.py:6396) `min_avail` and `max_avail` are BOTH harvested from the same already-performed all-reduce (`t[0]`, `t[max_avail_at]`), so dropping the comparison removes work rather than adding it. The single-rank path now publishes the LOCAL value instead of None -- it IS the group min for a group of one -- which is what lets None become a construction violation everywhere downstream. Behaviourally identical on even pools: the published floor equals the live local value, and the sgl-project#694 ledger keeps it tracking through the iteration. FIX-6 IS NOW ONE BRANCH. `floor is None` at the load-back raises, naming rid, kv_tokens and local availability. A rank that cannot answer from a group number must not answer from a local one -- that is how ranks stop agreeing, and the 21:52:25 wedge is the measured price. sgl-project#1046 -- THE DELIVERY CHAIN IS DELETED. Consumption is local: `_pp_load_back_extent` returns this rank's own stamp, chosen at its own match by one shared expression over the same content. Uniformity comes from identical DERIVATION, not from one rank shipping a value. Deleted with it: `apply_pp_load_back_row` and both its call sites, PP0's self-row parking and the one-lap delay, `pp_load_back_told` and all four readers, the `sgl-project#1035` deferral ledger, the fact carriers, `holders_with_unspent_extent`, `_spend_for_entry`, the spend transition, the `sgl-project#1041` population counter and the `sgl-project#1044` ship/recv ledgers. EVERY READER WAS DECIDED, NOT SWEPT ALONG -- the enumeration is the point, because a reader falling silently into a rank-local branch is the class that found the edge in the first place: unified_radix_cache.py:2713 group-fact signal -> moved to the floor (sgl-project#1045) schedule_policy.py:107 delivery mechanics -> local stamp schedule_policy.py:2305 delivery gate -> deleted, no fact to await schedule_policy.py:2360 clamp gate -> KEPT, re-pointed. Its hazard (a GDN anchor adopted at `_applied` while the KV is cut) is created by the load-back itself and is independent of where the extent came from. KEPT AND UNTOUCHED: the admission row, its `prefix_len`/`extend_len` columns and the sgl-project#791 membership and ordering rules -- batch geometry, a different axis. The `load_back_len` FIELD stays on the wire for width tolerance and always travels None. sgl-project#1042's lifecycle contract stays, minus the spend transition that had no consumer left. CHECKS: check_1045_floor_watchman.py proves the guard CAN FIRE (a crash guard that cannot crash is worse than the branch it replaced), that a small floor is an ordinary refusal, that the rank-local fallback is DELETED rather than bypassed, and that publication is unconditional and counted. check_1042 updated: the row build must now LEAVE the field alone -- a build that still cleared it would resurrect the eraser through the back door. check_1040 green. The 1041, 1043 and 1044 checks are DELETED with their subjects; the cell's zombie test picks up their markers (ROW APPLIED, DEFERRED, EXTENT POPULATION, ROW SHIP) so a stale build cannot pass silently. py_compile + import smoke on all five modules; ruff clean. NOT YET BOOTED -- this commit is desk-proven only.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
… construction Arm A publishes MIN over the per-rank coverage facts returned on the ring lap. That leaves one gap: observed_local is reported on lap N and applied on lap N+1, so a tier that evicts the span in between makes told > local DESPITE the MIN -- and the apply-site trace (DESIGN_968 5f) established that a prefix shortfall is NOT absorbable: prefix is a START POSITION, not a read amount, and moving it moves the batch, which is the sgl-project#631 divergence this change exists to remove. REPORTING IS PINNING. A rank that reports a span also pins it, and the pin reuses the eviction floor that already exists -- cache_protected_len, honoured at mem_cache/common.py:82 (evict_floor = max(req.cache_protected_len, req.swa_evict_floor)). No second protection mechanism. told <= pinned then holds by construction and the gap does not exist. A broken pin gets a DEFINED UNIFORM consequence instead of a silent one: UniformWidthPromiseBroken, naming both numbers. This is an invariant violation, not flow control, and the distinction matters -- boot 15's raise fired on a REACHABLE condition and re-fired 1448 times until the ring wedged; this one is unreachable while the pin holds and fires once. raenge-nie-uneins says a detected broken promise is a group crash, never a local compensation: silently taking less would move the batch and resurface as sgl-project#631 on a peer. min_told skips None rather than counting it as zero -- one silent rank must not collapse the group's prefix to 0 and recompute every prompt. No promises at all = no fact = no adoption, never a local substitute. THE CONTRACT TIGHTENED AND CORRECTLY BROKE ITS OWN EARLIER TESTS: six sgl-project#1059 tests assumed a shortfall was absorbable, which 5f refuted. They now supply the pin the real flow guarantees, which is the honest fixture rather than the convenient one. 18 tests. SIX mutants, all anchor-asserted (an unapplied mutant must not look like a surviving one) and all KILLED: 1 refusal-without-a-way-onward -> 10 failed 2 apply-skipped -> 7 failed 3 per-rank re-derivation -> 4 failed 4 shortfall moves the geometry -> 7 failed 5 eviction-between-laps goes silent -> 2 failed 6 a silent rank collapses the group -> 2 failed ruff clean. Behaviour: none yet -- nothing calls this module. Wiring remains, five sites: observed_local producer (per rank, and it must set the pin in the same breath), PP0's min_told, carrier (live, relays verbatim), consumer stash, apply at the re-admission consult (schedule_batch.py:1694-1712, beside sgl-project#1041 stamp_state_aligned_extent, which its own comment calls the placement that dominates every can_run_list filler).
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.
Motivation
When serving an extremely large model (e.g. Llama 400B), the #GPU might be more than #kv head. This leads to a replication on kv cache, which is troublesome when the sequence length is too large
Modification
This PR introduced a very basic sequence parallelism on the attention computation. For all other parts, the model is still fully tensor parallelized. The partition switches before and after the attention. This is achieved by:
sp_rank) together, this is referred as the sequence parallel layout in this pr and the code comments. Flash infer args are accordingly changed;Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.