cuda: cpy for q6_0

This commit is contained in:
Iwan Kawrakow
2025-08-14 14:07:07 +03:00
parent 7bdaae8861
commit ca703ed677

View File

@@ -86,27 +86,21 @@ static __device__ __forceinline__ void dequantize_q5_1(const void * vx, const in
#endif // GGML_CUDA_F16
}
// TODO
static __device__ __forceinline__ void dequantize_q6_0(const void * vx, const int64_t ib, const int iqs, dfloat2 & v){
const block_q6_0 * x = (const block_q6_0 *) vx;
const dfloat d = x[ib].d;
uint32_t qh;
memcpy(&qh, x[ib].qh, sizeof(qh));
const int xh_0 = ((qh >> (iqs + 0)) << 4) & 0x10;
const int xh_1 = ((qh >> (iqs + 12)) ) & 0x10;
v.x = ((x[ib].qs[iqs] & 0xf) | xh_0);
v.y = ((x[ib].qs[iqs] >> 4) | xh_1);
const uint8_t h = x[ib].qh[iqs%8] >> 2*(iqs/8);
v.x = ((x[ib].qs[iqs] & 0xf) | ((h & 0x3) << 4));
v.y = ((x[ib].qs[iqs] >> 4) | ((h & 0xc) << 2));
#ifdef GGML_CUDA_F16
v = __hsub2(v, {16.0f, 16.0f});
v = __hsub2(v, {32.0f, 32.0f});
v = __hmul2(v, {d, d});
#else
v.x = (v.x - 16.0f) * d;
v.y = (v.y - 16.0f) * d;
v.x = (v.x - 32.0f) * d;
v.y = (v.y - 32.0f) * d;
#endif // GGML_CUDA_F16
}