mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a48e82cf6a | ||
|
|
d2bda37e5f | ||
|
|
707cd64b8a | ||
|
|
f6cdabe973 | ||
|
|
26af5ff83e | ||
|
|
5798d51d4e | ||
|
|
fa89ef79f7 | ||
|
|
93d54c3723 | ||
|
|
3e3a42f13b | ||
|
|
483f663382 |
11
Makefile
11
Makefile
@@ -38,10 +38,16 @@ ifneq ($(OS),Windows_NT)
|
|||||||
CFLAGS += -DARCH_PPC -std=gnu99 -fstack-protector-all -Wno-language-extension-token
|
CFLAGS += -DARCH_PPC -std=gnu99 -fstack-protector-all -Wno-language-extension-token
|
||||||
else ifeq ($(arch), $(filter $(arch), arm aarch64_be aarch64 arm64 armv8b armv8l armv7l armv6l))
|
else ifeq ($(arch), $(filter $(arch), arm aarch64_be aarch64 arm64 armv8b armv8l armv7l armv6l))
|
||||||
SRC_DIR=src/arm/
|
SRC_DIR=src/arm/
|
||||||
SOURCE += $(COMMON_SRC) $(SRC_DIR)midr.c $(SRC_DIR)uarch.c $(SRC_COMMON)soc.c $(SRC_DIR)soc.c $(SRC_COMMON)pci.c $(SRC_DIR)udev.c
|
SOURCE += $(COMMON_SRC) $(SRC_DIR)midr.c $(SRC_DIR)uarch.c $(SRC_COMMON)soc.c $(SRC_DIR)soc.c $(SRC_COMMON)pci.c $(SRC_DIR)udev.c sve.o
|
||||||
HEADERS += $(COMMON_HDR) $(SRC_DIR)midr.h $(SRC_DIR)uarch.h $(SRC_COMMON)soc.h $(SRC_DIR)soc.h $(SRC_COMMON)pci.h $(SRC_DIR)udev.c $(SRC_DIR)socs.h
|
HEADERS += $(COMMON_HDR) $(SRC_DIR)midr.h $(SRC_DIR)uarch.h $(SRC_COMMON)soc.h $(SRC_DIR)soc.h $(SRC_COMMON)pci.h $(SRC_DIR)udev.c $(SRC_DIR)socs.h
|
||||||
CFLAGS += -DARCH_ARM -Wno-unused-parameter -std=c99 -fstack-protector-all
|
CFLAGS += -DARCH_ARM -Wno-unused-parameter -std=c99 -fstack-protector-all
|
||||||
|
|
||||||
|
# Check if the compiler supports -march=armv8-a+sve. We will use it (if supported) to compile SVE detection code later
|
||||||
|
is_sve_flag_supported := $(shell $(CC) -march=armv8-a+sve -c $(SRC_DIR)sve.c -o sve_test.o 2> /dev/null && echo 'yes'; rm -f sve_test.o)
|
||||||
|
ifeq ($(is_sve_flag_supported), yes)
|
||||||
|
SVE_FLAGS += -march=armv8-a+sve
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(os), Darwin)
|
ifeq ($(os), Darwin)
|
||||||
SOURCE += $(SRC_COMMON)sysctl.c
|
SOURCE += $(SRC_COMMON)sysctl.c
|
||||||
HEADERS += $(SRC_COMMON)sysctl.h
|
HEADERS += $(SRC_COMMON)sysctl.h
|
||||||
@@ -91,6 +97,9 @@ freq_avx.o: Makefile $(SRC_DIR)freq/freq_avx.c $(SRC_DIR)freq/freq_avx.h $(SRC_D
|
|||||||
freq_avx512.o: Makefile $(SRC_DIR)freq/freq_avx512.c $(SRC_DIR)freq/freq_avx512.h $(SRC_DIR)freq/freq.h
|
freq_avx512.o: Makefile $(SRC_DIR)freq/freq_avx512.c $(SRC_DIR)freq/freq_avx512.h $(SRC_DIR)freq/freq.h
|
||||||
$(CC) $(CFLAGS) $(SANITY_FLAGS) -c -mavx512f -pthread $(SRC_DIR)freq/freq_avx512.c -o $@
|
$(CC) $(CFLAGS) $(SANITY_FLAGS) -c -mavx512f -pthread $(SRC_DIR)freq/freq_avx512.c -o $@
|
||||||
|
|
||||||
|
sve.o: Makefile $(SRC_DIR)sve.c $(SRC_DIR)sve.h
|
||||||
|
$(CC) $(CFLAGS) $(SANITY_FLAGS) $(SVE_FLAGS) -c $(SRC_DIR)sve.c -o $@
|
||||||
|
|
||||||
$(OUTPUT): Makefile $(SOURCE) $(HEADERS)
|
$(OUTPUT): Makefile $(SOURCE) $(HEADERS)
|
||||||
ifeq ($(GIT_VERSION),"")
|
ifeq ($(GIT_VERSION),"")
|
||||||
$(CC) $(CFLAGS) $(SANITY_FLAGS) $(SOURCE) -o $(OUTPUT)
|
$(CC) $(CFLAGS) $(SANITY_FLAGS) $(SOURCE) -o $(OUTPUT)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "udev.h"
|
#include "udev.h"
|
||||||
#include "midr.h"
|
#include "midr.h"
|
||||||
#include "uarch.h"
|
#include "uarch.h"
|
||||||
|
#include "sve.h"
|
||||||
|
|
||||||
bool cores_are_equal(int c1pos, int c2pos, uint32_t* midr_array, int32_t* freq_array) {
|
bool cores_are_equal(int c1pos, int c2pos, uint32_t* midr_array, int32_t* freq_array) {
|
||||||
return midr_array[c1pos] == midr_array[c2pos] && freq_array[c1pos] == freq_array[c2pos];
|
return midr_array[c1pos] == midr_array[c2pos] && freq_array[c1pos] == freq_array[c2pos];
|
||||||
@@ -168,6 +169,15 @@ struct features* get_features_info(void) {
|
|||||||
feat->SHA1 = hwcaps & HWCAP_SHA1;
|
feat->SHA1 = hwcaps & HWCAP_SHA1;
|
||||||
feat->SHA2 = hwcaps & HWCAP_SHA2;
|
feat->SHA2 = hwcaps & HWCAP_SHA2;
|
||||||
feat->NEON = hwcaps & HWCAP_ASIMD;
|
feat->NEON = hwcaps & HWCAP_ASIMD;
|
||||||
|
feat->SVE = hwcaps & HWCAP_SVE;
|
||||||
|
|
||||||
|
hwcaps = getauxval(AT_HWCAP2);
|
||||||
|
if (errno == ENOENT) {
|
||||||
|
printWarn("Unable to retrieve AT_HWCAP2 using getauxval");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
feat->SVE2 = hwcaps & HWCAP2_SVE2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
else {
|
else {
|
||||||
@@ -183,6 +193,8 @@ struct features* get_features_info(void) {
|
|||||||
feat->CRC32 = hwcaps & HWCAP2_CRC32;
|
feat->CRC32 = hwcaps & HWCAP2_CRC32;
|
||||||
feat->SHA1 = hwcaps & HWCAP2_SHA1;
|
feat->SHA1 = hwcaps & HWCAP2_SHA1;
|
||||||
feat->SHA2 = hwcaps & HWCAP2_SHA2;
|
feat->SHA2 = hwcaps & HWCAP2_SHA2;
|
||||||
|
feat->SVE = false;
|
||||||
|
feat->SVE2 = false;
|
||||||
}
|
}
|
||||||
#endif // ifdef __aarch64__
|
#endif // ifdef __aarch64__
|
||||||
#elif defined __APPLE__ || __MACH__
|
#elif defined __APPLE__ || __MACH__
|
||||||
@@ -192,8 +204,14 @@ struct features* get_features_info(void) {
|
|||||||
feat->SHA1 = true;
|
feat->SHA1 = true;
|
||||||
feat->SHA2 = true;
|
feat->SHA2 = true;
|
||||||
feat->NEON = true;
|
feat->NEON = true;
|
||||||
|
feat->SVE = false;
|
||||||
|
feat->SVE2 = false;
|
||||||
#endif // ifdef __linux__
|
#endif // ifdef __linux__
|
||||||
|
|
||||||
|
if (feat->SVE || feat->SVE2) {
|
||||||
|
feat->cntb = sve_cntb();
|
||||||
|
}
|
||||||
|
|
||||||
return feat;
|
return feat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +431,8 @@ struct cpuInfo* get_cpu_info(void) {
|
|||||||
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
||||||
init_cpu_info(cpu);
|
init_cpu_info(cpu);
|
||||||
|
|
||||||
|
test_thread_siblings_list();
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
return get_cpu_info_linux(cpu);
|
return get_cpu_info_linux(cpu);
|
||||||
#elif defined __APPLE__ || __MACH__
|
#elif defined __APPLE__ || __MACH__
|
||||||
@@ -430,7 +450,7 @@ char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_soc
|
|||||||
|
|
||||||
char* get_str_features(struct cpuInfo* cpu) {
|
char* get_str_features(struct cpuInfo* cpu) {
|
||||||
struct features* feat = cpu->feat;
|
struct features* feat = cpu->feat;
|
||||||
uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,") + 1;
|
uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,SVE,SVE2") + 1;
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
char* string = ecalloc(max_len, sizeof(char));
|
char* string = ecalloc(max_len, sizeof(char));
|
||||||
|
|
||||||
@@ -438,6 +458,14 @@ char* get_str_features(struct cpuInfo* cpu) {
|
|||||||
strcat(string, "NEON,");
|
strcat(string, "NEON,");
|
||||||
len += 5;
|
len += 5;
|
||||||
}
|
}
|
||||||
|
if(feat->SVE) {
|
||||||
|
strcat(string, "SVE,");
|
||||||
|
len += 4;
|
||||||
|
}
|
||||||
|
if(feat->SVE2) {
|
||||||
|
strcat(string, "SVE2,");
|
||||||
|
len += 5;
|
||||||
|
}
|
||||||
if(feat->SHA1) {
|
if(feat->SHA1) {
|
||||||
strcat(string, "SHA1,");
|
strcat(string, "SHA1,");
|
||||||
len += 5;
|
len += 5;
|
||||||
|
|||||||
@@ -167,11 +167,13 @@ bool match_google(char* soc_name, struct system_on_chip* soc) {
|
|||||||
|
|
||||||
// https://www.techinsights.com/
|
// https://www.techinsights.com/
|
||||||
// https://datasheetspdf.com/pdf-file/1316605/HiSilicon/Hi3660/1
|
// https://datasheetspdf.com/pdf-file/1316605/HiSilicon/Hi3660/1
|
||||||
|
// https://github.com/Dr-Noob/cpufetch/issues/259
|
||||||
bool match_hisilicon(char* soc_name, struct system_on_chip* soc) {
|
bool match_hisilicon(char* soc_name, struct system_on_chip* soc) {
|
||||||
char* tmp;
|
char* tmp;
|
||||||
|
|
||||||
if((tmp = strstr(soc_name, "hi")) == NULL)
|
if((tmp = strstr(soc_name, "hi")) != NULL);
|
||||||
return false;
|
else if((tmp = strstr(soc_name, "kirin")) != NULL);
|
||||||
|
else return false;
|
||||||
|
|
||||||
soc->soc_vendor = SOC_VENDOR_KIRIN;
|
soc->soc_vendor = SOC_VENDOR_KIRIN;
|
||||||
|
|
||||||
@@ -204,6 +206,7 @@ bool match_hisilicon(char* soc_name, struct system_on_chip* soc) {
|
|||||||
SOC_EQ(tmp, "hi3680", "980", SOC_HISILICON_3680, soc, 7)
|
SOC_EQ(tmp, "hi3680", "980", SOC_HISILICON_3680, soc, 7)
|
||||||
//SOC_EQ(tmp, "?", "985", SOC_KIRIN, soc, 7)
|
//SOC_EQ(tmp, "?", "985", SOC_KIRIN, soc, 7)
|
||||||
SOC_EQ(tmp, "hi3690", "990", SOC_HISILICON_3690, soc, 7)
|
SOC_EQ(tmp, "hi3690", "990", SOC_HISILICON_3690, soc, 7)
|
||||||
|
SOC_EQ(tmp, "kirin9000s", "9000s", SOC_HISILICON_9000S,soc, 7)
|
||||||
SOC_END
|
SOC_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ enum {
|
|||||||
SOC_HISILICON_3670,
|
SOC_HISILICON_3670,
|
||||||
SOC_HISILICON_3680,
|
SOC_HISILICON_3680,
|
||||||
SOC_HISILICON_3690,
|
SOC_HISILICON_3690,
|
||||||
|
SOC_HISILICON_9000S,
|
||||||
// Kunpeng //
|
// Kunpeng //
|
||||||
SOC_KUNPENG_920,
|
SOC_KUNPENG_920,
|
||||||
SOC_KUNPENG_930,
|
SOC_KUNPENG_930,
|
||||||
@@ -377,7 +378,7 @@ enum {
|
|||||||
|
|
||||||
inline static VENDOR get_soc_vendor_from_soc(SOC soc) {
|
inline static VENDOR get_soc_vendor_from_soc(SOC soc) {
|
||||||
if(soc >= SOC_BCM_2835 && soc <= SOC_BCM_2712) return SOC_VENDOR_BROADCOM;
|
if(soc >= SOC_BCM_2835 && soc <= SOC_BCM_2712) return SOC_VENDOR_BROADCOM;
|
||||||
else if(soc >= SOC_HISILICON_3620 && soc <= SOC_HISILICON_3690) return SOC_VENDOR_KIRIN;
|
else if(soc >= SOC_HISILICON_3620 && soc <= SOC_HISILICON_9000S) return SOC_VENDOR_KIRIN;
|
||||||
else if(soc >= SOC_KUNPENG_920 && soc <= SOC_KUNPENG_930) return SOC_VENDOR_KUNPENG;
|
else if(soc >= SOC_KUNPENG_920 && soc <= SOC_KUNPENG_930) return SOC_VENDOR_KUNPENG;
|
||||||
else if(soc >= SOC_EXYNOS_3475 && soc <= SOC_EXYNOS_880) return SOC_VENDOR_EXYNOS;
|
else if(soc >= SOC_EXYNOS_3475 && soc <= SOC_EXYNOS_880) return SOC_VENDOR_EXYNOS;
|
||||||
else if(soc >= SOC_MTK_MT6893 && soc <= SOC_MTK_MT8783) return SOC_VENDOR_MEDIATEK;
|
else if(soc >= SOC_MTK_MT6893 && soc <= SOC_MTK_MT8783) return SOC_VENDOR_MEDIATEK;
|
||||||
|
|||||||
16
src/arm/sve.c
Normal file
16
src/arm/sve.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include "../common/global.h"
|
||||||
|
|
||||||
|
// https://learn.arm.com/learning-paths/servers-and-cloud-computing/sve/sve_basics/#:~:text=Using%20a%20text%20editor%20of%20your%20choice%2C%20copy,svcntb%28%29%29%3B%20%7D%20This%20program%20prints%20the%20vector%20length
|
||||||
|
uint64_t sve_cntb(void) {
|
||||||
|
#ifdef __ARM_FEATURE_SVE
|
||||||
|
uint64_t x0 = 0;
|
||||||
|
__asm volatile("cntb %0"
|
||||||
|
: "=r"(x0));
|
||||||
|
printf("cntb=%ld\n", x0);
|
||||||
|
return x0;
|
||||||
|
#else
|
||||||
|
printWarn("sve_cntb: SVE not enabled by the compiler");
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
6
src/arm/sve.h
Normal file
6
src/arm/sve.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __SVE_DETECTION__
|
||||||
|
#define __SVE_DETECTION__
|
||||||
|
|
||||||
|
uint64_t sve_cntb(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -75,6 +75,7 @@ static const ISA isas_uarch[] = {
|
|||||||
[UARCH_THUNDERX] = ISA_ARMv8_A,
|
[UARCH_THUNDERX] = ISA_ARMv8_A,
|
||||||
[UARCH_THUNDERX2] = ISA_ARMv8_1_A,
|
[UARCH_THUNDERX2] = ISA_ARMv8_1_A,
|
||||||
[UARCH_TAISHAN_V110] = ISA_ARMv8_2_A,
|
[UARCH_TAISHAN_V110] = ISA_ARMv8_2_A,
|
||||||
|
[UARCH_TAISHAN_V120] = ISA_ARMv8_2_A, // Not confirmed
|
||||||
[UARCH_TAISHAN_V200] = ISA_ARMv8_2_A, // Not confirmed
|
[UARCH_TAISHAN_V200] = ISA_ARMv8_2_A, // Not confirmed
|
||||||
[UARCH_DENVER] = ISA_ARMv8_A,
|
[UARCH_DENVER] = ISA_ARMv8_A,
|
||||||
[UARCH_DENVER2] = ISA_ARMv8_A,
|
[UARCH_DENVER2] = ISA_ARMv8_A,
|
||||||
@@ -202,8 +203,10 @@ struct uarch* get_uarch_from_midr(uint32_t midr, struct cpuInfo* cpu) {
|
|||||||
CHECK_UARCH(arch, cpu, 'C', 0x0AF, NA, NA, "ThunderX2 99XX", UARCH_THUNDERX2, CPU_VENDOR_CAVIUM)
|
CHECK_UARCH(arch, cpu, 'C', 0x0AF, NA, NA, "ThunderX2 99XX", UARCH_THUNDERX2, CPU_VENDOR_CAVIUM)
|
||||||
|
|
||||||
CHECK_UARCH(arch, cpu, 'H', 0xD01, NA, NA, "TaiShan v110", UARCH_TAISHAN_V110, CPU_VENDOR_HUAWEI) // Kunpeng 920 series
|
CHECK_UARCH(arch, cpu, 'H', 0xD01, NA, NA, "TaiShan v110", UARCH_TAISHAN_V110, CPU_VENDOR_HUAWEI) // Kunpeng 920 series
|
||||||
|
CHECK_UARCH(arch, cpu, 'H', 0xD02, 2, 2, "TaiShan v120", UARCH_TAISHAN_V120, CPU_VENDOR_HUAWEI) // Kiring 9000S Big cores (https://github.com/Dr-Noob/cpufetch/issues/259)
|
||||||
CHECK_UARCH(arch, cpu, 'H', 0xD02, NA, NA, "TaiShan v200", UARCH_TAISHAN_V200, CPU_VENDOR_HUAWEI) // Kunpeng 930 series (found in openeuler: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/XQCV7NX2UKRIUWUFKRF4PO3QENCOUFR3)
|
CHECK_UARCH(arch, cpu, 'H', 0xD02, NA, NA, "TaiShan v200", UARCH_TAISHAN_V200, CPU_VENDOR_HUAWEI) // Kunpeng 930 series (found in openeuler: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/XQCV7NX2UKRIUWUFKRF4PO3QENCOUFR3)
|
||||||
CHECK_UARCH(arch, cpu, 'H', 0xD40, NA, NA, "Cortex-A76", UARCH_CORTEX_A76, CPU_VENDOR_ARM) // Kirin 980 Big/Medium cores -> Cortex-A76
|
CHECK_UARCH(arch, cpu, 'H', 0xD40, NA, NA, "Cortex-A76", UARCH_CORTEX_A76, CPU_VENDOR_ARM) // Kirin 980 Big/Medium cores -> Cortex-A76
|
||||||
|
CHECK_UARCH(arch, cpu, 'H', 0xD42, NA, NA, "TaiShan v120", UARCH_TAISHAN_V120, CPU_VENDOR_HUAWEI) // Kiring 9000S Small Cores (https://github.com/Dr-Noob/cpufetch/issues/259)
|
||||||
|
|
||||||
CHECK_UARCH(arch, cpu, 'N', 0x000, NA, NA, "Denver", UARCH_DENVER, CPU_VENDOR_NVIDIA)
|
CHECK_UARCH(arch, cpu, 'N', 0x000, NA, NA, "Denver", UARCH_DENVER, CPU_VENDOR_NVIDIA)
|
||||||
CHECK_UARCH(arch, cpu, 'N', 0x003, NA, NA, "Denver2", UARCH_DENVER2, CPU_VENDOR_NVIDIA)
|
CHECK_UARCH(arch, cpu, 'N', 0x003, NA, NA, "Denver2", UARCH_DENVER2, CPU_VENDOR_NVIDIA)
|
||||||
@@ -291,7 +294,10 @@ int get_vpus_width(struct cpuInfo* cpu) {
|
|||||||
case UARCH_NEOVERSE_V1:
|
case UARCH_NEOVERSE_V1:
|
||||||
return 256;
|
return 256;
|
||||||
default:
|
default:
|
||||||
if(cpu->feat->NEON) {
|
if (cpu->feat->SVE && cpu->feat->cntb > 0) {
|
||||||
|
return cpu->feat->cntb * 8;
|
||||||
|
}
|
||||||
|
else if (cpu->feat->NEON) {
|
||||||
if(is_ARMv8_or_newer(cpu)) {
|
if(is_ARMv8_or_newer(cpu)) {
|
||||||
return 128;
|
return 128;
|
||||||
}
|
}
|
||||||
@@ -325,6 +331,7 @@ int get_number_of_vpus(struct cpuInfo* cpu) {
|
|||||||
case UARCH_ICESTORM: // [https://dougallj.github.io/applecpu/icestorm-simd.html]
|
case UARCH_ICESTORM: // [https://dougallj.github.io/applecpu/icestorm-simd.html]
|
||||||
case UARCH_BLIZZARD: // [https://en.wikipedia.org/wiki/Comparison_of_ARM_processors]
|
case UARCH_BLIZZARD: // [https://en.wikipedia.org/wiki/Comparison_of_ARM_processors]
|
||||||
case UARCH_TAISHAN_V110:// [https://www-file.huawei.com/-/media/corp2020/pdf/publications/huawei-research/2022/huawei-research-issue1-en.pdf]: "128-bit x 2 for single precision"
|
case UARCH_TAISHAN_V110:// [https://www-file.huawei.com/-/media/corp2020/pdf/publications/huawei-research/2022/huawei-research-issue1-en.pdf]: "128-bit x 2 for single precision"
|
||||||
|
case UARCH_TAISHAN_V120:// Not confirmed, asssuming same as v110
|
||||||
case UARCH_TAISHAN_V200:// Not confirmed, asssuming same as v110
|
case UARCH_TAISHAN_V200:// Not confirmed, asssuming same as v110
|
||||||
case UARCH_CORTEX_A57: // [https://www.anandtech.com/show/8718/the-samsung-galaxy-note-4-exynos-review/5]
|
case UARCH_CORTEX_A57: // [https://www.anandtech.com/show/8718/the-samsung-galaxy-note-4-exynos-review/5]
|
||||||
case UARCH_CORTEX_A72: // [https://www.anandtech.com/show/10347/arm-cortex-a73-artemis-unveiled/2]
|
case UARCH_CORTEX_A72: // [https://www.anandtech.com/show/10347/arm-cortex-a73-artemis-unveiled/2]
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ enum {
|
|||||||
UARCH_BRAHMA_B15,
|
UARCH_BRAHMA_B15,
|
||||||
UARCH_BRAHMA_B53,
|
UARCH_BRAHMA_B53,
|
||||||
UARCH_XGENE, // Applied Micro X-Gene.
|
UARCH_XGENE, // Applied Micro X-Gene.
|
||||||
|
// HUAWEI
|
||||||
UARCH_TAISHAN_V110, // HiSilicon TaiShan v110
|
UARCH_TAISHAN_V110, // HiSilicon TaiShan v110
|
||||||
|
UARCH_TAISHAN_V120, // HiSilicon TaiShan v120
|
||||||
UARCH_TAISHAN_V200, // HiSilicon TaiShan v200
|
UARCH_TAISHAN_V200, // HiSilicon TaiShan v200
|
||||||
// PHYTIUM
|
// PHYTIUM
|
||||||
UARCH_XIAOMI, // Not to be confused with Xiaomi Inc
|
UARCH_XIAOMI, // Not to be confused with Xiaomi Inc
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ struct features {
|
|||||||
bool SHA1;
|
bool SHA1;
|
||||||
bool SHA2;
|
bool SHA2;
|
||||||
bool CRC32;
|
bool CRC32;
|
||||||
|
bool SVE;
|
||||||
|
bool SVE2;
|
||||||
|
uint32_t cntb;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -315,6 +315,24 @@ int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Just to check what is going on with missing thread_siblings_list
|
||||||
|
void test_thread_siblings_list(void) {
|
||||||
|
int num_cores = 12;
|
||||||
|
int filelen;
|
||||||
|
char* buf = NULL;
|
||||||
|
|
||||||
|
for(int i=0; i < num_cores; i++) {
|
||||||
|
char* path = ecalloc(500, sizeof(char));
|
||||||
|
sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", i);
|
||||||
|
|
||||||
|
if((buf = read_file(path, &filelen)) == NULL) {
|
||||||
|
printf("Could not open '%s'", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s: %s\n", path, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int get_num_sockets_package_cpus(struct topology* topo) {
|
int get_num_sockets_package_cpus(struct topology* topo) {
|
||||||
// Get number of sockets using
|
// Get number of sockets using
|
||||||
// /sys/devices/system/cpu/cpu*/topology/package_cpus
|
// /sys/devices/system/cpu/cpu*/topology/package_cpus
|
||||||
|
|||||||
@@ -43,5 +43,6 @@ int get_num_sockets_package_cpus(struct topology* topo);
|
|||||||
int get_ncores_from_cpuinfo(void);
|
int get_ncores_from_cpuinfo(void);
|
||||||
char* get_field_from_cpuinfo(char* CPUINFO_FIELD);
|
char* get_field_from_cpuinfo(char* CPUINFO_FIELD);
|
||||||
bool is_devtree_compatible(char* str);
|
bool is_devtree_compatible(char* str);
|
||||||
|
void test_thread_siblings_list(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user