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
change
sglang
Commits
d1c4d51c
"vscode:/vscode.git/clone" did not exist on "3028089e5e6554a7e20a07d87153228d39f91695"
Unverified
Commit
d1c4d51c
authored
Aug 02, 2025
by
hzh0425
Committed by
GitHub
Aug 01, 2025
Browse files
bugfix(hicache): Fix 'MooncakeStore' not defined error. (#8668)
parent
1fe691a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
python/sglang/srt/managers/cache_controller.py
python/sglang/srt/managers/cache_controller.py
+8
-4
No files found.
python/sglang/srt/managers/cache_controller.py
View file @
d1c4d51c
...
@@ -236,6 +236,7 @@ class HiCacheController:
...
@@ -236,6 +236,7 @@ class HiCacheController:
self
.
enable_storage
=
False
self
.
enable_storage
=
False
# todo: move backend initialization to storage backend module
# todo: move backend initialization to storage backend module
if
storage_backend
is
not
None
:
if
storage_backend
is
not
None
:
self
.
storage_backend_type
=
storage_backend
from
sglang.srt.mem_cache.hicache_storage
import
HiCacheFile
,
get_hash_str
from
sglang.srt.mem_cache.hicache_storage
import
HiCacheFile
,
get_hash_str
if
storage_backend
==
"file"
:
if
storage_backend
==
"file"
:
...
@@ -573,6 +574,9 @@ class HiCacheController:
...
@@ -573,6 +574,9 @@ class HiCacheController:
self
.
storage_backend
.
batch_get
(
key_strs
,
buffer_ptrs
,
buffer_sizes
)
self
.
storage_backend
.
batch_get
(
key_strs
,
buffer_ptrs
,
buffer_sizes
)
operation
.
increment
(
len
(
operation
.
hash_value
)
*
self
.
page_size
)
operation
.
increment
(
len
(
operation
.
hash_value
)
*
self
.
page_size
)
def
is_mooncake_backend
(
self
):
return
self
.
storage_backend_type
==
"mooncake"
def
prefetch_io_aux_func
(
self
):
def
prefetch_io_aux_func
(
self
):
"""
"""
Auxiliary function conducting IO operations for prefetching.
Auxiliary function conducting IO operations for prefetching.
...
@@ -580,7 +584,7 @@ class HiCacheController:
...
@@ -580,7 +584,7 @@ class HiCacheController:
while
not
self
.
stop_event
.
is_set
():
while
not
self
.
stop_event
.
is_set
():
try
:
try
:
operation
=
self
.
prefetch_buffer
.
get
(
block
=
True
,
timeout
=
1
)
operation
=
self
.
prefetch_buffer
.
get
(
block
=
True
,
timeout
=
1
)
if
isinstance
(
self
.
storage_backend
,
MooncakeStore
):
if
self
.
is_mooncake_backend
(
):
self
.
mooncake_page_transfer
(
operation
)
self
.
mooncake_page_transfer
(
operation
)
else
:
else
:
self
.
generic_page_transfer
(
operation
)
self
.
generic_page_transfer
(
operation
)
...
@@ -615,14 +619,14 @@ class HiCacheController:
...
@@ -615,14 +619,14 @@ class HiCacheController:
)
)
# todo, more unified interface
# todo, more unified interface
if
not
isinstance
(
self
.
storage_backend
,
MooncakeStore
):
if
not
self
.
is_mooncake_backend
(
):
if
not
self
.
storage_backend
.
exists
(
last_hash
):
if
not
self
.
storage_backend
.
exists
(
last_hash
):
break
break
hash_value
.
append
(
last_hash
)
hash_value
.
append
(
last_hash
)
storage_hit_count
+=
self
.
page_size
storage_hit_count
+=
self
.
page_size
remaining_tokens
-=
self
.
page_size
remaining_tokens
-=
self
.
page_size
if
isinstance
(
self
.
storage_backend
,
MooncakeStore
):
if
self
.
is_mooncake_backend
(
):
# deferring to batch exists for mooncake store
# deferring to batch exists for mooncake store
exist_result
=
self
.
storage_backend
.
exists
(
hash_value
)
exist_result
=
self
.
storage_backend
.
exists
(
hash_value
)
storage_hit_count
=
(
storage_hit_count
=
(
...
@@ -744,7 +748,7 @@ class HiCacheController:
...
@@ -744,7 +748,7 @@ class HiCacheController:
remaining_tokens
-=
self
.
page_size
remaining_tokens
-=
self
.
page_size
operation
.
hash_value
=
hash_value
operation
.
hash_value
=
hash_value
if
isinstance
(
self
.
storage_backend
,
MooncakeStore
):
if
self
.
is_mooncake_backend
(
):
self
.
mooncake_page_backup
(
operation
)
self
.
mooncake_page_backup
(
operation
)
else
:
else
:
self
.
generic_page_backup
(
operation
)
self
.
generic_page_backup
(
operation
)
...
...
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