Add changes for AVX-512 support in k-NN. #2110
Add changes for AVX-512 support in k-NN. #2110naveentatikonda merged 8 commits intoopensearch-project:mainfrom
Conversation
…intel.com> Signed-off-by: Akash Shankaran <[email protected]>
…ankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]>
…by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]>
…el.com> Signed-off-by: Akash Shankaran <[email protected]>
|
Benchmark was run using opensearch-benchmark with cohere dataset(768 dimensions). Her are some configuration details for search: A forcemerge to reduce the number of max_num_segments to 1 is executed via the API before the seach. The opensearch cluster was deployed with 2 data nodes (r7i.2xlarges), 1 replica and 4 shards. |
@assanedi Can you also pls add other configuration details like the indexing clients, query clients, ef_construction, ef_search, etc |
@assanedi Isn't the max_num_segments was 1 during forcemerge ? |
Yes I run the forcemerge API, here is the results of it: |
Yes, but in the configuration you mentioned it as 10 instead of 1 for |
|
For FP32 we don’t need to make any changes in Faiss as they are using auto-vectorization to achieve the optimization with AVX512. But, for Scalar Quantization Intel have raised a PR to Faiss which is under review |
I updated the configuration details |
|
|
||
| public static boolean isFaissAVX512Disabled() { | ||
| try { | ||
| return KNNSettings.state().getSettingValue(KNNSettings.KNN_FAISS_AVX512_DISABLED); |
There was a problem hiding this comment.
Can we do proper null checks here? In general, I think its best to avoid catching all exceptions.
There was a problem hiding this comment.
Looks like java boolean cannot be null. So null check won't be possible.
Your second point on exceptions is valid, and this code shouldn't throw exceptions as a default value is set. I've removed the try/catch block.
There was a problem hiding this comment.
@akashsha1 as users will manually set this setting in opensearch.yml, there is a chance of getting null. To avoid it shall we change it to
return Booleans.parseBoolean(KNNSettings.state().getSettingValue(KNNSettings.KNN_FAISS_AVX512_DISABLED).toString(), false);
There was a problem hiding this comment.
Booleans.parseBoolean will do the null validation and if it is null, it will return the default value
There was a problem hiding this comment.
spoke with Naveen on slack, and updated to
return Booleans.parseBoolean(KNNSettings.state().getSettingValue(KNNSettings.KNN_FAISS_AVX512_DISABLED).toString(), KNN_DEFAULT_FAISS_AVX512_DISABLED_VALUE);
…intel.com> Signed-off-by: Akash Shankaran <[email protected]>
…[email protected]> Signed-off-by: Akash Shankaran <[email protected]>
…[email protected]> Signed-off-by: Akash Shankaran <[email protected]>
…ntel.com> Signed-off-by: Akash Shankaran <[email protected]>
* changes for AVX-512. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * add cpu detection logic to security workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * add cpu detection logic to backward compat test workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix bwc workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * address PR feedback. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * update KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> --------- Signed-off-by: Akash Shankaran <[email protected]> (cherry picked from commit 5423cc1)
* changes for AVX-512. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * add cpu detection logic to security workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * add cpu detection logic to backward compat test workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix bwc workflow. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * address PR feedback. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> * update KNNSettings. Signed-off by: Akash Shankaran <[email protected]> Signed-off-by: Akash Shankaran <[email protected]> --------- Signed-off-by: Akash Shankaran <[email protected]> (cherry picked from commit 5423cc1) Signed-off-by: Ryan Bogan <[email protected]>
* changes for AVX-512. Signed-off by: Akash Shankaran <[email protected]> * add cpu detection logic to security workflow. Signed-off by: Akash Shankaran <[email protected]> * add cpu detection logic to backward compat test workflow. Signed-off by: Akash Shankaran <[email protected]> * fix bwc workflow. Signed-off by: Akash Shankaran <[email protected]> * address PR feedback. Signed-off by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> * fix a bug in KNNSettings. Signed-off by: Akash Shankaran <[email protected]> * update KNNSettings. Signed-off by: Akash Shankaran <[email protected]> --------- (cherry picked from commit 5423cc1) Signed-off-by: Akash Shankaran <[email protected]> Signed-off-by: Ryan Bogan <[email protected]> Co-authored-by: akashsha1 <[email protected]>


Description
This change adds support to speed up vector search and indexing in faiss using AVX512 hardware accelerator.
Related Issues
Resolves #2056
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.