Skip to content

Conversation

@ganyi1996ppo
Copy link
Contributor

@ganyi1996ppo ganyi1996ppo commented Nov 13, 2025

Purpose

Got error message when PR #27005 merged

ting down executor.
(EngineCore_DP0 pid=2001222) Process EngineCore_DP0:
(EngineCore_DP0 pid=2001222) Traceback (most recent call last):
(EngineCore_DP0 pid=2001222)   File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
(EngineCore_DP0 pid=2001222)     self.run()
(EngineCore_DP0 pid=2001222)   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
(EngineCore_DP0 pid=2001222)     self._target(*self._args, **self._kwargs)
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/engine/core.py", line 859, in run_engine_core
(EngineCore_DP0 pid=2001222)     raise e
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/engine/core.py", line 846, in run_engine_core
(EngineCore_DP0 pid=2001222)     engine_core = EngineCoreProc(*args, **kwargs)
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/engine/core.py", line 619, in __init__
(EngineCore_DP0 pid=2001222)     super().__init__(
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/engine/core.py", line 110, in __init__
(EngineCore_DP0 pid=2001222)     num_gpu_blocks, num_cpu_blocks, kv_cache_config = self._initialize_kv_caches(
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/engine/core.py", line 244, in _initialize_kv_caches
(EngineCore_DP0 pid=2001222)     self.model_executor.initialize_from_config(kv_cache_configs)
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/executor/abstract.py", line 116, in initialize_from_config
(EngineCore_DP0 pid=2001222)     self.collective_rpc("compile_or_warm_up_model")
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/executor/multiproc_executor.py", line 307, in collective_rpc
(EngineCore_DP0 pid=2001222)     return aggregate(get_response())
(EngineCore_DP0 pid=2001222)   File "/home/ygan/vllm/vllm/v1/executor/multiproc_executor.py", line 290, in get_response
(EngineCore_DP0 pid=2001222)     raise RuntimeError(
(EngineCore_DP0 pid=2001222) RuntimeError: Worker failed with error 'get_cu_count() missing 1 required positional argument: 'cls'', please check the stack trace above for the root cause

The get_cu_count calling missing class variable, this PR remove that class variable to make sure the functionality on ROCm platform.

Test Plan

Test Result


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 correctly fixes a TypeError in the get_cu_count function by removing an unnecessary cls parameter. I've also identified a potential improvement within the same function. The current implementation could lead to unintended CUDA context initialization. I've provided a suggestion to use an existing utility function from the same file to make it safer in multiprocessing environments.

Comment on lines +27 to 29
def get_cu_count(device_id: int = 0) -> int:
"""Returns the total number of compute units (CU) on single GPU."""
return torch.cuda.get_device_properties(device_id).multi_processor_count
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While removing the unused cls parameter is correct, the function can be further improved. The direct call to torch.cuda.get_device_properties will initialize the CUDA context, which can cause issues in multiprocessing environments. This file provides a safer utility, cuda_get_device_properties, which avoids this side effect. Using it here would make the function more robust.

Suggested change
def get_cu_count(device_id: int = 0) -> int:
"""Returns the total number of compute units (CU) on single GPU."""
return torch.cuda.get_device_properties(device_id).multi_processor_count
def get_cu_count(device_id: int = 0) -> int:
"""Returns the total number of compute units (CU) on single GPU."""
return cuda_get_device_properties(device_id, ("multi_processor_count",))[0]

@ganyi1996ppo
Copy link
Contributor Author

@tjtanaa @wangxiyuan @gshtras @HAIAI please take a look

@ganyi1996ppo ganyi1996ppo changed the title [BugFix] Fix get_cu_count missing variable error [BugFix][ROCm] Fix get_cu_count missing variable error Nov 13, 2025
@mergify mergify bot added the rocm Related to AMD ROCm label Nov 13, 2025
Copy link
Collaborator

@tjtanaa tjtanaa left a comment

Choose a reason for hiding this comment

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

Thank you for the fix.

Copy link
Contributor

@wangxiyuan wangxiyuan left a comment

Choose a reason for hiding this comment

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

Oh, my silly mistake

@tjtanaa tjtanaa added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 13, 2025
@tjtanaa tjtanaa enabled auto-merge (squash) November 13, 2025 02:46
@ganyi1996ppo
Copy link
Contributor Author

Oh, my silly mistake

haha, that's fine, I spot it in time!

@tjtanaa tjtanaa merged commit 7dca0c9 into vllm-project:main Nov 13, 2025
53 checks passed
@gshtras gshtras deleted the ganyi/fix_get_cu_count branch November 13, 2025 17:07
geodavic pushed a commit to geodavic/vllm that referenced this pull request Nov 16, 2025
bwasti pushed a commit to bwasti/vllm that referenced this pull request Nov 17, 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 rocm Related to AMD ROCm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants