Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
f8a1a2d1
Unverified
Commit
f8a1a2d1
authored
Jun 06, 2025
by
Chen Zhang
Committed by
GitHub
Jun 05, 2025
Browse files
[v1] Hybrid Memory Allocator (#17996)
Signed-off-by:
Chen Zhang
<
zhangch99@outlook.com
>
parent
3465b87e
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
vllm/v1/worker/tpu_model_runner.py
vllm/v1/worker/tpu_model_runner.py
+10
-4
No files found.
vllm/v1/worker/tpu_model_runner.py
View file @
f8a1a2d1
...
@@ -1365,14 +1365,20 @@ class TPUModelRunner(LoRAModelRunnerMixin):
...
@@ -1365,14 +1365,20 @@ class TPUModelRunner(LoRAModelRunnerMixin):
assert
self
.
block_table_cpu
.
dtype
==
self
.
input_batch
.
block_table
[
assert
self
.
block_table_cpu
.
dtype
==
self
.
input_batch
.
block_table
[
0
].
get_cpu_tensor
().
dtype
0
].
get_cpu_tensor
().
dtype
kv_caches
:
dict
[
str
,
torch
.
Tensor
]
=
{}
kv_cache_sizes
=
{}
for
kv_cache_tensor
in
kv_cache_config
.
kv_cache_tensors
:
assert
len
(
kv_cache_tensor
.
shared_by
)
==
1
,
(
"KV cache tensor shared by multiple layers is not supported in "
"TPU."
)
kv_cache_sizes
[
kv_cache_tensor
.
shared_by
[
0
]]
=
kv_cache_tensor
.
size
kv_caches
:
dict
[
str
,
torch
.
Tensor
]
=
{}
for
kv_cache_group
in
kv_cache_config
.
kv_cache_groups
:
for
kv_cache_group
in
kv_cache_config
.
kv_cache_groups
:
kv_cache_spec
=
kv_cache_group
.
kv_cache_spec
kv_cache_spec
=
kv_cache_group
.
kv_cache_spec
for
layer_name
in
kv_cache_group
.
layer_names
:
for
layer_name
in
kv_cache_group
.
layer_names
:
tensor_
config
=
kv_cache_
config
.
tensor
s
[
layer_name
]
tensor_
size
=
kv_cache_
size
s
[
layer_name
]
assert
tensor_
config
.
size
%
kv_cache_spec
.
page_size_bytes
==
0
assert
tensor_size
%
kv_cache_spec
.
page_size_bytes
==
0
num_blocks
=
tensor_
config
.
size
//
kv_cache_spec
.
page_size_bytes
num_blocks
=
tensor_size
//
kv_cache_spec
.
page_size_bytes
# noqa
if
isinstance
(
kv_cache_spec
,
AttentionSpec
):
if
isinstance
(
kv_cache_spec
,
AttentionSpec
):
if
self
.
use_spmd
:
if
self
.
use_spmd
:
num_kv_heads
=
kv_cache_spec
.
num_kv_heads
num_kv_heads
=
kv_cache_spec
.
num_kv_heads
...
...
Prev
1
2
Next
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