Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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