Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions vllm/compilation/cuda_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def __init__(

self.first_run_finished = False
self.is_debugging_mode = envs.VLLM_LOGGING_LEVEL == "DEBUG"
self._runnable_str = str(runnable) if self.is_debugging_mode else None

# assert runtime_mode is not NONE(no cudagraph), otherwise, we don't
# need to initialize a CUDAGraphWrapper.
Expand All @@ -211,10 +212,12 @@ def __getattr__(self, key: str) -> Any:
# allow accessing the attributes of the runnable.
if hasattr(self.runnable, key):
return getattr(self.runnable, key)
raise AttributeError(
f"Attribute {key} not exists in the runnable of "
f"cudagraph wrapper: {self.runnable}"
)
if self.is_debugging_mode:
raise AttributeError(
f"Attribute {key} not exists in the runnable of "
f"cudagraph wrapper: {self._runnable_str}"
)
raise AttributeError
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.

does this need to be AttributeError()? (I don't know how this works)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ref to https://docs.python.org/3/library/functions.html#getattr, the default implementation will raise AttributeError() when attribute not exists.

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.

Does it matter if it's "raise AttributeError" vs "raise AttributeError()" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think they are nearly the same when no error message is provided.


def unwrap(self) -> Callable[..., Any]:
# in case we need to access the original runnable.
Expand Down
12 changes: 8 additions & 4 deletions vllm/v1/worker/gpu_ubatch_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def __init__(

self.sm_control = self._create_sm_control_context(vllm_config)
self.device = device
self.is_debugging_mode = envs.VLLM_LOGGING_LEVEL == "DEBUG"
self._runnable_str = str(runnable) if self.is_debugging_mode else None

@property
def graph_pool(self):
Expand Down Expand Up @@ -170,10 +172,12 @@ def __getattr__(self, key: str):
# allow accessing the attributes of the runnable.
if hasattr(self.runnable, key):
return getattr(self.runnable, key)
raise AttributeError(
f"Attribute {key} not exists in the runnable of "
f"cudagraph wrapper: {self.runnable}"
)
if self.is_debugging_mode:
raise AttributeError(
f"Attribute {key} not exists in the runnable of "
f"cudagraph wrapper: {self._runnable_str}"
)
raise AttributeError

def unwrap(self) -> Callable:
# in case we need to access the original runnable.
Expand Down
Loading