mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
The main loops iterating over vector components were not vectorized due to: - "cannot prove it is safe to reorder floating-point operations" - "Cannot vectorize early exit loop with more than one early exit" The first issue is fixed with adding `#pragma clang fp contract(fast) reassociate(on)`, which allows compiler to optimize floating point operations. The second issue is solved by refactoring the operations in the affected loop. Additionally using float operations instead of double increases throughput and numerical accuracy is not the main consideration in vector search scenarios. Performance measured: - scylla built using dbuild - using https://github.com/zilliztech/VectorDBBench (modified to call `SELECT id, similarity_cosine({vector<float, 1536>}, {vector<float, 1536>}) ...` without ANN search): - client concurrency 20 before: ~2250 QPS `float` operations: ~2350 QPS `compute_cosine_similarity` vectorization: ~2500QPS `extract_float_vector` vectorization: ~3000QPS Follow-up https://github.com/scylladb/scylladb/pull/28615 Ref https://scylladb.atlassian.net/browse/SCYLLADB-764 Closes scylladb/scylladb#28754