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
f5bbf603
Unverified
Commit
f5bbf603
authored
Mar 16, 2025
by
Zhiqiang Xie
Committed by
GitHub
Mar 16, 2025
Browse files
Fix: Complete int32 to int64 conversion (#4465)
parent
5cbd709e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
python/sglang/srt/mem_cache/hiradix_cache.py
python/sglang/srt/mem_cache/hiradix_cache.py
+1
-1
python/sglang/srt/mem_cache/memory_pool.py
python/sglang/srt/mem_cache/memory_pool.py
+2
-3
python/sglang/srt/mem_cache/radix_cache.py
python/sglang/srt/mem_cache/radix_cache.py
+2
-2
No files found.
python/sglang/srt/mem_cache/hiradix_cache.py
View file @
f5bbf603
...
...
@@ -305,7 +305,7 @@ class HiRadixCache(RadixCache):
if
value
:
value
=
torch
.
cat
(
value
)
else
:
value
=
torch
.
tensor
([],
dtype
=
torch
.
int
32
)
value
=
torch
.
tensor
([],
dtype
=
torch
.
int
64
)
last_node_global
=
last_node
while
last_node
.
evicted
:
...
...
python/sglang/srt/mem_cache/memory_pool.py
View file @
f5bbf603
...
...
@@ -622,11 +622,10 @@ class HostKVCache(abc.ABC):
self
.
mem_state
=
torch
.
zeros
(
(
self
.
size
,),
dtype
=
torch
.
uint8
,
device
=
self
.
device
)
self
.
free_slots
=
torch
.
arange
(
self
.
size
,
dtype
=
torch
.
int32
)
self
.
can_use_mem_size
=
self
.
size
# A lock for synchronized operations on memory allocation and state transitions.
self
.
lock
=
threading
.
RLock
()
self
.
clear
()
@
abc
.
abstractmethod
def
get_size_per_token
(
self
):
...
...
@@ -656,7 +655,7 @@ class HostKVCache(abc.ABC):
def
clear
(
self
):
self
.
mem_state
.
fill_
(
0
)
self
.
can_use_mem_size
=
self
.
size
self
.
free_slots
=
torch
.
arange
(
self
.
size
,
dtype
=
torch
.
int
32
)
self
.
free_slots
=
torch
.
arange
(
self
.
size
,
dtype
=
torch
.
int
64
)
@
synchronized
def
get_state
(
self
,
indices
:
torch
.
Tensor
)
->
MemoryStateInt
:
...
...
python/sglang/srt/mem_cache/radix_cache.py
View file @
f5bbf603
...
...
@@ -140,7 +140,7 @@ class RadixCache(BasePrefixCache):
return
(
torch
.
empty
(
(
0
,),
dtype
=
torch
.
int
32
,
dtype
=
torch
.
int
64
,
device
=
self
.
device
,
),
self
.
root_node
,
...
...
@@ -154,7 +154,7 @@ class RadixCache(BasePrefixCache):
if
value
:
value
=
torch
.
cat
(
value
)
else
:
value
=
torch
.
empty
((
0
,),
dtype
=
torch
.
int
32
,
device
=
self
.
device
)
value
=
torch
.
empty
((
0
,),
dtype
=
torch
.
int
64
,
device
=
self
.
device
)
return
value
,
last_node
def
insert
(
self
,
key
:
List
,
value
=
None
):
...
...
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