Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
_Walt
MegEngine
提交
c0528b24
MegEngine
项目概览
_Walt
/
MegEngine
与 Fork 源项目一致
Fork自
MegEngine 天元 / MegEngine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0528b24
编写于
8月 11, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(third_party): add cpuinfo
上级
4348960c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
119 addition
and
0 deletion
+119
-0
.gitmodules
.gitmodules
+3
-0
third_party/apply-patches.sh
third_party/apply-patches.sh
+20
-0
third_party/cpuinfo
third_party/cpuinfo
+1
-0
third_party/patches/0001-fix-arm-linux-fix-uclibc-build-error.patch
...y/patches/0001-fix-arm-linux-fix-uclibc-build-error.patch
+86
-0
third_party/prepare.sh
third_party/prepare.sh
+9
-0
未找到文件。
.gitmodules
浏览文件 @
c0528b24
...
...
@@ -25,3 +25,6 @@
[submodule "third_party/flatbuffers"]
path = third_party/flatbuffers
url = https://github.com/google/flatbuffers.git
[submodule "third_party/cpuinfo"]
path = third_party/cpuinfo
url = https://github.com/pytorch/cpuinfo.git
third_party/apply-patches.sh
0 → 100755
浏览文件 @
c0528b24
#!/bin/bash
set
-e
function
apply_cpuinfo_patches
()
{
if
[
-d
"./cpuinfo"
]
;
then
cp
./patches/0001-fix-arm-linux-fix-uclibc-build-error.patch cpuinfo/
pushd
cpuinfo
>
/dev/null
git am
--abort
||
true
git rebase
--abort
||
true
git reset
--hard
# Use git apply instead of git am to prevent git require name in .gitconfig
git apply 0001-fix-arm-linux-fix-uclibc-build-error.patch
rm
*
.patch
popd
>
/dev/null
else
echo
"cpuinfo not exist, can not apply patches."
echo
"Please run: 'git submodule update --init cpuinfo' first."
exit
-1
fi
}
cpuinfo
@
63b25457
Subproject commit 63b254577ed77a8004a9be6ac707f3dccc4e1fd9
third_party/patches/0001-fix-arm-linux-fix-uclibc-build-error.patch
0 → 100644
浏览文件 @
c0528b24
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
third_party/prepare.sh
浏览文件 @
c0528b24
...
...
@@ -11,12 +11,21 @@ fi
cd
$(
dirname
$0
)
git submodule
sync
git submodule foreach
--recursive
git reset
--hard
git submodule foreach
--recursive
git clean
-fd
git submodule update
--init
intel-mkl-dnn
git submodule update
--init
Halide
git submodule update
--init
protobuf
git submodule update
--init
flatbuffers
git submodule update
--init
gtest
git submodule update
--init
cpuinfo
source
./apply-patches.sh
apply_cpuinfo_patches
git submodule update
--init
OpenBLAS
git submodule update
--init
libzmq
git submodule update
--init
cppzmq
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录