Commit 07a1f05
committed
feat(uucore): add shared hardware detection module
Add shared CPU hardware capability detection in uucore to prevent
code duplication across utilities. This provides a unified interface
for detecting CPU features (AVX512, AVX2, PCLMUL, SSE2, ASIMD) and
respecting GLIBC_TUNABLES environment variable.
This unblocks PR #9088 (cksum --debug) and PR #9144 (wc --debug) by
providing a common implementation that both utilities can use.
Features:
- CPU feature detection with caching (singleton pattern)
- GLIBC_TUNABLES parsing for hwcaps restrictions
- Cross-platform support (x86/x86_64, aarch64)
- Comprehensive test coverage
- Zero-cost abstractions using std::arch
Implementation details:
- Uses std::arch feature detection (no external deps for detection)
- Adds cfg-if dependency for conditional compilation
- Feature-gated behind "hardware" feature flag
- Android excluded (no CPUID access in sandboxed environment)
Related: #9088, #91441 parent 73d1bce commit 07a1f05
File tree
6 files changed
+495
-144
lines changed- .vscode/cspell.dictionaries
- fuzz
- src/uucore
- src/lib
- features
6 files changed
+495
-144
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
0 commit comments