Skip to content

correct mistake README.md - #180

Closed
yaya-sy wants to merge 1 commit into
sgl-project:mainfrom
yaya-sy:patch-1
Closed

yaya-sy wants to merge 1 commit into
sgl-project:mainfrom
yaya-sy:patch-1

Conversation

@yaya-sy

@yaya-sy yaya-sy commented Feb 11, 2024

Copy link
Copy Markdown
Contributor

improve README by fixing a mistake: states.text_iter()instead of state.text_iter(), since the reference variable is states .

improve README by fixing a mistake: `states.text_iter()`instead of `state.text_iter()`, since the reference variable is `states` .
@yaya-sy yaya-sy closed this Feb 11, 2024
@yaya-sy
yaya-sy deleted the patch-1 branch February 11, 2024 20:32
NorthmanPKU pushed a commit to NorthmanPKU/sglang that referenced this pull request May 16, 2025
* initial gelu

* add gelu 2

* gelu 3

* working
rucnyz added a commit to rucnyz/sglang that referenced this pull request Jun 2, 2026
…tasks + T35 verify

Audit verdict per T (the 16 pending PLAN §3/§4 items):

DONE (covered by existing impl + tests):
  * T29 SGLANG_KV_POLICY_MODULE → _load_eviction_scorer exists;
    verify/t38/ stage C1 pins resolver
  * T32 all-rank atomic actions → tokenizer-server fanout exists;
    verify/t15/run_dp2_real.py exercises multi-rank wire
  * T35 authoritative_tier → baselines/base.py + new verify/t35/
    (8 stages: all residence combinations + empty-raises)

STRUCTURAL (compile-time invariant, no dedicated verify needed):
  * T19 atomic unit visibility → page_aligned() called in insert
    path at unified_radix_cache.py:574/599/731; run-time pin
    deferred to integration_stress flavor B

PARTIAL (impl half done):
  * T24 HASH_COLLISION → detection live with pair-dedupe; webhook
    firing pending ("T24 webhook pending" log) → sgl-project#182
  * T25 idempotent endpoints → migrate ✓, threshold ✓, pause/hint
    gated on T21/T40

OPEN — new tracking tasks created:
  * sgl-project#180  T18 state-dump single-snapshot read-lock
  * sgl-project#181  T21 PUT /aginfer/program_paused endpoint
  * sgl-project#182  T24 wire HASH_COLLISION webhook firing
  * sgl-project#183  T30+T39 proxy disconnect (paired)
  * sgl-project#184  T40 F2 hint emitter (daemon → sglang)
  * sgl-project#185  T41 F5 SESSION_END-for-PAUSED handler

OPEN — already tracked elsewhere:
  * T26 (HiCache/Mooncake EMA) → sgl-project#172 (T13 deferred)
  * T27 hint clear ordering → blocks on T40 (sgl-project#184)
  * T28 should_write_through → sgl-project#178

OUT OF SCOPE:
  * T31 harbor /aginfer/session_end — lives in harbor/client,
    not in sglang/daemon codebase

PLAN.md updated with per-T status notes referencing the audit
date + task IDs.  verify/t35/ added (8 stages, all green).
efschu pushed a commit to efschu/htsglang that referenced this pull request Jul 26, 2026
…ayouts it was written for

sgl-project#180.2 routed the target-verify metadata into the M4 split on forward_mode
alone. flashinfer does not: it gates on
_DCP_VERIFY_SPEC_INPUT_TYPES = {EAGLE_VERIFY, DFLASH_VERIFY}, because the split
assumes a uniform draft_token_num query block per request and a LINEAR
(non-tree) draft chain -- the draft block is attended ragged on local heads
with a plain causal mask while the committed prefix is read owner-sharded.

Four SpecInputTypes end in _VERIFY (EAGLE, FROZEN_KV_MTP, DFLASH, NGRAM), so
keying on forward_mode admitted two layouts the split was never written for and
would have served them silently -- the exact failure shape this feature exists
to remove, one layer up.

The refusal is a raise, deliberately not a fall-through: dropping into the
non-DCP branch would rebuild the FULL un-sharded kv indices against a compact
token-sharded pool, which is the out-of-bounds read sgl-project#180.2 removed.

The set is imported as the real SpecInputType enum rather than matched by name;
both import orders (triton_backend first, spec_info first) and the early
importer mem_cache.memory_pool were checked to load cleanly.

Tests: test_triton_dcp_spec_verify.py gains
test_only_the_verify_layouts_the_split_was_written_for_are_served (17 cases /
85 subtests total) -- it pins Triton's set EQUAL to flashinfer's rather than
restating the members, so the two cannot drift, and checks the two excluded
layouts are excluded rather than merely unmentioned. Falsified: deleting the
gate fails that test and only that test.
  distributed/            354 passed (+1), same 5 environmental failures
  spec+mem_cache+model_executor
                          1913 passed / 30 failed -- still IDENTICAL to base
efschu added a commit to efschu/htsglang that referenced this pull request Jul 26, 2026
…ect#180.1-.3)

The Triton backend now serves a CHAIN speculative verify (topk == 1) under the
weighted uneven-DCP owner rule. GPU-validated on the main rig (5090 + 2x3080,
torch order 0=5090, resolved via NVML at runtime) before merge.

Recipe order V6 -> V1 -> V2 -> V3 -> V5 -> V4. V7 (sm75/gfx900) SKIPPED --
second host unavailable this window; it remains the Nordstern reason for the
port and is still owed.

V1 index parity + V3 graph buffers: 8 passed / 48 subtests
  (test_triton_weighted_dcp_gpu.py, on device, no model)
V2/V3 wiring + guard matrix: 45 passed / 137 subtests
  (test_triton_dcp_spec_verify.py, test_triton_dcp_geometry_guard.py,
   test_triton_weighted_dcp_wiring.py)

V2 the guard, both directions, 27B FP8 uneven DCP TP=3, graphs on:
  topk == 1  -> BOOTS. Capture target verify 3.76 / 3.76 / 3.78 s, health 200.
                This is the refusal sgl-project#173 installed, now correctly lifted.
  topk == 2  -> REFUSED at boot, by name:
                'a TREE-masked speculative verify is on ... Chain verify
                (topk == 1) IS served here since sgl-project#180'
  The weightless sibling is pre-empted by an earlier server_args refusal
  (weightless x spec), so that guard branch stays CPU-covered only; sgl-project#180 does
  not touch it.

V5 empty-shard provocation: a 1-token prompt through the triton arm ANSWERS
  (prompt_tokens=1, 32 completion tokens, accept 3.200), it does not hang.
  No rank-local gate was reintroduced ahead of the q all-gather.

V4 parity anchor, 27B FP8, TP=3, --dcp-size 3, MTP chain, greedy, graphs ON,
   flashinfer (arm F) vs triton (arm T), identical sizing on both arms
   (token vector [14, 9, 9], per-rank KV 43022 / 27657 / 27657, cap 98328):
  Gate 1 -- token ids identical arm T vs arm F on all four prompts.
  Gate 2 -- meta_info.spec_accept_length (NOT spec_ema_accept_len):
            T 3.200 / 2.895 / 3.556 / 2.667
            F 2.909 / 2.895 / 3.556 / 2.667   -- same band, three exact.
  Gate 3 -- self-determinism on the TRITON arms only (flashinfer is not
            self-deterministic, G4 finding; it is a semantic oracle here):
            3x byte-identical per prompt at a fixed radix-cache state.

V6 default path unchanged, --dcp-size 1 with spec, compared against sgl-project#180's own
  parent 763ddef in a MATCHED measured-KV-budget regime (447173 vs 448089
  tokens): token ids identical on the three stable prompts, accepts identical.

Registered, NOT attributed to sgl-project#180 -- a pre-existing property of the Triton
lane found while running V4: on the long (11650-token) prompt the output
depends on radix-cache state and on max_total_num_tokens. It reproduces with
speculative decoding OFF and with --dcp-size 1, i.e. with every line of sgl-project#180
inert, and it reproduces on the parent commit. flashinfer is stable across the
same cold->warm transition. So that prompt is not a valid byte oracle on this
backend; the three short prompts are, and they are identical everywhere. The
underlying question -- why a radix prefix hit and a cold chunked prefill differ
numerically on the Triton path -- belongs to sgl-project#173's lane and is open.

Semantic check before merging, since triton_backend.py is touched by both this
branch and sgl-project#182 (merged two commits earlier) and both edit
reject_unsupported_dcp_geometry: verified in the merged file that BOTH
survived -- sgl-project#182's 'this branch is now only a backstop' note on branch (2) is
present once, and sgl-project#180's narrowing of branch (1) to TREE verify only is
present and still routes through the single dcp_verify_mask_mode predicate.
owner.py carries sgl-project#173's build_dcp_weighted_kv_indices next to sgl-project#180's
dcp_verify_paged_lens / _window_is_disjoint / _mask_mode.

Post-merge CPU suite: 410 passed / 278 subtests, with the same 5 pre-existing
host-environment failures as before the merge (test_uneven_tp_nccl_env MPS
pipe dir, 4x test_vmm_utils LOCAL_RANK).
efschu added a commit to efschu/htsglang that referenced this pull request Jul 26, 2026
…t#182/sgl-project#181 green and merged, sgl-project#96 RED

Main rig only; the second host was unavailable, so every sm75/gfx900 arm is
skipped and listed as owed rather than passed.

Three merges taken (a620d94, 81902b6, af162cd) with their gate
readings in the merge messages. sgl-project#96 (feat/swa-dcp-triton) is NOT merged.

sgl-project#96 root cause, found by instrumenting the raise rather than inferring it:
Gemma-4 mutates the attention backend's forward_metadata IN PLACE after
init_forward_metadata (gemma4_mm.py:428) to install its bidirectional mask,
and it does so on EVERY prefill -- the per-request append at :406 sits outside
the mm_inputs guard, so a pure-text request installs a plain causal mask too.
sgl-project#96 opens the geometry guard for SWA-hybrid models and thereby routes a
Gemma-4 full-attention layer into _forward_extend_dcp, which refuses any
custom mask. Explicitly NOT the kv>=tp write-gather sublane from sgl-project#173 that the
briefing flagged as the likely confound: the failure is a precondition check on
the extend read path, before any write gather, and the mask comes from the
model file.

Also registered: the long-prompt cold-vs-warm output difference seen while
running sgl-project#180's V4 is NOT sgl-project#180 -- it reproduces with spec off, with --dcp-size 1
and on sgl-project#180's parent commit, and flashinfer is stable across the same
transition. Plus the harness trap that made it look worse than it is:
SGLANG_MEASURED_KV_BUDGET sizes from the PREVIOUS boot's leftover, so a first
boot in a cold budget record is not comparable to a warm one.

Integrated regression on the merge tip is green (health 200, calibration
identity [2, 1, 2] unchanged, self-determinism 3x on the short prompts), with
capture at 3.93-3.95 s recorded as slightly above the asked band rather than
rounded into it, and "plan differs" reported as absent rather than as 0.
efschu added a commit to efschu/htsglang that referenced this pull request Jul 26, 2026
…load-bearing append

Task sgl-project#186 re-examined the H4 RED. The RED and every reading of the
instrumentation stand; the attribution does not.

The 275^2 mask was not a text-only prefill. prepare_attn_masks is not called on
every prefill -- gemma4_mm.py:657-665 already guards on contains_image_inputs()
-- and the 275-token prefill was sglang's own VLM boot warmup, which posts a
32x32 base64 PNG. Measured on CPU with the real gemma-4-31B processor and chat
template: 275 tokens, 256 of them image soft tokens; the same text without the
image is 17. The mask was genuinely bidirectional.

And the per-request append at :406 is the invariant, not a stray: the mask is
one flat buffer addressed by mask_indptr and USE_CUSTOM_MASK is a whole-launch
constexpr, so dropping a request's slot makes the kernel read the next
request's bytes with this request's row stride, and read out of bounds when the
skipped request is last. Route (b) is therefore correct only at batch
granularity.

Real blocker for sgl-project#96: the DCP Triton extend lane cannot serve an image request
at all, and the boot warmup sends one. Annotated in place with a pointer to
TASK_186_GEMMA4_MASK.md on fix/gemma4-textonly-mask, which also carries the
owner.py cross-check clearing sgl-project#96's q-head basis against sgl-project#180.
efschu added a commit to efschu/htsglang that referenced this pull request Jul 26, 2026
…the Stage-B lane

Rebasing feat/swa-dcp-triton onto integration/r3-probe (which now carries the
merged sgl-project#180) exposed one stale expectation, in the tests only.

sgl-project#96's guard test listed `speculative=True` among the refusals that the Stage-B
lane flag must not open. That was true when sgl-project#96 was written: any speculative
decoding was refused on the uneven lane. sgl-project#180 serves the CHAIN verify
(topk == 1), so the pair swa_hybrid_dcp + speculative now passes the guard.
The assertion was stale, not the code -- the refusal that must survive is the
TREE one, so the loop now asserts that instead, naming the actionable flag.

What is NOT established is that window x chain-verify is correct. sgl-project#180 drops
custom_mask/mask_indptr under dcp_size > 1 on the target-verify branch,
justified for the DCP paged path. Under sgl-project#96 a sliding-window layer no longer
takes the DCP path at all -- it falls through to the plain 2-stage kernel and
DOES receive a mask, with window_kv_offsets re-basing the column arithmetic.
Whether the drop is still right there is unverified in either direction. Added
test_window_lane_times_chain_verify_is_permitted_but_unvalidated, which pins
only what the guard currently decides and says in its docstring that it is not
evidence of correctness, plus the GPU experiment that would settle it.

Conflict resolution was otherwise mechanical, as the sgl-project#186 owner.py cross-check
predicted: four files, all additive. layers/dcp/__init__.py (import list +
__all__) and layers/dcp/owner.py (__all__) were union merges of two disjoint
symbol sets; triton_backend.py was one import-list hunk; the guard test's large
hunk was two independent test methods, both kept. No semantic conflict on
_plan_aware_dcp_group_q_head_counts -- sgl-project#180 touched no head-count code, and
sgl-project#96's full-attention basis is a precondition for the geometry the merge opens.

Tests: test/registered/unit/distributed/ + dcp/test_dcp_layout_unit.py ->
414 passed, 5 failed. The same 5 fail identically on the untouched base tree
(test_uneven_tp_nccl_env MPS pipe dir, test_vmm_utils KeyError: 'LOCAL_RANK') --
environment, not code. Error sets diff clean; sgl-project#96 adds 26 tests and 113
subtests over the baseline's 388.
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