Skip to content

Extend CPPCHECK scope to portable kernels#20236

Open
perheld wants to merge 1 commit into
pytorch:mainfrom
perheld:change-1273953
Open

Extend CPPCHECK scope to portable kernels#20236
perheld wants to merge 1 commit into
pytorch:mainfrom
perheld:change-1273953

Conversation

@perheld

@perheld perheld commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Remove the broad kernels/portable CPPCHECK exclusion and keep the remaining suppressions scoped to the portable tree.

Portable kernel entry points are referenced through generated registration tables, which cppcheck CTU does not see as direct C++ calls. Suppress the resulting unusedFunction reports for this tree.

Cppcheck also does not parse several ExecuTorch macro idioms used heavily in portable kernels, including empty macro arguments and printf-style macros concatenated into string literals. Keep those parser suppressions scoped to portable kernels instead of adding inline suppressions throughout the tree.

Fix small real findings by removing an impossible unsigned comparison and cleaning up unused test setup plus a stray comma expression.

Change-Id: I6279a123b487d32b5811fdbe46ae4f2e82dcabd5

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Remove the broad kernels/portable CPPCHECK exclusion and keep the
remaining suppressions scoped to the portable tree.

Portable kernel entry points are referenced through generated
registration tables, which cppcheck CTU does not see as direct C++
calls. Suppress the resulting unusedFunction reports for this tree.

Cppcheck also does not parse several ExecuTorch macro idioms used
heavily in portable kernels, including empty macro arguments and
printf-style macros concatenated into string literals. Keep those
parser suppressions scoped to portable kernels instead of adding
inline suppressions throughout the tree.

Fix small real findings by removing an impossible unsigned comparison
and cleaning up unused test setup plus a stray comma expression.

Signed-off-by: Per Held <per.held@arm.com>
Change-Id: I6279a123b487d32b5811fdbe46ae4f2e82dcabd5
@perheld perheld requested a review from manuelcandales as a code owner June 12, 2026 12:53
Copilot AI review requested due to automatic review settings June 12, 2026 12:53
@perheld perheld added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: none Do not include this in the release notes labels Jun 12, 2026
@pytorch-bot

pytorch-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20236

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures

As of commit 9660c90 with merge base 7282106 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 12, 2026

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.

Pull request overview

Extends the project’s cppcheck lint coverage to include the portable kernel tree by removing the broad kernels/portable/** exclusion and replacing it with targeted, portable-scoped suppressions, while also addressing a few small cppcheck findings in portable-kernel code/tests.

Changes:

  • Remove kernels/portable/** from .lintrunner.toml cppcheck exclusions and add portable-tree-specific suppressions (e.g., for CTU-driven unusedFunction and macro parsing limitations).
  • Fix a redundant/impossible unsigned comparison in portable copy/permute argument validation.
  • Clean up unused test setup and remove a stray comma expression in portable reduce util tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
kernels/portable/cpu/util/test/reduce_test.cpp Removes unused test variables and a no-op comma expression flagged by static analysis.
kernels/portable/cpu/util/copy_ops_util.cpp Removes a redundant >= 0 check on an unsigned value after prior validation.
.lintrunner.toml Enables cppcheck over kernels/portable/** and scopes necessary suppressions to that tree.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@perheld perheld added the help wanted Extra attention is needed label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. help wanted Extra attention is needed partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants