feat(uucore): add shared hardware detection module#9279
Merged
RenjiSann merged 1 commit intouutils:mainfrom Nov 24, 2025
Merged
feat(uucore): add shared hardware detection module#9279RenjiSann merged 1 commit intouutils:mainfrom
RenjiSann merged 1 commit intouutils:mainfrom
Conversation
4a2c1ae to
999f40f
Compare
|
GNU testsuite comparison: |
RenjiSann
reviewed
Nov 14, 2025
RenjiSann
reviewed
Nov 14, 2025
Collaborator
RenjiSann
left a comment
There was a problem hiding this comment.
Nice !
Small nitpick for the introduced cfg-if dependency, which I think is unnecessary, but a good patch otherwise ^^
33b7daa to
07a1f05
Compare
|
GNU testsuite comparison: |
Contributor
Author
|
|
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 uutils#9088 (cksum --debug) and PR uutils#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: uutils#9088, uutils#9144
07a1f05 to
d5d680d
Compare
|
GNU testsuite comparison: |
Collaborator
|
Thank you ! |
naoNao89
added a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 24, 2025
…are module and cpufeatures dependency\n- Enable uucore 'hardware' feature in uu_cksum\n- Print CPU feature info via uucore instead of local module\n\nRefs: uutils#9279
naoNao89
added a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 24, 2025
…are module and cpufeatures dependency\n- Enable uucore 'hardware' feature in uu_cksum\n- Print CPU feature info via uucore instead of local module\n\nRefs: uutils#9279 Amp-Thread-ID: https://ampcode.com/threads/T-d41c7ce1-7075-4950-aa22-3e1dd8c1461d Co-authored-by: Amp <amp@ampcode.com>
naoNao89
added a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 24, 2025
…are module and cpufeatures dependency\n- Enable uucore 'hardware' feature in uu_cksum\n- Print CPU feature info via uucore instead of local module\n\nRefs: uutils#9279 Amp-Thread-ID: https://ampcode.com/threads/T-d41c7ce1-7075-4950-aa22-3e1dd8c1461d Co-authored-by: Amp <amp@ampcode.com>
naoNao89
added a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 24, 2025
…are module and cpufeatures dependency\n- Enable uucore 'hardware' feature in uu_cksum\n- Print CPU feature info via uucore instead of local module\n\nRefs: uutils#9279
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds shared CPU feature detection to prevent code duplication. Detects AVX512/AVX2/PCLMUL/SSE2/ASIMD, parses GLIBC_TUNABLES, provides SIMD policy decisions.
Unblocks #9088 (cksum) and #9144 (wc) both can now use uucore::hardware instead of duplicate implementations.