Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tpu_sync/api/torch/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ py_library(
":pool_layout",
":torch_abi",
":torch_tpu_common_loader",
# buildcleaner: keep
"//tpu_sync/frameworks/torch:_tpu_raiden_torch",
"//tpu_sync/rpc:raiden_service_py_pb2",
],
Expand All @@ -60,8 +61,9 @@ py_library(
visibility = ["//visibility:public"],
deps = [
":pool_layout",
":torch_abi",
":torch_tpu_common_loader",
"//tpu_sync/frameworks/torch:_tpu_raiden_host",
"//tpu_sync/rpc:raiden_service_py_pb2",
],
)

Expand Down Expand Up @@ -138,9 +140,13 @@ py_test(
],
tags = ["nobuilder"],
deps = [
":kv_cache_manager_torch_py",
":kv_cache_store",
"//pyglib:resources",
"@com_google_absl_py//absl/testing:absltest",
"@pypi//numpy",
"@torch_tpu//shims/torch:pytorch",
"@torch_tpu//torch_tpu",
],
)

Expand All @@ -159,15 +165,14 @@ py_test(
":weight_synchronizer_torch_py",
"@com_google_absl_py//absl/testing:absltest",
"@com_google_absl_py//absl/testing:parameterized",
"@pypi//numpy",
"@torch_tpu//shims/torch:pytorch",
"@torch_tpu//torch_tpu",
],
)

# Base accelerator test requiring physical TPU devices via torch_tpu.
# Tagged "manual" because generic CPU Forge runners lack TPU hardware.
# For remote execution on Forge, use the _gf (TPU v4) or _gl (TPU v5e) targets below.
# For remote execution on Forge, use the _gl (TPU v6e) target below.
py_test(
name = "kv_cache_store_recovery_e2e_test",
srcs = ["kv_cache_store_recovery_e2e_test.py"],
Expand Down Expand Up @@ -201,7 +206,6 @@ py_test(
":kv_cache_manager_torch_py",
"@com_google_absl_py//absl/testing:absltest",
"@com_google_absl_py//absl/testing:parameterized",
"@pypi//numpy",
"@torch_tpu//shims/torch:pytorch",
"@torch_tpu//torch_tpu",
],
Expand Down
11 changes: 8 additions & 3 deletions tpu_sync/api/torch/kv_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ def __init__(
self._admission_summary = None
impl = _torch_impl()
if host_blocks_to_allocate is not None:
tensors = kv_caches
if tensors and not isinstance(tensors[0], (list, tuple)):
tensors = [[t] for t in tensors]
self._impl = impl.KVCacheManager(
kv_caches,
tensors,
local_control_port if local_control_port > 0 else None,
host_blocks_to_allocate,
unsafe_skip_buffer_lock,
Expand Down Expand Up @@ -512,5 +515,7 @@ def listener_port(self) -> Optional[int]:

@property
def is_listener_active(self) -> bool:
"""Returns whether the native C++ KVCacheListener is actively running."""
return self._impl.is_listener_active
"""Returns whether the native C++ listener or gRPC service is active."""
return (
self._impl.is_listener_active or self._impl.get_raiden_worker_port() > 0
)
Loading
Loading