Skip to content

Commit 76348e0

Browse files
feature: add RBLNLMCacheConnectorV1 for LMCache KV cache offloading (#523)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e014cc2 commit 76348e0

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2025 Rebellions Inc. All rights reserved.
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at:
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2025 Rebellions Inc. All rights reserved.
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at:
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

vllm_rbln/distributed/kv_transfer/kv_connector/factory.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@
1919
"vllm_rbln.distributed.kv_transfer.kv_connector.v1.rbln_nixl_connector",
2020
"RblnNixlConnector",
2121
)
22+
KVConnectorFactory.register_connector(
23+
"RBLNLMCacheConnectorV1",
24+
"vllm_rbln.distributed.kv_transfer.kv_connector.v1.rbln_lmcache_connector",
25+
"RBLNLMCacheConnectorV1",
26+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2025 Rebellions Inc. All rights reserved.
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at:
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2025 Rebellions Inc. All rights reserved.
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at:
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""RBLN LMCache KV connector for vLLM — thin re-export shim.
16+
17+
All RBLN-specific logic lives in the ``lmcache_rbln`` package.
18+
This module re-exports ``RBLNLMCacheConnectorV1`` so that vllm-rbln's
19+
factory registration can reference it via a stable path inside the
20+
``vllm_rbln`` namespace.
21+
22+
Usage in vLLM config::
23+
24+
kv_connector = (
25+
"vllm_rbln.distributed.kv_transfer"
26+
".kv_connector.v1.rbln_lmcache_connector"
27+
".RBLNLMCacheConnectorV1"
28+
)
29+
"""
30+
31+
from lmcache_rbln.integration.vllm.connector import RBLNLMCacheConnectorV1
32+
33+
__all__ = ["RBLNLMCacheConnectorV1"]

vllm_rbln/v1/worker/rbln_model_runner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,6 +4510,9 @@ def rbln_copy_kv_blocks(
45104510

45114511
kv_transfer_group.set_host_xfer_buffer_ops(rbln_copy_kv_blocks)
45124512

4513+
if hasattr(kv_transfer_group, "set_runtime_holder"):
4514+
kv_transfer_group.set_runtime_holder(self.runtime_holder)
4515+
45134516
if self.dcp_world_size > 1:
45144517
layer_type = cast(type[Any], AttentionLayerBase)
45154518
layers = get_layers_from_vllm_config(self.vllm_config, layer_type)

0 commit comments

Comments
 (0)