Skip to content

111 - #544

Closed
ZackZeng999 wants to merge 1 commit into
sgl-project:mainfrom
ZackZeng999:zzw
Closed

111#544
ZackZeng999 wants to merge 1 commit into
sgl-project:mainfrom
ZackZeng999:zzw

Conversation

@ZackZeng999

Copy link
Copy Markdown
Contributor

No description provided.

efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
…che observability gap

Records the boot recipe decisions (env-driven storage directory, explicit
24 GB host L2 pin over the derived 2.0 ratio, page_first rather than the
sgl-project#436-blocked page_first_direct) and the validation plan.

Notes the gap that forced the indirect activation proof: the hierarchical
cache emits NO Prometheus series whatsoever -- no hit, miss, write or
eviction counters and no tier-bytes gauge, only two log lines. L3 activity
is therefore not separable from the radix-level cache_hit_rate, and disk
capacity and eviction are unmeasured. The kvso spill tier already exposes
spill_tier_used_bytes / spill_tier_total_bytes, so the pattern to copy is
in tree. Follow-up task candidate.

Also records that cgroup memory.stat is the only trustworthy RAM source
here: lxcfs reports 120 GB against a real 98 GB, so any guard reading
psutil.available is blind in this container.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
…ect + direct

My earlier page_first choice was wrong and is reversed here. Three facts,
the first two from the tree and the third measured on this rig today:

* MambaPoolHost raises unless layout == 'page_first_direct'
  (memory_pool_host.py:96-100) and the hybrid assembler constructs it
  UNCONDITIONALLY for a GDN model (hybrid_pool_assembler.py:551). With
  page_first this boot would have failed hard, not stored KV-only.
* page_first + io_backend=kernel is the route with an OPEN segfault on
  both the cu12 and cu13 wheels (transfer_kv_all_layer_lf_ph, per the
  runbook). That was the combination I had picked.
* The direct route works. cudaMemcpyBatchAsync needs a pinned host side
  and a non-legacy stream; production satisfies both (pin_memory
  defaults True, and cache_controller.py:742 copies inside
  'with device_module.stream(self.write_stream)').

Measured matrix, transfer_kv_all_layer_direct_lf_pf through
MHATokenToKVPoolHost(layout='page_first_direct') on the cu13 wheel:

  pageable + default stream -> failIdx=SIZE_MAX invalid argument
  pageable + side stream    -> CUDA error: invalid argument
  pinned   + default stream -> failIdx=SIZE_MAX invalid argument
  pinned   + side stream    -> OK   (the production shape)

So the sgl-project#441(b) guard is NOT a stale flip: the test fails for real because
it allocates pageable host memory (pin_memory = io_backend == 'kernel')
and copies on the default stream. Unskipping it alone leaves it red. The
guard is restored with the measured matrix as its reason so nobody reads
it as 'direct is broken in production'; making the test production-shaped
is the actual follow-up, alongside the separate kernel+page_first
segfault.

Boot command accepts hermetically: hicache True/file/24,
layout page_first_direct, io direct, max_size 100Gi, min_free_space 20Gi,
chat_template_default_kwargs {'preserve_thinking': true}, spec EAGLE,
ctx 262144, kvso False.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
…two findings

Booted 2026-08-04T11:25Z, green. Server up 55 s after launch; serving
pgid stopped with no orphans; translator PID 30439 untouched throughout.

Live config: hicache file backend, ratio 2, page_first_direct + direct,
max_size 100Gi / min_free_space 20Gi, chat_template_default_kwargs
{'preserve_thinking': true}, ctx 262144, NEXTN, kvso False.

Validation:
* disk tier ACTIVE -- files under /spinning/hicache 381 -> 12270, 271 MB
  written; storage backend 'file' created on all three ranks. This is the
  only available proof: hicache emits no Prometheus series at all.
* short-context sanity correct ('Lisbon, 391').
* preserve_thinking kwarg has effect -- turn-2 prefix reuse 77.2 % vs
  6.4 % between variants.
* VRAM corridor held: min free 3009/3577/3013 MiB over 100 ms sampling.
* host RAM anon 18.8 + shmem 36.7 = 55.5 GB non-reclaimable of 98 GB.

Two findings for the owning tickets:

* sgl-project#540: the overshoot bound is understated. Measured 6/9/6 tokens at
  budgets 64/128/256 against a stated '<= draft_token_num' of 4. The
  closing marker is itself 1-3 tokens and is counted into
  reasoning_tokens, on top of the 4-token NEXTN verify granularity, so
  the bound should read draft_token_num + marker_tokens. Not a blocker.
* sgl-project#544: the preserve_thinking spread is INVERTED against the probe's own
  documented mechanism -- preserving thinking should raise turn-2 reuse
  and instead lowered it. The discriminator fires, so the kwarg reaches
  the template, but the direction needs resolving before the reuse figure
  is quoted as a benefit.

Also fixed two artifacts in the validation script itself: a 60-token cap
that starved the sanity answer behind the thinking block, and a quoting
bug in the section-1 config dump.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
…ed: broken control arm, no render bug

Outcome (c) of the discrimination matrix: probe-arm mix-up.

probe_preserve_thinking.py:89-90 builds its control as 'if preserve:
body[...] = {...}', so the false arm sends NO kwarg. That was a valid
control only before this boot set a server default. With
--chat-template-default-kwargs '{"preserve_thinking": true}' omission now
INHERITS true, so both arms ran preserved and the 77.2 vs 6.4 spread is
not attributable to the kwarg. Both arms rendered within one token of
each other (993 vs 992), so the spread was cache state read through
global counters on a shared server.

First-divergence matrix, both fronts against ONE raw /generate stream
(offline tokenisation, so the parser's lossy reasoning/content split does
not contaminate it):

  OpenAI    reasoning_content   pv=true   345/345 (100.0%)  byte-exact
  Anthropic wrapped in content  pv=true   345/345 (100.0%)  byte-exact
  OpenAI                        pv=false   29/345 (  8.4%)  diverges
  Anthropic                     pv=false   29/345 (  8.4%)  diverges

Hypothesis (b), whitespace/re-render mismatch, is REFUTED: at true the
re-render reproduces the whole assistant turn including the think block
and its close, token for token. The paths agree because the Anthropic
front prepends wrap_reasoning_history() as a plain text block rather than
as reasoning_content, and both shapes render the same once kept.

Consequence for the default-flip decision: the template STRIPS the think
block unless preserve_thinking is set, so flipping the default off would
CAUSE the prefix collapse it was suspected of -- 100% down to 8.4%, on
both fronts, with the Anthropic path unable to compensate per-request.
Recommendation: keep the default on. This matches the battery's own 62.9
vs 66.9 percent.

Two defects recorded: the Anthropic front ignores chat_template_kwargs
entirely (82 tokens for both true and false, against 48 vs 82 on the
OpenAI front), so only the server default reaches it; and the probe is
invalidated by the default it tests, corrected version added.

sgl-project#545: POST /hicache/storage-backend/resize returns HTTP 400
admin_api_key_missing -- the boot has no --admin-api-key, so the live
gap stays open pending that flag. The max_size cap was however validated
under real battery load: the tier grew about 20 GB/min and then flattened
(4636 MB per 20 s down to 46 MB per 20 s), so 100Gi engages and holds
instead of filling the filesystem.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
yunkchen pushed a commit to yunkchen/sglang that referenced this pull request Dec 2, 2026
Why:
- target model run in cp2 and draft model run in tp2, which should adjust
  kv slot layout in draft model context
- The earlier fix on this branch (384e881,
  original PR sgl-project#544, closed) wrapped the draft KV allocation in a conditional
  scope: self._draft_context() only when draft_parallel_layout.disable_cp,
  nullcontext() otherwise. The updated fix in public PR sgl-project#578 removes that
  condition so KV allocation always runs in the draft context. Per
  maintainer instruction, this commit absorbs the PR sgl-project#578 version wholesale
  to replace the earlier patch content on this development branch.

How:
- Single-file content replacement:
  python/sglang/srt/speculative/dspark_components/dspark_worker_v2.py
  is set byte-for-byte to the PR sgl-project#578 head version
  (26bc027, blob
  e109f07).
- Delta vs the previous patch version (blob
  d3cfaec): drop the contextlib.nullcontext
  import; replace the conditional with-context around alloc_memory_pool
  with an unconditional "with self._draft_context():".
- Direct content absorption, not a cherry-pick (the PR base
  release/v0.5.23 differs from this branch and a pick would conflict).
  No other file is touched; no additional semantic change is introduced.

Dependency:
- Source: public PR t-head#578
  (head 26bc027, base release/v0.5.23).
- Supersedes 384e881 on this branch; both
  versions share the same pre-patch file base (blob
  82aff99).

Test:
- Pending verification (not yet run on this branch):
  - Unit:
    - test/registered/kernels/ops/attention/
    - test/registered/unit/mem_cache/
  - E2E:
    - telechat cp2x4 with dspark E2E case

Signed-off-by: renhua92 <[email protected]>
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