MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / feature_detect_avx_fma

Function feature_detect_avx_fma

dnn/src/x86/utils.cpp:120–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120bool feature_detect_avx_fma(int ftr) {
121 // see Detecting Availability and Support in
122 // https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions
123
124 // check CPU support
125 if (!(bit(cpuid.ecx, 27) && bit(cpuid.ecx, ftr)))
126 return false;
127
128 // check OS support
129 uint32_t edx, eax;
130 asm volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(0));
131
132 return (eax & 6) == 6;
133}
134
135bool is_avx_supported = feature_detect_avx_fma(28);
136bool is_fma_supported = feature_detect_avx_fma(12);

Callers 1

utils.cppFile · 0.85

Calls 1

bitFunction · 0.85

Tested by

no test coverage detected