cache.h 745 B

1234567891011121314151617181920212223242526272829303132
  1. #include <torch/extension.h>
  2. #include <map>
  3. #include <vector>
  4. void swap_blocks(
  5. torch::Tensor& src,
  6. torch::Tensor& dst,
  7. const std::map<int64_t, int64_t>& block_mapping);
  8. void copy_blocks(
  9. std::vector<torch::Tensor>& key_caches,
  10. std::vector<torch::Tensor>& value_caches,
  11. const std::map<int64_t, std::vector<int64_t>>& block_mapping);
  12. void reshape_and_cache(
  13. torch::Tensor& key,
  14. torch::Tensor& value,
  15. torch::Tensor& key_cache,
  16. torch::Tensor& value_cache,
  17. torch::Tensor& slot_mapping);
  18. void gather_cached_kv(
  19. torch::Tensor& key,
  20. torch::Tensor& value,
  21. torch::Tensor& key_cache,
  22. torch::Tensor& value_cache,
  23. torch::Tensor& slot_mapping);
  24. void convert_fp8(
  25. torch::Tensor& src_cache,
  26. torch::Tensor& dst_cache);