Skip to content

Conversation

@RenjiSann
Copy link
Collaborator

@RenjiSann RenjiSann commented Dec 8, 2025

This MR fixes the GNU cksum.sh by correctly taking in account the GLIBC_TUNABLES env var

Fixes #9518

@RenjiSann RenjiSann force-pushed the fix-hardware-detection branch 2 times, most recently from 41dd915 to 70f9707 Compare December 8, 2025 17:43
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum is no longer failing! 
@RenjiSann RenjiSann force-pushed the fix-hardware-detection branch from 70f9707 to 6a734c6 Compare December 9, 2025 09:24
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum is no longer failing! 
@RenjiSann RenjiSann force-pushed the fix-hardware-detection branch from 6a734c6 to e1fef5d Compare December 9, 2025 09:42
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum is no longer failing! 
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum is no longer failing! 
@RenjiSann RenjiSann self-assigned this Dec 10, 2025
@RenjiSann RenjiSann requested a review from sylvestre December 10, 2025 00:47
@naoNao89
Copy link
Contributor

My string approach worked but was naive. Your enum-based design with TryFrom validation is the right way: type-safe, O(log n) lookups, feature alias support. Excellent work

 avx512: detect_avx512() && !disabled.contains(&"AVX512F".to_string()), avx2: detect_avx2() && !disabled.contains(&"AVX2".to_string()), pclmul: detect_pclmul() && !disabled.contains(&"PMULL".to_string()), vmull: detect_vmull() && !disabled.contains(&"VMULL".to_string()), sse2: detect_sse2() && !disabled.contains(&"SSE2".to_string()), asimd: detect_asimd() && !disabled.contains(&"ASIMD".to_string()),
Comment on lines 146 to 143
let mut set = BTreeSet::new();
if detect_avx512() {
set.insert(HardwareFeature::Avx512);
}
if self.avx2 {
features.push("AVX2");
if detect_avx2() {
set.insert(HardwareFeature::Avx2);
}
if self.pclmul {
features.push("PCLMUL");
if detect_pclmul() {
set.insert(HardwareFeature::PclMul);
}
if self.vmull {
features.push("VMULL");
if detect_vmull() {
set.insert(HardwareFeature::Vmull);
}
if self.sse2 {
features.push("SSE2");
if detect_sse2() {
set.insert(HardwareFeature::Sse2);
}
if self.asimd {
features.push("ASIMD");
if detect_asimd() {
set.insert(HardwareFeature::Asimd);
}
features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here a functional approach might be cleaner, something like:

 let set = [ (HardwareFeature::Avx512, detect_avx512 as fn() -> bool), (HardwareFeature::Avx2, detect_avx2), (HardwareFeature::PclMul, detect_pclmul), (HardwareFeature::Vmull, detect_vmull), (HardwareFeature::Sse2, detect_sse2), (HardwareFeature::Asimd, detect_asimd), ] .into_iter() .filter_map(|(feature, detect_func)| detect_func().then_some(feature)) .collect();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that looks really clean, I will switch to that. Thanks !

@RenjiSann RenjiSann force-pushed the fix-hardware-detection branch from 46c3bb6 to 231a857 Compare December 12, 2025 13:51
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch) Congrats! The gnu test tests/cksum/cksum is no longer failing! 
@cakebaker cakebaker merged commit 8ec02e7 into uutils:main Dec 12, 2025
126 of 127 checks passed
@cakebaker
Copy link
Contributor

Congrats! The gnu test tests/cksum/cksum is no longer failing!

Kudos, good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants