vllm.v1.kv_offload.worker.cpu_gpu ¶
CpuGpuOffloadingHandler ¶
Bases: OffloadingHandler
Source code in vllm/v1/kv_offload/worker/cpu_gpu.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 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 |
|
__init__ ¶
__init__(
gpu_block_size: int,
cpu_block_size: int,
num_cpu_blocks: int,
gpu_caches: dict[str, Tensor],
attn_backends: dict[str, type[AttentionBackend]],
)
Source code in vllm/v1/kv_offload/worker/cpu_gpu.py
get_finished ¶
get_finished() -> list[TransferResult]
Source code in vllm/v1/kv_offload/worker/cpu_gpu.py
transfer_async ¶
transfer_async(job_id: int, spec: TransferSpec) -> bool
Source code in vllm/v1/kv_offload/worker/cpu_gpu.py
expand_block_ids ¶
expand_block_ids(
block_ids: ndarray,
block_size_factor: int,
output: ndarray,
skip_count: int = 0,
)
Convert a list of block IDs to a list of matching block ids, assuming each block is composed of actual block_size_factor blocks. Outputs to output tensor. The first skip_count blocks will be skipped. Note that skip_count must be less than block_size_factor.
For example, if block_ids = [0, 1, 3] and block_size_factor = 4, then it yields [0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15] since 0 maps to [0, 1, 2, 3] 1 maps to [4, 5, 6, 7] and 3 maps to [12, 13, 14, 15]