[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:
Avinash Paul
2026-08-27 00:10:57 +08:00
committed by GitHub
co-authored by avininjamay8
parent c71f6f8a81
commit 8d301f075b
5 changed files with 97 additions and 31 deletions
+7 -1
View File
@@ -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: