quantize.cuh 979 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include "common.cuh"
  3. #include "mmq.cuh"
  4. #include <cstdint>
  5. #define CUDA_QUANTIZE_BLOCK_SIZE 256
  6. #define CUDA_QUANTIZE_BLOCK_SIZE_MMQ 128
  7. static_assert(MATRIX_ROW_PADDING % CUDA_QUANTIZE_BLOCK_SIZE == 0, "Risk of out-of-bounds access.");
  8. static_assert(MATRIX_ROW_PADDING % (4*CUDA_QUANTIZE_BLOCK_SIZE_MMQ) == 0, "Risk of out-of-bounds access.");
  9. typedef void (*quantize_cuda_t)(
  10. const float * x, void * vy, const int64_t kx0, const int64_t kx1, const int64_t channels, const int64_t kx0_padded,
  11. const ggml_type type_x, cudaStream_t stream);
  12. void quantize_row_q8_1_cuda(
  13. const float * x, void * vy, const int64_t kx0, const int64_t kx1, const int64_t channels, const int64_t kx0_padded,
  14. const ggml_type type_x, cudaStream_t stream);
  15. void quantize_mmq_q8_1_cuda(
  16. const float * x, void * vy, const int64_t kx0, const int64_t kx1, const int64_t channels, const int64_t kx0_padded,
  17. const ggml_type type_x, cudaStream_t stream);