Skip to content

Commit 07a1f05

Browse files
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, #9144
1 parent 73d1bce commit 07a1f05

File tree

6 files changed

+495
-144
lines changed

6 files changed

+495
-144
lines changed

.vscode/cspell.dictionaries/jargon.wordlist.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,16 @@ nofield
188188
# * clippy
189189
uninlined
190190
nonminimal
191+
192+
# * CPU/hardware features
193+
ASIMD
194+
asimd
195+
hwcaps
196+
PCLMUL
197+
pclmul
198+
PCLMULQDQ
199+
pclmulqdq
200+
TUNABLES
201+
tunables
202+
VMULL
203+
vmull

0 commit comments

Comments
 (0)