jbellis / jvector

JVector: the most advanced embedded vector search engine
Apache License 2.0
1.5k stars 112 forks source link

Usage of imprecise fp-model=fast. #360

Open jbhateja opened 1 month ago

jbhateja commented 1 month ago

With ANN search, we accept giving up accuracy for speed. Since most of the code in jvector_simd.c deals in floating-point computations, it may make sense to pass—fp-model=fast to the GCC compiler at build time. Even though most of the code is directly coded using intrinsics, there should be no harm in passing this option.

With a fast floating point model, the compiler attempts several value-unsafe optimizations[1], like reassociation and parallel reductions (maybe we can replace reduction intrinsics with equivalent C-code and let the compiler do the magic).

Best Regards, Jatin [1] https://www.nccs.nasa.gov/images/FloatingPoint_consistency.pdf

jkni commented 1 month ago

Thanks for the pointer, @jbhateja. I'll look into this.