vllm.models.deepseek_v41.amd.engram
¶
Engram with a TP-sharded gate on gfx942 and gfx950.
Classes:
-
RocmEngram–Engramwhose TP ranks each keep one dim slice of every key and of the
RocmEngram
¶
Bases: Engram
Engram whose TP ranks each keep one dim slice of every key and of the
value. The gate only needs per-token sums over dim, so the ranks exchange
those and their value slices instead of the whole projection.
Source code in vllm/models/deepseek_v41/amd/engram.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
_engram_gate_finish_kernel(hidden_states, gathered, gathered_f32, token_mask, output, num_tokens, hidden_stride_t, hidden_stride_h, hidden_stride_d, gathered_stride_t, gathered_f32_stride_t, mask_stride, output_stride_t, output_stride_h, output_stride_d, eps, clamp_value, DIM, WIDTH, TP_SIZE, HC_MULT, BLOCK_SIZE, HAS_MASK)
¶
_fused_engram_post_wkv_kernel on the rank-major rows the partials
kernel packed, all-gathered along tokens.
Source code in vllm/models/deepseek_v41/amd/engram.py
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 | |
_engram_gate_partials_kernel(hidden_states, kv, q_weight, k_weight, send, send_f32, hidden_stride_t, hidden_stride_h, hidden_stride_d, kv_stride_t, kv_stride_d, q_stride_h, q_stride_d, k_stride_h, k_stride_d, send_stride_t, send_f32_stride_t, dim_start, WIDTH, HC_MULT, BLOCK_SIZE)
¶
Pack one token's value slice and per-hc gate partial sums into send.
kv holds this rank's WIDTH columns of every key and of the value. The
row of send is the value slice followed by (sum key^2, sum hiddenqk*key)
as FP32 pairs, one per hc copy. Each program handles one hc copy, or the
value slice, of one token.