Skip to content

Allow disabling flashinfer sampling kernel - #778

Merged
merrymercy merged 5 commits into
mainfrom
allow-disable-flash-infer-sampling
Jul 28, 2024
Merged

merrymercy merged 5 commits into
mainfrom
allow-disable-flash-infer-sampling

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

a temporary fix for #771 to disable flashinfer sampling kernel

@merrymercy
merrymercy merged commit 752e643 into main Jul 28, 2024
@merrymercy
merrymercy deleted the allow-disable-flash-infer-sampling branch July 28, 2024 03:18
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
amote-i pushed a commit to amote-i/sglang that referenced this pull request Dec 8, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…s ~2x and breaks serving

d7c3736 (sgl-project#1015) was merged, booted, and REVERTED (a204832). It is not a
mis-scoped refactor -- it takes serving down.

MEASURED, boot_855_cons1_0840f82601_0830_073758 vs the same tree without it:

  TP-phase "weights + runtime state" (GiB)   before sgl-project#1015   with sgl-project#1015
    PP0                                          4.252        26.581
    PP1                                          2.719        14.788
    PP2                                          3.662        15.435
    sum                                         10.633        56.804

  The checkpoint is 27.5 GiB. sgl-project#1015 swung the post from under-booking (10.63,
  the defect I reported in sgl-project#1014) straight past correct to ~2x OVER-booking:
  56.8 GiB of weights charged for a 27.5 GiB model, i.e. roughly the WHOLE
  model on EVERY rank instead of that rank's shard.

  Consequence, same boot:
    TP-phase PP0 KV budget "rest"    24.195 GiB  ->   1.867 GiB
    EFFECTIVE max_total_num_tokens    615,434    ->   185,344   (-70 %)
    per-rank capacities         597210/448290/449378 -> 61152/57920/68724
    coherence probe (/generate, greedy, "capital of France")  -> NO RESPONSE

  The recalibrator then reacted to the collapsed capacities and moved the
  token vector [30,17,17] -> [21,20,23], which is correct behaviour on wrong
  inputs and would have written a garbage vector into the next boot's hint.

REVERT VERIFIED: a204832 restores TP world 615,434 and the probe answers
"Paris". One file, 60 lines
(model_executor/model_runner_kv_cache_mixin.py) -- so the runtime blast radius
of d7c3736 is exactly the weight post, which isolates the attribution.

WHAT I GOT WRONG AND SHOULD HAVE CAUGHT FIRST: I supplied the sgl-project#1014 diff that
motivated this fix, including the expected TP shard figures (~13.75/6.9/6.9
GiB from the 32,16,16 vector). I flagged at the time that I had NOT verified
whether the flip re-materialises weights or re-views the PP residency, and
that if it re-views them the "correct" TP post may legitimately be smaller
than shard arithmetic. That caveat turned out to be the whole question, and a
fix built on the arithmetic alone overshot. A boot-time falsifier -- assert
the summed TP weight post lies between the largest single rank shard and the
whole checkpoint -- would have caught this at the desk.

The rest of the planner chain (#1009a/sgl-project#1010/sgl-project#1018/sgl-project#1019) is NOT reverted: it
came in via cc70a6d and the earlier merges and is unaffected.

ALSO ON THIS BOOT, and it works: sgl-project#778 cold-post-spill (5379340) is live and
its markers fire on the real seam --
  "phase-release LEND pp_to_tp: 65536 rows (~1024 MiB)" on PP0,
  131072 rows (~1024 MiB) on PP1 and PP2 (row counts differ because the PP
  cell differs: 16384 B on PP0, 8192 B on PP1/PP2),
  "phase-release REPAY tp_to_pp: loan -> 0 rows" on all three before the
  prefill leg resumes.
REPAY reports "0 MiB returned" -- the dial had not yet grown into the credit
at that seam, so the repayment had nothing to hand back. That is the
convergence behaviour the author described, not a leak, but it means the
LEND's token effect is NOT yet demonstrated on metal and must not be counted
in any ladder until a boot under load shows the pool actually taking it.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…ken-effective, and my own

3-cut margin is inside the noise

Three passes on the identical config (gdncov, [32,18,14]/[8,4,4]), each boot
reading the previous pass's seam record, agent-shaped load between passes.

(1) sgl-project#778 RESERVE-LEND: NOT TOKEN-EFFECTIVE. Stays out of the ladder.

Under a full 240 s agent load: 36 LEND events, 33 REPAY events,
96 BACKING-DIAL calls (48 grow / 48 shrink). REPAY events returning >0 MiB:
ZERO of 33. Every one reads "loan 131072 -> 0 rows, 0 MiB returned"
(65536 rows on PP0). The loan is offered and fully released, and nothing is
returned because the pool never took the rows in the first place.

So the mechanism is desk-correct and seam-correct -- the row arithmetic is
per-rank right (65536 x 16384 B on PP0, 131072 x 8192 B on PP1/PP2, both
~1024 MiB) -- and token-INEFFECTIVE on this configuration. The missing
demonstration the operator asked for did not appear under load. It must NOT
be counted in any capacity ladder. That is now measured, not assumed.

(2) CONVERGENCE, and I CORRECT MY OWN PASS-2 READING.

  pass   TP world tokens   seam B/row (rank0)   staging post (rank0)
   1        615,434            3589.0                 --
   2        583,030            3954.3               1990 MiB
   3        616,194            3961.7               1903 MiB

After pass 2 I reported the pool as "shrinking, not converging" and called it
a ratchet. PASS 3 FALSIFIES THAT. The series is not monotone: pass 3 comes
back to 616,194, +760 tokens (+0.12 %) against pass 1. The seam per-row is
essentially flat between passes 2 and 3 (+0.2 %); what moved the tokens is the
STAGING POST, 1990 -> 1903 MiB. Pass 2 was the outlier, and I should not have
called direction on two points.

THE USEFUL NUMBER IS THE SPREAD, NOT THE TREND: pass-to-pass deviation reaches
5.3 % (615,434 -> 583,030) while pass 1 and pass 3 agree to 0.12 %. So one
boot's pool figure carries roughly +/-5 % of boot-to-boot noise from the seam
record alone, and the fixed point is stable at ~615k rather than eroding.

(3) CONSEQUENCE FOR MY OWN 3-CUT VERDICT -- it is weaker than I stated.

My three-cut table (fed1c56) compared single boots:
  [32,18,14] 616,670   [32,17,15] 592,677   [31,18,15] 567,412
The pin-vs-makespan gap is 3.9 %. That is INSIDE the +/-5.3 % per-pass noise I
have now measured, so those two cuts are NOT separable on one boot each. The
kv-floor gap (-8.0 %) is outside it and stands.

Restated honestly: [32,18,14] is the best MEASURED cut and remains the right
thing to serve, but "Pareto-dominant over [32,17,15]" overstates the evidence
-- on capacity those two are indistinguishable at n=1. Only the prefill axis
(15.03 s vs 15.81 s for kv-floor) and the kv-floor capacity loss are resolved.
Any future cut A/B needs repeats, not a single boot per arm; the same applies
to the -3.9 % regression I attributed to the makespan objective.

Serving is UP on pass 3 (616,194 tokens), coherent, deadman armed. Free per
card 1239 / 1078 / 1643 MiB -- all three now inside the 819-1229 corridor band
or just above it, the tightest this strand has measured.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…her premise holds

(1) "WHERE DID THE CONVERTED FREE GO" -- IT DIDN'T. The premise mixes two
    instruments, two cuts and two moments.

The KV budget posts are BYTE-IDENTICAL between pass 1 and pass 3, every post,
both phases:
  PP-phase  PP0 13.572 / PP1 7.408 / PP2 8.342 weights, holdback 1.000,
            mamba 0.731/0.426/0.304, spec 0.877/0.511/0.365, prefill 1.000
  TP-phase  weights 4.283 / 2.734 / 3.678, rest 24.164 / 13.821 / 13.855
Nothing in the ledger moved. And on the SAME instrument across passes,
available_gpu_mem is unchanged too: PP0 1.62 / PP1 3.01 / PP2 2.36 GB in pass
1 AND pass 3.

The "before" figures (PP1 3522 / PP2 2171 MiB) are available_gpu_mem READ OFF
THE solveRR BOOT -- a DIFFERENT cut ([32,17,15]) -- reported as 3.44 / 2.12 GB.
The "after" figures (1239/1078/1643) are NVML free sampled at runtime after
the conv3 boot. Different quantity, different cut, different moment. So the
free was never consumed and the 674k projection was never funded by it: on
this cut the headroom is 3.01 GB on PP1 and 2.36 GB on PP2 and it is STILL
THERE, unspent, right now.

WHAT DOES MOVE is the seam STAGING POST, and it existed in pass 1 too -- the
"vorher --" in the question is an artefact of which lines I had quoted
earlier, not of the boot:
  pass   rank0 seam B/row   rank0 STAGING   rank1/2 B/row   rank1/2 STAGING   world
   1         3620.4            1794 MiB        1167.1          701 MiB      615,434
   2         3954.3            1990 MiB        1167.1          701 MiB      583,030
   3         3961.7            1903 MiB        1202.9          685 MiB      616,194
rank0 B/row rises monotonically (3620 -> 3954 -> 3962) but STAGING does not
(1794 -> 1990 -> 1903), and the world figure follows STAGING, not B/row. So
this is not a sgl-project#782 monotone ratchet. Consistent with that: trapsafe finds ZERO
latch/refusal lines of any kind, and the rank1/2 staging change of -16 MiB is
itself below the 64 MiB latch threshold and happened anyway -- i.e. no latch
is arming on this path at all.

CONSEQUENCE: the +9.42 % projection is NOT falsified and NOT demonstrated. It
was never attempted, because the headroom it would draw on is still sitting
free. Pushing the staging post back is a live lever; it is just not the thing
that ate anything.

(2) LOAN-CAP HYPOTHESIS -- FALSIFIED. The pool does not refuse the rows; it
    never asks for them.

Log check on the TP-decode phase, conv3 boot: RESERVATION-CAPPED 0,
"reservation capped" 0, extent refusals 0, "capped at the id space" 0,
"beyond the id space" 0. Zero refusals of any kind.

The 39 BACKING-DIAL calls show why. Fields carried are request / prev_size /
uniform_backed_rows / reserved_backing_rows / store_bound_rows. First call:
request=575920 against prev_size=616194 -- the dial asks for LESS than the
pool already is. Last call: request=334134, prev_size=228134,
uniform_backed_rows=229376 -- growing, but to 334k against an id space of
616,194. Across the run the dial operates far BELOW the existing ceiling and
its requests track demand.

Also worth recording against the cap theory: reserved_backing_rows=763651 and
store_bound_rows=763652 are ABOVE the 616,194 id space, so the backing
bookkeeping is not clamped to the id space in the first place.

So the LEND is not unconsumable BY CONSTRUCTION. It is unconsumed because
demand at the tested load (agent-shaped, 5 sessions) never reached the
existing id space, so the loaned extension was never needed. That is a
weaker and more accurate statement than the cap hypothesis, and it changes
the handover: the open question for sgl-project#778 is not "fix the cap" but "does a
load that actually saturates 616k rows take the loan". My measurement does
not exclude that; it only shows this load never got near it.

sgl-project#778 therefore stays OUT of the ladder -- unchanged verdict, corrected reason.

LADDER STATUS with today's deletions: fixed point 616k MEASURED (pass 1 and
pass 3 agree to 0.12 %), +/-5.3 % boot-to-boot noise mandatory on every future
pool figure, sgl-project#364 out (both gates), sgl-project#778 out (not demonstrated), 674k
projection unattempted with its headroom still free.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…-bearing, not precaution

The comment asserted that "without this the grow would be refused as
RESERVATION-CAPPED". That was inferred from the boot's 609062-vs-592677
ratio and never from an observed refusal -- an indicator-law violation, a
ratio read off a boot and turned into a statement about behaviour.

Measured 2026-08-30 by the sgl-project#855 strand at 5 sessions (dial requests
334-576k against a 616194 id space): RESERVATION-CAPPED 0, extent refusals
0. The ceiling does not bind AT THAT LOAD.

The correction is bounded in both directions, which is the point. That
measurement falsifies the ceiling as a binding constraint at the tested
load; it does NOT establish that it never binds, because the load never
drove occupancy near 1.0 and saturation is exactly when the dial would
press against it. So the widening is UNPROVEN, not disproven, and equally
not "mere precaution" -- my own first retraction overshot that way and is
corrected here too.

It stays because the bet is asymmetric and the cheap side is already named
in lawful_reservation_rows: an over-sized VA reservation costs address
space, an under-sized one is a permanent wall no runtime actuator can lift.
The comment now says what is measured, what is not, and forbids
re-describing it either way until a saturated boot has read the LEND/grow
pair.

No behaviour change: comment only.
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