vllm.multimodal.cache.lru ¶
Implementation of Key-Replicated Cache (see docs/configuration/optimization.md).
Classes:
-
LruKeyReplicatedReceiverCache–The cache which is used on P1 when LRU caching is enabled.
-
LruKeyReplicatedSenderCache–The cache which is used on P0 when LRU caching is enabled.
LruKeyReplicatedReceiverCache ¶
Bases: BaseMultiModalReceiverCache
The cache which is used on P1 when LRU caching is enabled.
How to update each item:
- If the caller sent tensor data, store it (replacing any cached item under the same key) and return that data. P0 can miss after independent LRU eviction and resend a different item for the same identity.
- If the caller sent no data and the item is cached, return the cached item.
- If the caller sent no data and the item is not cached, raise
MultiModalCacheMissError.
Source code in vllm/multimodal/cache/lru.py
LruKeyReplicatedSenderCache ¶
Bases: BaseMultiModalProcessorCache
The cache which is used on P0 when LRU caching is enabled.
How to update each item:
-
If the item is already in the cache, clear the input to avoid unnecessary IPC.
-
If the item is not in the cache, store the metadata of that item so that the eviction policy remains the same as the cache on P1, and return the input. By only storing the metadata, we avoid keeping the data itself in memory inside P0.