fix Milvus docker image report illegal instruction (#2598)

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
pull/2615/head
Cai Yudong 2020-06-18 18:57:40 +08:00 committed by JinHai-CN
parent 290ff2e439
commit 6ac3d2bd08
2 changed files with 2 additions and 52 deletions

View File

@ -8,6 +8,7 @@ Please mark all change in change log and use the issue from GitHub
- \#2585 IVF_PQ on GPU with using metric_type IP
- \#2578 Result count doesn't match target vectors count
- \#2557 fix random crash of INSERT_DUPLICATE_ID case
- \#2598 fix Milvus docker image report illegal instruction
## Feature

View File

@ -3,6 +3,7 @@
#include <array>
#include <bitset>
#include <cpuid.h>
#include <cstring>
#include <iostream>
#include <string>
@ -10,58 +11,6 @@
namespace faiss {
#if defined(__i386__) && defined(__PIC__)
/* %ebx may be the PIC register. */
#if __GNUC__ >= 3
#define __cpuid(level, a, b, c, d) \
__asm__( \
"xchg{l}\t{%%}ebx, %1\n\t" \
"cpuid\n\t" \
"xchg{l}\t{%%}ebx, %1\n\t" \
: "=a"(a), "=r"(b), "=c"(c), "=d"(d) \
: "0"(level))
#define __cpuid_count(level, count, a, b, c, d) \
__asm__( \
"xchg{l}\t{%%}ebx, %1\n\t" \
"cpuid\n\t" \
"xchg{l}\t{%%}ebx, %1\n\t" \
: "=a"(a), "=r"(b), "=c"(c), "=d"(d) \
: "0"(level), "2"(count))
#else /* __GNUC__ >= 3 */
/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
nor alternatives in i386 code. */
#define __cpuid(level, a, b, c, d) \
__asm__( \
"xchgl\t%%ebx, %1\n\t" \
"cpuid\n\t" \
"xchgl\t%%ebx, %1\n\t" \
: "=a"(a), "=r"(b), "=c"(c), "=d"(d) \
: "0"(level))
#define __cpuid_count(level, count, a, b, c, d) \
__asm__( \
"xchgl\t%%ebx, %1\n\t" \
"cpuid\n\t" \
"xchgl\t%%ebx, %1\n\t" \
: "=a"(a), "=r"(b), "=c"(c), "=d"(d) \
: "0"(level), "2"(count))
#endif /* __GNUC__ >= 3 */
#else /* defined(__i386__) && defined(__PIC__) */
#define __cpuid(level, a, b, c, d) __asm__("cpuid\n\t" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(level))
#define __cpuid_count(level, count, a, b, c, d) \
__asm__("cpuid\n\t" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(level), "2"(count))
#endif /* defined(__i386__) && defined(__PIC__) */
class InstructionSet {
public:
static InstructionSet&