提交 b2918f40 编写于 作者: M Megvii Engine Team

feat(third_party): sync patch of cpuinfo and prepare.sh

GitOrigin-RevId: 59e92d25bfdea75b6963653a72c41ea87079add8
上级 bc2b8d6f
......@@ -3,12 +3,12 @@ set -e
function apply_cpuinfo_patches() {
if [ -d "./cpuinfo" ]; then
cp ./patches/0001-fix-arm-linux-fix-some-build-warnings-and-errors.patch cpuinfo/
cp ./patches/cpuinfo-multi-commits.patch cpuinfo/
pushd cpuinfo >/dev/null
git config user.name "$1"
git config user.email "$2"
git am 0001-fix-arm-linux-fix-some-build-warnings-and-errors.patch
rm 0001-fix-arm-linux-fix-some-build-warnings-and-errors.patch
git am cpuinfo-multi-commits.patch
rm cpuinfo-multi-commits.patch
popd >/dev/null
else
echo "cpuinfo not exist, can not apply patches."
......
From 0c64236f0d9463e508f8ebd8e73efafa0049d13b Mon Sep 17 00:00:00 2001
From: Megvii Engine Team <megengine@megvii.com>
Date: Thu, 30 Jul 2020 14:26:40 +0800
Subject: [PATCH] fix(arm/linux): fix uclibc build error
---
src/arm/linux/hwcap.c | 7 ++++---
src/arm/linux/init.c | 4 +++-
src/linux/processors.c | 5 +++++
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/arm/linux/hwcap.c b/src/arm/linux/hwcap.c
index 36d0d91..5e1c301 100644
--- a/src/arm/linux/hwcap.c
+++ b/src/arm/linux/hwcap.c
@@ -15,7 +15,8 @@
#include <arm/linux/api.h>
#include <cpuinfo/log.h>
-#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__)
+#if CPUINFO_ARCH_ARM64 || CPUINFO_ARCH_ARM && !defined(__ANDROID__) && !defined(__UCLIBC__)
+
#include <sys/auxv.h>
#else
#define AT_HWCAP 16
@@ -38,7 +39,7 @@
#endif
-#if CPUINFO_ARCH_ARM
+#if CPUINFO_ARCH_ARM && !defined(__UCLIBC__)
typedef unsigned long (*getauxval_function_t)(unsigned long);
bool cpuinfo_arm_linux_hwcap_from_getauxval(
@@ -144,7 +145,7 @@
#endif
}
#endif /* __ANDROID__ */
-#elif CPUINFO_ARCH_ARM64
+#elif CPUINFO_ARCH_ARM64 && !defined(__UCLIBC__)
uint32_t cpuinfo_arm_linux_hwcap_from_getauxval(void) {
#if CPUINFO_MOCK
return mock_hwcap;
diff --git a/src/arm/linux/init.c b/src/arm/linux/init.c
index 89d957e..8225f5e 100644
--- a/src/arm/linux/init.c
+++ b/src/arm/linux/init.c
@@ -234,6 +234,8 @@ void cpuinfo_arm_linux_init(void) {
cpuinfo_arm_linux_decode_chipset(proc_cpuinfo_hardware, proc_cpuinfo_revision, valid_processors, 0);
#endif
+#if !defined(__UCLIBC__)
+
#if CPUINFO_ARCH_ARM
uint32_t isa_features = 0, isa_features2 = 0;
#ifdef __ANDROID__
@@ -282,7 +284,7 @@ void cpuinfo_arm_linux_init(void) {
cpuinfo_arm64_linux_decode_isa_from_proc_cpuinfo(
isa_features, last_midr, &chipset, &cpuinfo_isa);
#endif
-
+#endif
/* Detect min/max frequency and package ID */
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
diff --git a/src/linux/processors.c b/src/linux/processors.c
index 4904e2a..a1d4693 100644
--- a/src/linux/processors.c
+++ b/src/linux/processors.c
@@ -90,8 +90,13 @@ static bool uint32_parser(const char* text_start, const char* text_end, void* co
uint32_t kernel_max = 0;
const char* parsed_end = parse_number(text_start, text_end, &kernel_max);
if (parsed_end == text_start) {
+#if defined(__UCLIBC__)
+ cpuinfo_log_warning("failed to parse file %s: \"%.*s\" is not an unsigned number",
+ KERNEL_MAX_FILENAME, (int) (text_end - text_start), text_start);
+#else
cpuinfo_log_error("failed to parse file %s: \"%.*s\" is not an unsigned number",
KERNEL_MAX_FILENAME, (int) (text_end - text_start), text_start);
+#endif
return false;
} else {
for (const char* char_ptr = parsed_end; char_ptr != text_end; char_ptr++) {
--
2.26.2
From 541633ca7734f4c58e4f1832171ff0fd141f547e Mon Sep 17 00:00:00 2001
From 20b885be9c76232f4d25ae9fe6c685861736a747 Mon Sep 17 00:00:00 2001
From: liyuzhong <liyuzhong@megvii.com>
Date: Thu, 9 Jul 2020 14:59:55 +0800
Subject: [PATCH 1/2] fix(arm/linux): fix unused var for cross compile error
---
src/arm/linux/chipset.c | 1 +
src/arm/linux/cpuinfo.c | 1 +
src/linux/processors.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/src/arm/linux/chipset.c b/src/arm/linux/chipset.c
index e36283c..8631f64 100644
--- a/src/arm/linux/chipset.c
+++ b/src/arm/linux/chipset.c
@@ -2402,6 +2402,7 @@ struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_ha
#endif
+ (void)max_cpu_freq_max;
/* Check Telechips TCC signature */
if (match_tcc(hardware, hardware_end, &chipset)) {
cpuinfo_log_debug(
diff --git a/src/arm/linux/cpuinfo.c b/src/arm/linux/cpuinfo.c
index 90e1631..ad89729 100644
--- a/src/arm/linux/cpuinfo.c
+++ b/src/arm/linux/cpuinfo.c
@@ -671,6 +671,7 @@ static bool parse_line(
if (line_start == line_end) {
return true;
}
+ (void)line_number;
/* Search for ':' on the line. */
const char* separator = line_start;
diff --git a/src/linux/processors.c b/src/linux/processors.c
index aedba74..4904e2a 100644
--- a/src/linux/processors.c
+++ b/src/linux/processors.c
@@ -217,6 +217,7 @@ bool cpuinfo_linux_get_processor_package_id(uint32_t processor, uint32_t package
static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) {
uint32_t* processor_number_ptr = (uint32_t*) context;
+ (void)processor_list_start;
const uint32_t processor_list_last = processor_list_end - 1;
if (*processor_number_ptr < processor_list_last) {
*processor_number_ptr = processor_list_last;
--
2.17.1
From a0f9f754b804e129f6e11f87047f3d586607a4ef Mon Sep 17 00:00:00 2001
From: chenqiyou <chenqiyou@megvii.com>
Date: Fri, 16 Jul 2021 19:10:40 +0800
Subject: [PATCH] fix(cpuinfo): fix cpuinfo build and sensitive word
Subject: [PATCH 2/2] fix(cpuinfo): fix cpuinfo build and sensitive word
---
src/arm/linux/chipset.c | 32 ++++++++++++++++++++++++++++++--
......@@ -288,5 +339,5 @@ index 4904e2a..a1d4693 100644
} else {
for (const char* char_ptr = parsed_end; char_ptr != text_end; char_ptr++) {
--
2.25.1
2.17.1
......@@ -2,8 +2,6 @@
cd $(dirname $0)
source ../ci/utils.sh
# force use /usr/bin/sort on windows, /c/Windows/system32/sort do not support -V
OS=$(uname -s)
SORT=sort
......@@ -22,21 +20,25 @@ log "Start downloading git submodules"
git submodule sync
git submodule update -f --init midout
git submodule update -f --init intel-mkl-dnn
git submodule update -f --init HalidePrebuilt
git submodule update -f --init Halide
git submodule update -f --init protobuf
git submodule update -f --init gtest
git submodule update -f --init flatbuffers
git submodule update -f --init cutlass
git submodule update -f --init Json
git submodule update -f --init pybind11
git submodule update -f --init llvm-project
git submodule update -f --init range-v3
git submodule update -f --init libzmq
git submodule update -f --init cppzmq
git submodule update -f --init OpenBLAS
git submodule update -f --init cpuinfo
name=`git config --get user.name`
name=`git config --get user.name || true`
if [ -z "$name" ]; then
name="default"
fi
email=`git config --get user.email`
email=`git config --get user.email || true`
if [ -z "$email" ]; then
email="default"
fi
......@@ -44,26 +46,12 @@ fi
source ./apply-patches.sh
apply_cpuinfo_patches ${name} ${email}
git submodule update -f --init OpenBLAS
if [[ ! -d mkl/$(uname -m) ]]; then
git submodule update -f --init mkl
fi
git submodule update -f --init libzmq
git submodule update -f --init cppzmq
git submodule update -f --init MegRay
pushd MegRay/third_party >/dev/null
git submodule sync
git submodule update -f --init nccl
git submodule update -f --init gdrcopy
git submodule update -f --init ucx
git submodule update -f --init rccl
popd >/dev/null
git submodule update -f --init pybind11
git submodule update -f --init llvm-project
git submodule update -f --init mc40
git submodule update -f --init range-v3
log "Finished downloading git submodules"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册