Unverified Commit d460f48c authored by 蔡宇东's avatar 蔡宇东 Committed by GitHub
Browse files

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

parent 5eca1fce
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
+5 −1
Original line number Diff line number Diff line
@@ -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";
    }
}

+2 −1
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
@@ -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;