vLLM Attention Backend 지도

마지막 수정:

inferencevllmattentionkernel

vLLM의 attention backend는 단순한 PyTorch attention 함수가 아니다.

PagedAttention에서는 KV cache가 request별 연속 tensor가 아니라 block table을 통해 연결된 physical block들의 집합이다.

logical sequence
  -> block table
  -> physical KV blocks
  -> attention kernel

Backend를 읽을 때 볼 것은 세 가지다.

1. prefill attention은 어떤 path로 가는가?
2. decode attention은 어떤 path로 가는가?
3. block table / slot mapping / sequence length metadata는 어디에서 kernel 입력이 되는가?

이 카드의 목표는 나중에 nano-vLLM에서 attention kernel을 교체할 때 “어디를 바꿔야 하는가”를 찾는 것이다.

확인

  • PagedAttention에서 attention kernel이 block table을 알아야 하는 이유는 무엇인가?
  • prefill과 decode attention backend가 달라질 수 있는 이유는 무엇인가?
  • kernel 최적화 후보를 찾으려면 backend 지도에서 무엇을 봐야 하는가?