Skip to content

Conversation

ZJY0516
Copy link
Contributor

@ZJY0516 ZJY0516 commented Aug 28, 2025

Purpose

In vLLM, several files share the same name—for example, vllm/config/__init__.py, vllm/plugins/__init__.py, and vllm/platforms/__init__.py. This can be confusing during debugging.

I suggest we use relative paths to better distinguish between these files. One thing I'm unsure about is whether we should use vllm/config/__init__.py or config/__init__.py.

Test Plan

# fish style
env VLLM_LOGGING_LEVEL=DEBUG vllm serve /data/datasets/models-hf/Qwen3-4B/

Test Result

DEBUG 08-29 00:12:44 [vllm/plugins/__init__.py:28] No plugins for group vllm.platform_plugins found.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:34] Checking if TPU platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:52] TPU platform is not available because: No module named 'libtpu'
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:58] Checking if CUDA platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:78] Confirmed CUDA platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:106] Checking if ROCm platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:120] ROCm platform is not available because: No module named 'amdsmi'
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:127] Checking if XPU platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:146] XPU platform is not available because: No module named 'intel_extension_for_pytorch'
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:153] Checking if CPU platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:175] Checking if Neuron platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:58] Checking if CUDA platform is available.
DEBUG 08-29 00:12:44 [vllm/platforms/__init__.py:78] Confirmed CUDA platform is available.
INFO 08-29 00:12:44 [vllm/platforms/__init__.py:241] Automatically detected platform cuda.
DEBUG 08-29 00:12:45 [vllm/entrypoints/utils.py:168] Setting VLLM_WORKER_MULTIPROC_METHOD to 'spawn'
DEBUG 08-29 00:12:45 [vllm/plugins/__init__.py:36] Available plugins for group vllm.general_plugins:
DEBUG 08-29 00:12:45 [vllm/plugins/__init__.py:38] - lora_filesystem_resolver -> vllm.plugins.lora_resolvers.filesystem_resolver:register_filesystem_resolver
DEBUG 08-29 00:12:45 [vllm/plugins/__init__.py:41] All plugins in this group will be loaded. Set `VLLM_PLUGINS` to control which plugins to load.
(APIServer pid=2780001) INFO 08-29 00:12:45 [vllm/entrypoints/openai/api_server.py:1885] vLLM API server version 0.10.2.dev333+gc5d004aaa

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to improve debuggability by using relative paths in log messages, which is a great idea for clarifying file origins. However, the current implementation introduces a performance overhead by calculating relative paths for all log messages, even in non-debug mode. I've provided a suggestion to conditionally perform this logic based on the VLLM_LOGGING_LEVEL, ensuring there's no performance impact in production environments.

@robertgshaw2-redhat robertgshaw2-redhat self-requested a review August 29, 2025 01:47
Signed-off-by: zjy0516 <[email protected]>
@ZJY0516 ZJY0516 changed the title [Log] use relpath in debug level log [Log] Use a relative path in debug-level logs to distinguish files with identical names Sep 1, 2025
@ProExpertProg
Copy link
Collaborator

I would vote for stripping the vllm prefix to reduce visual clutter. We should also think about what to do about long paths (I think some of the model_executors/layers/quantization/... gets very long)

@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 2, 2025

I would vote for stripping the vllm prefix to reduce visual clutter. We should also think about what to do about long paths (I think some of the model_executors/layers/quantization/... gets very long)

Yeah, I see your point. Those paths can get crazy long. I guess it's maybe okay when you're deep in debugging and need the full context, but for most other times, it's a lot of noise.

@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 2, 2025

@robertgshaw2-redhat Sorry to disturb you, do you have any advice on this?

@ProExpertProg
Copy link
Collaborator

@ZJY0516 how about we limit to 1 top-level folder and 2 bottom-level folders for now:

  • vllm/model_executor/layers/quantization/compressed_tensors/transform/schemes/linear_qutlass_nvfp4.py becomes model_executor/.../transform/schemes/linear_qutlass_nvfp4.py
  • vllm/model_executor/layers/quantization/utils/fp8_utils.py becomes model_executor/.../quantization/utils/fp8_utils.py
  • vllm/model_executor/layers/quantization/awq.py becomes model_executor/layers/quantization/awq.py

For v1, we can include the 2nd top-level folder:

  • vllm/v1/attention/backends/mla/common.py becomes v1/attention/backends/mla/common.py
  • vllm/v1/core/kernels/utils/ops/__init__.py becomes v1/core/.../utils/ops/__init__.py (currently no files are too deep anyway).

Does that make sense?

@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 2, 2025

Maybe just 2 bottom-level folder is enough?

@ProExpertProg
Copy link
Collaborator

Maybe just 2 bottom-level folder is enough?

I think the order of importance is last folder, first folder, second-to-last folder. So if you only want 2 do one bottom one top?

@ProExpertProg
Copy link
Collaborator

But I would still do what I proposed (2 bottom 1 top)

@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 6, 2025

But I would still do what I proposed (2 bottom 1 top)

I agree with you

Copy link
Collaborator

@ProExpertProg ProExpertProg left a comment

Choose a reason for hiding this comment

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

A small nit, let me know once this is ready for full review (with my proposed approach)

@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 6, 2025

A small nut, let me know once this is ready for full review (with my proposed approach)

Soon. I am a little busy today. Thanks a lot

Signed-off-by: zjy0516 <[email protected]>
@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 6, 2025

@ProExpertProg Now it's ready for full review


def format(self, record):

def shrink_path(relpath: str) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this take Path as an argument and can you add a comment what this does?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(it includes a property parts)

Comment on lines 25 to 38
if parts and parts[0] == "vllm":
parts = parts[1:]
if parts and parts[0] == "v1":
# If starts with 'v1', keep the first two and last two levels
if len(parts) > 4:
return "/".join(parts[:2] + ["..."] + parts[-2:])
else:
return "/".join(parts)
else:
# Otherwise, keep the first and last two levels
if len(parts) > 3:
return "/".join([parts[0], "..."] + parts[-2:])
else:
return "/".join(parts)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you could simplify this:

Suggested change
if parts and parts[0] == "vllm":
parts = parts[1:]
if parts and parts[0] == "v1":
# If starts with 'v1', keep the first two and last two levels
if len(parts) > 4:
return "/".join(parts[:2] + ["..."] + parts[-2:])
else:
return "/".join(parts)
else:
# Otherwise, keep the first and last two levels
if len(parts) > 3:
return "/".join([parts[0], "..."] + parts[-2:])
else:
return "/".join(parts)
new_parts = []
if parts[0] == "vllm":
parts = parts[1:]
if parts[0] == "v1":
new_parts += parts[0:1]
parts = parts[1:]
if len(parts) > 3:
parts = [parts[0]] + ["..."] + parts[-2:]
new_parts += parts
return "/".join(new_parts)

Signed-off-by: zjy0516 <[email protected]>
@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 6, 2025

Fixed! Can you check if it's all good now? @ProExpertProg

@ProExpertProg ProExpertProg added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 9, 2025
@ZJY0516
Copy link
Contributor Author

ZJY0516 commented Sep 9, 2025

@ProExpertProg Please take a look whether this can be mered

@ProExpertProg ProExpertProg merged commit b5fb300 into vllm-project:main Sep 9, 2025
37 checks passed
@ZJY0516 ZJY0516 deleted the relpath-log branch September 10, 2025 03:07
skyloevil pushed a commit to skyloevil/vllm that referenced this pull request Sep 13, 2025
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants