Skip to content

Temporarily disable the prev_output_ids for retract - #489

Closed
hnyls2002 wants to merge 1 commit into
mainfrom
revert-retract
Closed

hnyls2002 wants to merge 1 commit into
mainfrom
revert-retract

Conversation

@hnyls2002

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy merrymercy closed this Jun 1, 2024
@merrymercy
merrymercy deleted the revert-retract branch June 1, 2024 06:31
EdwardXuy pushed a commit to shun8686/sglang that referenced this pull request May 9, 2026
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…our losing side

Survey -> evaluation, desk only. Persistent file: docs/ANALYSE_489_int8_kv.md.
Verdict: do not pursue on this rig.

(a) NOT SUPPORTED, and it is unbuilt rather than unflagged.
server_args.py:1008 choices are ["auto","fp8_e5m2","fp8_e4m3","bf16",
"bfloat16","fp4_e2m1"] -- no int8. A tree-wide search returns ZERO int8-KV
code: none in memory_pool.py, none in the FlashInfer or Triton backends, no
"int8 kv cache" anywhere. (The int8 at server_args.py:3954 is
deepep_dispatcher_output_dtype, a MoE setting -- named here because it is the
obvious false positive when grepping.) So this is a feature to build: pool
storage dtype, quant/dequant paths, backend kernels.

(b) THE INVERSION APPLIES DIRECTLY, because we run FlashInfer.
The live boot reports attention_backend='flashinfer' for the text path.
triton_attn appears ONLY as the multimodal backend ("Multimodal attention
backend not set. Use triton_attn") -- a different selection that must not be
misread as the text path, and the GDN layers take the separate hybrid linear
backend. Adopting int8 would therefore move text attention OFF FlashInfer onto
Triton, which is exactly the trade that produced Whamp's -72% at 58K.

Our regime sits on the losing side and not marginally: context 327,680, pool
~436k, max_running_requests 4. The GAIN regime is short-context high-concurrency
decode (+76-81%); ours is deep context at low concurrency, ~5.6x past the
measured inversion point. The inversion is not a risk to manage here, it is the
expected outcome.

(c) MICROBENCH PLAN, spec not run. Notes the rig is HETEROGENEOUS IN SM
VERSION -- the two 3080s are sm_86, the 5090 is sm_120 -- so an "sm86
microbench" covers two of three cards and must be reported per card, never
averaged. Kernel-level arms (an end-to-end arm cannot be built without the
feature), depths through 58K to reproduce the inversion point on our own
silicon, A-vs-A first against the rig's 14.1% noise floor, and a KILL CONDITION:
if 58K reproduces the inversion on sm_86, the ticket closes.

(d) PER-RANK KV DTYPE is blocked by two independent contracts.
Pool side: nearly expressible -- per-rank cell width is ALREADY per-rank
(logged cell 14336/10240/8192), uniform only because one dtype is passed to
every pool. Seam side: HARD BLOCK, runtime-pinned at
phase_flip_runtime.py:32-35 -- "the receiver derives the expected byte count
from ITS OWN pool's per-layer row width; a sender whose row format diverges is
a loud size/checksum error". Divergent dtypes make every seam exchange a
checksum failure. Canonical-page side: independently blocked -- the sgl-project#706
contract requires the same key to name the same bytes regardless of which rank
wrote them, and a per-rank dtype makes the bytes rank-dependent, which is the
two-geometry problem that contract exists to prevent.

(e) QUALITY GATE, three parts, stated so it cannot be softened: determinism
A-vs-A with CPU-sampled inputs first; accuracy against the fp8 baseline with
tolerances FIXED BEFORE the run; and DEPTH-STRATIFIED reporting (1K/32K/128K/
327K separately), because the failure mode is depth-dependent and an average
would hide exactly our regime. No enable without all three; opt-in regardless.

RECOMMENDATION: close as evaluated-and-declined unless (c) contradicts the
published inversion on sm_86. (c) is the one cheap thing worth doing -- it is
kernel-level, rides any window, and its kill condition closes the ticket on our
own silicon rather than on someone else's.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…acle, and the cheap disconfirmer

THREE PREMISE CORRECTIONS before designing anything on top of them.

(a) There is no int8 KV dtype in this fork. --kv-cache-dtype admits
auto|fp8_e5m2|fp8_e4m3|bf16|bfloat16|fp4_e2m1 (server_args.py:1008). The
harvest agrees ("Ours: no INT8 KV at all") and so does the plan ("zero int8-KV
code tree-wide").

(b) "int8-PTH" is the name of a PROPOSAL, not a feature: the title of
docs/ANALYSE_489_int8_kv.md @ 272b408, status "survey -> evaluation, desk
only. No build, no GPU, no load." Nothing tiers to Triton in our tree because
nothing exists to tier.

(c) The Triton inversion is sgl-project#489's DECLINE REASON and it is external: +76-81%
decode short-context but -72% at 58K, because the dtype selects a BACKEND TIER
(fp8 keeps FlashInfer, int8 falls to Triton-only). Our rig runs flashinfer on
the text path and our 327,680-token regime sits ~5.6x past 58K. sgl-project#489 closed it
as evaluated-and-declined.

So sgl-project#726 is a RE-OPEN REQUEST against a documented decline, and the only
question is whether the new evidence bears on the decline's reason. It does:
sgl-project#489 assumed int8 => Triton => slow, and the harvest supplies what that
assumption lacked -- QK on native m16n8k32.s8 with K read straight from cache
with NO dequant, an sm80-era instruction verified to assemble on our CUDA for
sm_86 AND sm_120a, on cards (the 3080s) that have native IMMA and NO fp8
tensor-core path at all. The published -72% was measured against a Triton lane
doing dequant-and-bf16, which is exactly the lane IMMA-QK replaces.

That does not overturn the decline; it removes its ground -- which is the
condition sgl-project#489 wrote for itself: "Close as evaluated-and-declined for this rig,
UNLESS the (c) microbench contradicts the published inversion on sm_86."

SO NO KERNEL DESIGN, deliberately. sgl-project#489 section (c) is already a written ticket
spec with a sweep, an A-vs-A rule and a KILL CONDITION, recorded as "the only
cheap disconfirmer but NOT scheduled". Before sgl-project#726 it had no motivation; the
IMMA finding is that motivation. Scheduling it is cheaper than a design and can
close the ticket outright on our own silicon. Writing ANALYSE_726 as a
from-scratch design would also have duplicated sgl-project#489, which already carries the
support survey, the inversion pricing, the per-rank hetero twist and the
three-part lossy quality gate.

BUILT (hermetic, useful under either outcome), 16 pins, 4.7 s, no CUDA:
  * codec ORACLE -- pure-torch transcription of NInfer's codec: symmetric, no
    zero point, per-token per-64-group absmax, FP16-STORED scale, RNE, clamp
    +-127. The fp16 round-trip happens at quantize time because the kernel
    reads an fp16 scale and a reference must quantize against the value the
    kernel will use.
  * MEASURED error, CPU-sampled (the CUDA generator is not bit-comparable
    across architectures): normal 0.38% max / 0.59% RMS; heavy-tailed 0.39% /
    1.24%; with a 1000x outlier 0.39% / 0.60%. Two readings for the quality
    gate: group-64 DOES isolate outliers, and HEAVY TAILS ROUGHLY DOUBLE the
    RMS -- so the gate must test that distribution, not Gaussian noise.
  * 1.94x footprint as arithmetic: 256 codes + 4x2 B scales = 264 B vs 512 B
    bf16 = 1.939x, pinned so a later layout change cannot keep claiming it.

THE KEY-COLLISION SURFACE THE BRIEF EXPECTED IS ALREADY CLOSED.
compute_model_identity_hash (hicache_storage.py:59) already folds
kv_cache_dtype into the identity, and its docstring gives the sgl-project#241/sgl-project#513 reason
verbatim: a run differing in --kv-cache-dtype "would silently read pages
written in another byte format", and the hash "turns that silent wrong hit into
a clean miss". Adding an int8 value separates its pages automatically; NO key
work is required. Pinned anyway, including a source pin so a behavioural pass
cannot come from an incidental salt. Caveat left open: the hash is optional
("None keeps legacy key layout") and whether any tier runs legacy is NOT
ESTABLISHED.

Backend-carrier mapping and pool-layout cost are deliberately NOT in this note:
the verdict does not depend on them, and if sgl-project#489 (c) fires its kill condition
that map is work nobody needs.

ruff + codespell clean. Desk only, no boot, no GPU, no serving contact.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ves the layout and misses the point

The delegated map completed after the verdict and independently reproduced all
three premise corrections, including the zero-hits grep for int8 KV and the
absence of int8_pth anywhere in the fork. It supplied four things that change
what a build would have to do; the two load-bearing ones I verified directly
rather than adopting on trust.

VERIFIED (1): today's fp8 KV scale mechanism is hard-coded to PER-TENSOR and
says so -- layers/quantization/kv_cache.py:76-79 raises "Only support
per-tensor scaling factor for fp8 KV cache" unless both scales are plain
floats. A group-64 per-token layout is therefore not an extension of the fp8
path; that path actively refuses anything finer than one float per layer.

VERIFIED (2), and this is the trap: the ONE existing group-scale precedent
dequantizes EAGERLY. MHATokenToKVPoolFP4 (memory_pool.py:3302-3350) keeps a
separate per-layer k_scale_buffer with one scale per 16-element block --
structurally the right shape -- but _get_key_buffer then calls
BlockFP4KVQuantizeUtil.batched_dequantize, materialising full precision before
any backend sees it. Copying that pattern would deliver the VRAM saving and NOT
the bandwidth saving, and bandwidth is the entire point of IMMA-QK: NInfer
explicitly refuse a standalone quant/dequant kernel because it "would defeat
the halved-bandwidth goal". A build reusing the fp4 machinery would look like
it had landed the feature while delivering half of it.

FROM THE MAP (3): the closest carrier is the grouped Triton kernel --
_fwd_grouped_kernel_stage1 already does a real tl.dot(q_k, k) -- but k_scale is
folded into sm_scale as a SINGLE SCALAR before the kernel is entered, so no
per-group descale exists inside it. The non-grouped MHA path is further away
still: tl.sum(q * k, 1), not a dot.

FROM THE MAP (4): IMMA is already in-tree in the wrong place --
sgl-kernel/csrc/gemm/int8_gemm_kernel.cu runs mma.sync.aligned.m16n8k32.s8 for
W8A8 LINEAR layers, never reached from the KV pool or any attention backend;
per_token_group_quant_8bit.cu is a group-size-templated quant kernel and is a
plausible reusable primitive, also unapplied to KV.

CORRECTION TO MY OWN SECTION 4: I wrote that the key-collision surface is
already closed. That is right for the question asked and INCOMPLETE for the
question a build raises. compute_model_identity_hash hashes the dtype STRING,
not the byte layout within it -- so once int8 exists, a later group-64 ->
group-128 or fp16 -> bf16 scale change keeps the same string, the same identity
hash, and different bytes on disk. Persistent tiers outlive the process, so
that is a silent wrong hit of exactly the kind the hash was built to prevent
(sgl-project#513 class).

NAMED AS A BUILD REQUIREMENT, NOT PINNED: a pin asserting two int8 layouts
produce different keys cannot fail today because neither layout exists, and
writing one would encode a green state that does not exist -- refused twice
already on this strand. The requirement is that layout parameters (group size,
scale dtype) enter the identity, not just the dtype name.

None of this changes the verdict: schedule sgl-project#489 section (c) first. It is one
more item on the build's bill, and the build is not the next step.

codespell clean. Desk only, no boot, no GPU, no serving contact.
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.

2 participants