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. - A payload with only placeholder metadata (an EC consumer's metadata-only item) bypasses the cache: it must not replace, or later stand in for, an item that the encoder can run on.
Source code in vllm/multimodal/cache/lru.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
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.