From 3d0ac3227607da9ce05a65335db6efd162a9d9af Mon Sep 17 00:00:00 2001 From: Michelle Ma Date: Tue, 7 Jan 2025 06:27:53 -0800 Subject: [PATCH] Expose accumulate_to_mem from faiss interface (#4099) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4099 Expose interface of accumulate_to_mem. accumulate_to_mem calls pq4 fast scan accumulate with a dummy scaler and a StoreResultHandler. The function is not currently in use anywhere. We plan to use it in unicorn integration of PQ4 fast scan. Reviewed By: asadoughi Differential Revision: D67299378 fbshipit-source-id: d6b1b247c4f14b698058cb671dd418bf32d35ca0 --- faiss/impl/pq4_fast_scan.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/faiss/impl/pq4_fast_scan.h b/faiss/impl/pq4_fast_scan.h index b9ca9439ab..ccb084e7a5 100644 --- a/faiss/impl/pq4_fast_scan.h +++ b/faiss/impl/pq4_fast_scan.h @@ -189,4 +189,22 @@ void pq4_accumulate_loop_qbs( SIMDResultHandler& res, const NormTableScaler* scaler = nullptr); +/** Wrapper of pq4_accumulate_loop_qbs using simple StoreResultHandler + * and DummyScaler + * + * @param nq number of queries + * @param ntotal2 number of database elements (multiple of 32) + * @param nsq number of sub-quantizers (muliple of 2) + * @param codes packed codes array + * @param LUT packed look-up table + * @param accu array to store the results + */ +void accumulate_to_mem( + int nq, + size_t ntotal2, + int nsq, + const uint8_t* codes, + const uint8_t* LUT, + uint16_t* accu); + } // namespace faiss