Skip to content

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

Merged
sylvestre merged 1 commit into
uutils:mainfrom
ChihweiLHBird:zhiwei/hardware-feature-names
Oct 19, 2026
Merged

sylvestre merged 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 not alter performance

⚠️ 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.

✅ 401 untouched benchmarks
⏩ 70 skipped benchmarks1


Comparing ChihweiLHBird:zhiwei/hardware-feature-names (c4cdefb) with main (54d1309)2

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. ↩

  2. No successful run was found on main (bf9513b) during the generation of this report, so 54d1309 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@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

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.

Hi @sylvestre, may I get this re-review to unblock the follow up work? Or if you still think this rename is not right, I can combine this PR with the follow up work but diff will be larger (might be harder to review).

@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

@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from 556b621 to 69dfb27 Compare October 15, 2026 07:37
Copilot AI balanced review requested due to automatic review settings October 15, 2026 07:37

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding

🧠 Review effort: Lite

Comment thread src/uucore/src/lib/features/hardware.rs
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/cat/cat-distinct-err is no longer failing!

@ChihweiLHBird
ChihweiLHBird requested a balanced review from Copilot October 15, 2026 14:22

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open findings
1 resolved since last review

🧠 Review effort: Lite

Comment thread src/uucore/src/lib/features/hardware.rs
Comment thread src/uu/wc/src/wc.rs

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding
2 resolved since last review

🧠 Review effort: Lite

Comment thread src/uucore/src/lib/features/hardware.rs

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.

🔵 Needs a closer look

No code issues were identified, but required cross-platform CI results remain unverified.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from 69dfb27 to b8974c2 Compare October 15, 2026 22:40
Copilot AI balanced review requested due to automatic review settings October 15, 2026 22:40

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding

🧠 Review effort: Lite

Comment thread src/uucore/src/lib/features/hardware.rs
Copilot AI balanced review requested due to automatic review settings October 17, 2026 19:50
@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from b8974c2 to 4cab8ba Compare October 17, 2026 19:50

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 19:39
@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from 4cab8ba to c986ccb Compare October 18, 2026 19:39

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

`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>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:33
@ChihweiLHBird
ChihweiLHBird force-pushed the zhiwei/hardware-feature-names branch from c986ccb to c4cdefb Compare October 19, 2026 06:33

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@sylvestre
sylvestre merged commit 5fda18e into uutils:main Oct 19, 2026
192 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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