从零实现 LLM Inference:062. Triton KV append identity-pos(full batch 但 pos 不一致)
上一版 full-batch KV-append 只覆盖 pos 常量的稳态;但只要 prompt 长度不一致,decode 的 pos 就会按 request 分叉,仍然要构造 batch_idx/pos 这类 index tensor。这版补一个 identity batch 的 Triton kernel:...
上一版 full-batch KV-append 只覆盖 pos 常量的稳态;但只要 prompt 长度不一致,decode 的 pos 就会按 request 分叉,仍然要构造 batch_idx/pos 这类 index tensor。这版补一个 identity batch 的 Triton kernel:...
batch decode 稳态里,经常满足 fast_batch_idx 是 [0..B-1] 且同一步 pos 对整个 batch 是常量;这时 Triton KV append 还在每 step 构造 batch_idx/pos 这类小 tensor。这个 PR 新增 full-batch Triton ke...
append_token_batch 里 fast_batch_idx 很多时候就是 [0..B-1];之前每层都会 index_select 把 key_new/value_new 重新拷一遍,还会构造 pos_t。这个小改动在 identity batch 时直接复用 key_new/value_new,并且...
append_token_batch 之前只覆盖 len<block_size 的 fast path;一旦 last block 满了(len==block_size)就会退化成逐 request 的 append_token。这个点会制造 ITL 的尖刺。这版把 rollover 也塞回 batch:先...
prefix cache hit 时我们还在把 last_logits 从 CPU 拷回 GPU;这版把 entry 的 last_logits 直接存成 device 上的一份小 clone,hit 变成真正的零拷贝。