Skip to content

Commit a5436a0

Browse files
try CI fix
1 parent 9ecde9f commit a5436a0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

ggml-cuda/fattn-common.cuh

+21-3
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,13 @@ static __device__ __forceinline__ T dequantize_1_q4_0(const void * __restrict__
404404
const int q0 = x[ib].qs[iqs];
405405
const int q = ((q0 >> (4*shift)) & 0x0F) - 8;
406406

407-
return d*((T) q);
407+
#if FP16_AVAILABLE
408+
if (std::is_same<T, half>::value) {
409+
return ((half) d)*((half) q);
410+
}
411+
#endif // FP16_AVAILABLE
412+
413+
return ((float) d)*((float) q);
408414
}
409415

410416
template <typename T>
@@ -444,7 +450,13 @@ static __device__ __forceinline__ T dequantize_1_q5_0(const void * __restrict__
444450
const int qh = ((qh0 >> idq) << 4) & 0x10;
445451
const int q = (ql | qh) - 16;
446452

447-
return d*((T) q);
453+
#if FP16_AVAILABLE
454+
if (std::is_same<T, half>::value) {
455+
return ((half) d)*((half) q);
456+
}
457+
#endif // FP16_AVAILABLE
458+
459+
return ((float) d)*((float) q);
448460
}
449461

450462
template <typename T>
@@ -482,7 +494,13 @@ static __device__ __forceinline__ T dequantize_1_q8_0(const void * __restrict__
482494
const T d = x[ib].d;
483495
const int q = x[ib].qs[iqs];
484496

485-
return d*((T) q);
497+
#if FP16_AVAILABLE
498+
if (std::is_same<T, half>::value) {
499+
return ((half) d)*((half) q);
500+
}
501+
#endif // FP16_AVAILABLE
502+
503+
return ((float) d)*((float) q);
486504
}
487505

488506
template <typename T>

0 commit comments

Comments
 (0)