Spaces:
Running
Running
File size: 50,810 Bytes
c61ccee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 |
#pragma once
#ifndef CPUINFO_H
#define CPUINFO_H
#ifndef __cplusplus
#include <stdbool.h>
#endif
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#include <stdint.h>
/* Identify architecture and define corresponding macro */
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(_M_IX86)
#define CPUINFO_ARCH_X86 1
#endif
#if defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
#define CPUINFO_ARCH_X86_64 1
#endif
#if defined(__arm__) || defined(_M_ARM)
#define CPUINFO_ARCH_ARM 1
#endif
#if defined(__aarch64__) || defined(_M_ARM64)
#define CPUINFO_ARCH_ARM64 1
#endif
#if defined(__PPC64__) || defined(__powerpc64__) || defined(_ARCH_PPC64)
#define CPUINFO_ARCH_PPC64 1
#endif
#if defined(__asmjs__)
#define CPUINFO_ARCH_ASMJS 1
#endif
#if defined(__wasm__)
#if defined(__wasm_simd128__)
#define CPUINFO_ARCH_WASMSIMD 1
#else
#define CPUINFO_ARCH_WASM 1
#endif
#endif
/* Define other architecture-specific macros as 0 */
#ifndef CPUINFO_ARCH_X86
#define CPUINFO_ARCH_X86 0
#endif
#ifndef CPUINFO_ARCH_X86_64
#define CPUINFO_ARCH_X86_64 0
#endif
#ifndef CPUINFO_ARCH_ARM
#define CPUINFO_ARCH_ARM 0
#endif
#ifndef CPUINFO_ARCH_ARM64
#define CPUINFO_ARCH_ARM64 0
#endif
#ifndef CPUINFO_ARCH_PPC64
#define CPUINFO_ARCH_PPC64 0
#endif
#ifndef CPUINFO_ARCH_ASMJS
#define CPUINFO_ARCH_ASMJS 0
#endif
#ifndef CPUINFO_ARCH_WASM
#define CPUINFO_ARCH_WASM 0
#endif
#ifndef CPUINFO_ARCH_WASMSIMD
#define CPUINFO_ARCH_WASMSIMD 0
#endif
#if CPUINFO_ARCH_X86 && defined(_MSC_VER)
#define CPUINFO_ABI __cdecl
#elif CPUINFO_ARCH_X86 && defined(__GNUC__)
#define CPUINFO_ABI __attribute__((__cdecl__))
#else
#define CPUINFO_ABI
#endif
#define CPUINFO_CACHE_UNIFIED 0x00000001
#define CPUINFO_CACHE_INCLUSIVE 0x00000002
#define CPUINFO_CACHE_COMPLEX_INDEXING 0x00000004
struct cpuinfo_cache {
/** Cache size in bytes */
uint32_t size;
/** Number of ways of associativity */
uint32_t associativity;
/** Number of sets */
uint32_t sets;
/** Number of partitions */
uint32_t partitions;
/** Line size in bytes */
uint32_t line_size;
/**
* Binary characteristics of the cache (unified cache, inclusive cache, cache with complex indexing).
*
* @see CPUINFO_CACHE_UNIFIED, CPUINFO_CACHE_INCLUSIVE, CPUINFO_CACHE_COMPLEX_INDEXING
*/
uint32_t flags;
/** Index of the first logical processor that shares this cache */
uint32_t processor_start;
/** Number of logical processors that share this cache */
uint32_t processor_count;
};
struct cpuinfo_trace_cache {
uint32_t uops;
uint32_t associativity;
};
#define CPUINFO_PAGE_SIZE_4KB 0x1000
#define CPUINFO_PAGE_SIZE_1MB 0x100000
#define CPUINFO_PAGE_SIZE_2MB 0x200000
#define CPUINFO_PAGE_SIZE_4MB 0x400000
#define CPUINFO_PAGE_SIZE_16MB 0x1000000
#define CPUINFO_PAGE_SIZE_1GB 0x40000000
struct cpuinfo_tlb {
uint32_t entries;
uint32_t associativity;
uint64_t pages;
};
/** Vendor of processor core design */
enum cpuinfo_vendor {
/** Processor vendor is not known to the library, or the library failed to get vendor information from the OS. */
cpuinfo_vendor_unknown = 0,
/* Active vendors of modern CPUs */
/**
* Intel Corporation. Vendor of x86, x86-64, IA64, and ARM processor microarchitectures.
*
* Sold its ARM design subsidiary in 2006. The last ARM processor design was released in 2004.
*/
cpuinfo_vendor_intel = 1,
/** Advanced Micro Devices, Inc. Vendor of x86 and x86-64 processor microarchitectures. */
cpuinfo_vendor_amd = 2,
/** ARM Holdings plc. Vendor of ARM and ARM64 processor microarchitectures. */
cpuinfo_vendor_arm = 3,
/** Qualcomm Incorporated. Vendor of ARM and ARM64 processor microarchitectures. */
cpuinfo_vendor_qualcomm = 4,
/** Apple Inc. Vendor of ARM and ARM64 processor microarchitectures. */
cpuinfo_vendor_apple = 5,
/** Samsung Electronics Co., Ltd. Vendir if ARM64 processor microarchitectures. */
cpuinfo_vendor_samsung = 6,
/** Nvidia Corporation. Vendor of ARM64-compatible processor microarchitectures. */
cpuinfo_vendor_nvidia = 7,
/** MIPS Technologies, Inc. Vendor of MIPS processor microarchitectures. */
cpuinfo_vendor_mips = 8,
/** International Business Machines Corporation. Vendor of PowerPC processor microarchitectures. */
cpuinfo_vendor_ibm = 9,
/** Ingenic Semiconductor. Vendor of MIPS processor microarchitectures. */
cpuinfo_vendor_ingenic = 10,
/**
* VIA Technologies, Inc. Vendor of x86 and x86-64 processor microarchitectures.
*
* Processors are designed by Centaur Technology, a subsidiary of VIA Technologies.
*/
cpuinfo_vendor_via = 11,
/** Cavium, Inc. Vendor of ARM64 processor microarchitectures. */
cpuinfo_vendor_cavium = 12,
/** Broadcom, Inc. Vendor of ARM processor microarchitectures. */
cpuinfo_vendor_broadcom = 13,
/** Applied Micro Circuits Corporation (APM). Vendor of ARM64 processor microarchitectures. */
cpuinfo_vendor_apm = 14,
/**
* Huawei Technologies Co., Ltd. Vendor of ARM64 processor microarchitectures.
*
* Processors are designed by HiSilicon, a subsidiary of Huawei.
*/
cpuinfo_vendor_huawei = 15,
/**
* Hygon (Chengdu Haiguang Integrated Circuit Design Co., Ltd), Vendor of x86-64 processor microarchitectures.
*
* Processors are variants of AMD cores.
*/
cpuinfo_vendor_hygon = 16,
/* Active vendors of embedded CPUs */
/** Texas Instruments Inc. Vendor of ARM processor microarchitectures. */
cpuinfo_vendor_texas_instruments = 30,
/** Marvell Technology Group Ltd. Vendor of ARM processor microarchitectures. */
cpuinfo_vendor_marvell = 31,
/** RDC Semiconductor Co., Ltd. Vendor of x86 processor microarchitectures. */
cpuinfo_vendor_rdc = 32,
/** DM&P Electronics Inc. Vendor of x86 processor microarchitectures. */
cpuinfo_vendor_dmp = 33,
/** Motorola, Inc. Vendor of PowerPC and ARM processor microarchitectures. */
cpuinfo_vendor_motorola = 34,
/* Defunct CPU vendors */
/**
* Transmeta Corporation. Vendor of x86 processor microarchitectures.
*
* Now defunct. The last processor design was released in 2004.
* Transmeta processors implemented VLIW ISA and used binary translation to execute x86 code.
*/
cpuinfo_vendor_transmeta = 50,
/**
* Cyrix Corporation. Vendor of x86 processor microarchitectures.
*
* Now defunct. The last processor design was released in 1996.
*/
cpuinfo_vendor_cyrix = 51,
/**
* Rise Technology. Vendor of x86 processor microarchitectures.
*
* Now defunct. The last processor design was released in 1999.
*/
cpuinfo_vendor_rise = 52,
/**
* National Semiconductor. Vendor of x86 processor microarchitectures.
*
* Sold its x86 design subsidiary in 1999. The last processor design was released in 1998.
*/
cpuinfo_vendor_nsc = 53,
/**
* Silicon Integrated Systems. Vendor of x86 processor microarchitectures.
*
* Sold its x86 design subsidiary in 2001. The last processor design was released in 2001.
*/
cpuinfo_vendor_sis = 54,
/**
* NexGen. Vendor of x86 processor microarchitectures.
*
* Now defunct. The last processor design was released in 1994.
* NexGen designed the first x86 microarchitecture which decomposed x86 instructions into simple microoperations.
*/
cpuinfo_vendor_nexgen = 55,
/**
* United Microelectronics Corporation. Vendor of x86 processor microarchitectures.
*
* Ceased x86 in the early 1990s. The last processor design was released in 1991.
* Designed U5C and U5D processors. Both are 486 level.
*/
cpuinfo_vendor_umc = 56,
/**
* Digital Equipment Corporation. Vendor of ARM processor microarchitecture.
*
* Sold its ARM designs in 1997. The last processor design was released in 1997.
*/
cpuinfo_vendor_dec = 57,
};
/**
* Processor microarchitecture
*
* Processors with different microarchitectures often have different instruction performance characteristics,
* and may have dramatically different pipeline organization.
*/
enum cpuinfo_uarch {
/** Microarchitecture is unknown, or the library failed to get information about the microarchitecture from OS */
cpuinfo_uarch_unknown = 0,
/** Pentium and Pentium MMX microarchitecture. */
cpuinfo_uarch_p5 = 0x00100100,
/** Intel Quark microarchitecture. */
cpuinfo_uarch_quark = 0x00100101,
/** Pentium Pro, Pentium II, and Pentium III. */
cpuinfo_uarch_p6 = 0x00100200,
/** Pentium M. */
cpuinfo_uarch_dothan = 0x00100201,
/** Intel Core microarchitecture. */
cpuinfo_uarch_yonah = 0x00100202,
/** Intel Core 2 microarchitecture on 65 nm process. */
cpuinfo_uarch_conroe = 0x00100203,
/** Intel Core 2 microarchitecture on 45 nm process. */
cpuinfo_uarch_penryn = 0x00100204,
/** Intel Nehalem and Westmere microarchitectures (Core i3/i5/i7 1st gen). */
cpuinfo_uarch_nehalem = 0x00100205,
/** Intel Sandy Bridge microarchitecture (Core i3/i5/i7 2nd gen). */
cpuinfo_uarch_sandy_bridge = 0x00100206,
/** Intel Ivy Bridge microarchitecture (Core i3/i5/i7 3rd gen). */
cpuinfo_uarch_ivy_bridge = 0x00100207,
/** Intel Haswell microarchitecture (Core i3/i5/i7 4th gen). */
cpuinfo_uarch_haswell = 0x00100208,
/** Intel Broadwell microarchitecture. */
cpuinfo_uarch_broadwell = 0x00100209,
/** Intel Sky Lake microarchitecture (14 nm, including Kaby/Coffee/Whiskey/Amber/Comet/Cascade/Cooper Lake). */
cpuinfo_uarch_sky_lake = 0x0010020A,
/** DEPRECATED (Intel Kaby Lake microarchitecture). */
cpuinfo_uarch_kaby_lake = 0x0010020A,
/** Intel Palm Cove microarchitecture (10 nm, Cannon Lake). */
cpuinfo_uarch_palm_cove = 0x0010020B,
/** Intel Sunny Cove microarchitecture (10 nm, Ice Lake). */
cpuinfo_uarch_sunny_cove = 0x0010020C,
/** Pentium 4 with Willamette, Northwood, or Foster cores. */
cpuinfo_uarch_willamette = 0x00100300,
/** Pentium 4 with Prescott and later cores. */
cpuinfo_uarch_prescott = 0x00100301,
/** Intel Atom on 45 nm process. */
cpuinfo_uarch_bonnell = 0x00100400,
/** Intel Atom on 32 nm process. */
cpuinfo_uarch_saltwell = 0x00100401,
/** Intel Silvermont microarchitecture (22 nm out-of-order Atom). */
cpuinfo_uarch_silvermont = 0x00100402,
/** Intel Airmont microarchitecture (14 nm out-of-order Atom). */
cpuinfo_uarch_airmont = 0x00100403,
/** Intel Goldmont microarchitecture (Denverton, Apollo Lake). */
cpuinfo_uarch_goldmont = 0x00100404,
/** Intel Goldmont Plus microarchitecture (Gemini Lake). */
cpuinfo_uarch_goldmont_plus = 0x00100405,
/** Intel Knights Ferry HPC boards. */
cpuinfo_uarch_knights_ferry = 0x00100500,
/** Intel Knights Corner HPC boards (aka Xeon Phi). */
cpuinfo_uarch_knights_corner = 0x00100501,
/** Intel Knights Landing microarchitecture (second-gen MIC). */
cpuinfo_uarch_knights_landing = 0x00100502,
/** Intel Knights Hill microarchitecture (third-gen MIC). */
cpuinfo_uarch_knights_hill = 0x00100503,
/** Intel Knights Mill Xeon Phi. */
cpuinfo_uarch_knights_mill = 0x00100504,
/** Intel/Marvell XScale series. */
cpuinfo_uarch_xscale = 0x00100600,
/** AMD K5. */
cpuinfo_uarch_k5 = 0x00200100,
/** AMD K6 and alike. */
cpuinfo_uarch_k6 = 0x00200101,
/** AMD Athlon and Duron. */
cpuinfo_uarch_k7 = 0x00200102,
/** AMD Athlon 64, Opteron 64. */
cpuinfo_uarch_k8 = 0x00200103,
/** AMD Family 10h (Barcelona, Istambul, Magny-Cours). */
cpuinfo_uarch_k10 = 0x00200104,
/**
* AMD Bulldozer microarchitecture
* Zambezi FX-series CPUs, Zurich, Valencia and Interlagos Opteron CPUs.
*/
cpuinfo_uarch_bulldozer = 0x00200105,
/**
* AMD Piledriver microarchitecture
* Vishera FX-series CPUs, Trinity and Richland APUs, Delhi, Seoul, Abu Dhabi Opteron CPUs.
*/
cpuinfo_uarch_piledriver = 0x00200106,
/** AMD Steamroller microarchitecture (Kaveri APUs). */
cpuinfo_uarch_steamroller = 0x00200107,
/** AMD Excavator microarchitecture (Carizzo APUs). */
cpuinfo_uarch_excavator = 0x00200108,
/** AMD Zen microarchitecture (12/14 nm Ryzen and EPYC CPUs). */
cpuinfo_uarch_zen = 0x00200109,
/** AMD Zen 2 microarchitecture (7 nm Ryzen and EPYC CPUs). */
cpuinfo_uarch_zen2 = 0x0020010A,
/** AMD Zen 3 microarchitecture. */
cpuinfo_uarch_zen3 = 0x0020010B,
/** AMD Zen 4 microarchitecture. */
cpuinfo_uarch_zen4 = 0x0020010C,
/** NSC Geode and AMD Geode GX and LX. */
cpuinfo_uarch_geode = 0x00200200,
/** AMD Bobcat mobile microarchitecture. */
cpuinfo_uarch_bobcat = 0x00200201,
/** AMD Jaguar mobile microarchitecture. */
cpuinfo_uarch_jaguar = 0x00200202,
/** AMD Puma mobile microarchitecture. */
cpuinfo_uarch_puma = 0x00200203,
/** ARM7 series. */
cpuinfo_uarch_arm7 = 0x00300100,
/** ARM9 series. */
cpuinfo_uarch_arm9 = 0x00300101,
/** ARM 1136, ARM 1156, ARM 1176, or ARM 11MPCore. */
cpuinfo_uarch_arm11 = 0x00300102,
/** ARM Cortex-A5. */
cpuinfo_uarch_cortex_a5 = 0x00300205,
/** ARM Cortex-A7. */
cpuinfo_uarch_cortex_a7 = 0x00300207,
/** ARM Cortex-A8. */
cpuinfo_uarch_cortex_a8 = 0x00300208,
/** ARM Cortex-A9. */
cpuinfo_uarch_cortex_a9 = 0x00300209,
/** ARM Cortex-A12. */
cpuinfo_uarch_cortex_a12 = 0x00300212,
/** ARM Cortex-A15. */
cpuinfo_uarch_cortex_a15 = 0x00300215,
/** ARM Cortex-A17. */
cpuinfo_uarch_cortex_a17 = 0x00300217,
/** ARM Cortex-A32. */
cpuinfo_uarch_cortex_a32 = 0x00300332,
/** ARM Cortex-A35. */
cpuinfo_uarch_cortex_a35 = 0x00300335,
/** ARM Cortex-A53. */
cpuinfo_uarch_cortex_a53 = 0x00300353,
/** ARM Cortex-A55 revision 0 (restricted dual-issue capabilities compared to revision 1+). */
cpuinfo_uarch_cortex_a55r0 = 0x00300354,
/** ARM Cortex-A55. */
cpuinfo_uarch_cortex_a55 = 0x00300355,
/** ARM Cortex-A57. */
cpuinfo_uarch_cortex_a57 = 0x00300357,
/** ARM Cortex-A65. */
cpuinfo_uarch_cortex_a65 = 0x00300365,
/** ARM Cortex-A72. */
cpuinfo_uarch_cortex_a72 = 0x00300372,
/** ARM Cortex-A73. */
cpuinfo_uarch_cortex_a73 = 0x00300373,
/** ARM Cortex-A75. */
cpuinfo_uarch_cortex_a75 = 0x00300375,
/** ARM Cortex-A76. */
cpuinfo_uarch_cortex_a76 = 0x00300376,
/** ARM Cortex-A77. */
cpuinfo_uarch_cortex_a77 = 0x00300377,
/** ARM Cortex-A78. */
cpuinfo_uarch_cortex_a78 = 0x00300378,
/** ARM Neoverse N1. */
cpuinfo_uarch_neoverse_n1 = 0x00300400,
/** ARM Neoverse E1. */
cpuinfo_uarch_neoverse_e1 = 0x00300401,
/** ARM Neoverse V1. */
cpuinfo_uarch_neoverse_v1 = 0x00300402,
/** ARM Neoverse N2. */
cpuinfo_uarch_neoverse_n2 = 0x00300403,
/** ARM Neoverse V2. */
cpuinfo_uarch_neoverse_v2 = 0x00300404,
/** ARM Cortex-X1. */
cpuinfo_uarch_cortex_x1 = 0x00300501,
/** ARM Cortex-X2. */
cpuinfo_uarch_cortex_x2 = 0x00300502,
/** ARM Cortex-X3. */
cpuinfo_uarch_cortex_x3 = 0x00300503,
/** ARM Cortex-A510. */
cpuinfo_uarch_cortex_a510 = 0x00300551,
/** ARM Cortex-A710. */
cpuinfo_uarch_cortex_a710 = 0x00300571,
/** ARM Cortex-A715. */
cpuinfo_uarch_cortex_a715 = 0x00300572,
/** Qualcomm Scorpion. */
cpuinfo_uarch_scorpion = 0x00400100,
/** Qualcomm Krait. */
cpuinfo_uarch_krait = 0x00400101,
/** Qualcomm Kryo. */
cpuinfo_uarch_kryo = 0x00400102,
/** Qualcomm Falkor. */
cpuinfo_uarch_falkor = 0x00400103,
/** Qualcomm Saphira. */
cpuinfo_uarch_saphira = 0x00400104,
/** Nvidia Denver. */
cpuinfo_uarch_denver = 0x00500100,
/** Nvidia Denver 2. */
cpuinfo_uarch_denver2 = 0x00500101,
/** Nvidia Carmel. */
cpuinfo_uarch_carmel = 0x00500102,
/** Samsung Exynos M1 (Exynos 8890 big cores). */
cpuinfo_uarch_exynos_m1 = 0x00600100,
/** Samsung Exynos M2 (Exynos 8895 big cores). */
cpuinfo_uarch_exynos_m2 = 0x00600101,
/** Samsung Exynos M3 (Exynos 9810 big cores). */
cpuinfo_uarch_exynos_m3 = 0x00600102,
/** Samsung Exynos M4 (Exynos 9820 big cores). */
cpuinfo_uarch_exynos_m4 = 0x00600103,
/** Samsung Exynos M5 (Exynos 9830 big cores). */
cpuinfo_uarch_exynos_m5 = 0x00600104,
/* Deprecated synonym for Cortex-A76 */
cpuinfo_uarch_cortex_a76ae = 0x00300376,
/* Deprecated names for Exynos. */
cpuinfo_uarch_mongoose_m1 = 0x00600100,
cpuinfo_uarch_mongoose_m2 = 0x00600101,
cpuinfo_uarch_meerkat_m3 = 0x00600102,
cpuinfo_uarch_meerkat_m4 = 0x00600103,
/** Apple A6 and A6X processors. */
cpuinfo_uarch_swift = 0x00700100,
/** Apple A7 processor. */
cpuinfo_uarch_cyclone = 0x00700101,
/** Apple A8 and A8X processor. */
cpuinfo_uarch_typhoon = 0x00700102,
/** Apple A9 and A9X processor. */
cpuinfo_uarch_twister = 0x00700103,
/** Apple A10 and A10X processor. */
cpuinfo_uarch_hurricane = 0x00700104,
/** Apple A11 processor (big cores). */
cpuinfo_uarch_monsoon = 0x00700105,
/** Apple A11 processor (little cores). */
cpuinfo_uarch_mistral = 0x00700106,
/** Apple A12 processor (big cores). */
cpuinfo_uarch_vortex = 0x00700107,
/** Apple A12 processor (little cores). */
cpuinfo_uarch_tempest = 0x00700108,
/** Apple A13 processor (big cores). */
cpuinfo_uarch_lightning = 0x00700109,
/** Apple A13 processor (little cores). */
cpuinfo_uarch_thunder = 0x0070010A,
/** Apple A14 / M1 processor (big cores). */
cpuinfo_uarch_firestorm = 0x0070010B,
/** Apple A14 / M1 processor (little cores). */
cpuinfo_uarch_icestorm = 0x0070010C,
/** Apple A15 / M2 processor (big cores). */
cpuinfo_uarch_avalanche = 0x0070010D,
/** Apple A15 / M2 processor (little cores). */
cpuinfo_uarch_blizzard = 0x0070010E,
/** Cavium ThunderX. */
cpuinfo_uarch_thunderx = 0x00800100,
/** Cavium ThunderX2 (originally Broadcom Vulkan). */
cpuinfo_uarch_thunderx2 = 0x00800200,
/** Marvell PJ4. */
cpuinfo_uarch_pj4 = 0x00900100,
/** Broadcom Brahma B15. */
cpuinfo_uarch_brahma_b15 = 0x00A00100,
/** Broadcom Brahma B53. */
cpuinfo_uarch_brahma_b53 = 0x00A00101,
/** Applied Micro X-Gene. */
cpuinfo_uarch_xgene = 0x00B00100,
/* Hygon Dhyana (a modification of AMD Zen for Chinese market). */
cpuinfo_uarch_dhyana = 0x01000100,
/** HiSilicon TaiShan v110 (Huawei Kunpeng 920 series processors). */
cpuinfo_uarch_taishan_v110 = 0x00C00100,
};
struct cpuinfo_processor {
/** SMT (hyperthread) ID within a core */
uint32_t smt_id;
/** Core containing this logical processor */
const struct cpuinfo_core* core;
/** Cluster of cores containing this logical processor */
const struct cpuinfo_cluster* cluster;
/** Physical package containing this logical processor */
const struct cpuinfo_package* package;
#if defined(__linux__)
/**
* Linux-specific ID for the logical processor:
* - Linux kernel exposes information about this logical processor in /sys/devices/system/cpu/cpu<linux_id>/
* - Bit <linux_id> in the cpu_set_t identifies this logical processor
*/
int linux_id;
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
/** Windows-specific ID for the group containing the logical processor. */
uint16_t windows_group_id;
/**
* Windows-specific ID of the logical processor within its group:
* - Bit <windows_processor_id> in the KAFFINITY mask identifies this logical processor within its group.
*/
uint16_t windows_processor_id;
#endif
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
/** APIC ID (unique x86-specific ID of the logical processor) */
uint32_t apic_id;
#endif
struct {
/** Level 1 instruction cache */
const struct cpuinfo_cache* l1i;
/** Level 1 data cache */
const struct cpuinfo_cache* l1d;
/** Level 2 unified or data cache */
const struct cpuinfo_cache* l2;
/** Level 3 unified or data cache */
const struct cpuinfo_cache* l3;
/** Level 4 unified or data cache */
const struct cpuinfo_cache* l4;
} cache;
};
struct cpuinfo_core {
/** Index of the first logical processor on this core. */
uint32_t processor_start;
/** Number of logical processors on this core */
uint32_t processor_count;
/** Core ID within a package */
uint32_t core_id;
/** Cluster containing this core */
const struct cpuinfo_cluster* cluster;
/** Physical package containing this core. */
const struct cpuinfo_package* package;
/** Vendor of the CPU microarchitecture for this core */
enum cpuinfo_vendor vendor;
/** CPU microarchitecture for this core */
enum cpuinfo_uarch uarch;
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
/** Value of CPUID leaf 1 EAX register for this core */
uint32_t cpuid;
#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
/** Value of Main ID Register (MIDR) for this core */
uint32_t midr;
#endif
/** Clock rate (non-Turbo) of the core, in Hz */
uint64_t frequency;
};
struct cpuinfo_cluster {
/** Index of the first logical processor in the cluster */
uint32_t processor_start;
/** Number of logical processors in the cluster */
uint32_t processor_count;
/** Index of the first core in the cluster */
uint32_t core_start;
/** Number of cores on the cluster */
uint32_t core_count;
/** Cluster ID within a package */
uint32_t cluster_id;
/** Physical package containing the cluster */
const struct cpuinfo_package* package;
/** CPU microarchitecture vendor of the cores in the cluster */
enum cpuinfo_vendor vendor;
/** CPU microarchitecture of the cores in the cluster */
enum cpuinfo_uarch uarch;
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
/** Value of CPUID leaf 1 EAX register of the cores in the cluster */
uint32_t cpuid;
#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
/** Value of Main ID Register (MIDR) of the cores in the cluster */
uint32_t midr;
#endif
/** Clock rate (non-Turbo) of the cores in the cluster, in Hz */
uint64_t frequency;
};
#define CPUINFO_PACKAGE_NAME_MAX 48
struct cpuinfo_package {
/** SoC or processor chip model name */
char name[CPUINFO_PACKAGE_NAME_MAX];
/** Index of the first logical processor on this physical package */
uint32_t processor_start;
/** Number of logical processors on this physical package */
uint32_t processor_count;
/** Index of the first core on this physical package */
uint32_t core_start;
/** Number of cores on this physical package */
uint32_t core_count;
/** Index of the first cluster of cores on this physical package */
uint32_t cluster_start;
/** Number of clusters of cores on this physical package */
uint32_t cluster_count;
};
struct cpuinfo_uarch_info {
/** Type of CPU microarchitecture */
enum cpuinfo_uarch uarch;
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
/** Value of CPUID leaf 1 EAX register for the microarchitecture */
uint32_t cpuid;
#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
/** Value of Main ID Register (MIDR) for the microarchitecture */
uint32_t midr;
#endif
/** Number of logical processors with the microarchitecture */
uint32_t processor_count;
/** Number of cores with the microarchitecture */
uint32_t core_count;
};
#ifdef __cplusplus
extern "C" {
#endif
bool CPUINFO_ABI cpuinfo_initialize(void);
void CPUINFO_ABI cpuinfo_deinitialize(void);
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
/* This structure is not a part of stable API. Use cpuinfo_has_x86_* functions instead. */
struct cpuinfo_x86_isa {
#if CPUINFO_ARCH_X86
bool rdtsc;
#endif
bool rdtscp;
bool rdpid;
bool sysenter;
#if CPUINFO_ARCH_X86
bool syscall;
#endif
bool msr;
bool clzero;
bool clflush;
bool clflushopt;
bool mwait;
bool mwaitx;
#if CPUINFO_ARCH_X86
bool emmx;
#endif
bool fxsave;
bool xsave;
#if CPUINFO_ARCH_X86
bool fpu;
bool mmx;
bool mmx_plus;
#endif
bool three_d_now;
bool three_d_now_plus;
#if CPUINFO_ARCH_X86
bool three_d_now_geode;
#endif
bool prefetch;
bool prefetchw;
bool prefetchwt1;
#if CPUINFO_ARCH_X86
bool daz;
bool sse;
bool sse2;
#endif
bool sse3;
bool ssse3;
bool sse4_1;
bool sse4_2;
bool sse4a;
bool misaligned_sse;
bool avx;
bool avxvnni;
bool fma3;
bool fma4;
bool xop;
bool f16c;
bool avx2;
bool avx512f;
bool avx512pf;
bool avx512er;
bool avx512cd;
bool avx512dq;
bool avx512bw;
bool avx512vl;
bool avx512ifma;
bool avx512vbmi;
bool avx512vbmi2;
bool avx512bitalg;
bool avx512vpopcntdq;
bool avx512vnni;
bool avx512bf16;
bool avx512fp16;
bool avx512vp2intersect;
bool avx512_4vnniw;
bool avx512_4fmaps;
bool hle;
bool rtm;
bool xtest;
bool mpx;
#if CPUINFO_ARCH_X86
bool cmov;
bool cmpxchg8b;
#endif
bool cmpxchg16b;
bool clwb;
bool movbe;
#if CPUINFO_ARCH_X86_64
bool lahf_sahf;
#endif
bool fs_gs_base;
bool lzcnt;
bool popcnt;
bool tbm;
bool bmi;
bool bmi2;
bool adx;
bool aes;
bool vaes;
bool pclmulqdq;
bool vpclmulqdq;
bool gfni;
bool rdrand;
bool rdseed;
bool sha;
bool rng;
bool ace;
bool ace2;
bool phe;
bool pmm;
bool lwp;
};
extern struct cpuinfo_x86_isa cpuinfo_isa;
#endif
static inline bool cpuinfo_has_x86_rdtsc(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.rdtsc;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_rdtscp(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.rdtscp;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_rdpid(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.rdpid;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_clzero(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.clzero;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_mwait(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.mwait;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_mwaitx(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.mwaitx;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_fxsave(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.fxsave;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_xsave(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.xsave;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_fpu(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.fpu;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_mmx(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.mmx;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_mmx_plus(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.mmx_plus;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_3dnow(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.three_d_now;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_3dnow_plus(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.three_d_now_plus;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_3dnow_geode(void) {
#if CPUINFO_ARCH_X86_64
return false;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return false;
#else
return cpuinfo_isa.three_d_now_geode;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_prefetch(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.prefetch;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_prefetchw(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.prefetchw;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_prefetchwt1(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.prefetchwt1;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_daz(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.daz;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.sse;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse2(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.sse2;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse3(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.sse3;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_ssse3(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.ssse3;
#endif
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse4_1(void) {
#if CPUINFO_ARCH_X86_64
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.sse4_1;
#endif
#elif CPUINFO_ARCH_X86
return cpuinfo_isa.sse4_1;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse4_2(void) {
#if CPUINFO_ARCH_X86_64
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.sse4_2;
#endif
#elif CPUINFO_ARCH_X86
return cpuinfo_isa.sse4_2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sse4a(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.sse4a;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_misaligned_sse(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.misaligned_sse;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avxvnni(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avxvnni;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_fma3(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.fma3;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_fma4(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.fma4;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_xop(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.xop;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_f16c(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.f16c;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx2(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512f(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512f;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512pf(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512pf;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512er(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512er;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512cd(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512cd;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512dq(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512dq;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512bw(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512bw;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vl(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vl;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512ifma(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512ifma;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vbmi(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vbmi;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vbmi2(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vbmi2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512bitalg(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512bitalg;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vpopcntdq(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vpopcntdq;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vnni(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vnni;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512bf16(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512bf16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512fp16(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512fp16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512vp2intersect(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512vp2intersect;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512_4vnniw(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512_4vnniw;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_avx512_4fmaps(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.avx512_4fmaps;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_hle(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.hle;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_rtm(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.rtm;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_xtest(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.xtest;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_mpx(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.mpx;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_cmov(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
return cpuinfo_isa.cmov;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_cmpxchg8b(void) {
#if CPUINFO_ARCH_X86_64
return true;
#elif CPUINFO_ARCH_X86
return cpuinfo_isa.cmpxchg8b;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_cmpxchg16b(void) {
#if CPUINFO_ARCH_X86_64
return cpuinfo_isa.cmpxchg16b;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_clwb(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.clwb;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_movbe(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.movbe;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_lahf_sahf(void) {
#if CPUINFO_ARCH_X86
return true;
#elif CPUINFO_ARCH_X86_64
return cpuinfo_isa.lahf_sahf;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_lzcnt(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.lzcnt;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_popcnt(void) {
#if CPUINFO_ARCH_X86_64
#if defined(__ANDROID__)
return true;
#else
return cpuinfo_isa.popcnt;
#endif
#elif CPUINFO_ARCH_X86
return cpuinfo_isa.popcnt;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_tbm(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.tbm;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_bmi(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.bmi;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_bmi2(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.bmi2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_adx(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.adx;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_aes(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.aes;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_vaes(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.vaes;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_pclmulqdq(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.pclmulqdq;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_vpclmulqdq(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.vpclmulqdq;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_gfni(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.gfni;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_rdrand(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.rdrand;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_rdseed(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.rdseed;
#else
return false;
#endif
}
static inline bool cpuinfo_has_x86_sha(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
return cpuinfo_isa.sha;
#else
return false;
#endif
}
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
/* This structure is not a part of stable API. Use cpuinfo_has_arm_* functions instead. */
struct cpuinfo_arm_isa {
#if CPUINFO_ARCH_ARM
bool thumb;
bool thumb2;
bool thumbee;
bool jazelle;
bool armv5e;
bool armv6;
bool armv6k;
bool armv7;
bool armv7mp;
bool armv8;
bool idiv;
bool vfpv2;
bool vfpv3;
bool d32;
bool fp16;
bool fma;
bool wmmx;
bool wmmx2;
bool neon;
#endif
#if CPUINFO_ARCH_ARM64
bool atomics;
bool bf16;
bool sve;
bool sve2;
bool i8mm;
#endif
bool rdm;
bool fp16arith;
bool dot;
bool jscvt;
bool fcma;
bool fhm;
bool aes;
bool sha1;
bool sha2;
bool pmull;
bool crc32;
};
extern struct cpuinfo_arm_isa cpuinfo_isa;
#endif
static inline bool cpuinfo_has_arm_thumb(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.thumb;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_thumb2(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.thumb2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v5e(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.armv5e;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v6(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.armv6;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v6k(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.armv6k;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v7(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.armv7;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v7mp(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.armv7mp;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_v8(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.armv8;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_idiv(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.idiv;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv2(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv3(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv3_d32(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3 && cpuinfo_isa.d32;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv3_fp16(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3 && cpuinfo_isa.fp16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv3_fp16_d32(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3 && cpuinfo_isa.fp16 && cpuinfo_isa.d32;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv4(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3 && cpuinfo_isa.fma;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_vfpv4_d32(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.vfpv3 && cpuinfo_isa.fma && cpuinfo_isa.d32;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_fp16_arith(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.fp16arith;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_bf16(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.bf16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_wmmx(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.wmmx;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_wmmx2(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.wmmx2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.neon;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_fp16(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.neon && cpuinfo_isa.fp16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_fma(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.neon && cpuinfo_isa.fma;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_v8(void) {
#if CPUINFO_ARCH_ARM64
return true;
#elif CPUINFO_ARCH_ARM
return cpuinfo_isa.neon && cpuinfo_isa.armv8;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_atomics(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.atomics;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_rdm(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.rdm;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_fp16_arith(void) {
#if CPUINFO_ARCH_ARM
return cpuinfo_isa.neon && cpuinfo_isa.fp16arith;
#elif CPUINFO_ARCH_ARM64
return cpuinfo_isa.fp16arith;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_fhm(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.fhm;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_dot(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.dot;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_neon_bf16(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.bf16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_jscvt(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.jscvt;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_fcma(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.fcma;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_i8mm(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.i8mm;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_aes(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.aes;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_sha1(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.sha1;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_sha2(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.sha2;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_pmull(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.pmull;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_crc32(void) {
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
return cpuinfo_isa.crc32;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_sve(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.sve;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_sve_bf16(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.sve && cpuinfo_isa.bf16;
#else
return false;
#endif
}
static inline bool cpuinfo_has_arm_sve2(void) {
#if CPUINFO_ARCH_ARM64
return cpuinfo_isa.sve2;
#else
return false;
#endif
}
const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_processors(void);
const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_cores(void);
const struct cpuinfo_cluster* CPUINFO_ABI cpuinfo_get_clusters(void);
const struct cpuinfo_package* CPUINFO_ABI cpuinfo_get_packages(void);
const struct cpuinfo_uarch_info* CPUINFO_ABI cpuinfo_get_uarchs(void);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_caches(void);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_caches(void);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_caches(void);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l3_caches(void);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l4_caches(void);
const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_processor(uint32_t index);
const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_core(uint32_t index);
const struct cpuinfo_cluster* CPUINFO_ABI cpuinfo_get_cluster(uint32_t index);
const struct cpuinfo_package* CPUINFO_ABI cpuinfo_get_package(uint32_t index);
const struct cpuinfo_uarch_info* CPUINFO_ABI cpuinfo_get_uarch(uint32_t index);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1i_cache(uint32_t index);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l1d_cache(uint32_t index);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l2_cache(uint32_t index);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l3_cache(uint32_t index);
const struct cpuinfo_cache* CPUINFO_ABI cpuinfo_get_l4_cache(uint32_t index);
uint32_t CPUINFO_ABI cpuinfo_get_processors_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_cores_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_clusters_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_packages_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_uarchs_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_l1i_caches_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_l1d_caches_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_l2_caches_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_l3_caches_count(void);
uint32_t CPUINFO_ABI cpuinfo_get_l4_caches_count(void);
/**
* Returns upper bound on cache size.
*/
uint32_t CPUINFO_ABI cpuinfo_get_max_cache_size(void);
/**
* Identify the logical processor that executes the current thread.
*
* There is no guarantee that the thread will stay on the same logical processor for any time.
* Callers should treat the result as only a hint, and be prepared to handle NULL return value.
*/
const struct cpuinfo_processor* CPUINFO_ABI cpuinfo_get_current_processor(void);
/**
* Identify the core that executes the current thread.
*
* There is no guarantee that the thread will stay on the same core for any time.
* Callers should treat the result as only a hint, and be prepared to handle NULL return value.
*/
const struct cpuinfo_core* CPUINFO_ABI cpuinfo_get_current_core(void);
/**
* Identify the microarchitecture index of the core that executes the current thread.
* If the system does not support such identification, the function returns 0.
*
* There is no guarantee that the thread will stay on the same type of core for any time.
* Callers should treat the result as only a hint.
*/
uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index(void);
/**
* Identify the microarchitecture index of the core that executes the current thread.
* If the system does not support such identification, the function returns the user-specified default value.
*
* There is no guarantee that the thread will stay on the same type of core for any time.
* Callers should treat the result as only a hint.
*/
uint32_t CPUINFO_ABI cpuinfo_get_current_uarch_index_with_default(uint32_t default_uarch_index);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* CPUINFO_H */
|