Skip to content

Commit

Permalink
Update documentation to reflect k-NN FAISS AVX512 support (opensearch…
Browse files Browse the repository at this point in the history
…-project#8307)

* AVX512 updates

Signed-off-by: Noah Staveley <[email protected]>

* updatedwith correct version for AVX512 release

Signed-off-by: Noah Staveley <[email protected]>

* change to reflect avx512/avx2 preference order

Signed-off-by: Noah Staveley <[email protected]>

* change to knn-index. specified order of performance

Signed-off-by: Noah Staveley <[email protected]>

* Update _search-plugins/knn/knn-index.md

Signed-off-by: Noah Staveley <[email protected]>

* Update _search-plugins/knn/settings.md and knn-index.md

Signed-off-by: Noah Staveley <[email protected]>

---------

Signed-off-by: Noah Staveley <[email protected]>
Co-authored-by: kolchfa-aws <[email protected]>
  • Loading branch information
noahstaveley and kolchfa-aws authored Sep 30, 2024
1 parent 00d5bb3 commit 1867a65
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions _search-plugins/knn/knn-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Starting with k-NN plugin version 2.16, you can use `binary` vectors with the `f

## SIMD optimization for the Faiss engine

Starting with version 2.13, the k-NN plugin supports [Single Instruction Multiple Data (SIMD)](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) processing if the underlying hardware supports SIMD instructions (AVX2 on x64 architecture and Neon on ARM64 architecture). SIMD is supported by default on Linux machines only for the Faiss engine. SIMD architecture helps boost overall performance by improving indexing throughput and reducing search latency.
Starting with version 2.13, the k-NN plugin supports [Single Instruction Multiple Data (SIMD)](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) processing if the underlying hardware supports SIMD instructions (AVX2 on x64 architecture and Neon on ARM64 architecture). SIMD is supported by default on Linux machines only for the Faiss engine. SIMD architecture helps boost overall performance by improving indexing throughput and reducing search latency. Starting with version 2.18, the k-NN plugin supports AVX512 SIMD instructions on x64 architecture.

SIMD optimization is applicable only if the vector dimension is a multiple of 8.
{: .note}
Expand All @@ -60,14 +60,22 @@ SIMD optimization is applicable only if the vector dimension is a multiple of 8.
### x64 architecture
<!-- vale on -->

For the x64 architecture, two different versions of the Faiss library are built and shipped with the artifact:
For x64 architecture, the following versions of the Faiss library are built and shipped with the artifact:

- `libopensearchknn_faiss.so`: The non-optimized Faiss library without SIMD instructions.
- `libopensearchknn_faiss_avx2.so`: The Faiss library that contains AVX2 SIMD instructions.
- `libopensearchknn_faiss_avx512.so`: The Faiss library containing AVX512 SIMD instructions.
- `libopensearchknn_faiss_avx2.so`: The Faiss library containing AVX2 SIMD instructions.

If your hardware supports AVX2, the k-NN plugin loads the `libopensearchknn_faiss_avx2.so` library at runtime.
When using the Faiss library, the performance ranking is as follows: AVX512 > AVX2 > no optimization.
{: .note }

If your hardware supports AVX512, the k-NN plugin loads the `libopensearchknn_faiss_avx512.so` library at runtime.

If your hardware supports AVX2 but doesn't support AVX512, the k-NN plugin loads the `libopensearchknn_faiss_avx2.so` library at runtime.

To disable the AVX512 and AVX2 SIMD instructions and load the non-optimized Faiss library (`libopensearchknn_faiss.so`), specify the `knn.faiss.avx512.disabled` and `knn.faiss.avx2.disabled` static settings as `true` in `opensearch.yml` (by default, both of these are `false`).

To disable AVX2 and load the non-optimized Faiss library (`libopensearchknn_faiss.so`), specify the `knn.faiss.avx2.disabled` static setting as `true` in `opensearch.yml` (default is `false`). Note that to update a static setting, you must stop the cluster, change the setting, and restart the cluster. For more information, see [Static settings]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/index/#static-settings).
Note that to update a static setting, you must stop the cluster, change the setting, and restart the cluster. For more information, see [Static settings]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/index/#static-settings).

### ARM64 architecture

Expand Down
1 change: 1 addition & 0 deletions _search-plugins/knn/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Setting | Static/Dynamic | Default | Description
`knn.model.index.number_of_replicas`| Dynamic | `1` | The number of replica shards to use for the model system index. Generally, in a multi-node cluster, this value should be at least 1 in order to increase stability.
`knn.model.cache.size.limit` | Dynamic | `10%` | The model cache limit cannot exceed 25% of the JVM heap.
`knn.faiss.avx2.disabled` | Static | `false` | A static setting that specifies whether to disable the SIMD-based `libopensearchknn_faiss_avx2.so` library and load the non-optimized `libopensearchknn_faiss.so` library for the Faiss engine on machines with x64 architecture. For more information, see [SIMD optimization for the Faiss engine]({{site.url}}{{site.baseurl}}/search-plugins/knn/knn-index/#simd-optimization-for-the-faiss-engine).
`knn.faiss.avx512.disabled` | Static | `false` | A static setting that specifies whether to disable the SIMD-based `libopensearchknn_faiss_avx512.so` library and load the `libopensearchknn_faiss_avx2.so` library or the non-optimized `libopensearchknn_faiss.so` library for the Faiss engine on machines with x64 architecture. For more information, see [SIMD optimization for the Faiss engine]({{site.url}}{{site.baseurl}}/search-plugins/knn/knn-index/#simd-optimization-for-the-faiss-engine).

## Index settings

Expand Down

0 comments on commit 1867a65

Please sign in to comment.