Skip to content

Check SSE/AVX/AVX2 at runtime to decline in number of release binaries #768

Closed
@gangliao

Description

@gangliao

Currently, we have four release binaries, no-avx CPU, avx-CPU, no-avx-GPU, avx-GPU., which looks quite miscellaneous. Actually, we can check CPU capabilities at runtime via

  1. query cpuid
#ifdef _WIN32
/// MSVC CPUID
#define cpuid(info, x)    __cpuidex(info, x, 0)
#else
//  GCC Intrinsics
#include <cpuid.h>
/// gcc / clang CPUID
#define cpuid(info, x) __cpuid_count(x, 0, info[0], info[1], info[2], info[3])
#endif
  1. Then, do some bit manipulation to check whether AVX is supported or not.

That can help us decline in number of release binaries from four to two.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions