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
01857fab
Unverified
Commit
01857fab
authored
Jul 17, 2025
by
Ziqi Fan
Committed by
GitHub
Jul 17, 2025
Browse files
fix: update HostKVCache init to report correct msg when available memory is not enough (#8102)
parent
519ff5c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
python/sglang/srt/mem_cache/memory_pool_host.py
python/sglang/srt/mem_cache/memory_pool_host.py
+3
-2
No files found.
python/sglang/srt/mem_cache/memory_pool_host.py
View file @
01857fab
...
@@ -71,11 +71,12 @@ class HostKVCache(abc.ABC):
...
@@ -71,11 +71,12 @@ class HostKVCache(abc.ABC):
requested_bytes
=
self
.
size
*
self
.
size_per_token
requested_bytes
=
self
.
size
*
self
.
size_per_token
# preserve at least 10GB for other usage
# preserve at least 10GB for other usage
ten_gb
=
10
*
(
1024
**
3
)
ten_gb
=
10
*
(
1024
**
3
)
if
requested_bytes
>
host_mem
.
available
-
ten_gb
:
available_bytes
=
host_mem
.
available
-
ten_gb
if
requested_bytes
>
available_bytes
:
raise
ValueError
(
raise
ValueError
(
f
"Not enough host memory available. Requesting "
f
"Not enough host memory available. Requesting "
f
"
{
requested_bytes
/
1e9
:.
2
f
}
GB but only have "
f
"
{
requested_bytes
/
1e9
:.
2
f
}
GB but only have "
f
"
{
host_mem
.
available
/
1e9
:.
2
f
}
GB free. Please reduce the "
f
"
{
available
_bytes
/
1e9
:.
2
f
}
GB free. Please reduce the "
f
"size of the hierarchical cache."
f
"size of the hierarchical cache."
)
)
else
:
else
:
...
...
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