Repository navigation
add filter_files_not_needed_for_inference - #832
Closed
haichuan1221 wants to merge 17 commits into
Closed
haichuan1221 wants to merge 17 commits into
haichuan1221 wants to merge 17 commits into
Conversation
Contributor
|
Hi @haichuan1221 Thanks for your contribution. May you add a unit test for it? Thanks. |
Author
Will do this later |
Contributor
|
The code you are modifying is for an experimental feature that will likely never be used. How do you reach this code? What is your server launch command? |
Author
Well, it has never been used, so I suggest just removing it. Also, it will download files from huggingface even if they already exist and I fixed it. Can you please review the code again? |
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 24, 2026
…ry tree answers
W29 died on all three ranks with a one-row pool deficit:
pool memory leak detected! [full] total=469733, available=107041,
evictable=1, protected=0, session_held=0, uncached=0, withheld=362690
The seam's own sgl-project#832 census had already named the orphan by id --
`unaccounted=1 [1]`, flat from the first flip that crossed a non-empty
prefix tree onward, on every later census in both directions.
ROOT. `drop_prefix_tree_returning_rows` is the W27-retry fix for the
152-row orphan: evict-then-reset, so rows go back through the allocator
before `reset()` rebuilds the root. It decided how much to evict with
`getattr(tree, "full_evictable_size_", 0)`. That trailing-underscore
attribute belongs to exactly three caches (MambaRadixCache,
SWARadixCache, HiMambaRadixCache). The live tree is UnifiedRadixCache,
which keeps the same quantity in `component_evictable_size_` and has no
such attribute -- so the read returned ZERO, the eviction was skipped
outright, and `reset()` orphaned the tree's rows exactly as before. The
W27-retry fix was inert on this tree from the day it shipped.
The deficit is the SIZE OF THE TREE, not a constant. It read as a
constant unit only because both ranks held exactly one cached row (a
1-token health check) at every drop. W27-retry's 152 and W29's 1 are one
defect at two occupancies.
FIX, one writer and one clock. `tree_evictable_full_rows` reads the
BasePrefixCache contract method `full_evictable_size()`, which every
cache implements and which, on the three attribute-keeping caches,
returns that very attribute -- a strict superset of the old read, never
less. A tree that cannot answer yields None, not 0, and the caller says
so: zero is a licence to skip the eviction, and skipping it is the
defect. The evict is then RE-READ, because it can stop short on a locked
or un-backed node (sgl-project#841), and residue is reported before reset orphans
it.
The seam now prints how many rows the drop returned. It already computed
the number and its own docstring said it "has to be visible"; the caller
discarded it, so a drop returning zero rows logged identically to one
returning all of them, and the only reader left was a census one pass
too late to name an owner.
Nothing in the invariant checker is softened, widened or special-cased.
The abort was correct.
WHY THE SUITE WAS GREEN THROUGH A DEAD BOOT: this file's `_Tree` double
carried the private attribute and not the public method -- backwards
from every shipped cache. The double is corrected, a UnifiedRadixCache-
shaped double is added, and a drift-detector now asserts against the
REAL classes that each answers `full_evictable_size`, and that neither
reader's body touches the private attribute again.
TESTS
test_tree_drop_returns_rows_856.py + test_seam_order_856.py +
test_phase_flip_mover_streaming_631.py: 43 passed.
CAN-FAIL (a): TestTheCheckerStaysStrict asserts _check_pool_invariant
still flags W29's 1-row deficit AND W27-retry's 152-row orphan, and
passes a balanced pool.
CAN-FAIL (b): reverting only phase_flip_runtime.py turns 6 tests red,
including all four TestTheLiveTreeShape cases. Verified, restored.
managers unit suite (4026 collected):
HEAD e8bce97 9 failed / 4004 passed / 2 skipped
with this fix 8 failed / 4016 passed / 2 skipped
The 8 are a strict subset of HEAD's 9; no new failures. Pre-existing:
test_phase_flip_staging_reserve_631 (x4), test_rank_prefill_log (x1),
and, under full-suite ordering only, test_hisparse_unit (x2) and
test_draft_cuda_graph_removal (x1).
ruff check + format clean on both files.
Specimen and full record: /spinning/gpu-arb/W29-RESULT.md, section W29-A2.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 26, 2026
…f from a list THE QUESTION WAS ASKED OF MY OWN EARLIER WORK, AND THE HONEST ANSWER WAS NO. Three duck-typed attribute misses on the Unified family had been found one at a time -- sgl-project#832 `evictable_size` (killed all three ranks on W29), sgl-project#872 `_drain_storage_control_queues_local`, #872b `value`/`*lock_ref` on UnifiedTreeNode. All three were INSTANCE fixes. The two conformance suites from sgl-project#872/#872b were the first class-level checks in this tree, and measuring them shows they were not enough: * the sgl-project#872 suite reads probed names out of the SOURCE -- genuinely derived, but for ONE module (`hicache_flip_writeback`); * the #872b suite carries `expected_unreadable = {"UnifiedTreeNode"}` and pins `value` plus the `*lock_ref` trio. That is a LIST. Measured: `TreeNode` exposes SIX names `UnifiedTreeNode` lacks -- value, lock_ref, host_value, host_ref_counter, protect_host, release_host. The list covered TWO of six: exactly the ones that had already hurt. So the #872b half was a third instance fix in class clothing, and the fourth instance would have landed. A list extended at each new finding is a COUNTER. WHAT THIS IS INSTEAD. The surface is computed from the BASE at test time: whatever the non-Unified counterpart provides and the Unified one does not. Consumer modules are then scanned for duck-typed reads of those names. Nothing about the three known pains is privileged, and a new divergence enters the surface without anyone editing this file. Measured on `UnifiedRadixCache`: 17 names `RadixCache` provides that it lacks, 40 against `MambaRadixCache`. THE DISCRIMINATOR, WITHOUT WHICH IT CRIES WOLF. Not every `hasattr` on a diverging name is a cross-class probe. `session_radix_cache` guards `_session_leaves` with `hasattr` and then CREATES it (`_ensure_session_radix_state`) -- lazy init, entirely correct, and a false positive here. The rule that separates them, and it is derived rather than listed: a probe is a cross-class miss only if the probing module NEVER ASSIGNS the attribute itself. Without it this gate fires on working code, and a gate that fires on working code gets muted -- which is how the original condition survived three findings. WHAT IT FOUND THAT NO INSTANCE FIX EVER TOUCHED. Four sites are derived today. Three were known. The fourth is `UnifiedTreeNode.host_value`, duck-typed in `hicache_demotion.is_persistable` -- named as a landmine during #872b but covered by NO check until now. It remains UNREACHABLE (hicache_demotion is imported only by hiradix_cache.py, zero references from unified_radix_cache), and it is RECORDED rather than fixed, so it cannot become live unnoticed. `sgl-project#832`'s `evictable_size` correctly produces NO finding -- its consumer now reads `component_evictable_size_`, so the check confirms that fix still holds. THE NAMING TRAP, RECORDED because it is why two readers reached the same wrong conclusion independently: `Unified*` spans TWO unrelated subsystems. `UnifiedRadixCache`/`UnifiedTreeNode` are the radix TREE and are LIVE on this rig. The unified memory POOLS are gated behind `--enable-unified-memory`, which is False by default (server_args.py:1378), is set nowhere in the tree, and whose handler asserts `speculative_algorithm is None` while this rig always runs MTP. A shared prefix suggested a shared gate that does not exist, so this suite pairs only the TREE classes and says why. TESTS (hermetic; no boot; no card touched). CUDA_VISIBLE_DEVICES="" verified at the process, `nvidia-smi --query-compute-apps` empty throughout, cards 0/0/0. * CAN-FAIL ON A NAME THAT NEVER HURT, which is the point of the exercise: - un-recording `host_value` (no instance fix ever touched it) -> gate red; - injecting a BRAND-NEW divergent probe into real consumer code (`getattr(node, "protect_host", ...)` in hicache_demotion -- a name in no list anywhere) -> gate red AND names it in the failure message; - dropping the lazy-init discriminator -> 2 red, incl. the `_session_leaves` false positive returning. Green restored after each. If only the three known names had reddened, the answer to "does this cover the family" would have been no. * partitioned tier-2 gate: wide 3775 / narrow 291 / serial 353 passed, 24 exclusions reported, names agrees with the summary on every lane. TWO failures, neither mine -- this commit adds a single test file under mem_cache/ and touches no product code: - test_pp_admission_wraparound_never_blocks: PRE-EXISTING, proved earlier on the clean base 726f11e where that module fails TWO tests, i.e. MORE than here; - test_pp_admission_chain_flush_deadlock_795: PASSES in isolation on this tree (both modules together: 1 failed, 6 passed), so it is the order/contention shape the narrow lane's bounded worker count exists to avoid, already seen twice this session. * test/registered/unit/mem_cache: 2 failed / 1814 passed -- the known test_acceptance_emitters_758 RefillTiming pair; +6 over 1808 is this suite. WHERE THIS STRUCTURALLY DOES NOT REACH, named in the module rather than left to be discovered: factory indirection (a class produced by a builder, never named here); `getattr(obj, some_variable)` where the name is computed; registry or dispatch-table lookup, where neither side appears in the source; and a consumer that reads `obj.attr` directly and lets AttributeError fly -- out of scope by intent, because that failure is LOUD and therefore a different, better problem. The same methodological limit as the post-set enumeration and the sgl-project#880 reachability sweep: stated, not papered over. NOT ESTABLISHED. Whether the pairing itself is complete beyond the radix-tree module -- `test_every_unified_class_is_paired` enforces it for `unified_radix_cache`, but a Unified* class living in another module is outside that scan by construction.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 26, 2026
…ated gap and a stale double-owned reading as a leak, killing all three schedulers on idle Five on_idle firings (two boots) showed available+evictable+withheld exceeding total by exactly 22, never a deficit -- the opposite sign from sgl-project#814/sgl-project#902/sgl-project#832/sgl-project#856, and never previously routed through the sgl-project#822 ownership authority. Decomposition: 21 rows from _check_full_pool reading TokenToKVPoolAllocator.available_size() (a raw sum of free_pages+release_pages, allocator/token.py:52-54) instead of the union read_free_rows() already used by the phase-flip census and the sgl-project#822 audit (kv_row_ownership.py:743-843); 1 row from a single row simultaneously claimed by the free list and the radix tree, the sgl-project#822 authority's own EXCLUSIVITY "claimed by multiple" finding, never subtracted before. Fix, both additive, neither a tolerance/epsilon: - _check_full_pool now reads available via read_free_rows() when the allocator can enumerate; composite/watermark allocators keep ps.full_available_size unchanged. - _check_pool_invariant gained a double_owned term, subtracted, sourced from allocator.double_owned_slots (the sgl-project#822 EXCLUSIVITY count). Two defects found in review of the first cut, both fixed here: 1. The double_owned filter in phase_flip_runtime.py::_census_ownership_audit selected violations by substring match on Violation.detail ("more than one owner" in v.detail) -- prose used as control flow, against Violation's own "detail is never load-bearing" contract, the same shape as the line_gate substring defect (sgl-project#908). Fixed by giving Violation a structural kind field, set to EXCLUSIVITY_DOUBLED or EXCLUSIVITY_UNOWNED at its two EXCLUSIVITY construction sites in kv_row_ownership.py, and filtering on kind instead of detail text. 2. double_owned_slots is published only at phase-flip census (seam) events and read by on_idle at unrelated times; a reading taken before authority.retire() drops every claim it was computed from is stale past that point. Fixed by clearing double_owned_slots to None (not 0) at the exact point _retire_row_id_space calls authority.retire(). Checked analytically whether staleness alone could mask a genuine deficit: it cannot, for any non-negative reading, because double_owned is subtracted and can only push total_accounted further below total. It can mask an unrelated, coincidentally-equal-sized surplus; that residual case is disclosed, not eliminated, and bounded by the cutover-clearing fix. Tests (test/registered/unit/mem_cache/test_pool_invariant_double_owned_912.py, 14 tests, 31 subtests): reconstructs all five measured specimens, red-first against unfixed code, green after the fix; separate mutants for the original subtraction, the kind-based filter, and the retire-time clearing, each shown to fail only its own guard when reverted; a parametrized check that no non-negative stale double_owned value can turn a manufactured 100-row deficit into a false pass. Gate, hermetic (CUDA_VISIBLE_DEVICES=""), attribution proven by rerunning identical failing node-id lists with these three files restored to HEAD (git show HEAD:<path>) and diffing failure sets -- both axes' failures are identical with and without this fix, i.e. pre-existing: - mem_cache/: 2 failed, 1951 passed, 1658 skipped, 392 subtests passed (139.10s). Failures: test_acceptance_emitters_758.py RefillTiming x2, RuntimeError: No CUDA GPUs are available. - managers/: 15 failed, 4631 passed, 18 skipped, 563 subtests passed (719.09s). Failures: test_arena_high_water_631.py x7 and test_restore_never_rebuild_677.py x4 (RuntimeError: No CUDA GPUs are available), test_phase_flip_rotation_wiring_809.py x4 (Exception: retry() exceed maximum number of retries) -- all reproduced identically against HEAD-restored files. ruff check and codespell clean on every line touched by this change (both tools also flag pre-existing issues elsewhere in phase_flip_runtime.py and invariant_checker.py, outside this diff's hunks, left untouched as out of scope for sgl-project#912).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems there are some missing format for the model loader, such as filter_files_not_needed_for_inference,np_cache_weights_iterator, pt_weights_iterator etc. Do you guys want to support it or remove it?