Repository navigation
cksum: only report x86 hardware features on x86 targets #14805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,9 +34,11 @@ fn print_cpu_debug_info() { | |
| let features = SimdPolicy::detect(); | ||
|
|
||
| // x86/x86_64 | ||
| print_feature("avx512", features.has_avx512()); | ||
| print_feature("avx2", features.has_avx2()); | ||
| print_feature("pclmul", features.has_pclmul()); | ||
| if cfg!(any(target_arch = "x86", target_arch = "x86_64")) { | ||
| print_feature("avx512", features.has_avx512()); | ||
| print_feature("avx2", features.has_avx2()); | ||
| print_feature("pclmul", features.has_pclmul()); | ||
| } | ||
|
|
||
| // ARM aarch64 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not gate on little-endian here too, like uucore does?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if we should drop little endian gate. So is the decision to drop it in |
||
| if cfg!(target_arch = "aarch64") { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -3065,6 +3065,7 @@ mod debug_flag { | |||
| use super::*; | ||||
|
|
||||
| #[test] | ||||
| #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||||
| fn test_debug_flag() { | ||||
| // Test with default CRC algorithm - should output CPU feature detection | ||||
| new_ucmd!() | ||||
|
|
@@ -3121,6 +3122,7 @@ mod debug_flag { | |||
| } | ||||
|
|
||||
| #[test] | ||||
| #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||||
| fn test_debug_with_algorithms() { | ||||
| // Test with SHA256 - CPU detection should be same regardless of algorithm | ||||
| new_ucmd!() | ||||
|
|
@@ -3168,6 +3170,31 @@ mod debug_flag { | |||
| .stderr_contains("avx2") | ||||
| .stderr_contains("pclmul"); | ||||
| } | ||||
|
|
||||
| #[test] | ||||
| #[cfg(target_arch = "aarch64")] | ||||
| fn test_debug_flag_aarch64() { | ||||
| new_ucmd!() | ||||
| .arg("--debug") | ||||
| .arg("lorem_ipsum.txt") | ||||
| .succeeds() | ||||
| .stdout_is_fixture("crc_single_file.expected") | ||||
| .stderr_str_check(|stderr| { | ||||
| stderr == "using vmull hardware support\n" | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accepting both strings makes the check pretty thin, can't we at least assert there is a single line?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
| || stderr == "vmull support not detected\n" | ||||
| }); | ||||
| } | ||||
|
|
||||
| #[test] | ||||
| #[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))] | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test will never run on our CI targets, no? not sure it buys much
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. riscv64 CI runs this, which was the original purpose of this PR, to fix it for riscv64. coreutils/.github/workflows/CICD.yml Line 377 in c8675fd
|
||||
| fn test_debug_flag_no_hardware_features() { | ||||
| new_ucmd!() | ||||
| .arg("--debug") | ||||
| .arg("lorem_ipsum.txt") | ||||
| .succeeds() | ||||
| .stdout_is_fixture("crc_single_file.expected") | ||||
| .no_stderr(); | ||||
| } | ||||
| } | ||||
|
|
||||
| #[test] | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we now list the arches here, in hardware.rs and in the tests. could uucore expose the features the target can report instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean export
FEATURE_DETECTORS?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I know. Working on it now
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of regressions appreared when I applied this, some due to previous defects but were hidden and will be triggered by this change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just restored the PR to be the original simple shape. I think we can do those hardware changes step by step in follow up PRs.