#1480 add return code for AVX512 selection (#1482)

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
This commit is contained in:
Cai Yudong 2020-03-03 13:55:27 +08:00 committed by GitHub
parent 5eca1fce90
commit d460f48ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -69,8 +69,9 @@ Please mark all change in change log and use the issue from GitHub
- \#1234 Do S3 server validation check when Milvus startup
- \#1263 Allow system conf modifiable and some take effect directly
- \#1320 Remove debug logging from faiss
- \#1426 - Support to configure whether to enabled autoflush and the autoflush interval
- \#1426 Support to configure whether to enabled autoflush and the autoflush interval
- \#1444 Improve delete
- \#1480 Add return code for AVX512 selection
## Task

View File

@ -48,7 +48,7 @@ bool support_sse() {
return (instruction_set_inst.SSE());
}
void hook_init() {
std::string hook_init() {
static std::mutex hook_mutex;
std::lock_guard<std::mutex> lock(hook_mutex);
@ -65,6 +65,7 @@ void hook_init() {
sq_sel_quantizer = sq_select_quantizer_avx512;
std::cout << "FAISS hook AVX512" << std::endl;
return "AVX512";
} else if (support_avx()) {
/* for IVFFLAT */
fvec_inner_product = fvec_inner_product_avx;
@ -78,6 +79,7 @@ void hook_init() {
sq_sel_quantizer = sq_select_quantizer_avx;
std::cout << "FAISS hook AVX" << std::endl;
return "AVX";
} else if (support_sse()) {
/* for IVFFLAT */
fvec_inner_product = fvec_inner_product_sse;
@ -91,8 +93,10 @@ void hook_init() {
sq_sel_quantizer = sq_select_quantizer_sse;
std::cout << "FAISS hook SSE" << std::endl;
return "SSE";
} else {
FAISS_ASSERT_MSG(false, "CPU not supported!");
return "UNSUPPORTED";
}
}

View File

@ -5,6 +5,7 @@
#include <vector>
#include <stddef.h>
#include <string>
#include <faiss/impl/ScalarQuantizerOp.h>
namespace faiss {
@ -28,6 +29,6 @@ extern sq_sel_func_ptr sq_sel_quantizer;
extern bool support_avx512();
extern void hook_init();
extern std::string hook_init();
} // namespace faiss

View File

@ -17,6 +17,7 @@
#include "faiss/FaissHook.h"
#include "scheduler/Utils.h"
#include "server/Config.h"
#include "utils/Log.h"
#include <fiu-local.h>
#include <map>
@ -36,7 +37,8 @@ KnowhereResource::Initialize() {
bool use_avx512 = true;
CONFIG_CHECK(config.GetEngineConfigUseAVX512(use_avx512));
faiss::faiss_use_avx512 = use_avx512;
faiss::hook_init();
std::string type = faiss::hook_init();
ENGINE_LOG_DEBUG << "FAISS hook " << type;
#ifdef MILVUS_GPU_VERSION
bool enable_gpu = false;