lmcache-cli 0.5.8.dev0__py3-none-any.whl → 0.5.8rc2.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.
- lmcache/_version.py +3 -3
- lmcache/cli/commands/base.py +38 -0
- lmcache/cli/commands/bench/l2_adapter_bench/command.py +28 -10
- lmcache/cli/commands/bench/l2_adapter_bench/data.py +9 -2
- lmcache/cli/commands/bench/l2_adapter_bench/result.py +6 -1
- lmcache/cli/commands/bench/l2_adapter_bench/runner.py +3 -0
- lmcache/cli/commands/bench/server_bench/arguments.py +12 -0
- lmcache/cli/commands/bench/server_bench/buffers.py +6 -2
- lmcache/cli/commands/bench/server_bench/client.py +21 -16
- lmcache/cli/commands/bench/server_bench/command.py +7 -0
- lmcache/cli/commands/bench/server_bench/config.py +5 -0
- lmcache/cli/commands/bench/server_bench/helpers.py +6 -9
- lmcache/cli/commands/query/_coordinator.py +6 -8
- lmcache/cli/commands/query/_request.py +90 -29
- lmcache/cli/commands/quota/_helpers.py +1 -7
- lmcache/cli/commands/quota/delete_command.py +2 -1
- lmcache/cli/commands/quota/get_command.py +2 -1
- lmcache/cli/commands/quota/set_command.py +2 -1
- lmcache/cli/commands/trace/_driver.py +69 -64
- lmcache/cli/http.py +18 -3
- lmcache/cli/profiling.py +13 -11
- lmcache/integration/atom/multi_process_adapter.py +12 -107
- lmcache/integration/sglang/unified_lmcache_mp_connector.py +181 -119
- lmcache/integration/tensorrt_llm/__init__.py +3 -1
- lmcache/integration/tensorrt_llm/tensorrt_mp_adapter.py +5 -11
- lmcache/integration/vllm/experimental/dispatcher.py +5 -2
- lmcache/integration/vllm/experimental/token_drop_adapter.py +149 -0
- lmcache/integration/vllm/experimental/token_drop_scheduler.py +20 -0
- lmcache/integration/vllm/kv_cache_group_edits.py +57 -9
- lmcache/integration/vllm/kv_cache_groups.py +127 -23
- lmcache/integration/vllm/lazy_offload_manager.py +1 -0
- lmcache/integration/vllm/lmcache_mp_connector.py +453 -165
- lmcache/integration/vllm/lmcache_mp_metadata.py +167 -29
- lmcache/integration/vllm/mp_lookup_state.py +25 -23
- lmcache/integration/vllm/mp_server_launcher.py +1 -1
- lmcache/integration/vllm/utils.py +58 -95
- lmcache/integration/vllm/vllm_multi_process_adapter.py +407 -532
- lmcache/lmcache_frontend/app.py +101 -10
- lmcache/lmcache_frontend/static/index.html +2 -0
- lmcache/lmcache_frontend/static/js/app.js +15 -3
- lmcache/sdk/cache_kind.py +21 -0
- lmcache/sdk/context.py +181 -133
- lmcache/sdk/qringbuffer.py +55 -13
- lmcache/sdk/request.py +19 -4
- lmcache/sdk/wrapper/__init__.py +11 -2
- lmcache/sdk/wrapper/ring_mapping.py +234 -0
- lmcache/sdk/wrapper/ring_transfer.py +498 -0
- lmcache/security/api_key.py +12 -0
- lmcache/tools/cache_simulator/README.md +1 -1
- lmcache/tools/cache_simulator/lru_cache.py +14 -8
- lmcache/tools/cache_simulator/simulator.py +9 -2
- lmcache/tools/cache_simulator/trace_analyze.py +3 -3
- lmcache/tools/transfer_channel_benchmark/README.md +82 -9
- lmcache/tools/transfer_channel_benchmark/benchmark.py +168 -50
- lmcache/tools/transfer_channel_benchmark/config.py +33 -17
- lmcache/usage_telemetry/README.md +7 -7
- lmcache/usage_telemetry/__init__.py +4 -3
- lmcache/usage_telemetry/base.py +2 -1
- lmcache/usage_telemetry/messages.py +3 -2
- lmcache/utils.py +1 -306
- lmcache/v1/client/__init__.py +6 -0
- lmcache/v1/{multiprocess/transfer_context → client}/async_engine_driven.py +4 -4
- lmcache/v1/client/heartbeat.py +172 -0
- lmcache/v1/{multiprocess → client}/kv_event_subscriber.py +4 -4
- lmcache/v1/{multiprocess → client}/transfer_context/__init__.py +4 -14
- lmcache/v1/{multiprocess → client}/transfer_context/base.py +5 -5
- lmcache/v1/{multiprocess → client}/transfer_context/inline.py +3 -3
- lmcache/v1/{multiprocess → client}/transfer_context/shm.py +3 -3
- lmcache/v1/client/transport/__init__.py +5 -0
- lmcache/v1/{multiprocess → client}/transport/errors.py +6 -1
- lmcache/v1/{multiprocess → client}/transport/factory.py +12 -2
- lmcache/v1/client/transport/grpc_impl/__init__.py +43 -0
- lmcache/v1/client/transport/grpc_impl/auth.py +70 -0
- lmcache/v1/{multiprocess → client}/transport/grpc_impl/client.py +23 -40
- lmcache/v1/client/transport/zmq_impl/__init__.py +68 -0
- lmcache/v1/{multiprocess → client}/transport/zmq_impl/client.py +3 -3
- lmcache/v1/client/transport/zmq_impl/mq_client.py +564 -0
- lmcache/v1/client/transport/zmq_impl/polling_loop.py +232 -0
- lmcache/v1/{multiprocess/transfer_context → client}/worker_transfer.py +84 -44
- lmcache/v1/common/__init__.py +5 -0
- lmcache/v1/common/attn_window.py +79 -0
- lmcache/v1/common/custom_types.py +372 -0
- lmcache/v1/common/group_view.py +325 -0
- lmcache/v1/{gpu_connector → common}/kv_format/__init__.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/contiguity.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/detection.py +4 -4
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/__init__.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/atom.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/base.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/registry.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/sglang.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/trtllm.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/detectors/vllm.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/specs/__init__.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/specs/base.py +17 -10
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nb_nl_two_bs_nh_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nb_nl_two_nh_bs_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_hs.py +2 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_cs.py +3 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_hs.py +2 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bs_nh_two_hs.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_bsv_bss.py +2 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_nh_bs_cs.py +3 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_nh_bs_two_hs.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_bs_nh_hs.py +5 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_nh_bs_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nb_two_nh_one_bs_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_nbbs_one_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_np_x_nb_bs_one_hs.py +2 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_bs_nh_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_nh_bs_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_nb_nh_one_bs_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/nl_x_two_x_nb_bs_nh_hs.py +4 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/registry.py +2 -2
- lmcache/v1/{gpu_connector → common}/kv_format/specs/two_x_nl_x_nb_bs_nh_hs.py +1 -1
- lmcache/v1/{gpu_connector → common}/kv_format/specs/two_x_nl_x_nbbs_nh_hs.py +1 -1
- lmcache/v1/{multiprocess → common}/token_hasher.py +1 -1
- lmcache/v1/{distributed → common}/transfer_channel/api.py +2 -2
- lmcache/v1/{gpu_connector → common}/utils.py +28 -57
- lmcache/v1/distributed/api.py +172 -92
- lmcache/v1/distributed/config.py +110 -5
- lmcache/v1/distributed/eviction_policy/isolated_lru.py +9 -4
- lmcache/v1/distributed/key_codec.py +52 -14
- lmcache/v1/distributed/l1_manager/__init__.py +4 -0
- lmcache/v1/distributed/l1_manager/factory.py +9 -5
- lmcache/v1/distributed/l1_manager/shadow.py +227 -0
- lmcache/v1/distributed/l2_adapters/hf3fs_l2_adapter.py +20 -2
- lmcache/v1/distributed/l2_adapters/native_connector_l2_adapter.py +6 -5
- lmcache/v1/distributed/l2_adapters/p2p_l2_adapter.py +3 -3
- lmcache/v1/distributed/l2_adapters/raw_block/__init__.py +2 -8
- lmcache/v1/distributed/l2_adapters/raw_block/core.py +7 -37
- lmcache/v1/distributed/l2_adapters/raw_block/key_codec.py +2 -70
- lmcache/v1/distributed/l2_adapters/raw_block_l2_adapter.py +1 -1
- lmcache/v1/distributed/l2_adapters/resp_l2_adapter.py +19 -8
- lmcache/v1/distributed/l2_adapters/valkey/blob_tcp_worker_pool.py +193 -0
- lmcache/v1/distributed/l2_adapters/valkey/rdma_worker_pool.py +446 -0
- lmcache/v1/distributed/l2_adapters/valkey/worker_pool.py +20 -5
- lmcache/v1/distributed/l2_adapters/valkey_l2_adapter.py +181 -37
- lmcache/v1/distributed/memory_manager/__init__.py +7 -0
- lmcache/v1/distributed/memory_manager/shadow_l1_memory_manager.py +78 -0
- lmcache/v1/distributed/serde/utils.py +6 -6
- lmcache/v1/distributed/storage_controllers/prefetch_controller.py +69 -26
- lmcache/v1/distributed/storage_controllers/prefetch_policy.py +18 -12
- lmcache/v1/distributed/storage_manager.py +5 -1
- lmcache/v1/distributed/transfer_channel/__init__.py +5 -5
- lmcache/v1/distributed/transfer_channel/abstract.py +83 -11
- lmcache/v1/distributed/transfer_channel/impl/mooncake_te_impl.py +103 -49
- lmcache/v1/distributed/transfer_channel/impl/nixl_impl.py +156 -55
- lmcache/v1/kv_layer_groups.py +14 -34
- lmcache/v1/memory_management.py +264 -1
- lmcache/v1/memory_orchestrator/_codec.py +2 -2
- lmcache/v1/memory_orchestrator/_proto_gen/__init__.py +1 -1
- lmcache/v1/memory_orchestrator/_proto_gen/memory_orchestrator_pb2.pyi +1 -1
- lmcache/v1/memory_orchestrator/client.py +5 -1
- lmcache/v1/mp_coordinator/api.py +30 -1
- lmcache/v1/mp_coordinator/app.py +2 -2
- lmcache/v1/mp_coordinator/blend_client.py +1 -0
- lmcache/v1/mp_coordinator/blend_index.py +2 -2
- lmcache/v1/mp_coordinator/cache_events.py +1 -1
- lmcache/v1/mp_coordinator/controllers/eviction_controller.py +2 -7
- lmcache/v1/mp_coordinator/controllers/eviction_http_api.py +3 -0
- lmcache/v1/mp_coordinator/controllers/prefetch_manager.py +7 -1
- lmcache/v1/mp_coordinator/http_apis/cache_api.py +1 -0
- lmcache/v1/mp_coordinator/http_apis/dependencies.py +1 -1
- lmcache/v1/mp_coordinator/http_apis/directory_api.py +2 -0
- lmcache/v1/mp_coordinator/http_apis/instances_usage_api.py +7 -2
- lmcache/v1/mp_coordinator/http_auth.py +1 -1
- lmcache/v1/mp_coordinator/registrar.py +1 -1
- lmcache/v1/mp_coordinator/schemas.py +28 -1
- lmcache/v1/mp_coordinator/utils/encoding.py +14 -7
- lmcache/v1/mp_observability/event_bus.py +2 -1
- lmcache/v1/mp_observability/trace/codecs.py +3 -3
- lmcache/v1/multiprocess/cache_control/key_resolver.py +35 -6
- lmcache/v1/multiprocess/cache_control/prefetch_service.py +8 -0
- lmcache/v1/multiprocess/config.py +45 -8
- lmcache/v1/multiprocess/custom_types.py +12 -381
- lmcache/v1/multiprocess/engine_context.py +165 -15
- lmcache/v1/multiprocess/ext_server_module.py +5 -5
- lmcache/v1/multiprocess/group_view.py +24 -277
- lmcache/v1/multiprocess/http_apis/cache_api.py +1 -0
- lmcache/v1/multiprocess/http_apis/common/metrics_api.py +4 -1
- lmcache/v1/multiprocess/http_apis/schemas.py +8 -1
- lmcache/v1/multiprocess/http_server.py +1 -1
- lmcache/v1/multiprocess/modules/blend/lookup.py +63 -31
- lmcache/v1/multiprocess/modules/blend/matcher.py +27 -14
- lmcache/v1/multiprocess/modules/blend/module.py +21 -11
- lmcache/v1/multiprocess/modules/blend/read_set.py +33 -13
- lmcache/v1/multiprocess/modules/blend/registration.py +1 -1
- lmcache/v1/multiprocess/modules/blend/retrieve.py +17 -26
- lmcache/v1/multiprocess/modules/blend/rope.py +1 -1
- lmcache/v1/multiprocess/modules/blend/store.py +16 -4
- lmcache/v1/multiprocess/modules/engine_driven_transfer.py +10 -18
- lmcache/v1/multiprocess/modules/kv_events.py +10 -10
- lmcache/v1/multiprocess/modules/lmcache_driven_transfer.py +330 -77
- lmcache/v1/multiprocess/modules/lookup.py +188 -43
- lmcache/v1/multiprocess/modules/management.py +4 -4
- lmcache/v1/multiprocess/modules/p2p_controller.py +1 -1
- lmcache/v1/multiprocess/modules/server_transfer.py +20 -22
- lmcache/v1/multiprocess/object_group_transfer.py +316 -1
- lmcache/v1/multiprocess/plugin_modules/qstore.py +710 -10
- lmcache/v1/multiprocess/request_handler.py +1 -1
- lmcache/v1/multiprocess/server.py +15 -1
- lmcache/v1/multiprocess/session.py +55 -100
- lmcache/v1/multiprocess/transport/base.py +44 -9
- lmcache/v1/multiprocess/transport/grpc_impl/__init__.py +0 -35
- lmcache/v1/multiprocess/transport/grpc_impl/aio_server.py +13 -3
- lmcache/v1/multiprocess/transport/grpc_impl/auth.py +134 -0
- lmcache/v1/multiprocess/transport/grpc_impl/native_server.py +25 -20
- lmcache/v1/multiprocess/transport/grpc_impl/server.py +17 -4
- lmcache/v1/multiprocess/transport/grpc_impl/server_base.py +10 -5
- lmcache/v1/multiprocess/transport/grpc_impl/server_builder.py +2 -0
- lmcache/v1/multiprocess/transport/grpc_impl/server_handlers.py +52 -5
- lmcache/v1/multiprocess/transport/server_factory.py +2 -0
- lmcache/v1/multiprocess/transport/zmq_impl/__init__.py +0 -58
- lmcache/v1/multiprocess/transport/zmq_impl/mq.py +83 -444
- lmcache/v1/multiprocess/transport/zmq_impl/server.py +3 -1
- lmcache/v1/platform/__init__.py +8 -1
- lmcache/v1/platform/base/cache_context.py +14 -1
- lmcache/v1/platform/base/device_spec.py +1 -1
- lmcache/v1/platform/base/ipc_wrapper.py +63 -1
- lmcache/v1/platform/cache_context.py +3 -3
- lmcache/v1/platform/devices/cpu/__init__.py +1 -1
- lmcache/v1/platform/devices/cpu/cache_context.py +19 -4
- lmcache/v1/platform/devices/cpu/shm.py +5 -5
- lmcache/v1/platform/devices/cuda/cache_context.py +24 -9
- lmcache/v1/platform/devices/cuda/ipc_wrapper.py +17 -53
- lmcache/v1/platform/devices/mlu/device_ops.py +1 -1
- lmcache/v1/platform/devices/musa/__init__.py +1 -1
- lmcache/v1/platform/devices/musa/cache_context.py +25 -10
- lmcache/v1/platform/devices/musa/device_ops.py +156 -3
- lmcache/v1/platform/devices/musa/format_capabilities.py +2 -2
- lmcache/v1/platform/devices/musa/ipc_wrapper.py +32 -4
- lmcache/v1/platform/devices/musa/native_kv_transfer.py +1 -1
- lmcache/v1/platform/devices/neuron/device_ops.py +1 -1
- lmcache/v1/platform/devices/npu/cache_context.py +25 -5
- lmcache/v1/platform/devices/rbln/device_ops.py +2 -2
- lmcache/v1/platform/fd_channel.py +365 -0
- lmcache/v1/platform/kv_wrap.py +62 -3
- lmcache/v1/platform/native_block_transfer.py +2 -2
- lmcache/v1/platform/torch_ops/_kv_format.py +2 -2
- lmcache/v1/platform/torch_ops/mp_mem_kernels.py +1 -1
- lmcache/v1/protocol.py +1 -1
- lmcache/v1/rpc_utils.py +2 -1
- lmcache/v1/transport/__init__.py +6 -0
- lmcache/v1/transport/grpc/__init__.py +2 -0
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/__init__.py +1 -1
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/_generate.py +2 -2
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/common_pb2.pyi +20 -9
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/p2p_service_pb2.pyi +1 -1
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/__init__.py +3 -3
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/common.py +3 -3
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/p2p.py +2 -2
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/descriptors.py +2 -3
- lmcache/v1/transport/grpc/endpoint.py +43 -0
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/method_registry.py +4 -45
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/proto_codec.py +1 -1
- lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/common.proto +5 -1
- lmcache/v1/transport/grpc/protos/qstore_service.proto +75 -0
- lmcache/v1/transport/qstore.py +33 -0
- lmcache/v1/{multiprocess → transport}/rpc.py +1 -1
- lmcache/v1/transport/zmq/__init__.py +2 -0
- lmcache/v1/{multiprocess/transport/zmq_impl → transport/zmq}/wire.py +45 -1
- lmcache/v1/utils/frozen_dict.py +39 -0
- {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc2.dev0.dist-info}/METADATA +1 -1
- lmcache_cli-0.5.8rc2.dev0.dist-info/RECORD +735 -0
- lmcache/inprocess/__init__.py +0 -2
- lmcache/inprocess/integration/__init__.py +0 -2
- lmcache/inprocess/integration/base_service_factory.py +0 -171
- lmcache/inprocess/integration/tensorrt_llm/tensorrt_adapter.py +0 -377
- lmcache/inprocess/integration/tensorrt_llm/utils.py +0 -94
- lmcache/inprocess/integration/vllm/__init__.py +0 -2
- lmcache/inprocess/integration/vllm/lmcache_connector_v1.py +0 -210
- lmcache/inprocess/integration/vllm/lmcache_connector_v1_085.py +0 -147
- lmcache/inprocess/integration/vllm/utils.py +0 -160
- lmcache/inprocess/integration/vllm/vllm_ec_adapter.py +0 -194
- lmcache/inprocess/integration/vllm/vllm_service_factory.py +0 -343
- lmcache/inprocess/integration/vllm/vllm_v1_adapter.py +0 -1947
- lmcache/inprocess/observability.py +0 -1998
- lmcache/inprocess/standalone/__init__.py +0 -1
- lmcache/inprocess/standalone/__main__.py +0 -599
- lmcache/inprocess/standalone/manager.py +0 -82
- lmcache/inprocess/standalone/standalone_service_factory.py +0 -86
- lmcache/inprocess/tools/__init__.py +0 -1
- lmcache/inprocess/tools/controller_benchmark/README.md +0 -161
- lmcache/inprocess/tools/controller_benchmark/__init__.py +0 -1
- lmcache/inprocess/tools/controller_benchmark/__main__.py +0 -331
- lmcache/inprocess/tools/controller_benchmark/benchmark.py +0 -660
- lmcache/inprocess/tools/controller_benchmark/config.py +0 -44
- lmcache/inprocess/tools/controller_benchmark/constants.py +0 -10
- lmcache/inprocess/tools/controller_benchmark/handlers/__init__.py +0 -31
- lmcache/inprocess/tools/controller_benchmark/handlers/admit.py +0 -52
- lmcache/inprocess/tools/controller_benchmark/handlers/base.py +0 -47
- lmcache/inprocess/tools/controller_benchmark/handlers/deregister.py +0 -49
- lmcache/inprocess/tools/controller_benchmark/handlers/evict.py +0 -52
- lmcache/inprocess/tools/controller_benchmark/handlers/heartbeat.py +0 -56
- lmcache/inprocess/tools/controller_benchmark/handlers/p2p_lookup.py +0 -47
- lmcache/inprocess/tools/controller_benchmark/handlers/register.py +0 -56
- lmcache/inprocess/usage_telemetry/__init__.py +0 -1
- lmcache/inprocess/usage_telemetry/context.py +0 -106
- lmcache/inprocess/usage_telemetry/continuous.py +0 -212
- lmcache/inprocess/usage_telemetry/messages.py +0 -111
- lmcache/inprocess/v1/__init__.py +0 -1
- lmcache/inprocess/v1/api_server/__init__.py +0 -2
- lmcache/inprocess/v1/api_server/__main__.py +0 -545
- lmcache/inprocess/v1/basic_check.py +0 -112
- lmcache/inprocess/v1/cache_controller/__init__.py +0 -11
- lmcache/inprocess/v1/cache_controller/commands/__init__.py +0 -15
- lmcache/inprocess/v1/cache_controller/commands/base.py +0 -35
- lmcache/inprocess/v1/cache_controller/commands/full_sync.py +0 -49
- lmcache/inprocess/v1/cache_controller/config.py +0 -179
- lmcache/inprocess/v1/cache_controller/controller_manager.py +0 -552
- lmcache/inprocess/v1/cache_controller/controllers/__init__.py +0 -11
- lmcache/inprocess/v1/cache_controller/controllers/full_sync_tracker.py +0 -473
- lmcache/inprocess/v1/cache_controller/controllers/kv_controller.py +0 -441
- lmcache/inprocess/v1/cache_controller/controllers/registration_controller.py +0 -285
- lmcache/inprocess/v1/cache_controller/executor.py +0 -470
- lmcache/inprocess/v1/cache_controller/frontend/static/css/style.css +0 -201
- lmcache/inprocess/v1/cache_controller/frontend/static/img/logo.png +0 -0
- lmcache/inprocess/v1/cache_controller/frontend/static/index.html +0 -234
- lmcache/inprocess/v1/cache_controller/frontend/static/js/controller_app.js +0 -660
- lmcache/inprocess/v1/cache_controller/full_sync_sender.py +0 -475
- lmcache/inprocess/v1/cache_controller/locks.py +0 -149
- lmcache/inprocess/v1/cache_controller/message.py +0 -828
- lmcache/inprocess/v1/cache_controller/observability.py +0 -208
- lmcache/inprocess/v1/cache_controller/utils.py +0 -685
- lmcache/inprocess/v1/cache_controller/worker.py +0 -668
- lmcache/inprocess/v1/cache_engine.py +0 -2216
- lmcache/inprocess/v1/cache_interface.py +0 -19
- lmcache/inprocess/v1/check/__init__.py +0 -76
- lmcache/inprocess/v1/check/check_mode_gen.py +0 -86
- lmcache/inprocess/v1/check/check_mode_test_l2_adapter.py +0 -327
- lmcache/inprocess/v1/check/check_mode_test_remote.py +0 -155
- lmcache/inprocess/v1/check/check_mode_test_storage_manager.py +0 -142
- lmcache/inprocess/v1/check/utils.py +0 -566
- lmcache/inprocess/v1/compute/__init__.py +0 -2
- lmcache/inprocess/v1/compute/attention/__init__.py +0 -1
- lmcache/inprocess/v1/compute/attention/abstract.py +0 -39
- lmcache/inprocess/v1/compute/attention/flash_attn.py +0 -139
- lmcache/inprocess/v1/compute/attention/flash_infer_sparse.py +0 -285
- lmcache/inprocess/v1/compute/attention/metadata.py +0 -176
- lmcache/inprocess/v1/compute/attention/triton_kernels/__init__.py +0 -13
- lmcache/inprocess/v1/compute/attention/triton_kernels/block_sparse_attention.py +0 -559
- lmcache/inprocess/v1/compute/attention/triton_sparse.py +0 -149
- lmcache/inprocess/v1/compute/attention/utils.py +0 -103
- lmcache/inprocess/v1/compute/blend/__init__.py +0 -7
- lmcache/inprocess/v1/compute/blend/blender.py +0 -172
- lmcache/inprocess/v1/compute/blend/metadata.py +0 -34
- lmcache/inprocess/v1/compute/blend/utils.py +0 -64
- lmcache/inprocess/v1/compute/models/__init__.py +0 -0
- lmcache/inprocess/v1/compute/models/base.py +0 -156
- lmcache/inprocess/v1/compute/models/llama.py +0 -9
- lmcache/inprocess/v1/compute/models/qwen3.py +0 -24
- lmcache/inprocess/v1/compute/models/utils.py +0 -69
- lmcache/inprocess/v1/compute/positional_encoding.py +0 -203
- lmcache/inprocess/v1/config.py +0 -1228
- lmcache/inprocess/v1/config_base.py +0 -849
- lmcache/inprocess/v1/ec_engine.py +0 -202
- lmcache/inprocess/v1/event_manager.py +0 -145
- lmcache/inprocess/v1/gpu_connector/__init__.py +0 -184
- lmcache/inprocess/v1/gpu_connector/gpu_connectors.py +0 -1743
- lmcache/inprocess/v1/gpu_connector/hpu_connector.py +0 -340
- lmcache/inprocess/v1/gpu_connector/mock_gpu_connector.py +0 -67
- lmcache/inprocess/v1/gpu_connector/musa_connectors.py +0 -952
- lmcache/inprocess/v1/gpu_connector/utils.py +0 -41
- lmcache/inprocess/v1/gpu_connector/xpu_connectors.py +0 -1241
- lmcache/inprocess/v1/health_monitor/__init__.py +0 -1
- lmcache/inprocess/v1/health_monitor/base.py +0 -577
- lmcache/inprocess/v1/health_monitor/checks/__init__.py +0 -1
- lmcache/inprocess/v1/health_monitor/checks/remote_backend_check.py +0 -311
- lmcache/inprocess/v1/health_monitor/constants.py +0 -36
- lmcache/inprocess/v1/hidden_state_store.py +0 -365
- lmcache/inprocess/v1/internal_api_server/__init__.py +0 -0
- lmcache/inprocess/v1/internal_api_server/api_registry.py +0 -63
- lmcache/inprocess/v1/internal_api_server/api_server.py +0 -134
- lmcache/inprocess/v1/internal_api_server/controller/__init__.py +0 -0
- lmcache/inprocess/v1/internal_api_server/controller/key_stats_api.py +0 -81
- lmcache/inprocess/v1/internal_api_server/controller/worker_info_api.py +0 -136
- lmcache/inprocess/v1/internal_api_server/utils.py +0 -43
- lmcache/inprocess/v1/internal_api_server/vllm/__init__.py +0 -0
- lmcache/inprocess/v1/internal_api_server/vllm/backend_api.py +0 -221
- lmcache/inprocess/v1/internal_api_server/vllm/bypass_api.py +0 -204
- lmcache/inprocess/v1/internal_api_server/vllm/cache_api.py +0 -897
- lmcache/inprocess/v1/internal_api_server/vllm/chunk_statistics_api.py +0 -141
- lmcache/inprocess/v1/internal_api_server/vllm/conf_api.py +0 -147
- lmcache/inprocess/v1/internal_api_server/vllm/freeze_api.py +0 -172
- lmcache/inprocess/v1/internal_api_server/vllm/hot_cache_api.py +0 -184
- lmcache/inprocess/v1/internal_api_server/vllm/inference_api.py +0 -65
- lmcache/inprocess/v1/internal_api_server/vllm/load_fs_chunks_api.py +0 -320
- lmcache/inprocess/v1/internal_api_server/vllm/lookup_api.py +0 -145
- lmcache/inprocess/v1/lookup_client/__init__.py +0 -27
- lmcache/inprocess/v1/lookup_client/abstract_client.py +0 -77
- lmcache/inprocess/v1/lookup_client/async_lookup_message.py +0 -50
- lmcache/inprocess/v1/lookup_client/chunk_statistics_lookup_client.py +0 -211
- lmcache/inprocess/v1/lookup_client/factory.py +0 -253
- lmcache/inprocess/v1/lookup_client/hit_limit_lookup_client.py +0 -94
- lmcache/inprocess/v1/lookup_client/lmcache_async_lookup_client.py +0 -410
- lmcache/inprocess/v1/lookup_client/lmcache_lookup_client.py +0 -296
- lmcache/inprocess/v1/lookup_client/lmcache_lookup_client_bypass.py +0 -102
- lmcache/inprocess/v1/lookup_client/mooncake_lookup_client.py +0 -98
- lmcache/inprocess/v1/lookup_client/record_strategies/__init__.py +0 -69
- lmcache/inprocess/v1/lookup_client/record_strategies/base.py +0 -327
- lmcache/inprocess/v1/lookup_client/record_strategies/file_hash.py +0 -130
- lmcache/inprocess/v1/lookup_client/record_strategies/memory_bloom_filter.py +0 -81
- lmcache/inprocess/v1/manager.py +0 -532
- lmcache/inprocess/v1/memory_allocators/__init__.py +0 -2
- lmcache/inprocess/v1/memory_allocators/cu_file_memory_allocator.py +0 -38
- lmcache/inprocess/v1/memory_allocators/hip_file_memory_allocator.py +0 -34
- lmcache/inprocess/v1/memory_allocators/paged_cpu_gpu_memory_allocator.py +0 -205
- lmcache/inprocess/v1/metadata.py +0 -121
- lmcache/inprocess/v1/offload_server/__init__.py +0 -19
- lmcache/inprocess/v1/offload_server/abstract_server.py +0 -37
- lmcache/inprocess/v1/offload_server/message.py +0 -30
- lmcache/inprocess/v1/offload_server/zmq_server.py +0 -122
- lmcache/inprocess/v1/protocol.py +0 -148
- lmcache/inprocess/v1/rpc/__init__.py +0 -17
- lmcache/inprocess/v1/rpc/transport.py +0 -105
- lmcache/inprocess/v1/rpc/zmq_transport.py +0 -213
- lmcache/inprocess/v1/rpc_utils.py +0 -218
- lmcache/inprocess/v1/storage_backend/__init__.py +0 -342
- lmcache/inprocess/v1/storage_backend/abstract_backend.py +0 -460
- lmcache/inprocess/v1/storage_backend/audit_backend.py +0 -252
- lmcache/inprocess/v1/storage_backend/batched_message_sender.py +0 -226
- lmcache/inprocess/v1/storage_backend/cache_policy/__init__.py +0 -47
- lmcache/inprocess/v1/storage_backend/cache_policy/base_policy.py +0 -87
- lmcache/inprocess/v1/storage_backend/cache_policy/fifo.py +0 -61
- lmcache/inprocess/v1/storage_backend/cache_policy/lfu.py +0 -108
- lmcache/inprocess/v1/storage_backend/cache_policy/lru.py +0 -84
- lmcache/inprocess/v1/storage_backend/cache_policy/mru.py +0 -64
- lmcache/inprocess/v1/storage_backend/connector/__init__.py +0 -426
- lmcache/inprocess/v1/storage_backend/connector/audit_adapter.py +0 -79
- lmcache/inprocess/v1/storage_backend/connector/audit_connector.py +0 -363
- lmcache/inprocess/v1/storage_backend/connector/azure_adapter.py +0 -73
- lmcache/inprocess/v1/storage_backend/connector/azure_connector.py +0 -335
- lmcache/inprocess/v1/storage_backend/connector/base_connector.py +0 -382
- lmcache/inprocess/v1/storage_backend/connector/bigtable_adapter.py +0 -35
- lmcache/inprocess/v1/storage_backend/connector/bigtable_connector.py +0 -1172
- lmcache/inprocess/v1/storage_backend/connector/bigtable_schema.py +0 -74
- lmcache/inprocess/v1/storage_backend/connector/blackhole_adapter.py +0 -26
- lmcache/inprocess/v1/storage_backend/connector/blackhole_connector.py +0 -38
- lmcache/inprocess/v1/storage_backend/connector/eic_adapter.py +0 -33
- lmcache/inprocess/v1/storage_backend/connector/eic_connector.py +0 -776
- lmcache/inprocess/v1/storage_backend/connector/external_adapter.py +0 -81
- lmcache/inprocess/v1/storage_backend/connector/fs_adapter.py +0 -51
- lmcache/inprocess/v1/storage_backend/connector/fs_connector.py +0 -411
- lmcache/inprocess/v1/storage_backend/connector/hf3fs_adapter.py +0 -291
- lmcache/inprocess/v1/storage_backend/connector/hf3fs_connector.py +0 -631
- lmcache/inprocess/v1/storage_backend/connector/hfbucket_adapter.py +0 -57
- lmcache/inprocess/v1/storage_backend/connector/hfbucket_connector.py +0 -782
- lmcache/inprocess/v1/storage_backend/connector/infinistore_adapter.py +0 -58
- lmcache/inprocess/v1/storage_backend/connector/infinistore_connector.py +0 -178
- lmcache/inprocess/v1/storage_backend/connector/instrumented_connector.py +0 -221
- lmcache/inprocess/v1/storage_backend/connector/mock_adapter.py +0 -59
- lmcache/inprocess/v1/storage_backend/connector/mock_connector.py +0 -354
- lmcache/inprocess/v1/storage_backend/connector/mooncakestore_adapter.py +0 -43
- lmcache/inprocess/v1/storage_backend/connector/mooncakestore_connector.py +0 -841
- lmcache/inprocess/v1/storage_backend/connector/redis_adapter.py +0 -199
- lmcache/inprocess/v1/storage_backend/connector/redis_connector.py +0 -833
- lmcache/inprocess/v1/storage_backend/connector/s3_adapter.py +0 -61
- lmcache/inprocess/v1/storage_backend/connector/s3_connector.py +0 -717
- lmcache/inprocess/v1/storage_backend/connector/sagemaker_hyperpod_adapter.py +0 -243
- lmcache/inprocess/v1/storage_backend/connector/sagemaker_hyperpod_connector.py +0 -1031
- lmcache/inprocess/v1/storage_backend/connector/valkey_adapter.py +0 -178
- lmcache/inprocess/v1/storage_backend/connector/valkey_connector.py +0 -441
- lmcache/inprocess/v1/storage_backend/gds_backend.py +0 -1323
- lmcache/inprocess/v1/storage_backend/hipfile_shim.py +0 -167
- lmcache/inprocess/v1/storage_backend/job_executor/__init__.py +0 -0
- lmcache/inprocess/v1/storage_backend/job_executor/base_executor.py +0 -34
- lmcache/inprocess/v1/storage_backend/job_executor/pq_executor.py +0 -237
- lmcache/inprocess/v1/storage_backend/legacy_serde/__init__.py +0 -1
- lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_basics.py +0 -210
- lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_decoder.py +0 -211
- lmcache/inprocess/v1/storage_backend/legacy_serde/cachegen_encoder.py +0 -396
- lmcache/inprocess/v1/storage_backend/legacy_serde/serde.py +0 -75
- lmcache/inprocess/v1/storage_backend/local_cpu_backend.py +0 -994
- lmcache/inprocess/v1/storage_backend/local_disk_backend.py +0 -844
- lmcache/inprocess/v1/storage_backend/maru_backend.py +0 -737
- lmcache/inprocess/v1/storage_backend/naive_serde/__init__.py +0 -57
- lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_basics.py +0 -135
- lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_decoder.py +0 -142
- lmcache/inprocess/v1/storage_backend/naive_serde/cachegen_encoder.py +0 -116
- lmcache/inprocess/v1/storage_backend/naive_serde/kivi_serde.py +0 -25
- lmcache/inprocess/v1/storage_backend/naive_serde/naive_serde.py +0 -21
- lmcache/inprocess/v1/storage_backend/naive_serde/serde.py +0 -37
- lmcache/inprocess/v1/storage_backend/native_clients/aerospike_client.py +0 -74
- lmcache/inprocess/v1/storage_backend/native_clients/connector_client_base.py +0 -165
- lmcache/inprocess/v1/storage_backend/native_clients/resp_client.py +0 -35
- lmcache/inprocess/v1/storage_backend/nixl_storage_backend.py +0 -2422
- lmcache/inprocess/v1/storage_backend/p2p_backend.py +0 -794
- lmcache/inprocess/v1/storage_backend/path_sharder.py +0 -115
- lmcache/inprocess/v1/storage_backend/pd_backend.py +0 -1093
- lmcache/inprocess/v1/storage_backend/pd_backend_async.py +0 -1735
- lmcache/inprocess/v1/storage_backend/plugins/dax_backend.py +0 -931
- lmcache/inprocess/v1/storage_backend/plugins/rust_raw_block_backend.py +0 -758
- lmcache/inprocess/v1/storage_backend/remote_backend.py +0 -629
- lmcache/inprocess/v1/storage_backend/resp_client.py +0 -227
- lmcache/inprocess/v1/storage_backend/storage_backend_listener.py +0 -21
- lmcache/inprocess/v1/storage_backend/storage_manager.py +0 -1429
- lmcache/inprocess/v1/system_detection.py +0 -116
- lmcache/inprocess/v1/token_database.py +0 -580
- lmcache/inprocess/v1/transfer_channel/__init__.py +0 -83
- lmcache/inprocess/v1/transfer_channel/abstract.py +0 -285
- lmcache/inprocess/v1/transfer_channel/mock_memory_channel.py +0 -156
- lmcache/inprocess/v1/transfer_channel/nixl_channel.py +0 -688
- lmcache/inprocess/v1/transfer_channel/py_socket_channel.py +0 -260
- lmcache/inprocess/v1/transfer_channel/transfer_utils.py +0 -61
- lmcache/integration/vllm/lmcache_connector_v1.py +0 -210
- lmcache/sdk/wrapper/contiguous.py +0 -82
- lmcache/v1/multiprocess/transport/grpc_impl/protos/qstore_service.proto +0 -16
- lmcache_cli-0.5.8.dev0.dist-info/RECORD +0 -949
- /lmcache/v1/{multiprocess → client}/client_config.py +0 -0
- /lmcache/v1/{multiprocess → client}/transfer_context/tensor_wire.py +0 -0
- /lmcache/v1/{gpu_connector → common}/kv_format/types.py +0 -0
- /lmcache/v1/{multiprocess → common}/token_codec.py +0 -0
- /lmcache/{inprocess/integration/tensorrt_llm → v1/common/transfer_channel}/__init__.py +0 -0
- /lmcache/v1/{multiprocess → platform}/posix_shm.py +0 -0
- /lmcache/v1/{multiprocess → platform}/transfer_mode.py +0 -0
- /lmcache/v1/{multiprocess/transport → transport}/auth.py +0 -0
- /lmcache/v1/{multiprocess → transport}/futures.py +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/_proto_gen/.gitignore +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/codecs/base.py +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/__init__.py +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/blend_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/engine_driven_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/extension_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/kv_event_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/lmcache_driven_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/lookup_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/management_service.proto +0 -0
- /lmcache/v1/{multiprocess/transport/grpc_impl → transport/grpc}/protos/p2p_service.proto +0 -0
- /lmcache/v1/{multiprocess/protocols → transport}/server_module.py +0 -0
- {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc2.dev0.dist-info}/WHEEL +0 -0
- {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc2.dev0.dist-info}/entry_points.txt +0 -0
- {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc2.dev0.dist-info}/licenses/LICENSE +0 -0
- {lmcache_cli-0.5.8.dev0.dist-info → lmcache_cli-0.5.8rc2.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.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 5, 8, 'dev0')
|
|
21
|
+
__version__ = version = '0.5.8rc2.dev0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 5, 8, 'rc2', 'dev0')
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g6a316c3e0'
|
lmcache/cli/commands/base.py
CHANGED
|
@@ -22,6 +22,44 @@ from lmcache.logging import init_logger
|
|
|
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=
|
|
100
|
+
type=positive_int,
|
|
96
101
|
default=1,
|
|
97
|
-
help="
|
|
102
|
+
help="Positive number of measurement rounds per operation (default: 1).",
|
|
98
103
|
)
|
|
99
104
|
parser.add_argument(
|
|
100
105
|
"--warmup-rounds",
|
|
101
|
-
type=
|
|
106
|
+
type=nonnegative_int,
|
|
102
107
|
default=1,
|
|
103
|
-
help="
|
|
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
|
-
#
|
|
611
|
-
|
|
612
|
-
|
|
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[
|
|
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=
|
|
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
|
-
#
|
|
88
|
-
|
|
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
|
-
|
|
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,22 +44,21 @@ 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.
|
|
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.
|
|
62
|
-
from lmcache.v1.multiprocess.transfer_context.worker_transfer import IPCEvent
|
|
61
|
+
from lmcache.v1.client.worker_transfer import IPCEvent, TransferContext
|
|
63
62
|
from lmcache.v1.multiprocess.transport.base import RequestClient
|
|
64
63
|
|
|
65
64
|
|
|
@@ -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
|
-
|
|
365
|
-
if
|
|
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[
|
|
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
|
-
|
|
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 =
|
|
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.
|
|
16
|
-
from lmcache.v1.multiprocess.futures import DeviceMessagingFuture, MessagingFuture
|
|
15
|
+
from lmcache.v1.common.custom_types import IPCCacheServerKey
|
|
17
16
|
from lmcache.v1.multiprocess.transport.base import RequestClient
|
|
17
|
+
from lmcache.v1.transport.futures import DeviceMessagingFuture, MessagingFuture
|
|
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
|
|
118
|
-
(each reader's RETRIEVE
|
|
119
|
-
|
|
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
|
|
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
|
"""
|
|
@@ -18,6 +18,7 @@ from __future__ import annotations
|
|
|
18
18
|
from collections.abc import Callable
|
|
19
19
|
from dataclasses import dataclass, field
|
|
20
20
|
from typing import Any
|
|
21
|
+
from urllib.parse import quote
|
|
21
22
|
import json
|
|
22
23
|
import sys
|
|
23
24
|
import urllib.error
|
|
@@ -25,6 +26,8 @@ import urllib.request
|
|
|
25
26
|
|
|
26
27
|
# First Party
|
|
27
28
|
from lmcache.cli.commands.describe import fmt_bytes
|
|
29
|
+
from lmcache.cli.commands.quota._helpers import escape_salt
|
|
30
|
+
from lmcache.cli.http import normalize_url as normalize_url
|
|
28
31
|
from lmcache.cli.metrics import Metrics
|
|
29
32
|
from lmcache.logging import init_logger
|
|
30
33
|
|
|
@@ -33,13 +36,6 @@ logger = init_logger(__name__)
|
|
|
33
36
|
_TIMEOUT = 10
|
|
34
37
|
|
|
35
38
|
|
|
36
|
-
def normalize_url(url: str) -> str:
|
|
37
|
-
"""Ensure *url* has a scheme and no trailing slash."""
|
|
38
|
-
if not url.startswith(("http://", "https://")):
|
|
39
|
-
url = f"http://{url}"
|
|
40
|
-
return url.rstrip("/")
|
|
41
|
-
|
|
42
|
-
|
|
43
39
|
def _fetch(url: str, timeout: int = _TIMEOUT) -> str:
|
|
44
40
|
"""GET *url* and return the body as text.
|
|
45
41
|
|
|
@@ -317,7 +313,9 @@ APIS: dict[str, CoordinatorApi] = {
|
|
|
317
313
|
"quota": CoordinatorApi(
|
|
318
314
|
summary="per-salt usage against quota",
|
|
319
315
|
path=lambda a: (
|
|
320
|
-
f"/quota/{a.cache_salt}"
|
|
316
|
+
f"/quota/{quote(escape_salt(a.cache_salt), safe='')}"
|
|
317
|
+
if a.cache_salt is not None
|
|
318
|
+
else "/quota"
|
|
321
319
|
),
|
|
322
320
|
render=_render_quota,
|
|
323
321
|
),
|