Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhaoyu6
sglang
Commits
653b873b
"git@developer.sourcefind.cn:zhaoyu6/sglang.git" did not exist on "e88dd482ed4bad37e153deea14583a7e74230e90"
Unverified
Commit
653b873b
authored
Jul 08, 2025
by
kk
Committed by
GitHub
Jul 08, 2025
Browse files
Fix cache modules of triton import error (#7832)
parent
d379bda4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+28
-10
No files found.
python/sglang/srt/utils.py
View file @
653b873b
...
...
@@ -83,12 +83,7 @@ from torch.func import functional_call
from
torch.library
import
Library
from
torch.profiler
import
ProfilerActivity
,
profile
,
record_function
from
torch.utils._contextlib
import
_DecoratorContextManager
from
triton.runtime.cache
import
(
FileCacheManager
,
default_cache_dir
,
default_dump_dir
,
default_override_dir
,
)
from
triton.runtime.cache
import
FileCacheManager
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -923,18 +918,41 @@ class CustomCacheManager(FileCacheManager):
self
.
key
=
key
self
.
lock_path
=
None
try
:
module_path
=
"triton.runtime.cache"
cache_module
=
importlib
.
import_module
(
module_path
)
default_cache_dir
=
getattr
(
cache_module
,
"default_cache_dir"
,
None
)
default_dump_dir
=
getattr
(
cache_module
,
"default_dump_dir"
,
None
)
default_override_dir
=
getattr
(
cache_module
,
"default_override_dir"
,
None
)
except
(
ModuleNotFoundError
,
AttributeError
)
as
e
:
default_cache_dir
=
None
default_dump_dir
=
None
default_override_dir
=
None
if
dump
:
self
.
cache_dir
=
default_dump_dir
()
self
.
cache_dir
=
(
default_dump_dir
()
if
default_dump_dir
is
not
None
else
os
.
path
.
join
(
Path
.
home
(),
".triton"
,
"dump"
)
)
self
.
cache_dir
=
os
.
path
.
join
(
self
.
cache_dir
,
self
.
key
)
self
.
lock_path
=
os
.
path
.
join
(
self
.
cache_dir
,
"lock"
)
os
.
makedirs
(
self
.
cache_dir
,
exist_ok
=
True
)
elif
override
:
self
.
cache_dir
=
default_override_dir
()
self
.
cache_dir
=
(
default_override_dir
()
if
default_override_dir
is
not
None
else
os
.
path
.
join
(
Path
.
home
(),
".triton"
,
"override"
)
)
self
.
cache_dir
=
os
.
path
.
join
(
self
.
cache_dir
,
self
.
key
)
else
:
# create cache directory if it doesn't exist
self
.
cache_dir
=
(
os
.
getenv
(
"TRITON_CACHE_DIR"
,
""
).
strip
()
or
default_cache_dir
()
self
.
cache_dir
=
os
.
getenv
(
"TRITON_CACHE_DIR"
,
""
).
strip
()
or
(
default_cache_dir
()
if
default_cache_dir
is
not
None
else
os
.
path
.
join
(
Path
.
home
(),
".triton"
,
"cache"
)
)
if
self
.
cache_dir
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment