feat(hicache): Use NIXL path-mode (#27060)

This commit is contained in:
Lukas Humbel
2026-07-01 02:59:45 -07:00
committed by GitHub
parent 07ca24372b
commit 7d9de81cda
3 changed files with 95 additions and 9 deletions
@@ -382,17 +382,36 @@ class TestNixlUnified(CustomTestCase):
num_pages * mock_host.page_size, dtype=torch.int64
)
# Distinct data per key so a round trip that mixes keys up (e.g. a
# FILE registration that collapses every desc onto one file) is
# caught, not just the pass/fail return codes. Non-zero-copy only:
# the layer_first layout makes per-page seeding straightforward.
if not is_zero_copy_mode:
ps = mock_host.page_size
for p in range(num_pages):
mock_host.kv_buffer[:, :, p * ps : (p + 1) * ps] = float(p + 1)
expected = mock_host.kv_buffer.clone()
set_results = hicache.batch_set_v1(keys, host_indices)
self.assertTrue(
all(set_results),
f"batch_set_v1 failed (zero_copy={is_zero_copy_mode}): {set_results}",
)
if not is_zero_copy_mode:
mock_host.kv_buffer.zero_()
get_results = hicache.batch_get_v1(keys, host_indices)
self.assertTrue(
all(get_results),
f"batch_get_v1 failed (zero_copy={is_zero_copy_mode}): {get_results}",
)
if not is_zero_copy_mode:
self.assertTrue(
torch.equal(mock_host.kv_buffer, expected),
"round trip corrupted or mixed up per-key data",
)
finally:
agent.get_reg_descs = orig_get_reg
agent.register_memory = orig_register