attention.cpp 544 B

12345678910111213141516171819
  1. #include <torch/extension.h>
  2. void single_query_cached_kv_attention(
  3. torch::Tensor& out,
  4. torch::Tensor& query,
  5. torch::Tensor& key_cache,
  6. torch::Tensor& value_cache,
  7. float scale,
  8. torch::Tensor& block_tables,
  9. torch::Tensor& context_lens,
  10. int block_size,
  11. int max_context_len);
  12. PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
  13. m.def(
  14. "single_query_cached_kv_attention",
  15. &single_query_cached_kv_attention,
  16. "Compute the attention between an input query and the cached key/value tensors.");
  17. }