Skip to content

enable marlin kernels - #286

Merged
merrymercy merged 1 commit into
sgl-project:mainfrom
qeternity:marlin
Mar 13, 2024
Merged

merrymercy merged 1 commit into
sgl-project:mainfrom
qeternity:marlin

Conversation

@qeternity

Copy link
Copy Markdown
Contributor

Closes #28

@merrymercy
merrymercy merged commit d9b3b01 into sgl-project:main Mar 13, 2024
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
EdwardXuy pushed a commit to shun8686/sglang that referenced this pull request Apr 8, 2026
IzacharyI pushed a commit to IzacharyI/sglang that referenced this pull request Jun 13, 2026
* Fused kernel before moe

* Add shared_expert_topk_fusion

---------

Co-authored-by: root <[email protected]>
efschu added a commit to efschu/htsglang that referenced this pull request Jul 29, 2026
…register.py — generisches VRAM-Posten-Tiering (Klassen graph_rungs/drafter_heads/lane_workspaces/cold_lane/experts, Regler resident|ram|auto + fraction, Presets --lane-offload-profile, phase_mask + Zeitkonstanten-Stufen wave|phase|turn, on_phase_boundary-No-Op-Planer mit injizierbarer Overlap-Kostenfunktion, Latenz-Term-API fuer sgl-project#279); Invarianten (Hysterese/Hot-Ablehnung/Prio-Schutz/Fraction-Kappe) in park() und Planer erzwungen; Adapter hinter SGLANG_OFFLOAD_REGISTER=1, Default-Pfad unveraendert; Audit-Tabelle Experten-Maschinerie in INTEGRATION_R3_VALIDATION; Tests 42 neu + 152 Concurrency gruen, ruff/codespell sauber
efschu added a commit to efschu/htsglang that referenced this pull request Jul 29, 2026
…-only): offload_movement.py (Bewegungs-Backend mit Zustandsmaschine resident->park_in_flight->parked->wave_in_flight, injizierbare DeviceOps, Tensor-/Tag-/Suspend-Routen), Tier-Leiter own_vram->peer_vram->host_ram->remote mit gerichtetem P2P-Faehigkeitsmodell (effektive Apertur als Messwert, nominal nur Info; reject|chunk beide angelegt, Default konservativ reject; ungemessene Pfade nie genutzt; Peer-Budget-Grant-Pflicht), offload_sizes.py echte Groessen-Erhebung mit Live-Refresh, offload_bus_budget.py PCIe-Arbiter nach 236/242-Muster mit Planer-Anbindung, --lane-offload-park-targets + klasse=politik[:anteil][@ziele]-Syntax; 260 Tests gruen; Doku-Konflikt (beide Vorbau-Sektionen) beidseitig behalten
efschu added a commit to efschu/htsglang that referenced this pull request Jul 29, 2026
…t): htccl_path_dispatcher.py (PathProfile affine ms(bytes) + Kapazitaet + effektive Apertur + measured|placeholder je Eintrag; decide() je Klasse/Groesse/Lane/Prio mit Saettigungs-Ueberlauf, Latch je log2-Band, Flips nur an Runden-/Capture-Grenzen) + htccl_path_rates.py (Parser p2p_readiness NUR Effektivwerte, sgl-project#278-TSV, NCCL-Referenz-Schema v1 mit Pflicht-p99+Last-Arm); harte Regeln je an einer Stelle erzwungen: Placeholder-Neutralitaet (ohne measured-Daten byte-identische sgl-project#240-Wahl, per Identitaets-Test ueber 3x3x4x4 belegt), Graph-Safety, Prio-Schutz, Offload-Latenz-Term-Anschluss; Bus-Begriff mit sgl-project#286-Arbiter geteilt via benanntem Sensor-Adapter; SGLANG_HTCCL_PATH_DISPATCHER Default aus; 46 neue Tests, distributed-Suite ohne neuen Fehlschlag
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
Desk design only, no cards (CUDA_VISIBLE_DEVICES=99), no implementation.

Verdict: sgl-project#407 is not a new abstraction, it is a NODE layer plus a
reconciliation. The edge half — what does it cost to move a byte from here
to there — already exists FOUR times with four readers and four absent-value
rules: cost_model.PairMatrix (#348b, UUID-keyed), barlink_path_rates.
PathProfile (sgl-project#279, affine per route), offload_movement.PeerPathCapability
(sgl-project#286, CUDA-ordinal-keyed) and card_probe h2d/d2h (sgl-project#271). E2 and E3 both want
the effective BAR1 aperture from p2p_readiness/capability_matrix.json and only
E2 has a loader. What exists nowhere is the node layer, and in its place the
tree carries four disjoint tier vocabularies (PARK_TARGETS sgl-project#286;
LOCAL_DESTINATION/SUPPORTED_PARK_BACKENDS sgl-project#224; StorageMedium telemetry;
HiCache choices=). Expert offload, the largest byte mover in the fork, is in
none of them: its tier is device="cpu" + .pin_memory() written out five times.

Two shipped contradictions the design bends around, both stated up front:

C1 — two opposite total orders over one axis. sgl-project#224's destinations_error makes
'local' first a hard validation law ("a remote tier is a tier BELOW local,
never above it"); sgl-project#286's ladder puts peer_vram ABOVE host_ram. Resolved by
making the order a shortest path over a STAGING GRAPH: 'local first' is
recovered as reachability (the only edge out of a device tier toward a blob
tier runs through host), peer_vram is recovered because vram->vram is a direct
edge. Neither consumer's shipped behaviour changes.

C2 — the one existing tier ledger is positionally keyed. CapacityLedger keys
peer-VRAM budgets by CUDA ordinal; AUDIT_331 calls that SCOPED and legitimate
until it crosses a process boundary, which is exactly what sgl-project#305 §6 ("one
ledger, no second accounting") asks for. On this rig the 5090 is CUDA ordinal
0 and NVML index 1, so the failure is silent card-swapping.

Honesty correction on three numbers the brief assumed measured: the peer-VRAM
1-3 us posted-write class is an explicit ASSUMPTION (EVAL_p2p §"Tragende
Annahmen"), NVMe latency does not exist in the tree in any unit, and host DRAM
38 GB/s is derived from an ASSUMED DDR4-3200 peak (the VM hides SPD). They
ship as ESTIMATE/ABSENT under #348b's measured-or-named rule. Everything else
in the inventory is sourced: 5090 32607 MiB / 3080 20480 MiB, membw 1558/723
GB/s, BAR1 256 MiB nominal but 96 MiB contiguous with 1.13-1.34x vs NCCL at
20 KiB-16 MiB, H2D 6.4/13/13 GB/s gen4 x4/x8/x8, NVMe 1.8 GB/s cold (ARC rows
excluded), rig-2 2.07-2.83 GB/s with 1.47 us at 8 B and ~89/202 us serving
collectives.

Consumer survey, eight consumers read in their target-selection code:
sgl-project#77/sgl-project#123 expert offload MECHANICAL for the UUID-vector half (it revives sgl-project#394's
merged-but-starved link-proportional sharding, 145 -> 86 ms/token, 1.69x) and
REBUILD for a third rung (two dicts, binary resident|spill, UVA aliasing);
HiCache MECHANICAL for backends, ladder EXCLUDED (it is the type signature of
every controller method, not configuration); sgl-project#224 MECHANICAL for the list,
REBUILD for the ordering law, victim half untouched; sgl-project#89 MECHANICAL-PLUS
(needs a persistence class or a tmpfs --hibernate-dir is a silent regression,
and a driver-free arg-parse-time query); sgl-project#305 NO MIGRATION, it is the awaited
mechanism; sgl-project#286 MECHANICAL and the donor — lift _select_target and
CapacityLedger rather than write new ones; sgl-project#389 and sgl-project#306 greenfield.

Cut plan, no big bang: 1 registry + read-only enumeration + GateRow dashboard
row (S); 2 publish the rank->card-UUID vector without a collective so sgl-project#394
comes alive (S, the only cut whose yield is already measured); 3 sgl-project#224 consumes
it (S-M); 4 CapacityLedger becomes a view of registry/ledger.py, keys widen to
TierId (M); 5-9 expert offload, hibernate, sgl-project#305 transitions, HiCache backends,
NVMe/sgl-project#306 declaration. Exclusions with hard reasons only: the HiCache ladder,
GDN state (DEVICE_BOUND_ONLY admission, a refusal not an omission), cross-rig
GPU-to-GPU (driver guard, sgl-project#280 closed in userspace), compute placement (sgl-project#302).

Measurement plan names six gaps, five of them S, three of them new arms in the
existing comm-suite which today has no BAR1, storage or host-DRAM arm.

codespell clean; ruff not applicable (documentation only).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…r plus a reconciliation, not a new abstraction — edge costs already exist FOUR times (PairMatrix #348b, PathProfile sgl-project#279, PeerPathCapability sgl-project#286 on CUDA ordinals, card_probe sgl-project#271) with four absent-value rules and no reconciler, while four disjoint tier vocabularies coexist and the largest byte mover (expert offload) is in none of them; honesty corrections shipped as ESTIMATE/ABSENT (peer-VRAM us-class is an assumption, NVMe latency unmeasured in any unit, DRAM derived from assumed DDR4-3200); contradictions resolved in design: local-first vs peer-vram-above-host becomes shortest-path reachability over a staging graph (neither consumer changes), the positionally-keyed CapacityLedger named as the silent-card-swap hazard at process boundaries; TenantState frozen (client-visible enum mixing tiers into policy) with orthogonal resident_tier; cut plan S-first with cut 2 = publish rank->UUID vector WITHOUT a collective — revives sgl-project#394, the only cut with measured yield (1.69x) (sgl-project#407)
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
… consumers yet

Charter: every memory you have access to must be a level cache, a spill target
or an offload target depending on volatility -- disk, RAM, VRAM, local as well
as remote. Today four disjoint tier vocabularies coexist (sgl-project#286's PARK_TARGETS,
sgl-project#224's destination chain, StorageMedium telemetry, HiCache's choices= list) and
the largest byte mover in the fork, expert offload, is in none of them. This is
the node layer they can share. The edge layer (what a byte costs between two
places) is NOT re-implemented: planner.cost_model keeps it.

python/sglang/srt/memtier/, six modules, no consumer touched, no write outside
a test's temp directory:

* tiers.py -- TierId grammar (UUID or a named absence of one; a bare CUDA
  ordinal is refused at the door, naming C2: on this rig the 5090 is CUDA 0 and
  NVML 1, so a positional key silently swaps cards across a process boundary),
  the record, and the volatility law. Admission is a REFUSAL, not a ranking: a
  registry that only ordered tiers by cost would happily offer the GDN pool a
  remote tier, and recurrent state that made a lossy round trip is a
  correctness failure. Two enums, tier-side and payload-side, mapped by one
  table -- which is what makes the falsifier expressible.
* profile.py + profiles/rig1.json -- the measured numbers as DATA for exactly
  one machine, every rate carrying the probe it came off. Device tiers bind
  from card-MODEL templates when a live card is enumerated, so no UUID is
  hardcoded and an unprofiled model gets live capacity with ABSENT caps rather
  than a roofline (#348b D4 one layer down). Overlay merges by tier id.
* registry.py -- enumerate (blocked tiers included; omission is how a spill
  target silently becomes a different spill target), filter by volatility,
  object class, bandwidth floor, capability property and capacity, and a NAMED
  refusal for every tier that did not make the list. The ordering key is public
  so cut 3 can swap in the staging-graph path cost visibly.
* reservations.py -- one ledger, no second accounting (DESIGN_305 §6). A tier
  reservation is a named post in the sgl-project#260/sgl-project#400 Posten sense; VramLedgerHook
  forwards device tiers into registry/ledger.py so the corridor, lease and
  invariant stay where they are.
* probe.py -- DESIGN_407 §4's M1-M8 as records, every arm declared and every
  arm refusing. apply_outcome is the only writer of a measured cap.

The three honesty corrections ship as the design demanded: host DRAM bandwidth
is an ESTIMATE (its 51.2 GB/s reference peak is an ASSUMED DDR4-3200 figure --
dmidecode is empty under this VM), the peer-VRAM "1-3 us posted write" class is
ABSENT because it is an assumption and not a probe, and NVMe latency is ABSENT
because it does not exist in this tree in any unit. M1 also records the harness
it CANNOT use: barlink has no send/recv, so the BAR1 ladder needs p2p_readiness.

Deviations from the design, all recorded in its new §8: aperture is a Rate not
an Optional[int] (an int cannot say why it is missing); vram:unenumerated@<host>
added to the grammar so rig-2's cards are declared-and-blocked rather than
invented; no staging graph and no GET route (both cut 3 / a consumer).

Tests: 82 hermetic cases in test/registered/unit/memtier/, base-a-test-cpu, no
driver and no network -- 28 records/registry, 22 profile, 14 reservations, 18
probe. All green. collect_local_facts is executed for real against /proc/meminfo
and statvfs, and VramLedgerHook is driven against a real ReservationStore in a
temp directory, so neither path is desk-written.

Can-fail proof, 12 mutations, each turning exactly its guard red: EXPENSIVE_OK
admitting persistence; a CUDA ordinal accepted as a card key; the provenance
rank dropped from the ordering key (an estimate 21x faster than a measurement
then wins); an absent bandwidth read as zero; an unknown headroom read as
unlimited; an unnamed ledger post; a profile rate with no source; a roofline
substituted for an unprofiled card; a failed probe delivering its value; an
estimate entering through a probe; a measurement silently overwritten; blocked
tiers omitted from the enumeration.

ruff / codespell / black / isort clean; mypy clean on the package. The
test_module_state_ratchet failure on this branch is pre-existing
(layers/moe/utils.py _barlink_overlap_announced) and untouched here.

Desk work, no cards (CUDA_VISIBLE_DEVICES=99). Next: cut 2, publish the
rank -> card-UUID vector so sgl-project#394's merged link-proportional sharding comes
alive -- the only cut in the plan whose yield is already measured (145 -> 86
ms/token on the cold tier, 1.69x).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 3, 2026
…riptors, §8 ladder, partial spill, graph-state families, capture refusal, first memtier consumer (sgl-project#421 F6 retired)
efschu added a commit to efschu/htsglang that referenced this pull request Aug 3, 2026
…h a real park

Per the 2026-08-03 order, every asset lives under one runtime and one ledger:
a component whose VRAM the register cannot see makes every cross-asset
arbitration decision silently wrong. The translator's four audio modules --
talker trunk, residual code predictor, codec decoder, speaker encoder -- are
now the audio_modules class in the sgl-project#286 register with a descriptor on the
DESIGN_407 8 ladder.

Ranked with the cold second model rather than at idle sessions, deliberately:
an idle translator holding ~2 GB IS the cold-provisioned model 8.1 describes,
and ranking it above idle sessions would let a silent phone outrank a user's
live conversation. RECONSTRUCTABLE rather than EXPENSIVE_RECONSTRUCTABLE
because these are read-only weight blocks re-readable from a local checkpoint,
so a discarded park costs a file read and not a recomputation. Granularity is
one module: the codec decoder alone is 229 MB and is the module a turn needs
last, which makes it the natural first victim.

Registration alone would be decoration, so the tests move bytes. Park really
frees: the parameters become meta tensors and the module genuinely stops
working, which a park that quietly kept them alive could not satisfy. Restore
brings back bit-identical weights and identical compute, and replaces the
registered estimate with the measured cost so later victim choices are priced
on an observed number. The register's own import-time completeness guard
caught the new class before it had a descriptor, which is exactly what it is
for.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 3, 2026
… the ledger gap it hid

The first warm GPU number came back at RTF 24.6 on a 5090 for a 0.6 B talker.
Two orders of magnitude from anything the architecture predicts is a symptom,
not a limit, so it got opened rather than reported. `probe_stage_timing.py`
(new) times the three links of one call with the device drained around each:

  prompt 5.3s | talker 4.3s | codec decode 85.2s   <- 90% of the call

The codec hangs off `model.speech_tokenizer`, and `Qwen3TTSTokenizer` is a
PLAIN class, not an nn.Module (`inference/qwen3_tts_tokenizer.py:44`). It is
therefore not in `model._modules`, `model.to("cuda:0")` never reached it, and
it carries its own construction-time device snapshot that its encode/decode
use to place inputs. Talker on the card, the entire 12 Hz codec left on the
CPU in bfloat16. Nothing failed; bfloat16 convolutions are simply that slow.

Same shape as the device fault fixed in the previous commit, one level deeper,
which is why the fix is one function: it now finds holders STRUCTURALLY -- a
plain attribute owning an nn.Module and caching a device -- rather than by
name, so a second such holder cannot be stranded silently the way this one
was. And it VERIFIES: after the moves it walks every parameter and buffer and
refuses if any is off-target, because "we called .to()" is a success claim and
a stranded module is silent by construction.

Found while reading that code: `codec_decoder` was registered against
`inner.code2wav`, which does not exist on this checkpoint. It resolved to None
on every load, logged a warning nobody read, and the largest single audio
asset (229 MB) was never in the sgl-project#286 register at all -- a registration with
reach zero. Now `speech_tokenizer.model`, and a missing module is a hard
failure: an unledgered module is memory the register cannot see, park or
evict, and the one-runtime law rests on that register being complete.

Falsifiers (hermetic, `meta` for `cuda`): the detached holder is NOT moved by
the model's own `.to()` (the bug), is moved after retargeting (the fix), a
`.to()` that silently does nothing is caught by the state probe, and an
explicit device the model is not on is refused rather than recorded.

Tests: 295 hermetic pass under CUDA_VISIBLE_DEVICES=99 (was 291).
Measured on the 5090, same command before and after:
  before: prompt 5.3s  talker 4.3s  codec 85.2s   RTF 24.18
  after:  prompt 0.02s talker 5.2s  codec 0.04s   RTF 1.15
  codec per frame 1739.6 ms -> 0.7 ms
`latency_window.py`, warm, n=10, A-vs-A floor 245 ms:
  TTS whole utterance 4216 ms median for 3.68 s of audio, RTF 1.146
  ASR (faster-whisper large-v3-turbo, int8_float16) 96.9 ms for 3.11 s
  MT still unmeasured -- no endpoint up in this window.
The talker is now 99% of the call at ~90 ms/frame. That is the rung-B
limitation DESIGN_466 §12 already names (no CUDA-graph capture over the nested
code predictor), not a new defect, and it is what sgl-project#488 exists to remove.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 3, 2026
… medians, honest server state

Three new server-side computed blocks the Monitor tab's landing poll now
returns (all server-side so a curl client sees exactly what the page
draws, per the runbook's "curl is a complete client" architecture rule):

- server_state.py: a four-state discriminator (not_running | starting |
  running_no_metrics | running_with_metrics) that keys off an explicit API
  probe, never a metrics-scrape failure alone -- a connection-refused
  scrape used to be rendered as "no --enable-metrics", which is a
  different diagnosis than "not running at all". running_no_metrics is
  only ever reported with a passing API probe.
- rate_medians.py: medians behind the rate tiles, windowed over
  PROCESSING polls only -- idle polls never enter the window, so an idle
  server still reports the median of what it did while working, not a
  zero-diluted average.
- spill_tiers.py / tier_occupancy.py: one row per spill/offload tier type
  x place, with absent tiers PRINTED alongside their reason rather than
  hidden or shown as zero. Two tiers are deliberately never populated:
  the sgl-project#407 memtier registry (no production consumer, so reading it would
  print zeros that look measured) and the sgl-project#286 short-term register (no
  reachable byte ledger in this build) -- both documented as absent-by-
  construction, not omissions.

webui.py and live_metrics.py wire these into the existing landing poll;
metrics_reporter.py and metrics_collector.py get the small hooks the new
blocks read from.

Clean auto-merge on both touched docs (FEATURE_CATALOG.md and
rig-runbook.md) -- neither had a conflicting edit on this line since this
branch's base (3e3aca2, the sgl-project#510 merge). rig-runbook.md gains new
§8.0 documenting the shell-only verification recipe (curl + three python3
one-liners for state/medians/tiers) and the restart requirement: the
dashboard serves from one long-lived process, so a change is live only
after that process restarts -- done as the merge step below, not
mid-session. All 17 catalog sections and all 21 previously-preserved
additive paragraphs verified present (two-axis §1, matrix doctrine §2,
all six §12 families from sgl-project#510/sgl-project#513/sgl-project#511/sgl-project#487/qwen38-prep, sgl-project#514's five
families + value-pinning, sgl-project#499's resolution-ordering, sgl-project#517's two sgl-project#459
paragraphs, MERGE-DUTY owner-sites + SITREP §12, NVENC §13).

Tests (CUDA_VISIBLE_DEVICES=99, PYTHONPATH pinned to this worktree):
- The six directly touched/new test files: 517 passed, 0 failed.
- test/registered/unit/planner/ (full, HTSGLANG_TEST_MODEL_DIR set):
  2337 passed, 1 skipped, 352 subtests -- no failures.
- ruff check --select=F401,F821,UP037: 1 finding
  (live_metrics.py's LiveSnapshot import), confirmed pre-existing --
  already unused in the pre-merge base, only mentioned in a docstring,
  the line just shifted from sgl-project#522's unrelated insertions above it.
- codespell: 1 hit (webui.py:1786 "unparseable"), confirmed pre-existing
  at the identical line in the pre-merge base, in unrelated SVG
  chess-piece-parsing code this branch never touches.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 4, 2026
…ections that move the plan

SLICE 1, BUILT. models/qwen3_tts_fast_predictor.py replaces the single call
that the precursor measured at 104.44 ms of a 142.78 ms frame -- 73 % of it --
with a raw 15-step loop. It is a drop-in: the reference reads .sequences off
code_predictor.generate (modeling_qwen3_tts.py:1671) and gets the same shape,
so the 1596-line prompt builder, the trunk loop and the codec are untouched.
install()/uninstall() keep the reference reachable in the same process, which
the identity gate needs and an operator needs as a way out that is not a
restart. It holds no weights, so it costs no VRAM. Sampled tokens never leave
the device -- every .item() there is one of the 602 syncs per frame this
removes, and a host round trip would also make the loop uncapturable in slice 2.

The step schedule is data, not a comment: prefill takes lm_head[0] and no
codebook embedding, decode step g takes codec_embedding[g-1] with lm_head[g].
Off-by-one there does not crash, it picks a neighbouring codebook and degrades
timbre, so step_schedule() is pinned by five assertions.

The sampler is the main correctness surface and is driven against transformers'
OWN TemperatureLogitsWarper / TopKLogitsWarper / TopPLogitsWarper on fixed
logits, mask and values separately, including the production defaults
(top_k=50, top_p=1.0, temperature=0.9) and all three no-op cases -- a skip
transformers takes and we do not is a silent divergence on a DEFAULT config.
One test was wrong and is corrected rather than deleted: temperature and top_k
genuinely COMMUTE (monotonic scaling cannot change which tokens top-k keeps),
so an ordering bug between those two is unobservable; the detectability arm now
uses top_p, which does not commute with temperature. Both facts are pinned.
14 hermetic, 215 green across the models suite.

End-to-end greedy code-token identity needs the real checkpoint and the
tenant's import shims, so it runs with the GPU measurement rather than here.
The gap is named in the test file, not only in this message.

CORRECTION 1 -- the 127 MiB is a rebooking and fp8 is NOT the pool gate. My
"fp8 is the gate" is withdrawn. But two named levers do not reach this boot,
read at source: sgl-project#330's dial needs --enable-vram-dial, which is a BOOT flag the
deployed launch line does not carry (/proc/3953200/cmdline), so "no restart"
does not apply to this instance; and it additionally requires weighted uneven
DCP (vram_dial.py:1110) while the boot has no --rank-kv-ratio at all. The knob
that DOES reach it is already in the launch line: --rank-auto-reserve-mib
13000,3800,3800, whose two 3080 entries go 3800 -> 4200 for ~400 MiB each at
the next restart, with no new flag and no dial precondition. Priced honestly:
16 full-attention layers x 4 kv heads x 256 x 2 x 1 B fp8 = 32 KiB/token, so
400 MiB costs 12,800 tokens on that rank, ~4.9 % of one 262144 context. bf16
instances then fit and the pool does not wait for fp8. Still to check before
any quantisation effort: an sm86 bf16 engine may already fit under 2551 MiB by
itself, which is a measurement on the built engine, not a prediction.

CORRECTION 2 -- TRT is cut as fork lane infrastructure (sgl-project#337), not a talker
side path. The discipline I specified already EXISTS in
video_enhance/engine_cache.py: EngineKey over nvml_uuid|device|driver|trt|
onnx_sha256|precision|shape triplet|flags, provenance manifests, and "no
manifest means absent, not usable". So the plan is promote, not duplicate: lift
it to srt/trt_lane/ with video_enhance as its first existing consumer and
byte-identical video behaviour as the acceptance condition, then add the sgl-project#337
rung registry, sgl-project#286 ledger registration so a loaded engine is parkable like any
other VRAM tenant, sgl-project#407 tier placement, per-regime crossover as a reported
output, and sm86 refusals by name. The talker's two engines are the first
production consumer; RIFE/SR (sgl-project#469) attach afterwards.

Ordering unchanged: graphs first -- the 6.53x needs none of this.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
…buffer with garbage

The sgl-project#286 ledger parked a module by capturing state_dict() and restored it with
to_empty(device=...) followed by load_state_dict(..., strict=True).
state_dict() omits NON-PERSISTENT buffers by definition; to_empty()
re-materialises them anyway, with whatever was in that memory; and the strict
load then fills only the keys the state dict has. So every non-persistent
buffer came back as uninitialised memory, while park and restore both reported
success and the measured restore latency looked healthy. strict=True cannot
catch it: the keys are missing from BOTH sides, which is precisely why the
asymmetry is invisible at the seam.

For the translator that buffer is the rotary inv_freq. The symptom is NaN
cos/sin -> NaN attention scores -> NaN logits -> "probability tensor contains
inf, nan or element < 0" from torch.multinomial, one park and thirty layers
from the cause, and only when sampling actually runs.

REACHABLE BY DEFAULT. IdleParkConfig.enabled is True, and the sgl-project#546 translator
idle park drives exactly this pair: ledger.park_all() on the way down,
ensure_resident() -> ledger.restore() on the way back. So the corruption was on
the default path of a default-on feature, not behind a flag.

The same failure already had a repair on the LOAD path
(qwen3_tts_compat.refresh_rotary_buffers, whose docstring describes this NaN
chain in full). The RESTORE path never got an equivalent and nothing connected
the two -- the fork had diagnosed the failure once and stayed exposed to it
through a second door.

Fixed GENERICALLY in the ledger rather than per-module: park captures the
non-persistent buffers (named_buffers() minus the state-dict keys, skipping
meta) alongside the state dict, and restore writes them back through
register_buffer(persistent=False) into the owning submodule, so the flag
survives the round trip and a second park still finds them. The bytes are
carried VERBATIM rather than recomputed -- recomputation is a per-module repair
someone has to remember to write for each new buffer, while copying is correct
for every module the ledger will ever be handed, and is bit-exact besides.
Kept in its own dict, not merged into _cpu_state, because the restore's
strict=True load rejects keys the module does not expect.

A module with no non-persistent buffers takes the unchanged path.

Tests (CUDA_VISIBLE_DEVICES=99, hermetic, no GPU, no server):
  PYTHONPATH=python pytest test/registered/translator -q
  -> 645 passed, 2 warnings, 37 subtests passed in 24.80s

CAN-FAIL PROVEN: neutralising the restore write-back turns 3 of the 5 new tests
red -- "the non-persistent buffer did not survive the park round" for the
bit-identity test, plus the second-round and nested-submodule tests -- because
to_empty leaves the buffer holding whatever the allocator handed out. The other
two are the no-regression halves (persistent state untouched; a module without
such buffers unchanged) and stay green either way, which is their job.

The tests assert CORRECTNESS AFTER RESTORE -- the values, and that inv_freq is
genuinely absent from state_dict() so the premise is checked rather than
assumed -- not how many such buffers a model has, which is a property of the
model and no constant worth pinning.

FEATURE_CATALOG gains the round-trip-asymmetry family entry.
ruff check: no new findings. ruff format: clean on all added lines.
codespell: clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
…and a five-cut list

Desk analysis only, no build, as scoped. docs/dev/ANALYSE_553_elastic_coresidence.md.

What the four named building blocks actually are, read from the code rather
than from their titles:

- sgl-project#330 VRAM dial: a REAL mechanism, and its decisive property for sgl-project#553 is that
  store_bound_rows is a LIFETIME bound baked into captured graphs. So the dial
  has a FREE BAND (shrink to any floor, re-grow to the boot bound) and a HARD
  WALL above it. The free band is exactly where CUDA-graph compatibility is
  preserved.
- sgl-project#364 GDN slot ladder: a real, executing hot/cold mover, and graph-neutral by
  construction (it moves state between slots, not geometry). It is the
  existence proof that a hot/cold event need not touch capture, and its
  inventory seam -- the owner enumerates its live set, consumers never read a
  container directly -- is the pattern the other consumers need (sgl-project#551).
- sgl-project#287 KV pressure ladder: PLANNER ONLY. Seventeen NotImplementedError sites;
  the docstring says so plainly. But the ordering invariants are already
  enforced in code and the relief rungs reference existing features BY NAME, so
  the relief half can be made to execute by delegation without new mechanism.
- sgl-project#286 register: the right vocabulary, but exactly one ledger exists and it is
  wired to the translator. There is no generic tenant to raise an event
  against.

The pattern across the event table: both directions are largely built, and
what is missing is ARBITRATION. Two registries exist (dial participants, sgl-project#286
asset classes) and neither can see the other, so "free 4 GiB for the video
tenant" has no addressee.

Cut list, ordered so each cut is provable alone and no cut before the last
touches capture: (1) one registry or an explicit bridge; (2) a generic tenant
mover factored out of AudioAssetLedger; (3) make sgl-project#287's RELIEF rungs execute by
delegation -- the largest block of stubs, and it never approaches the graph
wall because relief rungs are declared "no KV layout change"; (4) the
arbitration policy on top; (5) LAST and only with the rig, cross the graph wall
via the per-rung pre-captured graphs sgl-project#287 already specifies, with cold rungs
parked as register class graph_rungs.

Graph compatibility is treated as the target state throughout, per directive:
every cut states its effect on graph state, and cut 5 carries the explicit
route back to full coverage. Until cut 5 lands, sgl-project#553 must state its band --
"elastic within the boot capture bound" -- rather than implying unlimited
elasticity.

Instrumentation named honestly: SGLANG_KVSO_TICK_TRACE=1 (throttled per-session
regulator trace: effective interval, measured tick_cost, binding headroom
ratio, host-tail size; pure logging, no control effect). The analysis states
what it is NOT -- a regulator trace, not a per-phase breakdown of device time --
and proposes no measurement it has not checked exists.

One decision deliberately left open and named as such: whether sgl-project#553 owns the
arbitration policy or whether it belongs to sgl-project#363. That fork needs the sgl-project#363
stage feed bound first, since an arbitration policy fed by a table holding one
stage would have nothing to choose between -- the same failure sgl-project#363/S8
documents one level up.

codespell: clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
…ot per-flip

User correction, pinned hard because it is a repeat-forgotten class. The first
draft priced every graph-addressed knob at 3-6 s recapture and therefore put
all of them on the slow side of the tick/regime line. That is wrong: the stack
can pre-capture N stages and park the inactive ones FULL-CAPTURED in host RAM,
so a flip back to an already-captured stage rebuilds nothing and costs only the
graph-state RESTORE -- observed 40-85 ms, two orders of magnitude cheaper.

Carriers verified in tree rather than taken on report:
  * sgl-project#93 physical aliasing/remap keeps VAs stable across the park
    (offload_register.py, offload_movement.py, input_buffers.py,
    runtime_context.py) -- this is what leaves a parked capture valid;
  * sgl-project#286 offload register ALREADY lists graph_rungs as a parkable item class
    (offload_register.py:17 "cold capture rungs of the K-/algo ladder", class
    table at :114) -- confirmed, so this is drive-not-build;
  * sgl-project#89 hibernate for host-side staging;
  * sgl-project#464 has NO marker in python/sglang/srt -- it is a target, not a mechanism,
    so restore is priced at the observed band and any sgl-project#464 gain is upside the
    design must not assume.

R9's classification gains two middle classes: restore-flippable (graph-
addressed but target already captured and parked -- priced at restore, possibly
coarse-tick) and capture-bound (target never captured -- 3-6 s, one-time). The
criterion is unchanged in form; what changed is that "graph-addressed" no
longer implies "expensive", it implies "expensive ONCE".

R9(iii): the planner pre-captures its own sgl-project#363 stair at boot or lazily on first
entry, then parks. First entry is a priced one-time investment scheduled
deliberately (low load), never a tax paid at the moment a flip is wanted -- a
design that pays capture at flip time has turned a startup cost into a serving
cost.

R9(iv) + R1: holding N stages is nearly VRAM-free while parked (physical pages
returned via the sgl-project#330 VMM dial, VA reservation remains) but NOT free in host
RAM, so R1 now extends to host bytes and the ledger must carry the parked
stages' host footprint as a term. A stack parking eight stages without that
term runs exactly the unledgered-demand defect sgl-project#582 removed from VRAM, one tier
down. Falsifier R1b: parking N stages must move the host term by N x per-stage.

R5 splits its graph cost into two terms (capture one-time, restore per-flip); a
single "graph cost" line is wrong by ~2 orders of magnitude in one direction or
the other. F5b: a gain against a 60 ms restore must be accepted even at short
horizon; refusing it means a restore was priced as a capture.

F9d (runtime) asserts on the ABSENCE of a recapture rather than on elapsed
time, since a fast machine can hide a recapture inside a generous threshold.
F9e (modelling) is the more dangerous error and gets its own test: a model that
prices an already-captured flip at capture cost never misbehaves visibly, it
just silently refuses flips that were cheap, so the gain is never observed and
nothing surfaces the mistake.

FOUND IN TREE, same error, today: registry/rungs.py:93-95 prices the WARM rung
at "3-6 s / graph recapture" -- a blanket recapture tax on promotion. Correct
for a never-captured stage, wrong as a blanket price. Slice 4b must split it or
the planner inherits the very tax this correction removes.

Slice plan gains 4b (pricing split + WARM rung fix, desk-provable) and 4c
(pre-capture/park + host-RAM term). 4c is the one addition needing a card, and
it is cheap: capture two stages, park one, flip, time the restore.
TianHao65 pushed a commit to apinge/sglang that referenced this pull request Aug 12, 2026


Ports both commits of zejunchen-zejun#286 (cfae48f "Fused kernel
before moe", da7a0d2 "Add shared_expert_topk_fusion") onto this branch,
replacing the in-kernel activation added by 1214860a4 (upstream sgl-project#28658).

The shared-expert gate now runs as a standalone Triton kernel
(fused_linear_sigmoid_kernel, one kernel for sigmoid(x @ w^T) on a bias-free
(1, H) linear) and its per-token output is appended to the routed top-k by
_fused_append_shared_experts_gated_kernel. Previously the raw gate logits were
streamed into _fused_append_shared_experts_with_weights_kernel, which applied
sigmoid + the 1/ep_size scale in-register on the fp32 output.

Measured on Qwen3.5-397B-A17B-PTPC-FP8, TP=8, 8x MI308X, ROCm 7.2.0, torch
profiler over 4 prompts x 8000 in / 10 out. Kernel times are summed over the
profiled window; 480 calls == 48 layers x 10 decode steps.

Performance: this is a net regression on the shared-expert path.

  kernel                                       before            after
  ------------------------------------------------------------------------
  Cijk_..._MT16x128x128     (gate GEMM)    240 /  9817.6us    0 /       0us
  Cijk_..._MT16x16x128      (gate GEMM)    240 /  2042.9us    0 /       0us
  fused_linear_sigmoid_kernel                0 /      0us   480 /  9564.2us
  _fused_append_shared_experts_with_weights 480 /  3340.7us    0 /       0us
  _fused_append_shared_experts_gated         0 /      0us   480 /  3336.0us
  bfloat16tofloat32_copy_kernel_cuda         8 /     43.5us  488 /  3236.9us
  ------------------------------------------------------------------------
  path total, TP-0                             15244.7us        16137.2us

The Triton gate kernel genuinely beats hipBLASLt on this shape: 9564.2us vs
11860.5us over the same 480 calls, -2296.3us (-19.4%). But it stores its result
as bf16, and topk_weights is fp32 (topk.py allocates it fp32 on every routing
path), so fused_append_shared_experts_gated's shared_weights.to(topk_weights
.dtype) launches one copy kernel per layer per step. That cast goes from 8
calls / 43.5us to 488 calls / 3236.9us, +3193.4us, which more than gives the
GEMM saving back.

Net per rank, all eight profiled:

  TP-0 +892.5us (+5.9%)   TP-4 +828.0us (+5.4%)
  TP-1 +661.0us (+4.3%)   TP-5 +778.4us (+5.1%)
  TP-2 +668.9us (+4.4%)   TP-6 +941.2us (+6.1%)
  TP-3 +714.8us (+4.7%)   TP-7 +775.1us (+5.1%)

Same sign and same kernel set on every rank, so this is structural, not noise.
End-to-end serving numbers are not reported: the profiling config is 4 prompts
at concurrency 1 with 10 output tokens, far inside the 5-12% launch-to-launch
noise band for this box.

Reachability, TP-0 and TP-1 python_function stacks confirm the dispatch chain
Qwen2MoeSparseMoeBlock._append_shared_to_topk_output ->
get_shared_expert_gate_weights -> can_fuse_shared_expert_gate ->
fused_linear_sigmoid -> append_shared_to_topk, with both target kernels at
480 calls and the old with_weights kernel at 0.

Two deliberate differences from the upstream patch:

- Import path. sgl-project#286 imports fused_append_shared_experts_gated from
  layers/moe/fused_moe_triton/, which does not exist on this tree; the Triton
  MoE kernels live under layers/moe/moe_runner/triton_utils/. The import sits
  inside a try/except ImportError, so taking sgl-project#286 verbatim would silently fall
  back to the eager append_shared_to_topk_ref and neither Triton kernel would
  ever run.

- 1/ep_size pre-scale. sgl-project#286 drops the scale that 1214860a4 applies to cancel
  the post-experts all_reduce summing the fused shared expert ep_size times.
  Re-folded into _get_shared_expert_weights after the gate call, since the
  gated append kernel takes the weights verbatim. No-op and no extra kernel at
  moe_ep_size == 1, which is every TP-only serving config here.

Two consequences worth noting for review:

- 1214860a4 kept a _use_aiter branch so CUDA stayed on eager sigmoid; sgl-project#286 has
  no such branch, so the CUDA path now also goes through the Triton kernels.
  Not exercised here, this is a ROCm-only box.

- fused_append_shared_experts_with_weights and its kernel are left in place but
  now have no callers.

Known follow-up, not included here: giving fused_linear_sigmoid an out_dtype
argument and passing topk_weights.dtype from the caller makes the kernel store
fp32 straight out of its already-fp32 internal sigmoid. That deletes the cast
entirely and turns the +892us regression into a -2.3ms win, and drops gate
error from 1.952e-3 to 7.040e-4. It is left out so this port stays faithful to
sgl-project#286 and the A/B stays clean.

Numerics, validated on device against eager references: gate max abs error
1.952e-3 versus an fp32 linear+sigmoid reference, which is bf16 store rounding
(2^-8 ULP); append output ids exactly equal and weights bit-identical to
append_shared_to_topk_ref.

Files: python/sglang/srt/layers/fused_linear_sigmoid_mul_triton.py (new),
python/sglang/srt/layers/moe/shared_expert_topk_fusion.py (new),
python/sglang/srt/layers/moe/moe_runner/triton_utils/fused_moe_triton_kernels.py,
python/sglang/srt/models/qwen2_moe.py. 392 insertions, 30 deletions.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…run, DEFAULT OFF

commit_range splits a gap into self._chunk-sized extents (the sgl-project#330 dial), so a
~1 GiB resume becomes ~500 x 2 MiB extents and therefore ~500 map + ~500
setAccess driver calls. When the run is CONTIGUOUS those extents describe ONE
VA region and one handle suffices, taking the resume to ~3 calls (map,
setAccess, memset). Pinned by a mocked driver: 1001 calls -> 3.

DEFAULT OFF, and the reason is stated in the code: the 40-85 ms band is
UNMEASURED. The flag exists so the measurement can be taken, not because the
win is assumed. Off reproduces the per-chunk plan byte-for-byte, pinned by a
test. The diff is purely additive -- 97 insertions, 0 deletions.

CONTIGUITY IS A PRECONDITION, NOT AN ASSUMPTION. decommit_span can leave an
interior HOLE -- the sgl-project#631 note inside commit_range says so explicitly -- so a
non-contiguous plan is a LEGITIMATE state, not a bug. On a hole the coalescer
REFUSES and says where: merging across it would map pages nobody asked for, and
splitting into some other shape silently would give the caller a layout it
cannot predict. Default is fall-back-unchanged with a named reason;
require_contiguous=True raises VmmCoalesceRefused for a caller that asserted
contiguity.

sgl-project#286 ASSET CLASSES ARE RESPECTED BY CONSTRUCTION: a plan is built inside a
single commit_range call, which addresses ONE offset -- one buffer -- so no
coalesced run can span two independently parked assets. No cross-asset merge is
reachable from this entry point.

A MISTAKE WORTH RECORDING: my first attempt inserted the module-level helpers
immediately before `def commit_range`, which is at METHOD indentation. Python
accepted it and commit_range silently became a nested function inside the
helper rather than a method of KvVmmArena. It parsed clean and would have
failed only at call time. Caught by asserting membership via ast rather than by
trusting that "it parses"; the helpers now sit before the class.

10 hermetic tests with a mocked driver layer: the 1001->3 reduction; the
coalesced extent covering exactly the same bytes (a resume that maps a
different range is a bug, not an optimisation); hole refusal naming the
location; require_contiguous raising; multiple holes counted; single/empty
plans left alone; uneven trailing chunk still coalescing; and driver_calls_saved
being two per removed extent.

The 40-85 ms measurement remains a window item and is not claimed here.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…s re-checked at code

A parallel trace landed after cb0097c and contradicted one of my own
statements. Correcting it rather than leaving it, and recording three further
findings it surfaced. Each re-verified at code here, not taken on report.

THE CORRECTION. §9.1(c) said "beyond that first slot, order is by measured
bandwidth, not by operator preference". Wrong. Below the local slot the
operator's configured order in --kv-session-offload-destinations IS respected;
a measurement may promote a tier above it only when that tier is at least
PROMOTION_RATIO = 4.0 times faster (kv_spill_park_tier.py:134, applied by
_park_ranking, kv_session_spill_destination.py:1259-1300), and that ratio is a
module constant behind no flag and no env var.

This makes sgl-project#224 MORE delivered than I credited: "Zielliste + Richtung
konfigurierbar" is satisfied below a physically fixed first slot. What is not
configurable is the promotion threshold that can override the operator.

FOUR REFINEMENTS (§9.5):

1. The remote row cannot reach a ladder even if read. I wrote that the spill
   path "deliberately does not read" rig1.json's remote rows -- true, but it
   understates the guard. host:rig-2 carries health.reachable = false
   (rig1.json:164) and TierRegistry refuses on exactly that before any other
   rule (registry.py:353), with a named reason. The tier is enumerable and can
   never enter a select() candidate list. Structural, not a convention.

2. sgl-project#286's `remote` is an always-refusing stub and says so in its refusal:
   "remote: stub tier (sgl-project#224 RDMA attachment point, not wired yet)"
   (offload_movement.py:750). Recorded because sgl-project#286 and sgl-project#224 both say "remote"
   for different things -- sgl-project#286's is a placeholder in the expert-offload
   ladder, not the kvso park tier.

3. The sgl-project#286 registry consumer is unreachable from production. price_park_target
   is the function that actually calls registry.select(TierQuery(...)) and is
   annotated as the fork's first memtier consumer, but its only callers are in
   test_short_term_offload_register.py. memtier/consumers.py's
   expert_offload_host_targets is the same shape. So §9.1(d)'s importer list
   needed the qualification now added: seven modules import memtier, but only
   kv_spill_tier_selection / kv_session_spill_destination perform tier
   SELECTION on a live path. The sgl-project#421-F3 shape again, inside sgl-project#407's own
   migration.

4. A provenance defect the profile records against itself: rig1.json:172 warns
   that the 3.43 GB/s and 1.47 us figures quoted together in
   destinations_error come from DIFFERENT lines (100G and 40G). Those paired
   numbers appear in the --kv-session-offload-destinations help text as the
   justification for the local-first law. The LAW is not in doubt -- it is a
   D2H-staging argument, not a bandwidth one -- but an operator reading that
   help is reading a mixed pair. Not fixed here: it is help-text prose and the
   correct replacement needs the sgl-project#266 run's numbers re-read rather than
   invented. Named so the next edit does not re-copy it.

No code change; docs only. Tests unaffected (the 8 pointer-I/O cases and the
memtier suite are unchanged by this commit).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…sgl-project#568 correction

Same-step rule was missed on 7d70249: the mechanism shipped without its
FEATURE_CATALOG line. Added beside session_handover, which is the same
five-phase vocabulary one tier down.

The entry carries three things a future lane would otherwise re-derive:

* the four GATES with line anchors -- completeness, membership (a differing
  member set is refused, naming both; RE-FORM is absent by construction, not
  disabled by flag), phase order, and the trigger TYPE (DESIGN_329 §9's
  no-transient-reflex rule is enforced by making the reflex inexpressible);
* the DETERMINATION that RESTORE is the only phase with no in-process
  implementation, with loader.py:2468's skeleton rebuild and its parse-time
  selection at server_args.py:16097 named, so nobody re-opens that question;
* the sgl-project#568 CORRECTION on record, marked do-not-re-litigate: the
  non-persistent-buffer fix DOES generalize (a rule over the persistence
  property at translator/ledger.py:436, plus weight_updater.py:361 which never
  had the bug), and NON_CHECKPOINT_NAME_PATTERNS at phase_flip_boot.py:67 is
  the weights-arena exclusion, NOT that fix -- citing it as evidence of
  non-generality is the specific error I made and retracted.

Also records that ASSET_CLASSES is not the sgl-project#286 offload register, since §17
already warns that "sgl-project#286 offload register" names two modules.

Line anchors verified against the source rather than quoted from memory; two
of them (phase-order and trigger gates) were wrong on first write and
corrected to :272 and :255. codespell clean.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ation; delete lineage B

train/0818-desk-410-reconcile (through 9509c7b) merged into train/0817-desk.
21 conflict hunks across 11 files, resolved on DESIGN_410 / NOTE_411's own
verdicts. The two lineage-B modules are deleted IN THIS COMMIT, so there is no
window where both are importable.

DELETED WITH THE MERGE: mem_cache/session_manifest.py, mem_cache/session_bundle.py,
and test_session_manifest_410.py -- the B test that imported a deleted module.
Leaving it would have errored the suite; the reconcile branch had already
dropped it. pin_ledger.py STAYS: the reconciliation keeps and extends it (the
`unpinned` shortfall field) and hicache_storage consumes it -- which is why the
briefed three-file set was corrected to two.

NON-OBVIOUS HUNKS, with the authority:

* evictor hunks 2/3 -> THEIRS. NOTE_411 "Step 2: A's evictor moves to ALLOCATED
  bytes ... the evictor and the pin ledger share one unit".
* evictor hunk 4 -> OURS, and this one departs from the incoming text on
  evidence: theirs inlines a flat stat loop, while this train has already
  refactored that into the injectable `_iter_existing` and applies
  `self._allocated_size(st)` in `_scan_existing_files`. The VERDICT (allocated
  accounting) is satisfied; taking theirs would have duplicated the stat and
  regressed sharded-layout support.
* evictor hunks 0/1 -> OURS / UNION. Theirs predates A's `writer_count`,
  `path_for_stem` and `iter_existing` ctor params; the union keeps those AND
  theirs' pin-ledger param.
* http_server / scheduler / tokenizer_control_mixin -> OURS. Theirs predates
  the phase-flip and session-handover imports; taking it would have deleted
  live wiring.
* server_args -> UNION. Two disjoint flag blocks (phase flip, session
  checkpoints); both must exist.
* AUDIT_421 F6 cells -> merged, naming BOTH credits (sgl-project#286's first consumer and
  sgl-project#410's checkpoint tier). Both statements are true; a table cell cannot hold
  two rows.
* test_unwired_features_421 -> UNION, so theirs' positive pin class survives
  alongside ours' retirement note.

THREE INCOHERENCES THE TEXTUAL MERGE HID, found by running the suites:

1. DUPLICATE METHODS. Both lineages define the same methods in different
   places, so git merged both and the SECOND silently shadowed the first. An
   AST audit over every merged file found five: `stats` and `_allocated_size`
   in the evictor, `capacity_stats`, `pin_checkpoint`, `unpin_checkpoint` and
   `pin_stats` in hicache_storage. Resolved per pair -- ours' `capacity_stats`
   (a strict superset, it adds `file_path`), theirs' pin methods (the
   authority's `_pin_path`/`unpinned` version), ours' `_allocated_size` (same
   behaviour, richer docstring), and ours' `stats` with theirs' unique
   `accounting_overshoot_bytes` key folded in. http_server's pair is NOT a
   merge artifact: two different FastAPI handlers that share a name, present at
   HEAD before this merge.
2. EVICTION STOPPED REMOVING FILES. Hunk 5's incoming block extended past the
   comment into the removal line, replacing `self._path_for_stem(evict_stem)`
   with a flat join. This backend injects the sharded resolver, so `os.remove`
   missed, the entry left the LRU and the bytes stayed -- the cap silently
   stopped holding. Restored to the injected resolver; line 466 already stats
   through it and the two must not disagree.
3. `_pin_path` WAS FLAT ON A SHARDED STORE. The reconciliation wrote it as a
   flat join because its own lineage had no sharding. Here that names a path
   the store never writes, so `pin_checkpoint` dropped every stem as "missing"
   and pinned NOTHING while reporting success. `_pin_path` now delegates to
   `_existing_path` (sharded, else legacy flat, else the path it would occupy),
   which preserves the property the reconciliation actually asked for -- "the
   ledger must stat exactly what the evictor unlinks" -- under this layout.

Gates: mem_cache 1157 passed / 0 failed; managers 19 failed / 2507 passed,
IMPROVED on the established 22 and exactly the cluster-b inherited set;
mem_ledger 514/0; server_args 681/0; boot_matrix 159/0; spec 13F/711P;
entrypoints 4F/450P/3E; planner 1F/2880P; distributed 27F/2769P -- every one
at or better than its established count.

Also verified present rather than assumed: 54ffc4d (the corrected
pp_with_spec register row) is an ancestor, and test_phase_flip_args no longer
asserts the sgl-project#630 hierarchical-cache refusal -- F4-r4's lift (be93340)
removed that third twin, and the file is 23 passed / 0 failed here.
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.

[Feature Request] Optimized quantised kernels

2 participants