Skip to content

Commit

Permalink
convert rpd_mark to try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan138 committed Oct 1, 2024
1 parent b05b3ce commit 83fa980
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,23 @@ def create_file(filename):
print(f"An error occurred while creating the filename: {e}")


@lru_cache(maxsize=None)
def is_hipScopedMarker_available():
try:
from hipScopedMarker import hipScopedMarker
except ImportError:
hipScopedMarker = None
return hipScopedMarker is not None


class rpd_mark():

def __init__(self, name=None):
self.name = name

def __call__(self, func):

if envs.VLLM_RPD_PROFILER_DIR is None:
return func
else:
if is_hipScopedMarker_available():

@wraps(func)
def inner(*args, **kwds):
Expand All @@ -252,6 +259,9 @@ def inner(*args, **kwds):

return inner

else:
return func


class Device(enum.Enum):
GPU = enum.auto()
Expand Down

0 comments on commit 83fa980

Please sign in to comment.