Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 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 on x64 architecture.
Comment thread
noahstaveley marked this conversation as resolved.
Outdated

SIMD optimization is applicable only if the vector dimension is a multiple of 8.
{: .note}
Expand All @@ -60,14 +60,19 @@ 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 the x64 architecture, three different versions of the Faiss library are built and shipped with the artifact:
Comment thread
noahstaveley marked this conversation as resolved.
Outdated
Comment thread
noahstaveley marked this conversation as resolved.
Outdated
Comment thread
noahstaveley marked this conversation as resolved.
Outdated

- `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 that contains AVX512 SIMD instructions.
Comment thread
noahstaveley marked this conversation as resolved.
Outdated
Comment thread
noahstaveley marked this conversation as resolved.
Outdated
- `libopensearchknn_faiss_avx2.so`: The Faiss library that contains AVX2 SIMD instructions.
Comment thread
noahstaveley marked this conversation as resolved.
Outdated

If your hardware supports AVX2, the k-NN plugin loads the `libopensearchknn_faiss_avx2.so` library at runtime.
The Faiss library order of performance is AVX512, AVX2, generic.
Comment thread
noahstaveley marked this conversation as resolved.
Outdated
If your hardware supports AVX512, the k-NN plugin loads the `libopensearchknn_faiss_avx512.so` library at runtime.
Comment thread
noahstaveley marked this conversation as resolved.
Comment thread
noahstaveley marked this conversation as resolved.
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 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).
To disable AVX512 and AVX2 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` (defaults are `false`).
Comment thread
noahstaveley marked this conversation as resolved.
Outdated

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` 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).
Comment thread
noahstaveley marked this conversation as resolved.
Outdated

## Index settings

Expand Down