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
e2574ee9
"examples/vscode:/vscode.git/clone" did not exist on "2b04ec2ff7270d2044410378b04d85a194fa3d4a"
Unverified
Commit
e2574ee9
authored
Apr 19, 2025
by
Zhiqiang Xie
Committed by
GitHub
Apr 19, 2025
Browse files
fix hicache write back (#5543)
parent
ab4b5606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
python/sglang/srt/mem_cache/hiradix_cache.py
python/sglang/srt/mem_cache/hiradix_cache.py
+5
-1
No files found.
python/sglang/srt/mem_cache/hiradix_cache.py
View file @
e2574ee9
...
@@ -92,7 +92,7 @@ class HiRadixCache(RadixCache):
...
@@ -92,7 +92,7 @@ class HiRadixCache(RadixCache):
self
.
ongoing_write_through
[
node
.
id
]
=
node
self
.
ongoing_write_through
[
node
.
id
]
=
node
self
.
inc_lock_ref
(
node
)
self
.
inc_lock_ref
(
node
)
else
:
else
:
return
None
return
0
return
len
(
host_indices
)
return
len
(
host_indices
)
...
@@ -153,6 +153,7 @@ class HiRadixCache(RadixCache):
...
@@ -153,6 +153,7 @@ class HiRadixCache(RadixCache):
if
x
.
host_value
is
None
:
if
x
.
host_value
is
None
:
if
self
.
cache_controller
.
write_policy
==
"write_back"
:
if
self
.
cache_controller
.
write_policy
==
"write_back"
:
num_evicted
+=
self
.
write_backup
(
x
)
num_evicted
+=
self
.
write_backup
(
x
)
pending_nodes
.
append
(
x
)
elif
self
.
cache_controller
.
write_policy
==
"write_through_selective"
:
elif
self
.
cache_controller
.
write_policy
==
"write_through_selective"
:
num_evicted
+=
self
.
_evict_write_through_selective
(
x
)
num_evicted
+=
self
.
_evict_write_through_selective
(
x
)
else
:
else
:
...
@@ -177,6 +178,9 @@ class HiRadixCache(RadixCache):
...
@@ -177,6 +178,9 @@ class HiRadixCache(RadixCache):
while
len
(
self
.
ongoing_write_through
)
>
0
:
while
len
(
self
.
ongoing_write_through
)
>
0
:
self
.
writing_check
()
self
.
writing_check
()
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
for
node
in
pending_nodes
:
assert
node
.
host_value
is
not
None
self
.
_evict_write_through
(
node
)
def
_evict_write_through
(
self
,
node
:
TreeNode
):
def
_evict_write_through
(
self
,
node
:
TreeNode
):
# evict a node already written to host
# evict a node already written to host
...
...
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