Skip to content

[mem_cache][10/N] refactor: drop the redundant _component suffix in unified_cache/components - #35644

Merged
ispobock merged 8 commits into
sgl-project:mainfrom
alphabetc1:refactor/mem-cache-unified-cache-components
Sep 13, 2026
Merged

ispobock merged 8 commits into
sgl-project:mainfrom
alphabetc1:refactor/mem-cache-unified-cache-components

Conversation

@alphabetc1

@alphabetc1 alphabetc1 commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Part of #25371. Mechanical Move.

#32484 moved unified_cache_components/ to unified_cache/components/ but kept the
_component suffix on every file, so the directory now reads
unified_cache/components/full_component.py -- the role is stated twice, once by the
directory and again by every file inside it. The RFC's naming rule is to drop affixes
that do not differentiate (compare models/qwen.py, not models/qwen_model.py); this
finishes the move that was started.

tree_component.py is also misnamed: it is not "a tree component" but the
TreeComponent ABC plus the shared enums and helpers every component imports. base.py
matches how allocator/base.py and pool_host/base.py already name that role.

Modifications

tree_component.py  -> base.py     TreeComponent ABC, ComponentType, ComponentData, ...
full_component.py  -> full.py     FullComponent
mamba_component.py -> mamba.py    MambaComponent
swa_component.py   -> swa.py      SWAComponent

git mv for all four, then the import path updated at every call site. No symbol was
renamed, no re-export shim added.

Diff surface is exactly: 19 import-path lines, 3 filename string literals in
test_session_unified_radix_cache.py (which asserts on file contents by name), 5 lines
in unified_cache/components/README.md, and isort reordering where base now sorts
ahead of its siblings. Nothing else.

Accuracy Test

Mechanical move, so the bar is byte-level equality rather than accuracy:

  • base.py is byte-identical to tree_component.py.
  • full.py / mamba.py / swa.py differ from their originals in exactly one line
    each -- the tree_component -> base import.

Verified on an H200 devbox (PYTHONPATH shadowing the image's copy):

              PR branch:   1117 passed, 1070 skipped, 52 subtests passed
  pristine main baseline:  1117 passed, 1070 skipped, 52 subtests passed

Identical command over test_unified_radix_cache_unittest.py,
test_tree_core_registry.py, test_mamba_path_state_cap.py,
test_mamba_donated_alloc_ratio.py, test_session_unified_radix_cache.py against both
trees on the same box -- zero delta, so the 1070 skips are pre-existing and none were
introduced here. Package and per-module imports were also smoke-tested.

Benchmark and Profiling Results

Not applicable -- no runtime behavior changes.

Checklist

  • Format your code according to the Code Formatting with Pre-Commit.
  • Add unit tests as outlined in the Running Unit Tests.
  • Update documentation / docstrings / example tutorials as needed, according to Writing Documentation.
  • Provide throughput / latency benchmark results and accuracy evaluation results as needed, according to Benchmark and Profiling.
  • For reviewers: If you haven't made any contributions to this PR and are only assisting with merging the main branch, please remove yourself as a co-author when merging the PR.
  • Please feel free to join our Slack channel at https://slack.sglang.ai to discuss your PR.

Independent of the other in-flight #25371 PRs -- touches no file that #35306 or #35638 touch.

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #34703150536
Latest PR Test (Extra): 🚫 Run #34703150408
Latest PR Test (AMD ROCm 10): ❌ Run #34703150480

…nents

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alphabetc1
alphabetc1 force-pushed the refactor/mem-cache-unified-cache-components branch from b8f7466 to 8187719 Compare September 2, 2026 10:47
@alphabetc1
alphabetc1 requested a review from Jialin as a code owner September 9, 2026 17:28

@Jialin Jialin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean up!

@ispobock
ispobock merged commit 7f1f8c7 into sgl-project:main Sep 13, 2026
368 of 407 checks passed
@alphabetc1
alphabetc1 deleted the refactor/mem-cache-unified-cache-components branch September 13, 2026 13:50
zsun6 added a commit to zsun6/sglang that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apple-silicon bypass-fastfail documentation Improvements or additions to documentation run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants