Skip to content

[Refactor] utils: Move domain-dependent modules out of srt.utils - #48758

Merged
hnyls2002 merged 3 commits into
mainfrom
lsyin/srt-utils-owners
Nov 6, 2026
Merged

hnyls2002 merged 3 commits into
mainfrom
lsyin/srt-utils-owners

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator
  • Move profile_utils and request_logger to sglang.srt.observability
  • Move offloader and host_shared_memory to sglang.srt.layers; model_loader would form an import cycle, since its package init reaches layers modules that import the offloader at module level
  • Move weight_checker and weight_checker_comparator to sglang.srt.model_executor
  • Move cuda_vmm_transport_utils to sglang.srt.multimodal.transport.cuda_vmm, next to cuda_ipc
  • Move crash_dump to sglang.srt.observability.request_dump, next to its --crash-dump-folder flag's group. The periodic dump_requests_folder dump writes the same file format through its own copy of the code in TokenizerManager; both now use build_request_dump and save_request_dump from that module
  • Move hf_transformers/ to sglang.srt.hf_transformers; it now imports hf_transformers_patches from sglang.srt.utils by absolute path
  • Update every importer, mock.patch target, CODEOWNERS entry, and path in comments; the weight checker, request logger, and crash dump tests move next to their modules
  • check-srt-utils-imports drops its allowlist, since every sglang.srt.utils module now follows the rule, and fails when it finds no files to scan

No behavior change: module contents are unchanged apart from import paths, and both dump writers produce byte-identical files (checked with picklable and unpicklable server_args). The only visible difference is that the periodic dump's pickle-retry error is logged by sglang.srt.observability.request_dump instead of the TokenizerManager logger.


CI States

Latest PR Test (Base): 🚫 Run #42145343297
Latest PR Test (Extra): ❌ Run #42145343406
Latest PR Test (AMD ROCm 10): 🚫 Run #42145343423

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Nov 6, 2026
@hnyls2002
hnyls2002 merged commit 93cfea6 into main Nov 6, 2026
115 of 206 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/srt-utils-owners branch November 6, 2026 01:56
metamergebot added a commit that referenced this pull request Nov 6, 2026
#48758 moved the crash-dump writer, the last other user of pickle in this
module, out to sglang.srt.observability and dropped the import; the pickled
request history still needs it here.
alexnails pushed a commit to zyt329/sglang that referenced this pull request Nov 6, 2026
Multimodal models load tokenizers through get_processor(), which bypassed
the _fix_v5_add_bos_eos_token() compatibility repair applied by
get_tokenizer(). For affected Gemma tokenizers, the processor path could
omit the expected BOS token. Apply the existing helper to the final
tokenizer selected by get_processor() and add a CPU-only regression test.

Rebased onto main after hf_transformers moved out of srt.utils (sgl-project#48758).
kpham-sgl added a commit to kpham-sgl/sglang that referenced this pull request Nov 6, 2026
…ckend check

Main moved sglang.srt.utils.hf_transformers to sglang.srt.hf_transformers (sgl-project#48758).
metamergebot added a commit that referenced this pull request Nov 6, 2026
…bility

Upstream moved `sglang.srt.utils.request_logger` to
`sglang.srt.observability.request_logger` (#48758) after the request-log
port was written, so `rust_server/config.py` and `test_rust_request_log.py`
failed to import. Import from the new module; no other change.
metamergebot added a commit that referenced this pull request Nov 6, 2026
Takes current `main` through the parent branch. Conflicts resolved:

- `python/sglang/srt/utils/crash_dump.py` moved to
  `python/sglang/srt/observability/request_dump.py` (#48758) and its writer
  split into `build_request_dump` / `save_request_dump` / `write_crash_dump`:
  the crash-dump additions (grace constants, `crash_dump_hostname`,
  `filename_suffix`, the dumping marker, `wait_for_crash_dumps`,
  `CrashDumpGrace`) now live there, and the atomic write is
  `save_request_dump` to a uniquely named temporary file plus `os.replace`,
  so upstream keeps one pickle writer.
- `run_scheduler_process` keeps `main`'s `traceback.format_exc()` line and
  dumps before SIGQUIT after it.
- `rust_server/server.py` imports: `main`'s `envs` and `get_device` plus the
  crash-dump names from the new module.
- Imports in `entrypoints/engine.py` and the moved unit test
  (`test/registered/unit/observability/test_crash_dump.py`) follow the module.
metamergebot added a commit that referenced this pull request Nov 6, 2026
Brings upstream main in under the port, through the parent branch. Two
upstream refactors moved functions this change edits, so the same
redaction now sits where they live; no other line changes:

- `build_server_info` moved to `entrypoints/server_utils.py` (#48781):
  the server-info redaction and its import follow it, and the test
  imports it from there.
- `utils/crash_dump.py` became `observability/request_dump.py`, with
  `write_crash_dump` split into `build_request_dump`, `save_request_dump`
  and `write_crash_dump` (#48758): `server_args` and `resolved_config` are
  redacted in `build_request_dump`, which every writer calls, and the
  launch command in `write_crash_dump`.
- `tokenizer_manager.py` no longer uses `redact_watermark_secrets` after
  that move, so the now-unused import goes.
metamergebot added a commit that referenced this pull request Nov 6, 2026
…bility in the parity scan

Upstream #48758 moved python/sglang/srt/utils/request_logger.py to
python/sglang/srt/observability/request_logger.py. The parity scan lists
every Python-frontend source it reads, and reads each with read_text(), so
the old entry would raise FileNotFoundError on first use. One path line
changes; nothing else.
nvpohanh added a commit to rystewart-nvidia/sglang that referenced this pull request Nov 17, 2026
Move dflash_gguf.py to python/sglang/srt/hf_transformers/ after sgl-project#48758 and update its imports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek diffusion SGLang Diffusion documentation Improvements or additions to documentation hicache Hierarchical Caching for SGLang lora Multi-modal multi-modal language model npu run-ci CI: run the baseline test suite on this PR rust-processor speculative-decoding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant