-
Notifications
You must be signed in to change notification settings - Fork 4.3k
support cpu count > 64 #6189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
support cpu count > 64 #6189
Conversation
support cpu count > 64 对于Win平台: 使用多组掩码方案,每组默认为64。根据Windows系统版本设置最大CPU支持数 生产环境中,group = 1(cpu count <= 64)的情况下,使用legacy mode,保留原始逻辑 缺憾:在group > 1(cpu count > 64)的情况下,假定了每组的性能以及功能相同,未区分大小核 新增单元测试:test_multicpu,在测试环境中,屏蔽 legacy mode 强制使用 group 逻辑,验证多组掩码的逻辑功能 对于Linux/Android平台: 未作修改。 cpu_set_t 的大小,在现代主流实现(如 glibc)默认通过 CPU_SETSIZE 定义为 1024。即原生支持 cpu count > 64 如想支持 > 1024,可使用 cpu_set_t* 加上带有_S POSIX指令实现 对于Apple平台: 未作修改。 unsigned int最高支持32核,考虑到Apple目前没有超过32核的芯片,为了面向未来的健壮性,可改用uint64_t以支持64 cpu 其余单元测试结果与主分支一致 修改文件 src/cpu.cpp src/cpu.h tests/CMakeList.txt 新增文件 tests/test_multicpu.cpp
|
The binary size change of libncnn.so (bytes)
|
Please enable github action in YOUR FORKED REPO to make code-format workflow work |
* support win group mask * reconstruct CpuSet class of _WIN32 * adapt the rest part to Group Mask CpuSet * fix rebase conflict in cpu.h * pair if endif and delete unused function * delete unused function * add NCNN_TEST_FORCE_MULTI_GROUP to test * get rid of legacy_mode in cpu.cpp * delete duplicate code
get rid of legacy mode to keep consistency and reduce compelxity. Functionality remains unchanged, and unit test results are consistent with the master branch |
* support win group mask * reconstruct CpuSet class of _WIN32 * adapt the rest part to Group Mask CpuSet * fix merge error * fix rebase conflict in cpu.h * pair if endif and delete unused function * delete unused function * get rid of legacy_mode in cpu.cpp * delete duplicate code * try fix cross-platform compilation error
try fix cross-platform compilation error |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6189 +/- ##
===========================================
- Coverage 95.78% 94.05% -1.74%
===========================================
Files 835 417 -418
Lines 252528 120537 -131991
===========================================
- Hits 241887 113371 -128516
+ Misses 10641 7166 -3475 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix: #6142 support cpu count > 64
对于Win平台:
使用多组掩码方案,每组默认为64。根据Windows系统版本设置最大CPU支持数
生产环境中,
group = 1(cpu count <= 64)
的情况下,使用legacy mode
,保留原始逻辑缺憾:在
group > 1(cpu count > 64)
的情况下,假定了每组的性能以及功能相同,未区分大小核新增单元测试:test_multicpu,在测试环境中,屏蔽
legacy mode
强制使用 group 逻辑,验证多组掩码的逻辑功能对于Linux/Android平台:
未作修改。
cpu_set_t
的大小,在现代主流实现(如 glibc)默认通过CPU_SETSIZE
定义为 1024。即原生支持 cpu count > 64 如想支持 > 1024,可使用cpu_set_t*
加上带有_S
POSIX指令实现对于Apple平台:
未作修改。
unsigned int
最高支持32核,考虑到Apple目前没有超过32核的芯片,为了面向未来的健壮性,可改用uint64_t
以支持64 cpu其余单元测试结果与主分支一致
修改文件
src/cpu.cpp
src/cpu.h
tests/CMakeList.txt
新增文件
tests/test_multicpu.cpp