|
14 | 14 | import org.opensearch.client.Client; |
15 | 15 | import org.opensearch.cluster.metadata.IndexMetadata; |
16 | 16 | import org.opensearch.cluster.service.ClusterService; |
| 17 | +import org.opensearch.common.Booleans; |
17 | 18 | import org.opensearch.common.settings.Setting; |
18 | 19 | import org.opensearch.common.settings.Settings; |
19 | 20 | import org.opensearch.common.unit.TimeValue; |
@@ -86,11 +87,13 @@ public class KNNSettings { |
86 | 87 | public static final String KNN_FAISS_AVX2_DISABLED = "knn.faiss.avx2.disabled"; |
87 | 88 | public static final String QUANTIZATION_STATE_CACHE_SIZE_LIMIT = "knn.quantization.cache.size.limit"; |
88 | 89 | public static final String QUANTIZATION_STATE_CACHE_EXPIRY_TIME_MINUTES = "knn.quantization.cache.expiry.minutes"; |
| 90 | + public static final String KNN_FAISS_AVX512_DISABLED = "knn.faiss.avx512.disabled"; |
89 | 91 |
|
90 | 92 | /** |
91 | 93 | * Default setting values |
92 | 94 | */ |
93 | 95 | public static final boolean KNN_DEFAULT_FAISS_AVX2_DISABLED_VALUE = false; |
| 96 | + public static final boolean KNN_DEFAULT_FAISS_AVX512_DISABLED_VALUE = false; |
94 | 97 | public static final String INDEX_KNN_DEFAULT_SPACE_TYPE = "l2"; |
95 | 98 | public static final String INDEX_KNN_DEFAULT_SPACE_TYPE_FOR_BINARY = "hamming"; |
96 | 99 | public static final Integer INDEX_KNN_DEFAULT_ALGO_PARAM_M = 16; |
@@ -302,6 +305,12 @@ public class KNNSettings { |
302 | 305 | Dynamic |
303 | 306 | ); |
304 | 307 |
|
| 308 | + public static final Setting<Boolean> KNN_FAISS_AVX512_DISABLED_SETTING = Setting.boolSetting( |
| 309 | + KNN_FAISS_AVX512_DISABLED, |
| 310 | + KNN_DEFAULT_FAISS_AVX512_DISABLED_VALUE, |
| 311 | + NodeScope |
| 312 | + ); |
| 313 | + |
305 | 314 | /** |
306 | 315 | * Dynamic settings |
307 | 316 | */ |
@@ -429,6 +438,10 @@ private Setting<?> getSetting(String key) { |
429 | 438 | return KNN_FAISS_AVX2_DISABLED_SETTING; |
430 | 439 | } |
431 | 440 |
|
| 441 | + if (KNN_FAISS_AVX512_DISABLED.equals(key)) { |
| 442 | + return KNN_FAISS_AVX512_DISABLED_SETTING; |
| 443 | + } |
| 444 | + |
432 | 445 | if (KNN_VECTOR_STREAMING_MEMORY_LIMIT_IN_MB.equals(key)) { |
433 | 446 | return KNN_VECTOR_STREAMING_MEMORY_LIMIT_PCT_SETTING; |
434 | 447 | } |
@@ -460,6 +473,7 @@ public List<Setting<?>> getSettings() { |
460 | 473 | ADVANCED_FILTERED_EXACT_SEARCH_THRESHOLD_SETTING, |
461 | 474 | KNN_FAISS_AVX2_DISABLED_SETTING, |
462 | 475 | KNN_VECTOR_STREAMING_MEMORY_LIMIT_PCT_SETTING, |
| 476 | + KNN_FAISS_AVX512_DISABLED_SETTING, |
463 | 477 | QUANTIZATION_STATE_CACHE_SIZE_LIMIT_SETTING, |
464 | 478 | QUANTIZATION_STATE_CACHE_EXPIRY_TIME_MINUTES_SETTING |
465 | 479 | ); |
@@ -499,6 +513,13 @@ public static boolean isFaissAVX2Disabled() { |
499 | 513 | } |
500 | 514 | } |
501 | 515 |
|
| 516 | + public static boolean isFaissAVX512Disabled() { |
| 517 | + return Booleans.parseBoolean( |
| 518 | + KNNSettings.state().getSettingValue(KNNSettings.KNN_FAISS_AVX512_DISABLED).toString(), |
| 519 | + KNN_DEFAULT_FAISS_AVX512_DISABLED_VALUE |
| 520 | + ); |
| 521 | + } |
| 522 | + |
502 | 523 | public static Integer getFilteredExactSearchThreshold(final String indexName) { |
503 | 524 | return KNNSettings.state().clusterService.state() |
504 | 525 | .getMetadata() |
|
0 commit comments