From 91cf8288aeace1e9031fb84bd75205af1bc91264 Mon Sep 17 00:00:00 2001 From: "Artem M. Chirkin" <9253178+achirkin@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:21:04 +0200 Subject: [PATCH] Hotfix: wrong constant in IVF-PQ fp_8bit2half #1644 introduced a direct conversion from the custom ivf-pq fp8 type to half and a bug alongside. The exponent bias value wrong by one bit. --- cpp/include/raft/neighbors/detail/ivf_pq_fp_8bit.cuh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/raft/neighbors/detail/ivf_pq_fp_8bit.cuh b/cpp/include/raft/neighbors/detail/ivf_pq_fp_8bit.cuh index ca7eb4b7d9..68c8a513f6 100644 --- a/cpp/include/raft/neighbors/detail/ivf_pq_fp_8bit.cuh +++ b/cpp/include/raft/neighbors/detail/ivf_pq_fp_8bit.cuh @@ -116,7 +116,7 @@ struct fp_8bit { u &= ~1; // zero the sign bit } half r; - constexpr uint16_t kBase16 = (0x7c00u | (0x0200u >> ValBits)) - (ExpMask << 10); + constexpr uint16_t kBase16 = (0x3c00u | (0x0200u >> ValBits)) - (ExpMask << 10); *reinterpret_cast(&r) = kBase16 + (u << (2u + ExpBits)); if constexpr (Signed) { // recover the sign bit if (v.bitstring & 1) { r = -r; }