[Bugfix][ROCm][Disagg] Fix MoRIIO shared KV memory region registration (#53698)
Signed-off-by: avininjamay8 <avpaul@amd.com> Co-authored-by: avininjamay8 <avpaul@amd.com>
This commit is contained in:
co-authored by
avininjamay8
parent
c71f6f8a81
commit
8d301f075b
@@ -392,7 +392,13 @@ def allocate_kv_cache(
|
||||
|
||||
sizes = {tensor.size for tensor in kv_cache_config.kv_cache_tensors}
|
||||
assert len(sizes) == 1, "KV cache tensors must share one backing allocation."
|
||||
buf = torch.zeros(sizes.pop(), dtype=torch.int8, device=device)
|
||||
raw_size = sizes.pop()
|
||||
page_size = 4096
|
||||
buf = torch.zeros(
|
||||
((raw_size + page_size - 1) // page_size) * page_size,
|
||||
dtype=torch.int8,
|
||||
device=device,
|
||||
)
|
||||
|
||||
kv_caches: dict[str, torch.Tensor] = {}
|
||||
for tensor in kv_cache_config.kv_cache_tensors:
|
||||
|
||||
Reference in New Issue
Block a user