Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
cpu_x86.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 */
30
31/* cpu_x86.h
32 *
33 * Author : Alexander J. Yee
34 * Date Created : 04/12/2014
35 * Last Modified : 04/12/2014
36 *
37 */
38
39#pragma once
40#ifndef _cpu_x86_H
41#define _cpu_x86_H
46// Dependencies
47#include <stdint.h>
48#include <string>
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
50namespace FeatureDetector
51{
56struct cpu_x86 {
57 // Vendor
58 bool Vendor_AMD;
59 bool Vendor_Intel;
60
61 // OS Features
62 bool OS_x64;
63 bool OS_AVX;
64 bool OS_AVX512;
65
66 // Misc.
67 bool HW_MMX;
68 bool HW_x64;
69 bool HW_ABM;
70 bool HW_RDRAND;
71 bool HW_BMI1;
72 bool HW_BMI2;
73 bool HW_ADX;
74 bool HW_PREFETCHWT1;
75 bool HW_MPX;
76
77 // SIMD: 128-bit
78 bool HW_SSE;
79 bool HW_SSE2;
80 bool HW_SSE3;
81 bool HW_SSSE3;
82 bool HW_SSE41;
83 bool HW_SSE42;
84 bool HW_SSE4a;
85 bool HW_AES;
86 bool HW_SHA;
87
88 // SIMD: 256-bit
89 bool HW_AVX;
90 bool HW_XOP;
91 bool HW_FMA3;
92 bool HW_FMA4;
93 bool HW_AVX2;
94
95 // SIMD: 512-bit
96 bool HW_AVX512_F;
97 bool HW_AVX512_PF;
98 bool HW_AVX512_ER;
99 bool HW_AVX512_CD;
100 bool HW_AVX512_VL;
101 bool HW_AVX512_BW;
102 bool HW_AVX512_DQ;
103 bool HW_AVX512_IFMA;
104 bool HW_AVX512_VBMI;
105
106public:
107 cpu_x86();
108
109 void print() const;
110
111 static void cpuid(int32_t out[4], int32_t x);
112 static std::string get_vendor_string();
113
114private:
115 void detect_host();
116 static void print(const char *label, bool yes);
117
118 static bool detect_OS_x64();
119 static bool detect_OS_AVX();
120 static bool detect_OS_AVX512();
121};
126} // namespace FeatureDetector
127#endif
128#endif