Skip to content

uucore: name hardware features after the CPU instructions - #15232

Open
ChihweiLHBird wants to merge 1 commit into
uutils:mainfrom
ChihweiLHBird:zhiwei/hardware-feature-names
Open

ChihweiLHBird wants to merge 1 commit into
uutils:mainfrom
ChihweiLHBird:zhiwei/hardware-feature-names

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

HardwareFeature::PclMul and HardwareFeature::Vmull take their names from the two CRC paths that cksum --debug reports as pclmul and vmull. But they detect CPU instructions: is_x86_feature_detected!("pclmulqdq") and is_aarch64_feature_detected!("pmull"). The distinction matters because a path needs more than its instruction. For example, the pclmul path also needs AVX, so a check such as has_pclmul() && has_avx() (in a follow up PR) reads as if pclmul needs more than pclmul.

This PR renames the variants to Pclmulqdq and Pmull, with has_pclmulqdq(), has_pmull() and the detect_* functions to match. Now the enum names the instruction and cksum names the path. Behavior does not change: cksum --debug still prints pclmul and vmull, and the GLIBC_TUNABLES names and wc --debug labels stay the same but may be updated in the follow up PRs to align with GNU behaviors.

No behavior change is intended in this PR.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The rename is complete and preserves existing detection and output behavior.

0 open findings

What changed in this PR

Renames hardware feature APIs to match the detected CPU instructions without changing user-visible debug labels or behavior.

Changes:

  • Renames PCLMULQDQ and PMULL feature variants, methods, and detectors.
  • Updates cksum and wc call sites while preserving output labels.
File Description
src/​uucore/​src/​lib/​features/​hardware.rs Renames hardware feature APIs.
src/​uu/​cksum/​src/​cksum.rs Uses the renamed detection methods.
src/​uu/​wc/​src/​wc.rs Updates variants while retaining existing labels.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codspeed

codspeed Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 31.01%

⚠️ 123 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 2 regressed benchmarks
✅ 397 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation factor_three_39_bit_primes 321.7 ms 1,267.3 ms -74.61%
❌ Simulation factor_five_38_bit_primes 1.5 s 1.9 s -16.92%
⚡ ⚠️ Simulation du_all_wide_tree[(5000, 500)] 35.7 ms 34.3 ms +4.17%
⚡ Memory du_all_wide_tree[(5000, 500)] 1,041.8 KB 1,010.5 KB +3.1%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ChihweiLHBird:zhiwei/hardware-feature-names (556b621) with main (1747ba1)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from b9051d8 to 53687b2 Compare October 13, 2026 00:20
Copilot AI balanced review requested due to automatic review settings October 13, 2026 00:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The rename is complete and consistent, with no unresolved references or behavior changes.

0 open findings

🧠 Review effort: Balanced

Comment thread src/uucore/src/lib/features/hardware.rs Outdated
"AVX2" => Ok(Avx2),
"PCLMUL" | "PMULL" => Ok(PclMul),
"VMULL" => Ok(Vmull),
"PCLMUL" | "PMULL" => Ok(Pclmulqdq),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

with the new names, "PMULL" => Pclmulqdq looks wrong, is that intended?

@ChihweiLHBird ChihweiLHBird Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's intended to keep this as a non-behavior-change PR and avoid a large hard-to-review diff. But I do have a plan to change them later after fixing another bug it's relying on for preventing regressions.

A sample of such regression of we make the change now for the keys here:

With GLIBC_TUNABLES=glibc.cpu.hwcaps=-PMULL

GNU:           cksum: pclmul support not detected
main:          cksum: pclmul support not detected
keys changed:  cksum: using pclmul hardware support

`PclMul` and `Vmull` were named after the cksum CRC paths, not after
the PCLMULQDQ and PMULL instructions that they detect. Rename them, and
their `has_*` and `detect_*` functions, after the instructions.

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from 53687b2 to 556b621 Compare October 13, 2026 15:11
Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The rename is complete and preserves existing behavior across all affected call sites.

0 open findings

🧠 Review effort: Balanced

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants