qdq_8.cuh 732 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Copied from https://github.com/turboderp/exllamav2
  3. */
  4. #ifndef _qdq_8_cuh
  5. #define _qdq_8_cuh
  6. #include "qdq_util.cuh"
  7. namespace aphrodite {
  8. namespace gptq {
  9. __forceinline__ __device__ void shuffle_8bit_4
  10. (
  11. uint32_t* q,
  12. int stride
  13. )
  14. {
  15. }
  16. __forceinline__ __device__ void dequant_8bit_8
  17. (
  18. const uint32_t q_0,
  19. const uint32_t q_1,
  20. half2 (&dq)[4],
  21. int stride,
  22. const uint32_t zero
  23. )
  24. {
  25. half dqh[8];
  26. for (int i = 0; i < 4; i++) dqh[i ] = dq_ns(exb(q_0, i * 8, 0xff), zero);
  27. for (int i = 0; i < 4; i++) dqh[i + 4] = dq_ns(exb(q_1, i * 8, 0xff), zero);
  28. for (int i = 0; i < 4; i++) dq[i] = __halves2half2(dqh[i * 2], dqh[i * 2 + 1]);
  29. }
  30. } // namespace gptq
  31. } // namespace aphrodite
  32. #endif