lmcache-cli 0.5.8.dev0__py3-none-any.whl → 0.5.8rc3.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (599) hide show
  1. lmcache/_version.py +3 -3
  2. lmcache/cli/commands/base.py +40 -2
  3. lmcache/cli/commands/bench/l2_adapter_bench/command.py +28 -10
  4. lmcache/cli/commands/bench/l2_adapter_bench/data.py +9 -2
  5. lmcache/cli/commands/bench/l2_adapter_bench/result.py +6 -1
  6. lmcache/cli/commands/bench/l2_adapter_bench/runner.py +3 -0
  7. lmcache/cli/commands/bench/server_bench/arguments.py +12 -0
  8. lmcache/cli/commands/bench/server_bench/buffers.py +6 -2
  9. lmcache/cli/commands/bench/server_bench/client.py +22 -17
  10. lmcache/cli/commands/bench/server_bench/command.py +7 -0
  11. lmcache/cli/commands/bench/server_bench/config.py +5 -0
  12. lmcache/cli/commands/bench/server_bench/helpers.py +7 -10
  13. lmcache/cli/commands/coordinator.py +1 -1
  14. lmcache/cli/commands/describe.py +61 -38
  15. lmcache/cli/commands/query/_coordinator.py +162 -10
  16. lmcache/cli/commands/query/_request.py +90 -29
  17. lmcache/cli/commands/quota/_helpers.py +1 -7
  18. lmcache/cli/commands/quota/delete_command.py +2 -1
  19. lmcache/cli/commands/quota/get_command.py +2 -1
  20. lmcache/cli/commands/quota/set_command.py +2 -1
  21. lmcache/cli/commands/trace/_driver.py +69 -64
  22. lmcache/cli/commands/trace/replay_command.py +2 -2
  23. lmcache/cli/commands/trace/replay_events_command.py +1 -1
  24. lmcache/cli/http.py +18 -3
  25. lmcache/cli/metrics/__init__.py +7 -9
  26. lmcache/cli/profiling.py +13 -11
  27. lmcache/integration/atom/multi_process_adapter.py +13 -108
  28. lmcache/integration/sglang/unified_lmcache_mp_connector.py +197 -130
  29. lmcache/integration/tensorrt_llm/__init__.py +3 -1
  30. lmcache/integration/tensorrt_llm/tensorrt_mp_adapter.py +6 -12
  31. lmcache/integration/vllm/experimental/dispatcher.py +5 -2
  32. lmcache/integration/vllm/experimental/token_drop_adapter.py +149 -0
  33. lmcache/integration/vllm/experimental/token_drop_scheduler.py +20 -0
  34. lmcache/integration/vllm/kv_cache_group_edits.py +161 -49
  35. lmcache/integration/vllm/kv_cache_groups.py +260 -55
  36. lmcache/integration/vllm/lazy_offload_manager.py +1 -0
  37. lmcache/integration/vllm/lmcache_mp_connector.py +468 -184
  38. lmcache/integration/vllm/lmcache_mp_metadata.py +208 -46
  39. lmcache/integration/vllm/mp_lookup_state.py +26 -24
  40. lmcache/integration/vllm/mp_server_launcher.py +1 -1
  41. lmcache/integration/vllm/utils.py +58 -95
  42. lmcache/integration/vllm/vllm_multi_process_adapter.py +408 -533
  43. lmcache/lmcache_frontend/app.py +103 -14
  44. lmcache/lmcache_frontend/static/index.html +2 -0
  45. lmcache/lmcache_frontend/static/js/app.js +15 -3
  46. lmcache/lmcache_native.pyi +11 -0
  47. lmcache/sdk/batch.py +37 -15
  48. lmcache/sdk/cache_kind.py +21 -0
  49. lmcache/sdk/context.py +314 -174
  50. lmcache/sdk/qringbuffer.py +61 -14
  51. lmcache/sdk/request.py +19 -4
  52. lmcache/sdk/wrapper/__init__.py +5 -2
  53. lmcache/sdk/wrapper/ring_mapping.py +334 -0
  54. lmcache/sdk/wrapper/ring_transfer.py +427 -0
  55. lmcache/security/api_key.py +12 -0
  56. lmcache/security/bearer.py +31 -0
  57. lmcache/security/http.py +1 -29
  58. lmcache/tools/cache_simulator/README.md +1 -1
  59. lmcache/tools/cache_simulator/lru_cache.py +14 -8
  60. lmcache/tools/cache_simulator/simulator.py +9 -2
  61. lmcache/tools/cache_simulator/trace_analyze.py +4 -4
  62. lmcache/tools/transfer_channel_benchmark/README.md +82 -9
  63. lmcache/tools/transfer_channel_benchmark/benchmark.py +168 -50
  64. lmcache/tools/transfer_channel_benchmark/config.py +33 -17
  65. lmcache/usage_telemetry/README.md +7 -7
  66. lmcache/usage_telemetry/__init__.py +4 -3
  67. lmcache/usage_telemetry/base.py +2 -1
  68. lmcache/usage_telemetry/messages.py +3 -2
  69. lmcache/utils.py +4 -306
  70. lmcache/v1/client/__init__.py +6 -0
  71. lmcache/v1/{multiprocess/transfer_context → client}/async_engine_driven.py +5 -5
  72. lmcache/v1/client/heartbeat.py +172 -0
  73. lmcache/v1/{multiprocess → client}/kv_event_subscriber.py +5 -5
  74. lmcache/v1/{multiprocess → client}/transfer_context/__init__.py +4 -14
  75. lmcache/v1/{multiprocess → client}/transfer_context/base.py +10 -14
  76. lmcache/v1/{multiprocess → client}/transfer_context/inline.py +4 -4
  77. lmcache/v1/{multiprocess → client}/transfer_context/shm.py +4 -4
  78. lmcache/v1/client/transport/__init__.py +5 -0
  79. lmcache/v1/{multiprocess → client}/transport/errors.py +6 -1
  80. lmcache/v1/{multiprocess → client}/transport/factory.py +13 -3
  81. lmcache/v1/client/transport/grpc_impl/__init__.py +43 -0
  82. lmcache/v1/client/transport/grpc_impl/auth.py +70 -0
  83. lmcache/v1/{multiprocess → client}/transport/grpc_impl/client.py +24 -68
  84. lmcache/v1/client/transport/zmq_impl/__init__.py +68 -0
  85. lmcache/v1/{multiprocess → client}/transport/zmq_impl/client.py +4 -4
  86. lmcache/v1/client/transport/zmq_impl/mq_client.py +564 -0
  87. lmcache/v1/client/transport/zmq_impl/polling_loop.py +232 -0
  88. lmcache/v1/{multiprocess/transfer_context → client}/worker_transfer.py +85 -45
  89. lmcache/v1/common/__init__.py +5 -0
  90. lmcache/v1/common/api.py +24 -0
  91. lmcache/v1/common/attn_window.py +109 -0
  92. lmcache/v1/common/custom_types.py +372 -0
  93. lmcache/v1/common/errors.py +50 -0
  94. lmcache/v1/common/group_view.py +325 -0
  95. lmcache/v1/{gpu_connector → common}/kv_format/__init__.py +2 -2
  96. lmcache/v1/{gpu_connector → common}/kv_format/contiguity.py +1 -1
  97. lmcache/v1/{gpu_connector → common}/kv_format/detection.py +4 -4
  98. lmcache/v1/{gpu_connector → common}/kv_format/detectors/__init__.py +1 -1
  99. lmcache/v1/{gpu_connector → common}/kv_format/detectors/atom.py +2 -2
  100. lmcache/v1/{gpu_connector → common}/kv_format/detectors/base.py +1 -1
  101. lmcache/v1/{gpu_connector → common}/kv_format/detectors/registry.py +1 -1
  102. lmcache/v1/{gpu_connector → common}/kv_format/detectors/sglang.py +2 -2
  103. lmcache/v1/{gpu_connector → common}/kv_format/detectors/trtllm.py +2 -2
  104. lmcache/v1/{gpu_connector → common}/kv_format/detectors/vllm.py +2 -2
  105. lmcache/v1/{gpu_connector → common}/kv_format/specs/__init__.py +2 -2
  106. lmcache/v1/{gpu_connector → common}/kv_format/specs/base.py +17 -10
  107. lmcache/v1/{gpu_connector → common}/kv_format/specs/nb_nl_two_bs_nh_hs.py +1 -1
  108. lmcache/v1/{gpu_connector → common}/kv_format/specs/nb_nl_two_nh_bs_hs.py +1 -1
  109. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_hs.py +2 -1
  110. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_cs.py +3 -1
  111. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_hs.py +2 -1
  112. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_two_hs.py +2 -2
  113. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bsv_bss.py +2 -1
  114. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_nh_bs_cs.py +3 -1
  115. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_nh_bs_two_hs.py +2 -2
  116. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_bs_nh_hs.py +5 -1
  117. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_nh_bs_hs.py +1 -1
  118. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_nh_one_bs_hs.py +1 -1
  119. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nbbs_one_hs.py +1 -1
  120. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_np_x_nb_bs_one_hs.py +2 -1
  121. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_bs_nh_hs.py +1 -1
  122. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_nh_bs_hs.py +1 -1
  123. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_nh_one_bs_hs.py +1 -1
  124. lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_x_nb_bs_nh_hs.py +4 -1
  125. lmcache/v1/{gpu_connector → common}/kv_format/specs/registry.py +2 -2
  126. lmcache/v1/{gpu_connector → common}/kv_format/specs/two_x_nl_x_nb_bs_nh_hs.py +1 -1
  127. lmcache/v1/{gpu_connector → common}/kv_format/specs/two_x_nl_x_nbbs_nh_hs.py +1 -1
  128. lmcache/v1/common/metrics/__init__.py +29 -0
  129. lmcache/{cli → v1/common}/metrics/formatter.py +1 -1
  130. lmcache/{cli → v1/common}/metrics/handler.py +4 -4
  131. lmcache/{cli → v1/common}/metrics/metrics.py +3 -3
  132. lmcache/v1/{multiprocess → common}/token_codec.py +35 -6
  133. lmcache/v1/{multiprocess → common}/token_hasher.py +1 -1
  134. lmcache/v1/{distributed → common}/transfer_channel/api.py +2 -2
  135. lmcache/v1/{gpu_connector → common}/utils.py +41 -57
  136. lmcache/v1/distributed/api.py +236 -116
  137. lmcache/v1/distributed/bitmap_ops/fold.py +1 -1
  138. lmcache/v1/distributed/config.py +197 -10
  139. lmcache/v1/distributed/eviction_policy/isolated_lru.py +9 -4
  140. lmcache/v1/distributed/internal_api.py +4 -1
  141. lmcache/v1/distributed/key_codec.py +52 -14
  142. lmcache/v1/distributed/l1_manager/__init__.py +4 -0
  143. lmcache/v1/distributed/l1_manager/base.py +10 -3
  144. lmcache/v1/distributed/l1_manager/devdax.py +7 -2
  145. lmcache/v1/distributed/l1_manager/factory.py +9 -5
  146. lmcache/v1/distributed/l1_manager/shadow.py +230 -0
  147. lmcache/v1/distributed/l2_adapters/aerospike_l2_adapter.py +23 -15
  148. lmcache/v1/distributed/l2_adapters/fs_native_l2_adapter.py +2 -2
  149. lmcache/v1/distributed/l2_adapters/hf3fs_l2_adapter.py +20 -2
  150. lmcache/v1/distributed/l2_adapters/native_connector_l2_adapter.py +6 -5
  151. lmcache/v1/distributed/l2_adapters/nixl_native_l2_adapter.py +64 -10
  152. lmcache/v1/distributed/l2_adapters/p2p_l2_adapter.py +384 -26
  153. lmcache/v1/distributed/l2_adapters/raw_block/__init__.py +2 -8
  154. lmcache/v1/distributed/l2_adapters/raw_block/core.py +7 -37
  155. lmcache/v1/distributed/l2_adapters/raw_block/key_codec.py +2 -70
  156. lmcache/v1/distributed/l2_adapters/raw_block_l2_adapter.py +1 -1
  157. lmcache/v1/distributed/l2_adapters/resp_l2_adapter.py +19 -8
  158. lmcache/v1/distributed/l2_adapters/valkey/blob_tcp_worker_pool.py +193 -0
  159. lmcache/v1/distributed/l2_adapters/valkey/rdma_worker_pool.py +446 -0
  160. lmcache/v1/distributed/l2_adapters/valkey/worker_pool.py +30 -7
  161. lmcache/v1/distributed/l2_adapters/valkey_l2_adapter.py +181 -37
  162. lmcache/v1/distributed/memory_manager/__init__.py +7 -0
  163. lmcache/v1/distributed/memory_manager/shadow_l1_memory_manager.py +78 -0
  164. lmcache/v1/distributed/memory_manager/shared_devdax_region.py +161 -0
  165. lmcache/v1/distributed/p2p.py +161 -0
  166. lmcache/v1/distributed/serde/aesgcm.py +54 -7
  167. lmcache/v1/distributed/serde/utils.py +6 -6
  168. lmcache/v1/distributed/shared_l1/__init__.py +2 -0
  169. lmcache/v1/distributed/shared_l1/visibility.py +58 -0
  170. lmcache/v1/distributed/storage_controllers/p2p_store_policy.py +117 -0
  171. lmcache/v1/distributed/storage_controllers/prefetch_controller.py +145 -97
  172. lmcache/v1/distributed/storage_controllers/prefetch_policy.py +34 -20
  173. lmcache/v1/distributed/storage_controllers/store_controller.py +155 -31
  174. lmcache/v1/distributed/storage_controllers/store_policy.py +21 -2
  175. lmcache/v1/distributed/storage_manager.py +32 -3
  176. lmcache/v1/distributed/transfer_channel/__init__.py +5 -5
  177. lmcache/v1/distributed/transfer_channel/abstract.py +83 -11
  178. lmcache/v1/distributed/transfer_channel/impl/mooncake_te_impl.py +104 -50
  179. lmcache/v1/distributed/transfer_channel/impl/nixl_impl.py +157 -56
  180. lmcache/v1/gpu_connector/gpu_ops.py +1 -12
  181. lmcache/v1/kv_layer_groups.py +20 -42
  182. lmcache/v1/memory_allocators/devdax_memory_allocator.py +20 -3
  183. lmcache/v1/memory_management.py +264 -1
  184. lmcache/v1/memory_orchestrator/_codec.py +36 -3
  185. lmcache/v1/memory_orchestrator/_proto_gen/__init__.py +1 -1
  186. lmcache/v1/memory_orchestrator/_proto_gen/memory_orchestrator_pb2.pyi +31 -1
  187. lmcache/v1/memory_orchestrator/api.py +13 -0
  188. lmcache/v1/memory_orchestrator/client.py +43 -1
  189. lmcache/v1/memory_orchestrator/protos/memory_orchestrator.proto +25 -1
  190. lmcache/v1/memory_orchestrator/service.py +33 -0
  191. lmcache/v1/memory_orchestrator/state.py +69 -0
  192. lmcache/v1/mp_coordinator/api.py +33 -3
  193. lmcache/v1/mp_coordinator/app.py +2 -2
  194. lmcache/v1/mp_coordinator/blend_client.py +1 -0
  195. lmcache/v1/mp_coordinator/blend_index.py +2 -2
  196. lmcache/v1/mp_coordinator/cache_events.py +6 -3
  197. lmcache/v1/mp_coordinator/config.py +1 -1
  198. lmcache/v1/mp_coordinator/controllers/eviction_controller.py +4 -8
  199. lmcache/v1/mp_coordinator/controllers/eviction_http_api.py +45 -37
  200. lmcache/v1/mp_coordinator/controllers/prefetch_manager.py +10 -3
  201. lmcache/v1/mp_coordinator/http_apis/cache_api.py +1 -0
  202. lmcache/v1/mp_coordinator/http_apis/dependencies.py +1 -1
  203. lmcache/v1/mp_coordinator/http_apis/directory_api.py +2 -0
  204. lmcache/v1/mp_coordinator/http_apis/instances_usage_api.py +7 -2
  205. lmcache/v1/mp_coordinator/http_auth.py +3 -5
  206. lmcache/v1/mp_coordinator/persistence/quiesce.py +1 -1
  207. lmcache/v1/mp_coordinator/registrar.py +1 -1
  208. lmcache/v1/mp_coordinator/schemas.py +136 -12
  209. lmcache/v1/mp_coordinator/utils/encoding.py +14 -7
  210. lmcache/v1/mp_coordinator/utils/http.py +29 -0
  211. lmcache/v1/mp_coordinator/views/key_directory.py +38 -22
  212. lmcache/v1/mp_observability/errors.py +33 -39
  213. lmcache/v1/mp_observability/event_bus.py +12 -1
  214. lmcache/v1/mp_observability/subscribers/metrics/l2_failures.py +2 -3
  215. lmcache/v1/mp_observability/trace/codecs.py +3 -3
  216. lmcache/v1/multiprocess/affinity_pool.py +39 -0
  217. lmcache/v1/multiprocess/cache_control/key_resolver.py +35 -6
  218. lmcache/v1/multiprocess/cache_control/prefetch_service.py +10 -1
  219. lmcache/v1/multiprocess/config.py +140 -21
  220. lmcache/v1/multiprocess/custom_types.py +3 -440
  221. lmcache/v1/multiprocess/engine_context.py +258 -25
  222. lmcache/v1/multiprocess/engine_module.py +12 -0
  223. lmcache/v1/multiprocess/ext_server_module.py +5 -5
  224. lmcache/v1/multiprocess/group_view.py +24 -277
  225. lmcache/v1/multiprocess/http_apis/cache_api.py +1 -0
  226. lmcache/v1/multiprocess/http_apis/common/metrics_api.py +4 -1
  227. lmcache/v1/multiprocess/http_apis/schemas.py +8 -1
  228. lmcache/v1/multiprocess/http_auth.py +2 -4
  229. lmcache/v1/multiprocess/http_server.py +82 -4
  230. lmcache/v1/multiprocess/modules/blend/fingerprint_eviction.py +200 -0
  231. lmcache/v1/multiprocess/modules/blend/lookup.py +64 -32
  232. lmcache/v1/multiprocess/modules/blend/matcher.py +69 -26
  233. lmcache/v1/multiprocess/modules/blend/module.py +31 -11
  234. lmcache/v1/multiprocess/modules/blend/read_set.py +33 -13
  235. lmcache/v1/multiprocess/modules/blend/registration.py +1 -1
  236. lmcache/v1/multiprocess/modules/blend/retrieve.py +17 -26
  237. lmcache/v1/multiprocess/modules/blend/rope.py +1 -1
  238. lmcache/v1/multiprocess/modules/blend/store.py +31 -4
  239. lmcache/v1/multiprocess/modules/engine_driven_transfer.py +17 -19
  240. lmcache/v1/multiprocess/modules/kv_events.py +31 -26
  241. lmcache/v1/multiprocess/modules/lmcache_driven_transfer.py +436 -90
  242. lmcache/v1/multiprocess/modules/lookup.py +231 -58
  243. lmcache/v1/multiprocess/modules/management.py +4 -4
  244. lmcache/v1/multiprocess/modules/p2p_controller.py +119 -18
  245. lmcache/v1/multiprocess/modules/server_transfer.py +20 -22
  246. lmcache/v1/multiprocess/object_group_transfer/__init__.py +42 -0
  247. lmcache/v1/multiprocess/object_group_transfer/direct_copy.py +264 -0
  248. lmcache/v1/multiprocess/object_group_transfer/dispatch.py +111 -0
  249. lmcache/v1/multiprocess/object_group_transfer/engines.py +138 -0
  250. lmcache/v1/multiprocess/object_group_transfer/gpu_dma.py +43 -0
  251. lmcache/v1/multiprocess/object_group_transfer/nic_dma.py +42 -0
  252. lmcache/v1/multiprocess/object_group_transfer/nvme_dma.py +42 -0
  253. lmcache/v1/multiprocess/object_group_transfer/planning.py +148 -0
  254. lmcache/v1/multiprocess/object_group_transfer/staged.py +413 -0
  255. lmcache/v1/multiprocess/object_group_transfer/unfull_chunk.py +338 -0
  256. lmcache/v1/multiprocess/plugin_modules/qstore.py +716 -11
  257. lmcache/v1/multiprocess/request_handler.py +11 -5
  258. lmcache/v1/multiprocess/rocm_host_event_wait.py +386 -0
  259. lmcache/v1/multiprocess/server.py +96 -36
  260. lmcache/v1/multiprocess/session.py +61 -102
  261. lmcache/v1/multiprocess/transport/base.py +1 -272
  262. lmcache/v1/multiprocess/transport/grpc_impl/__init__.py +0 -35
  263. lmcache/v1/multiprocess/transport/grpc_impl/aio_server.py +16 -4
  264. lmcache/v1/multiprocess/transport/grpc_impl/auth.py +134 -0
  265. lmcache/v1/multiprocess/transport/grpc_impl/native_server.py +30 -23
  266. lmcache/v1/multiprocess/transport/grpc_impl/server.py +20 -7
  267. lmcache/v1/multiprocess/transport/grpc_impl/server_base.py +20 -11
  268. lmcache/v1/multiprocess/transport/grpc_impl/server_builder.py +39 -4
  269. lmcache/v1/multiprocess/transport/grpc_impl/server_handlers.py +59 -7
  270. lmcache/v1/multiprocess/transport/server_factory.py +2 -0
  271. lmcache/v1/multiprocess/transport/zmq_impl/__init__.py +0 -58
  272. lmcache/v1/multiprocess/transport/zmq_impl/mq.py +78 -495
  273. lmcache/v1/multiprocess/transport/zmq_impl/server.py +3 -1
  274. lmcache/v1/platform/__init__.py +8 -1
  275. lmcache/v1/platform/base/cache_context.py +14 -1
  276. lmcache/v1/platform/base/device_spec.py +1 -1
  277. lmcache/v1/platform/base/ipc_wire.py +6 -0
  278. lmcache/v1/platform/base/ipc_wrapper.py +63 -1
  279. lmcache/v1/platform/cache_context.py +7 -7
  280. lmcache/v1/platform/devices/cpu/__init__.py +1 -1
  281. lmcache/v1/platform/devices/cpu/cache_context.py +20 -5
  282. lmcache/v1/platform/devices/cpu/shm.py +5 -5
  283. lmcache/v1/platform/devices/cuda/cache_context.py +25 -10
  284. lmcache/v1/platform/devices/cuda/ipc_wrapper.py +54 -78
  285. lmcache/v1/platform/devices/mlu/device_ops.py +1 -1
  286. lmcache/v1/platform/devices/musa/__init__.py +1 -1
  287. lmcache/v1/platform/devices/musa/cache_context.py +25 -10
  288. lmcache/v1/platform/devices/musa/device_ops.py +156 -3
  289. lmcache/v1/platform/devices/musa/format_capabilities.py +2 -2
  290. lmcache/v1/platform/devices/musa/ipc_wrapper.py +32 -4
  291. lmcache/v1/platform/devices/musa/native_kv_transfer.py +1 -1
  292. lmcache/v1/platform/devices/neuron/device_ops.py +1 -1
  293. lmcache/v1/platform/devices/npu/cache_context.py +26 -6
  294. lmcache/v1/platform/devices/rbln/device_ops.py +2 -2
  295. lmcache/v1/platform/devices/rocm/__init__.py +23 -0
  296. lmcache/v1/platform/devices/rocm/ipc_wrapper.py +36 -0
  297. lmcache/v1/platform/devices/rocm/vmm_bindings.py +173 -0
  298. lmcache/v1/platform/fd_channel.py +365 -0
  299. lmcache/v1/platform/kv_wrap.py +62 -3
  300. lmcache/v1/platform/native_block_transfer.py +2 -2
  301. lmcache/v1/platform/torch_ops/_kv_format.py +2 -2
  302. lmcache/v1/platform/torch_ops/mp_mem_kernels.py +1 -1
  303. lmcache/v1/protocol.py +1 -1
  304. lmcache/v1/rpc_utils.py +2 -1
  305. lmcache/v1/transport/__init__.py +6 -0
  306. lmcache/v1/{multiprocess/transport → transport}/auth.py +1 -1
  307. lmcache/v1/{multiprocess → transport}/futures.py +1 -1
  308. lmcache/v1/transport/grpc/__init__.py +2 -0
  309. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/__init__.py +1 -1
  310. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/_generate.py +2 -2
  311. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/common_pb2.pyi +20 -9
  312. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/p2p_service_pb2.pyi +29 -1
  313. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/__init__.py +3 -3
  314. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/common.py +3 -3
  315. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/p2p.py +2 -2
  316. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/descriptors.py +15 -8
  317. lmcache/v1/transport/grpc/endpoint.py +43 -0
  318. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/method_registry.py +11 -50
  319. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/proto_codec.py +1 -1
  320. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/common.proto +5 -1
  321. lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/p2p_service.proto +25 -0
  322. lmcache/v1/transport/grpc/protos/qstore_service.proto +75 -0
  323. lmcache/v1/transport/grpc/utils.py +48 -0
  324. lmcache/v1/transport/qstore.py +33 -0
  325. lmcache/v1/transport/request_client.py +294 -0
  326. lmcache/v1/{multiprocess → transport}/rpc.py +9 -8
  327. lmcache/v1/transport/zmq/__init__.py +2 -0
  328. lmcache/v1/transport/zmq/codec.py +109 -0
  329. lmcache/v1/{multiprocess/transport/zmq_impl → transport/zmq}/wire.py +46 -4
  330. lmcache/v1/utils/frozen_dict.py +39 -0
  331. {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc3.dev0.dist-info}/METADATA +1 -1
  332. lmcache_cli-0.5.8rc3.dev0.dist-info/RECORD +761 -0
  333. lmcache/inprocess/__init__.py +0 -2
  334. lmcache/inprocess/integration/__init__.py +0 -2
  335. lmcache/inprocess/integration/base_service_factory.py +0 -171
  336. lmcache/inprocess/integration/tensorrt_llm/tensorrt_adapter.py +0 -377
  337. lmcache/inprocess/integration/tensorrt_llm/utils.py +0 -94
  338. lmcache/inprocess/integration/vllm/__init__.py +0 -2
  339. lmcache/inprocess/integration/vllm/lmcache_connector_v1.py +0 -210
  340. lmcache/inprocess/integration/vllm/lmcache_connector_v1_085.py +0 -147
  341. lmcache/inprocess/integration/vllm/utils.py +0 -160
  342. lmcache/inprocess/integration/vllm/vllm_ec_adapter.py +0 -194
  343. lmcache/inprocess/integration/vllm/vllm_service_factory.py +0 -343
  344. lmcache/inprocess/integration/vllm/vllm_v1_adapter.py +0 -1947
  345. lmcache/inprocess/observability.py +0 -1998
  346. lmcache/inprocess/standalone/__init__.py +0 -1
  347. lmcache/inprocess/standalone/__main__.py +0 -599
  348. lmcache/inprocess/standalone/manager.py +0 -82
  349. lmcache/inprocess/standalone/standalone_service_factory.py +0 -86
  350. lmcache/inprocess/tools/__init__.py +0 -1
  351. lmcache/inprocess/tools/controller_benchmark/README.md +0 -161
  352. lmcache/inprocess/tools/controller_benchmark/__init__.py +0 -1
  353. lmcache/inprocess/tools/controller_benchmark/__main__.py +0 -331
  354. lmcache/inprocess/tools/controller_benchmark/benchmark.py +0 -660
  355. lmcache/inprocess/tools/controller_benchmark/config.py +0 -44
  356. lmcache/inprocess/tools/controller_benchmark/constants.py +0 -10
  357. lmcache/inprocess/tools/controller_benchmark/handlers/__init__.py +0 -31
  358. lmcache/inprocess/tools/controller_benchmark/handlers/admit.py +0 -52
  359. lmcache/inprocess/tools/controller_benchmark/handlers/base.py +0 -47
  360. lmcache/inprocess/tools/controller_benchmark/handlers/deregister.py +0 -49
  361. lmcache/inprocess/tools/controller_benchmark/handlers/evict.py +0 -52
  362. lmcache/inprocess/tools/controller_benchmark/handlers/heartbeat.py +0 -56
  363. lmcache/inprocess/tools/controller_benchmark/handlers/p2p_lookup.py +0 -47
  364. lmcache/inprocess/tools/controller_benchmark/handlers/register.py +0 -56
  365. lmcache/inprocess/usage_telemetry/__init__.py +0 -1
  366. lmcache/inprocess/usage_telemetry/context.py +0 -106
  367. lmcache/inprocess/usage_telemetry/continuous.py +0 -212
  368. lmcache/inprocess/usage_telemetry/messages.py +0 -111
  369. lmcache/inprocess/v1/__init__.py +0 -1
  370. lmcache/inprocess/v1/api_server/__init__.py +0 -2
  371. lmcache/inprocess/v1/api_server/__main__.py +0 -545
  372. lmcache/inprocess/v1/basic_check.py +0 -112
  373. lmcache/inprocess/v1/cache_controller/__init__.py +0 -11
  374. lmcache/inprocess/v1/cache_controller/commands/__init__.py +0 -15
  375. lmcache/inprocess/v1/cache_controller/commands/base.py +0 -35
  376. lmcache/inprocess/v1/cache_controller/commands/full_sync.py +0 -49
  377. lmcache/inprocess/v1/cache_controller/config.py +0 -179
  378. lmcache/inprocess/v1/cache_controller/controller_manager.py +0 -552
  379. lmcache/inprocess/v1/cache_controller/controllers/__init__.py +0 -11
  380. lmcache/inprocess/v1/cache_controller/controllers/full_sync_tracker.py +0 -473
  381. lmcache/inprocess/v1/cache_controller/controllers/kv_controller.py +0 -441
  382. lmcache/inprocess/v1/cache_controller/controllers/registration_controller.py +0 -285
  383. lmcache/inprocess/v1/cache_controller/executor.py +0 -470
  384. lmcache/inprocess/v1/cache_controller/frontend/static/css/style.css +0 -201
  385. lmcache/inprocess/v1/cache_controller/frontend/static/img/logo.png +0 -0
  386. lmcache/inprocess/v1/cache_controller/frontend/static/index.html +0 -234
  387. lmcache/inprocess/v1/cache_controller/frontend/static/js/controller_app.js +0 -660
  388. lmcache/inprocess/v1/cache_controller/full_sync_sender.py +0 -475
  389. lmcache/inprocess/v1/cache_controller/locks.py +0 -149
  390. lmcache/inprocess/v1/cache_controller/message.py +0 -828
  391. lmcache/inprocess/v1/cache_controller/observability.py +0 -208
  392. lmcache/inprocess/v1/cache_controller/utils.py +0 -685
  393. lmcache/inprocess/v1/cache_controller/worker.py +0 -668
  394. lmcache/inprocess/v1/cache_engine.py +0 -2216
  395. lmcache/inprocess/v1/cache_interface.py +0 -19
  396. lmcache/inprocess/v1/check/__init__.py +0 -76
  397. lmcache/inprocess/v1/check/check_mode_gen.py +0 -86
  398. lmcache/inprocess/v1/check/check_mode_test_l2_adapter.py +0 -327
  399. lmcache/inprocess/v1/check/check_mode_test_remote.py +0 -155
  400. lmcache/inprocess/v1/check/check_mode_test_storage_manager.py +0 -142
  401. lmcache/inprocess/v1/check/utils.py +0 -566
  402. lmcache/inprocess/v1/compute/__init__.py +0 -2
  403. lmcache/inprocess/v1/compute/attention/__init__.py +0 -1
  404. lmcache/inprocess/v1/compute/attention/abstract.py +0 -39
  405. lmcache/inprocess/v1/compute/attention/flash_attn.py +0 -139
  406. lmcache/inprocess/v1/compute/attention/flash_infer_sparse.py +0 -285
  407. lmcache/inprocess/v1/compute/attention/metadata.py +0 -176
  408. lmcache/inprocess/v1/compute/attention/triton_kernels/__init__.py +0 -13
  409. lmcache/inprocess/v1/compute/attention/triton_kernels/block_sparse_attention.py +0 -559
  410. lmcache/inprocess/v1/compute/attention/triton_sparse.py +0 -149
  411. lmcache/inprocess/v1/compute/attention/utils.py +0 -103
  412. lmcache/inprocess/v1/compute/blend/__init__.py +0 -7
  413. lmcache/inprocess/v1/compute/blend/blender.py +0 -172
  414. lmcache/inprocess/v1/compute/blend/metadata.py +0 -34
  415. lmcache/inprocess/v1/compute/blend/utils.py +0 -64
  416. lmcache/inprocess/v1/compute/models/__init__.py +0 -0
  417. lmcache/inprocess/v1/compute/models/base.py +0 -156
  418. lmcache/inprocess/v1/compute/models/llama.py +0 -9
  419. lmcache/inprocess/v1/compute/models/qwen3.py +0 -24
  420. lmcache/inprocess/v1/compute/models/utils.py +0 -69
  421. lmcache/inprocess/v1/compute/positional_encoding.py +0 -203
  422. lmcache/inprocess/v1/config.py +0 -1228
  423. lmcache/inprocess/v1/config_base.py +0 -849
  424. lmcache/inprocess/v1/ec_engine.py +0 -202
  425. lmcache/inprocess/v1/event_manager.py +0 -145
  426. lmcache/inprocess/v1/gpu_connector/__init__.py +0 -184
  427. lmcache/inprocess/v1/gpu_connector/gpu_connectors.py +0 -1743
  428. lmcache/inprocess/v1/gpu_connector/hpu_connector.py +0 -340
  429. lmcache/inprocess/v1/gpu_connector/mock_gpu_connector.py +0 -67
  430. lmcache/inprocess/v1/gpu_connector/musa_connectors.py +0 -952
  431. lmcache/inprocess/v1/gpu_connector/utils.py +0 -41
  432. lmcache/inprocess/v1/gpu_connector/xpu_connectors.py +0 -1241
  433. lmcache/inprocess/v1/health_monitor/__init__.py +0 -1
  434. lmcache/inprocess/v1/health_monitor/base.py +0 -577
  435. lmcache/inprocess/v1/health_monitor/checks/__init__.py +0 -1
  436. lmcache/inprocess/v1/health_monitor/checks/remote_backend_check.py +0 -311
  437. lmcache/inprocess/v1/health_monitor/constants.py +0 -36
  438. lmcache/inprocess/v1/hidden_state_store.py +0 -365
  439. lmcache/inprocess/v1/internal_api_server/__init__.py +0 -0
  440. lmcache/inprocess/v1/internal_api_server/api_registry.py +0 -63
  441. lmcache/inprocess/v1/internal_api_server/api_server.py +0 -134
  442. lmcache/inprocess/v1/internal_api_server/controller/__init__.py +0 -0
  443. lmcache/inprocess/v1/internal_api_server/controller/key_stats_api.py +0 -81
  444. lmcache/inprocess/v1/internal_api_server/controller/worker_info_api.py +0 -136
  445. lmcache/inprocess/v1/internal_api_server/utils.py +0 -43
  446. lmcache/inprocess/v1/internal_api_server/vllm/__init__.py +0 -0
  447. lmcache/inprocess/v1/internal_api_server/vllm/backend_api.py +0 -221
  448. lmcache/inprocess/v1/internal_api_server/vllm/bypass_api.py +0 -204
  449. lmcache/inprocess/v1/internal_api_server/vllm/cache_api.py +0 -897
  450. lmcache/inprocess/v1/internal_api_server/vllm/chunk_statistics_api.py +0 -141
  451. lmcache/inprocess/v1/internal_api_server/vllm/conf_api.py +0 -147
  452. lmcache/inprocess/v1/internal_api_server/vllm/freeze_api.py +0 -172
  453. lmcache/inprocess/v1/internal_api_server/vllm/hot_cache_api.py +0 -184
  454. lmcache/inprocess/v1/internal_api_server/vllm/inference_api.py +0 -65
  455. lmcache/inprocess/v1/internal_api_server/vllm/load_fs_chunks_api.py +0 -320
  456. lmcache/inprocess/v1/internal_api_server/vllm/lookup_api.py +0 -145
  457. lmcache/inprocess/v1/lookup_client/__init__.py +0 -27
  458. lmcache/inprocess/v1/lookup_client/abstract_client.py +0 -77
  459. lmcache/inprocess/v1/lookup_client/async_lookup_message.py +0 -50
  460. lmcache/inprocess/v1/lookup_client/chunk_statistics_lookup_client.py +0 -211
  461. lmcache/inprocess/v1/lookup_client/factory.py +0 -253
  462. lmcache/inprocess/v1/lookup_client/hit_limit_lookup_client.py +0 -94
  463. lmcache/inprocess/v1/lookup_client/lmcache_async_lookup_client.py +0 -410
  464. lmcache/inprocess/v1/lookup_client/lmcache_lookup_client.py +0 -296
  465. lmcache/inprocess/v1/lookup_client/lmcache_lookup_client_bypass.py +0 -102
  466. lmcache/inprocess/v1/lookup_client/mooncake_lookup_client.py +0 -98
  467. lmcache/inprocess/v1/lookup_client/record_strategies/__init__.py +0 -69
  468. lmcache/inprocess/v1/lookup_client/record_strategies/base.py +0 -327
  469. lmcache/inprocess/v1/lookup_client/record_strategies/file_hash.py +0 -130
  470. lmcache/inprocess/v1/lookup_client/record_strategies/memory_bloom_filter.py +0 -81
  471. lmcache/inprocess/v1/manager.py +0 -532
  472. lmcache/inprocess/v1/memory_allocators/__init__.py +0 -2
  473. lmcache/inprocess/v1/memory_allocators/cu_file_memory_allocator.py +0 -38
  474. lmcache/inprocess/v1/memory_allocators/hip_file_memory_allocator.py +0 -34
  475. lmcache/inprocess/v1/memory_allocators/paged_cpu_gpu_memory_allocator.py +0 -205
  476. lmcache/inprocess/v1/metadata.py +0 -121
  477. lmcache/inprocess/v1/offload_server/__init__.py +0 -19
  478. lmcache/inprocess/v1/offload_server/abstract_server.py +0 -37
  479. lmcache/inprocess/v1/offload_server/message.py +0 -30
  480. lmcache/inprocess/v1/offload_server/zmq_server.py +0 -122
  481. lmcache/inprocess/v1/protocol.py +0 -148
  482. lmcache/inprocess/v1/rpc/__init__.py +0 -17
  483. lmcache/inprocess/v1/rpc/transport.py +0 -105
  484. lmcache/inprocess/v1/rpc/zmq_transport.py +0 -213
  485. lmcache/inprocess/v1/rpc_utils.py +0 -218
  486. lmcache/inprocess/v1/storage_backend/__init__.py +0 -342
  487. lmcache/inprocess/v1/storage_backend/abstract_backend.py +0 -460
  488. lmcache/inprocess/v1/storage_backend/audit_backend.py +0 -252
  489. lmcache/inprocess/v1/storage_backend/batched_message_sender.py +0 -226
  490. lmcache/inprocess/v1/storage_backend/cache_policy/__init__.py +0 -47
  491. lmcache/inprocess/v1/storage_backend/cache_policy/base_policy.py +0 -87
  492. lmcache/inprocess/v1/storage_backend/cache_policy/fifo.py +0 -61
  493. lmcache/inprocess/v1/storage_backend/cache_policy/lfu.py +0 -108
  494. lmcache/inprocess/v1/storage_backend/cache_policy/lru.py +0 -84
  495. lmcache/inprocess/v1/storage_backend/cache_policy/mru.py +0 -64
  496. lmcache/inprocess/v1/storage_backend/connector/__init__.py +0 -426
  497. lmcache/inprocess/v1/storage_backend/connector/audit_adapter.py +0 -79
  498. lmcache/inprocess/v1/storage_backend/connector/audit_connector.py +0 -363
  499. lmcache/inprocess/v1/storage_backend/connector/azure_adapter.py +0 -73
  500. lmcache/inprocess/v1/storage_backend/connector/azure_connector.py +0 -335
  501. lmcache/inprocess/v1/storage_backend/connector/base_connector.py +0 -382
  502. lmcache/inprocess/v1/storage_backend/connector/bigtable_adapter.py +0 -35
  503. lmcache/inprocess/v1/storage_backend/connector/bigtable_connector.py +0 -1172
  504. lmcache/inprocess/v1/storage_backend/connector/bigtable_schema.py +0 -74
  505. lmcache/inprocess/v1/storage_backend/connector/blackhole_adapter.py +0 -26
  506. lmcache/inprocess/v1/storage_backend/connector/blackhole_connector.py +0 -38
  507. lmcache/inprocess/v1/storage_backend/connector/eic_adapter.py +0 -33
  508. lmcache/inprocess/v1/storage_backend/connector/eic_connector.py +0 -776
  509. lmcache/inprocess/v1/storage_backend/connector/external_adapter.py +0 -81
  510. lmcache/inprocess/v1/storage_backend/connector/fs_adapter.py +0 -51
  511. lmcache/inprocess/v1/storage_backend/connector/fs_connector.py +0 -411
  512. lmcache/inprocess/v1/storage_backend/connector/hf3fs_adapter.py +0 -291
  513. lmcache/inprocess/v1/storage_backend/connector/hf3fs_connector.py +0 -631
  514. lmcache/inprocess/v1/storage_backend/connector/hfbucket_adapter.py +0 -57
  515. lmcache/inprocess/v1/storage_backend/connector/hfbucket_connector.py +0 -782
  516. lmcache/inprocess/v1/storage_backend/connector/infinistore_adapter.py +0 -58
  517. lmcache/inprocess/v1/storage_backend/connector/infinistore_connector.py +0 -178
  518. lmcache/inprocess/v1/storage_backend/connector/instrumented_connector.py +0 -221
  519. lmcache/inprocess/v1/storage_backend/connector/mock_adapter.py +0 -59
  520. lmcache/inprocess/v1/storage_backend/connector/mock_connector.py +0 -354
  521. lmcache/inprocess/v1/storage_backend/connector/mooncakestore_adapter.py +0 -43
  522. lmcache/inprocess/v1/storage_backend/connector/mooncakestore_connector.py +0 -841
  523. lmcache/inprocess/v1/storage_backend/connector/redis_adapter.py +0 -199
  524. lmcache/inprocess/v1/storage_backend/connector/redis_connector.py +0 -833
  525. lmcache/inprocess/v1/storage_backend/connector/s3_adapter.py +0 -61
  526. lmcache/inprocess/v1/storage_backend/connector/s3_connector.py +0 -717
  527. lmcache/inprocess/v1/storage_backend/connector/sagemaker_hyperpod_adapter.py +0 -243
  528. lmcache/inprocess/v1/storage_backend/connector/sagemaker_hyperpod_connector.py +0 -1031
  529. lmcache/inprocess/v1/storage_backend/connector/valkey_adapter.py +0 -178
  530. lmcache/inprocess/v1/storage_backend/connector/valkey_connector.py +0 -441
  531. lmcache/inprocess/v1/storage_backend/gds_backend.py +0 -1323
  532. lmcache/inprocess/v1/storage_backend/hipfile_shim.py +0 -167
  533. lmcache/inprocess/v1/storage_backend/job_executor/__init__.py +0 -0
  534. lmcache/inprocess/v1/storage_backend/job_executor/base_executor.py +0 -34
  535. lmcache/inprocess/v1/storage_backend/job_executor/pq_executor.py +0 -237
  536. lmcache/inprocess/v1/storage_backend/legacy_serde/__init__.py +0 -1
  537. lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_basics.py +0 -210
  538. lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_decoder.py +0 -211
  539. lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_encoder.py +0 -396
  540. lmcache/inprocess/v1/storage_backend/legacy_serde/serde.py +0 -75
  541. lmcache/inprocess/v1/storage_backend/local_cpu_backend.py +0 -994
  542. lmcache/inprocess/v1/storage_backend/local_disk_backend.py +0 -844
  543. lmcache/inprocess/v1/storage_backend/maru_backend.py +0 -737
  544. lmcache/inprocess/v1/storage_backend/naive_serde/__init__.py +0 -57
  545. lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_basics.py +0 -135
  546. lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_decoder.py +0 -142
  547. lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_encoder.py +0 -116
  548. lmcache/inprocess/v1/storage_backend/naive_serde/kivi_serde.py +0 -25
  549. lmcache/inprocess/v1/storage_backend/naive_serde/naive_serde.py +0 -21
  550. lmcache/inprocess/v1/storage_backend/naive_serde/serde.py +0 -37
  551. lmcache/inprocess/v1/storage_backend/native_clients/aerospike_client.py +0 -74
  552. lmcache/inprocess/v1/storage_backend/native_clients/connector_client_base.py +0 -165
  553. lmcache/inprocess/v1/storage_backend/native_clients/resp_client.py +0 -35
  554. lmcache/inprocess/v1/storage_backend/nixl_storage_backend.py +0 -2422
  555. lmcache/inprocess/v1/storage_backend/p2p_backend.py +0 -794
  556. lmcache/inprocess/v1/storage_backend/path_sharder.py +0 -115
  557. lmcache/inprocess/v1/storage_backend/pd_backend.py +0 -1093
  558. lmcache/inprocess/v1/storage_backend/pd_backend_async.py +0 -1735
  559. lmcache/inprocess/v1/storage_backend/plugins/dax_backend.py +0 -931
  560. lmcache/inprocess/v1/storage_backend/plugins/rust_raw_block_backend.py +0 -758
  561. lmcache/inprocess/v1/storage_backend/remote_backend.py +0 -629
  562. lmcache/inprocess/v1/storage_backend/resp_client.py +0 -227
  563. lmcache/inprocess/v1/storage_backend/storage_backend_listener.py +0 -21
  564. lmcache/inprocess/v1/storage_backend/storage_manager.py +0 -1429
  565. lmcache/inprocess/v1/system_detection.py +0 -116
  566. lmcache/inprocess/v1/token_database.py +0 -580
  567. lmcache/inprocess/v1/transfer_channel/__init__.py +0 -83
  568. lmcache/inprocess/v1/transfer_channel/abstract.py +0 -285
  569. lmcache/inprocess/v1/transfer_channel/mock_memory_channel.py +0 -156
  570. lmcache/inprocess/v1/transfer_channel/nixl_channel.py +0 -688
  571. lmcache/inprocess/v1/transfer_channel/py_socket_channel.py +0 -260
  572. lmcache/inprocess/v1/transfer_channel/transfer_utils.py +0 -61
  573. lmcache/integration/vllm/lmcache_connector_v1.py +0 -210
  574. lmcache/sdk/wrapper/contiguous.py +0 -82
  575. lmcache/v1/multiprocess/object_group_transfer.py +0 -776
  576. lmcache/v1/multiprocess/transport/grpc_impl/protos/qstore_service.proto +0 -16
  577. lmcache_cli-0.5.8.dev0.dist-info/RECORD +0 -949
  578. /lmcache/v1/{multiprocess → client}/client_config.py +0 -0
  579. /lmcache/v1/{multiprocess → client}/transfer_context/tensor_wire.py +0 -0
  580. /lmcache/v1/{gpu_connector → common}/kv_format/types.py +0 -0
  581. /lmcache/{cli → v1/common}/metrics/section.py +0 -0
  582. /lmcache/{inprocess/integration/tensorrt_llm → v1/common/transfer_channel}/__init__.py +0 -0
  583. /lmcache/v1/{multiprocess → platform}/posix_shm.py +0 -0
  584. /lmcache/v1/{multiprocess → platform}/transfer_mode.py +0 -0
  585. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/.gitignore +0 -0
  586. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/base.py +0 -0
  587. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/__init__.py +0 -0
  588. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/blend_service.proto +0 -0
  589. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/engine_driven_service.proto +0 -0
  590. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/extension_service.proto +0 -0
  591. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/kv_event_service.proto +0 -0
  592. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/lmcache_driven_service.proto +0 -0
  593. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/lookup_service.proto +0 -0
  594. /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/management_service.proto +0 -0
  595. /lmcache/v1/{multiprocess/protocols → transport}/server_module.py +0 -0
  596. {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc3.dev0.dist-info}/WHEEL +0 -0
  597. {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc3.dev0.dist-info}/entry_points.txt +0 -0
  598. {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc3.dev0.dist-info}/licenses/LICENSE +0 -0
  599. {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc3.dev0.dist-info}/top_level.txt +0 -0
lmcache/_version.py CHANGED
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.5.8.dev0'
22
- __version_tuple__ = version_tuple = (0, 5, 8, 'dev0')
21
+ __version__ = version = '0.5.8rc3.dev0'
22
+ __version_tuple__ = version_tuple = (0, 5, 8, 'rc3', 'dev0')
23
23
 
24
- __commit_id__ = commit_id = 'g236f3eec3'
24
+ __commit_id__ = commit_id = 'g831e05028'
@@ -11,17 +11,55 @@ import argparse
11
11
  import sys
12
12
 
13
13
  # First Party
14
- from lmcache.cli.metrics import (
14
+ from lmcache.logging import init_logger
15
+ from lmcache.v1.common.metrics import (
15
16
  FileHandler,
16
17
  Metrics,
17
18
  StreamHandler,
18
19
  get_formatter,
19
20
  )
20
- from lmcache.logging import init_logger
21
21
 
22
22
  logger = init_logger(__name__)
23
23
 
24
24
 
25
+ def positive_int(value: str) -> int:
26
+ """Parse an argparse value as an integer greater than zero.
27
+
28
+ Args:
29
+ value: Integer text supplied on the command line.
30
+
31
+ Returns:
32
+ The parsed positive integer.
33
+
34
+ Raises:
35
+ ValueError: If value is not integer text.
36
+ argparse.ArgumentTypeError: If the integer is zero or negative.
37
+ """
38
+ count = int(value)
39
+ if count <= 0:
40
+ raise argparse.ArgumentTypeError("must be a positive integer")
41
+ return count
42
+
43
+
44
+ def nonnegative_int(value: str) -> int:
45
+ """Parse an argparse value as an integer greater than or equal to zero.
46
+
47
+ Args:
48
+ value: Integer text supplied on the command line.
49
+
50
+ Returns:
51
+ The parsed non-negative integer.
52
+
53
+ Raises:
54
+ ValueError: If value is not integer text.
55
+ argparse.ArgumentTypeError: If the integer is negative.
56
+ """
57
+ count = int(value)
58
+ if count < 0:
59
+ raise argparse.ArgumentTypeError("must be a non-negative integer")
60
+ return count
61
+
62
+
25
63
  def _route_head(tokens: Sequence[str]) -> tuple[str | None, list[str]]:
26
64
  """Split the current level's route head off the remaining tokens.
27
65
 
@@ -15,6 +15,9 @@ import argparse
15
15
  import os
16
16
  import sys
17
17
 
18
+ # First Party
19
+ from lmcache.cli.commands.base import nonnegative_int, positive_int
20
+
18
21
  if TYPE_CHECKING:
19
22
  # First Party
20
23
  from lmcache.cli.commands.base import BaseCommand
@@ -29,6 +32,8 @@ if TYPE_CHECKING:
29
32
  def add_l2_arguments(parser: argparse.ArgumentParser) -> None:
30
33
  """Add ``lmcache bench l2`` arguments to *parser*.
31
34
 
35
+ Require positive measurement rounds and non-negative warmup rounds.
36
+
32
37
  Args:
33
38
  parser: The ``ArgumentParser`` for the L2 bench subcommand.
34
39
  """
@@ -92,15 +97,15 @@ def add_l2_arguments(parser: argparse.ArgumentParser) -> None:
92
97
  )
93
98
  parser.add_argument(
94
99
  "--rounds",
95
- type=int,
100
+ type=positive_int,
96
101
  default=1,
97
- help="Measurement rounds per operation (default: 1).",
102
+ help="Positive number of measurement rounds per operation (default: 1).",
98
103
  )
99
104
  parser.add_argument(
100
105
  "--warmup-rounds",
101
- type=int,
106
+ type=nonnegative_int,
102
107
  default=1,
103
- help="Warmup rounds before measurement (default: 1).",
108
+ help="Non-negative warmup rounds before measurement (default: 1).",
104
109
  )
105
110
  parser.add_argument(
106
111
  "--lookup-max-hit-rate",
@@ -189,6 +194,11 @@ def run_l2_adapter_bench(command: "BaseCommand", args: argparse.Namespace) -> No
189
194
  to obtain a configured :class:`Metrics` object via
190
195
  ``command.create_metrics``.
191
196
  args: Parsed CLI arguments from the ``bench l2`` subparser.
197
+
198
+ Raises:
199
+ SystemExit: With code 1 if adapter creation or verification fails, or
200
+ an operation times out in every measured round; code 2 for invalid
201
+ arguments or unavailable requested profiling tools.
192
202
  """
193
203
  # Lazy imports: keep CLI loadable without torch / native deps.
194
204
  # First Party
@@ -572,6 +582,13 @@ def run_l2_adapter_bench(command: "BaseCommand", args: argparse.Namespace) -> No
572
582
  data_per_round_mb=(keys_per_round * data_size) / mb,
573
583
  results=results,
574
584
  )
585
+ for result in results:
586
+ if result.timed_out_rounds > 0 and not result.round_durations:
587
+ print(
588
+ f"Error: all measured {result.operation.lower()} rounds timed out.",
589
+ file=sys.stderr,
590
+ )
591
+ failed = True
575
592
  finally:
576
593
  # Idempotent: a no-op if profiling already stopped on the normal
577
594
  # path; tears the recorder down if a phase raised.
@@ -607,20 +624,21 @@ def _strip_warmup(result: "BenchResult", warmup: int) -> "BenchResult":
607
624
  # First Party
608
625
  from lmcache.cli.commands.bench.l2_adapter_bench.result import BenchResult
609
626
 
610
- # Adjust the expected hit count proportionally for the kept rounds.
611
- kept_rounds = max(0, len(result.round_durations) - warmup)
612
- total_rounds = max(1, len(result.round_durations))
613
- scaled_expected_hit = int(result.expected_hit_count * kept_rounds / total_rounds)
627
+ # Timed-out rounds have no duration entry, so skip only completed warmup rounds.
628
+ warmup_timeouts = sum(result.round_timed_out[:warmup])
629
+ warmup_completed = warmup - warmup_timeouts
614
630
 
615
631
  return BenchResult(
616
632
  operation=result.operation,
617
633
  in_flight=result.in_flight,
618
634
  num_keys=result.num_keys,
619
635
  data_size_bytes=result.data_size_bytes,
620
- round_durations=result.round_durations[warmup:],
636
+ round_durations=result.round_durations[warmup_completed:],
621
637
  success_counts=result.success_counts[warmup:],
638
+ timed_out_rounds=result.timed_out_rounds - warmup_timeouts,
639
+ round_timed_out=result.round_timed_out[warmup:],
622
640
  expected_max_hit_rate=result.expected_max_hit_rate,
623
- expected_hit_count=scaled_expected_hit,
641
+ expected_hit_count=result.expected_hit_count,
624
642
  )
625
643
 
626
644
 
@@ -5,6 +5,7 @@
5
5
  from __future__ import annotations
6
6
 
7
7
  # Standard
8
+ import hashlib
8
9
  import select
9
10
 
10
11
  # Third Party
@@ -76,6 +77,10 @@ def make_object_keys(
76
77
  ``ObjectKey`` is a frozen dataclass with field order:
77
78
  (chunk_hash, model_name, kv_rank).
78
79
 
80
+ Each ``chunk_hash`` is a deterministic 32-byte hash of the key index, so
81
+ the same index always yields the same key and hash bytes are uniformly
82
+ distributed like real blake3/sha256 chunk hashes.
83
+
79
84
  Args:
80
85
  num_keys: Number of keys to generate.
81
86
  model_name: Model name embedded in each key.
@@ -84,8 +89,10 @@ def make_object_keys(
84
89
  keys: list[ObjectKey] = []
85
90
  for i in range(num_keys):
86
91
  idx = key_offset + i
87
- # chunk_hash: 16 bytes derived from index to guarantee uniqueness
88
- chunk_hash = idx.to_bytes(16, "big")
92
+ # Hash the index so keys look like real 32-byte chunk hashes. A raw
93
+ # big-endian index starts with zero bytes, which collapses adapters
94
+ # that place files by hash prefix into a single directory.
95
+ chunk_hash = hashlib.blake2b(idx.to_bytes(16, "big"), digest_size=32).digest()
89
96
  keys.append(
90
97
  ObjectKey(
91
98
  chunk_hash=chunk_hash,
@@ -49,8 +49,13 @@ class BenchResult:
49
49
  data_size_bytes: int
50
50
  round_durations: list[float] = field(default_factory=list)
51
51
  success_counts: list[int] = field(default_factory=list)
52
- # Rounds that hit the wait timeout and therefore have no duration.
52
+
53
+ # One timeout flag per attempted round, aligned with success_counts.
54
+ round_timed_out: list[bool] = field(default_factory=list)
55
+
56
+ # Timeout count for the rounds represented by this result.
53
57
  timed_out_rounds: int = 0
58
+
54
59
  # Lookup-specific metadata (left as defaults for store/load).
55
60
  expected_max_hit_rate: float = 0.0
56
61
  expected_hit_count: int = 0
@@ -176,6 +176,7 @@ def bench_store(
176
176
  if completed.get(tid, L2StoreResult(False, 0)).is_successful()
177
177
  )
178
178
 
179
+ result.round_timed_out.append(timed_out)
179
180
  if timed_out:
180
181
  log(
181
182
  f" [Store] Round {r + 1}: TIMEOUT "
@@ -246,6 +247,7 @@ def bench_lookup(
246
247
 
247
248
  total_found = sum(_bitmap_count(results.get(tid)) for tid in task_ids)
248
249
 
250
+ result.round_timed_out.append(timed_out)
249
251
  if timed_out:
250
252
  log(
251
253
  f" [Lookup] Round {r + 1}: TIMEOUT "
@@ -312,6 +314,7 @@ def bench_load(
312
314
 
313
315
  total_loaded = sum(_bitmap_count(results.get(tid)) for tid in task_ids)
314
316
 
317
+ result.round_timed_out.append(timed_out)
315
318
  if timed_out:
316
319
  log(
317
320
  f" [Load] Round {r + 1}: TIMEOUT "
@@ -55,6 +55,18 @@ def add_server_arguments(parser: argparse.ArgumentParser) -> None:
55
55
  "gpu->lmcache_driven, cpu->engine_driven."
56
56
  ),
57
57
  )
58
+ parser.add_argument(
59
+ "--isolated-ipc",
60
+ action=argparse.BooleanOptionalAction,
61
+ default=False,
62
+ help=(
63
+ "Use the IPC mechanisms for a bench client and server that share "
64
+ "no host IPC namespace or /dev/shm (CUDA: timeline-semaphore "
65
+ "events instead of interprocess event handles). GPU mode only. "
66
+ "Must match the server's --isolated-ipc setting; on a mismatch "
67
+ "the server cannot open the client's events. (Default is False)"
68
+ ),
69
+ )
58
70
  parser.add_argument(
59
71
  "--tp-size",
60
72
  type=int,
@@ -10,8 +10,8 @@ import torch
10
10
 
11
11
  # First Party
12
12
  from lmcache import torch_dev, torch_device_type
13
+ from lmcache.v1.common.group_view import EngineGroupInfo
13
14
  from lmcache.v1.kv_layer_groups import KVLayerGroupInfo
14
- from lmcache.v1.multiprocess.group_view import EngineGroupInfo
15
15
  from lmcache.v1.platform import synchronize_device
16
16
 
17
17
 
@@ -33,8 +33,11 @@ class KVCacheBuffers:
33
33
  device: str | torch.device | None = None,
34
34
  *,
35
35
  block_size: int | None = None,
36
+ tp_replicas: int = 1,
36
37
  ) -> None:
37
- """Allocate client-validated groups, optionally overriding token block size."""
38
+ """Allocate client-validated groups, optionally overriding token block size.
39
+
40
+ ``tp_replicas`` ranks share each group's object (MLA-style replication)."""
38
41
  self.kv_caches: dict[str, torch.Tensor] = {}
39
42
  self.engine_group_infos: list[EngineGroupInfo] = []
40
43
  self.block_size: int = (
@@ -61,6 +64,7 @@ class KVCacheBuffers:
61
64
  engine_group_id=group_index,
62
65
  layer_indices=tuple(group.layer_indices),
63
66
  tokens_per_block=self.block_size,
67
+ tp_replicas=tp_replicas,
64
68
  )
65
69
  )
66
70
  for _ in range(sd.nl):
@@ -44,23 +44,22 @@ from lmcache.cli.commands.bench.server_bench.helpers import (
44
44
  _wait_for_result,
45
45
  )
46
46
  from lmcache.utils import EngineType
47
- from lmcache.v1.gpu_connector.utils import LayoutHints
47
+ from lmcache.v1.client.transport.factory import RequestClientFactory
48
+ from lmcache.v1.client.worker_transfer import (
49
+ EngineDrivenTransferContext,
50
+ create_transfer_context,
51
+ )
52
+ from lmcache.v1.common.utils import LayoutHints
48
53
  from lmcache.v1.kv_layer_groups import (
49
54
  DTYPE_MAP,
50
55
  format_kvcache_shape_spec,
51
56
  parse_kvcache_shape_spec,
52
57
  )
53
- from lmcache.v1.multiprocess.transfer_context import (
54
- EngineDrivenTransferContext,
55
- create_transfer_context,
56
- )
57
- from lmcache.v1.multiprocess.transport.factory import RequestClientFactory
58
58
 
59
59
  if TYPE_CHECKING:
60
60
  # First Party
61
- from lmcache.v1.multiprocess.transfer_context import TransferContext
62
- from lmcache.v1.multiprocess.transfer_context.worker_transfer import IPCEvent
63
- from lmcache.v1.multiprocess.transport.base import RequestClient
61
+ from lmcache.v1.client.worker_transfer import IPCEvent, TransferContext
62
+ from lmcache.v1.transport.request_client import RequestClient
64
63
 
65
64
 
66
65
  @dataclass(frozen=True)
@@ -344,8 +343,6 @@ class ServerBenchClient:
344
343
  start=0,
345
344
  end=request.num_full_tokens,
346
345
  world_size=self._kv_world_size,
347
- num_kv_readers=sum(w.spec.retrieve_enabled for w in self._workers)
348
- // self._kv_world_size,
349
346
  )
350
347
  started_at = time.monotonic()
351
348
  if not _send_lookup(req_client, lookup_key, tp_size=len(self._workers)):
@@ -361,9 +358,8 @@ class ServerBenchClient:
361
358
  error="timeout",
362
359
  )
363
360
 
364
- hit_chunks = _poll_prefetch_status(req_client, lookup_key.request_id)
365
- if hit_chunks is None:
366
- hit_chunks = 0
361
+ hit_tokens = _poll_prefetch_status(req_client, lookup_key.request_id)
362
+ hit_chunks = 0 if hit_tokens is None else hit_tokens // self._chunk_size
367
363
  latency_ms = (time.monotonic() - started_at) * 1000
368
364
  self._log(
369
365
  " [seq %d/%s] LOOKUP: %d/%d chunks hit (%.1f ms)"
@@ -523,8 +519,13 @@ class ServerBenchClient:
523
519
  worker.spec.kv_worker_id: checksums[worker.spec.rank]
524
520
  for worker in workers
525
521
  }
522
+ # A reader's object is written by the first of its tp_replicas
523
+ # consecutive ranks.
526
524
  checksums = {
527
- worker.spec.rank: writer_checksums[worker.spec.kv_worker_id]
525
+ worker.spec.rank: writer_checksums[
526
+ worker.spec.kv_worker_id
527
+ - worker.spec.kv_worker_id % self._tp_replicas
528
+ ]
528
529
  for worker in self._workers
529
530
  if worker.spec.retrieve_enabled
530
531
  }
@@ -916,15 +917,19 @@ class ServerBenchClient:
916
917
  "--use-mla requires --kvcache-shape-spec with kv_size=1 "
917
918
  "(single-plane MLA group), got kv_size=%s" % kv_size_display
918
919
  )
919
- self._kv_world_size = 1 if use_mla else config.tp_size
920
+ # MLA replicates KV on every rank: the ranks share one object per
921
+ # chunk, keyed by rank 0, and the server counts them as its readers.
922
+ self._kv_world_size = config.tp_size
923
+ self._tp_replicas = config.tp_size if use_mla else 1
920
924
 
921
925
  for rank in range(config.tp_size):
922
926
  instance_id = _INSTANCE_ID_BASE + self._client_index * config.tp_size + rank
923
- kv_worker_id = 0 if use_mla else rank
927
+ kv_worker_id = rank
924
928
  buffers = KVCacheBuffers(
925
929
  groups=tensor_groups,
926
930
  device=None if use_gpu else "cpu",
927
931
  block_size=self._block_size,
932
+ tp_replicas=self._tp_replicas,
928
933
  )
929
934
  kv_caches = buffers.kv_caches
930
935
  self._log(
@@ -183,6 +183,12 @@ def run_server_bench(
183
183
  args: Parsed CLI arguments for ``lmcache bench server``.
184
184
  """
185
185
  config = parse_args_to_config(args)
186
+ # The IPC policy is process-wide and the CUDA event backend is cached on
187
+ # first resolution, so set it before any client starts.
188
+ # First Party
189
+ from lmcache.v1.platform.ipc_policy import set_isolated_ipc
190
+
191
+ set_isolated_ipc(config.isolated_ipc)
186
192
  stop = threading.Event()
187
193
  cases = _build_cases(config, args, stop)
188
194
 
@@ -266,6 +272,7 @@ def _emit_server_bench_metrics(
266
272
  cfg_section.add("num_tokens", "Tokens / request", args.num_tokens)
267
273
  cfg_section.add("interval", "Interval (s)", args.interval)
268
274
  cfg_section.add("concurrency", "Concurrency", getattr(args, "concurrency", 1))
275
+ cfg_section.add("isolated_ipc", "Isolated IPC", args.isolated_ipc)
269
276
 
270
277
  result_section = metrics.add_section("results", "Results")
271
278
  result_section.add("total_requests", "Total requests", result.completed_runs)
@@ -34,6 +34,7 @@ class BenchConfig:
34
34
  num_blocks: Fallback number of paged KV blocks.
35
35
  block_size: Fallback number of tokens per paged KV block.
36
36
  concurrency: Number of clients sending requests at the same time.
37
+ isolated_ipc: Whether clients use the isolated IPC policy.
37
38
  block_allocation: Allocate the lowest free IDs or sample free IDs randomly.
38
39
  transfer_timeout_s: Positive, finite shared wait budget per transfer call.
39
40
  """
@@ -49,6 +50,7 @@ class BenchConfig:
49
50
  num_blocks: int
50
51
  block_size: int
51
52
  concurrency: int = 1
53
+ isolated_ipc: bool = False
52
54
  block_allocation: Literal["sequential", "random"] = "sequential"
53
55
  transfer_timeout_s: float = 10.0
54
56
 
@@ -63,6 +65,8 @@ class BenchConfig:
63
65
  raise ValueError(f"unsupported transfer mode: {self.transfer_mode}")
64
66
  if self.tp_size < 1:
65
67
  raise ValueError(f"tp_size must be positive, got {self.tp_size}")
68
+ if self.isolated_ipc and self.mode != "gpu":
69
+ raise ValueError("--isolated-ipc only applies to --mode gpu")
66
70
  if self.concurrency < 1:
67
71
  raise ValueError(f"concurrency must be positive, got {self.concurrency}")
68
72
 
@@ -151,6 +155,7 @@ def parse_args_to_config(args: argparse.Namespace) -> BenchConfig:
151
155
  num_blocks=args.num_blocks,
152
156
  block_size=args.block_size,
153
157
  concurrency=int(getattr(args, "concurrency", 1)),
158
+ isolated_ipc=args.isolated_ipc,
154
159
  block_allocation=getattr(args, "block_allocation", "sequential"),
155
160
  transfer_timeout_s=float(getattr(args, "transfer_timeout", 10.0)),
156
161
  )
@@ -12,9 +12,9 @@ import urllib.error
12
12
  import urllib.request
13
13
 
14
14
  # First Party
15
- from lmcache.v1.multiprocess.custom_types import IPCCacheServerKey
16
- from lmcache.v1.multiprocess.futures import DeviceMessagingFuture, MessagingFuture
17
- from lmcache.v1.multiprocess.transport.base import RequestClient
15
+ from lmcache.v1.common.custom_types import IPCCacheServerKey
16
+ from lmcache.v1.transport.futures import DeviceMessagingFuture, MessagingFuture
17
+ from lmcache.v1.transport.request_client import RequestClient
18
18
 
19
19
  # ------------------------------------------------------------------ #
20
20
  # Constants #
@@ -92,13 +92,11 @@ def _make_key(
92
92
  end: int = 0,
93
93
  worker_id: int | None = None,
94
94
  world_size: int = _WORLD_SIZE,
95
- num_kv_readers: int = 1,
96
95
  ) -> IPCCacheServerKey:
97
96
  """Build an IPCCacheServerKey."""
98
97
  return IPCCacheServerKey.from_token_ids(
99
98
  model_name=_MODEL_NAME,
100
99
  world_size=world_size,
101
- num_kv_readers=num_kv_readers,
102
100
  worker_id=worker_id,
103
101
  token_ids=token_ids,
104
102
  start=start,
@@ -114,10 +112,9 @@ def _send_lookup(
114
112
  ) -> bool:
115
113
  """LOOKUP — submit a prefix lookup.
116
114
 
117
- The server reserves ``key.num_kv_readers`` read locks per chunk
118
- (each reader's RETRIEVE releases one; see
119
- ``IPCCacheServerKey.require_num_kv_readers``). ``tp_size`` is
120
- a legacy wire field the server ignores.
115
+ The server reserves one read lock per chunk per rank that shares the
116
+ object (``EngineGroupInfo.tp_replicas``); each reader's RETRIEVE
117
+ releases one. ``tp_size`` is a legacy wire field the server ignores.
121
118
 
122
119
  The server-side handler returns ``None`` (void) on success, so
123
120
  we only distinguish RPC timeout from a completed call.
@@ -134,7 +131,7 @@ def _poll_prefetch_status(
134
131
  ) -> int | None:
135
132
  """QUERY_PREFETCH_STATUS — poll until done.
136
133
 
137
- Returns the hit chunk count, or ``None`` if the polling budget
134
+ Returns the hit token count, or ``None`` if the polling budget
138
135
  is exhausted. The server keys prefetch jobs by ``request_id``
139
136
  (str), not an integer job handle.
140
137
  """
@@ -51,7 +51,7 @@ class CoordinatorCommand(BaseCommand):
51
51
  "--host",
52
52
  type=str,
53
53
  default=None,
54
- help="Host the coordinator's HTTP server binds to (default: 0.0.0.0).",
54
+ help="Host the coordinator's HTTP server binds to (default: 127.0.0.1).",
55
55
  )
56
56
  parser.add_argument(
57
57
  "--port",
@@ -29,7 +29,7 @@ from lmcache.cli.http import (
29
29
 
30
30
  if TYPE_CHECKING:
31
31
  # First Party
32
- from lmcache.cli.metrics import Metrics
32
+ from lmcache.v1.common.metrics import Metrics
33
33
 
34
34
  # -------------------------------------------------------------------
35
35
  # Shared helpers
@@ -127,6 +127,12 @@ def fmt_bytes(n: int) -> str:
127
127
  return f"{n} B"
128
128
 
129
129
 
130
+ def fmt_l1_used(used_bytes: int, total_bytes: int) -> str:
131
+ """Format L1 usage as GB with its share of capacity, e.g. ``0.33 (8.3%)``."""
132
+ pct = used_bytes / total_bytes * 100 if total_bytes > 0 else 0.0
133
+ return f"{used_bytes / 1024**3:.2f} ({pct:.1f}%)"
134
+
135
+
130
136
  def fmt_health(is_healthy: object) -> str | None:
131
137
  """Format a boolean health flag as ``'OK'`` / ``'UNHEALTHY'``."""
132
138
  if is_healthy is None:
@@ -183,51 +189,43 @@ class KVCacheDescriber:
183
189
  self.metrics.add("chunk_size", "Chunk size", self.data.get("chunk_size"))
184
190
 
185
191
  def add_l1_storage(self) -> None:
186
- """L1 cache capacity, usage, eviction, and object count."""
187
- total_bytes = safe_get(
188
- self.data, "storage_manager", "l1_manager", "memory_total_bytes"
189
- )
190
- if total_bytes is not None:
191
- self.metrics.add(
192
- "l1_capacity_gb",
193
- "L1 capacity (GB)",
194
- round(total_bytes / (1024**3), 2),
195
- )
196
- else:
197
- self.metrics.add("l1_capacity_gb", "L1 capacity (GB)", None)
192
+ """L1 totals across all L1s, plus one section per L1 when there are several.
198
193
 
199
- used_bytes = safe_get(
200
- self.data, "storage_manager", "l1_manager", "memory_used_bytes"
201
- )
202
- usage_ratio = safe_get(
203
- self.data, "storage_manager", "l1_manager", "memory_usage_ratio"
204
- )
205
- if used_bytes is not None and usage_ratio is not None:
206
- gb = used_bytes / (1024**3)
207
- pct = usage_ratio * 100
208
- self.metrics.add("l1_used_gb", "L1 used (GB)", f"{gb:.2f} ({pct:.1f}%)")
209
- else:
210
- self.metrics.add("l1_used_gb", "L1 used (GB)", None)
211
-
212
- self.metrics.add(
213
- "eviction_policy",
214
- "Eviction policy",
215
- safe_get(
216
- self.data,
217
- "storage_manager",
218
- "eviction_controller",
219
- "eviction_policy",
220
- ),
194
+ Reads the per-tag ``l1_managers`` and ``l1_eviction_controllers`` maps,
195
+ which ``/status`` sends for any number of L1s. The single-L1 keys
196
+ (``l1_manager``, ``l1_eviction_controller``) are omitted on multi-L1
197
+ servers, so they cannot describe every deployment.
198
+ """
199
+ managers = safe_get(self.data, "storage_manager", "l1_managers") or {}
200
+ evictions = (
201
+ safe_get(self.data, "storage_manager", "l1_eviction_controllers") or {}
221
202
  )
203
+ capacity_gb: float | None = None
204
+ used_gb: str | None = None
205
+ objects: int | None = None
206
+ if managers:
207
+ total = sum(m["memory_total_bytes"] for m in managers.values())
208
+ used = sum(m["memory_used_bytes"] for m in managers.values())
209
+ capacity_gb = round(total / (1024**3), 2)
210
+ used_gb = fmt_l1_used(used, total)
211
+ objects = sum(m["total_object_count"] for m in managers.values())
212
+ # Each L1 may set its own policy; list each distinct one once.
213
+ policies = dict.fromkeys(e["eviction_policy"] for e in evictions.values())
214
+
215
+ self.metrics.add("l1_capacity_gb", "L1 capacity (GB)", capacity_gb)
216
+ self.metrics.add("l1_used_gb", "L1 used (GB)", used_gb)
222
217
  self.metrics.add(
223
- "cached_objects",
224
- "Cached objects",
225
- safe_get(self.data, "storage_manager", "l1_manager", "total_object_count"),
218
+ "eviction_policy", "Eviction policy", ", ".join(policies) or None
226
219
  )
220
+ self.metrics.add("cached_objects", "Cached objects", objects)
227
221
  self.metrics.add(
228
222
  "active_sessions", "Active sessions", self.data.get("active_sessions")
229
223
  )
230
224
 
225
+ if len(managers) > 1:
226
+ for tag, manager in managers.items():
227
+ self._add_l1_section(tag, manager, evictions[tag])
228
+
231
229
  def add_models(self) -> None:
232
230
  """Per-model KV cache layout sections.
233
231
 
@@ -355,6 +353,31 @@ class KVCacheDescriber:
355
353
  f"{pool_used} / {pool_size} ({pct:.1f}%)",
356
354
  )
357
355
 
356
+ def _add_l1_section(self, tag: str, manager: dict, eviction: dict) -> None:
357
+ """Emit one ``l1_managers`` list section for the L1 tagged *tag*.
358
+
359
+ Args:
360
+ tag: The L1's configured tag.
361
+ manager: That L1's entry in ``storage_manager.l1_managers``.
362
+ eviction: That L1's entry in ``storage_manager.l1_eviction_controllers``.
363
+ """
364
+ self.metrics.add_list_section("l1_managers", f"l1_{tag}", f"L1: {tag}")
365
+ sec = self.metrics[f"l1_{tag}"]
366
+ sec.add("tag", "Tag", tag)
367
+ sec.add("backend", "Backend", manager["backend"])
368
+ sec.add(
369
+ "capacity_gb",
370
+ "Capacity (GB)",
371
+ round(manager["memory_total_bytes"] / (1024**3), 2),
372
+ )
373
+ sec.add(
374
+ "used_gb",
375
+ "Used (GB)",
376
+ fmt_l1_used(manager["memory_used_bytes"], manager["memory_total_bytes"]),
377
+ )
378
+ sec.add("cached_objects", "Cached objects", manager["total_object_count"])
379
+ sec.add("eviction_policy", "Eviction policy", eviction["eviction_policy"])
380
+
358
381
 
359
382
  # -------------------------------------------------------------------
360
383
  # Engine describer