Skip to content

Arm backend: Fix CPPCHECK findings in runner and VGF setup#19390

Open
perheld wants to merge 1 commit intopytorch:mainfrom
perheld:change-1246135
Open

Arm backend: Fix CPPCHECK findings in runner and VGF setup#19390
perheld wants to merge 1 commit intopytorch:mainfrom
perheld:change-1246135

Conversation

@perheld
Copy link
Copy Markdown
Collaborator

@perheld perheld commented May 8, 2026

Change-Id: Ib114ad67278edd5aea85288cc907a9d64456b534

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

Copilot AI review requested due to automatic review settings May 8, 2026 11:54
@perheld perheld added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label May 8, 2026
@perheld perheld requested a review from digantdesai as a code owner May 8, 2026 11:54
@perheld perheld added ciflow/trunk release notes: none Do not include this in the release notes labels May 8, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 8, 2026

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit 798af41 with merge base ada8e35 (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 May 8, 2026
@github-actions github-actions Bot added the module: arm Issues related to arm backend label May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses static-analysis (cppcheck) findings in the Arm executor runner and VGF setup code by reducing unused-function/variable warnings, improving initialization, and hardening some file I/O paths.

Changes:

  • Annotate several platform-adaptation functions as [[maybe_unused]], initialize some previously uninitialized members, and clean up unused locals.
  • Improve semihosting file I/O robustness (close file on allocation failure; check fopen(); validate full writes in some paths).
  • Gate VGF resource-debug helpers behind ET_ARM_VGF_DEBUG to avoid always compiling debug-only utilities.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
examples/arm/executor_runner/arm_executor_runner.cpp Cppcheck-driven cleanups plus additional I/O hardening for outputs/etdump/debug buffer emission.
backends/arm/runtime/VGFSetup.cpp Wrap resource debug helpers behind ET_ARM_VGF_DEBUG and add more detailed debug logging.

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

Comment on lines 469 to +473
}
}

// If input_buffers.size <= 0, we don't have any input, fill it with 1's.
if (input_buffers.size() <= 0) {
// If there are no input buffers, fill inputs with 1s.
if (input_buffers.empty()) {
Comment on lines 974 to 975
snprintf(out_filename, 255, "%s-%d.bin", ctx.output_basename, i);
ET_LOG(Info, "Writing output to file: %s", out_filename);
Comment on lines 1103 to +1113
FILE* f = fopen(etdump_output_filename, "w+");
fwrite((uint8_t*)ctx.debug_buffer, 1, outputdump_len, f);
fclose(f);
if (f == nullptr) {
ET_LOG(
Error,
"Could not open etdump debug buffer file %s (errno: %d)",
etdump_output_filename,
errno);
} else {
fwrite(
reinterpret_cast<uint8_t*>(ctx.debug_buffer), 1, outputdump_len, f);
fclose(f);
Comment on lines 1123 to +1134
const char* etdump_filename = "etdump.bin";
ET_LOG(Info, "Writing etdump to file: %s", etdump_filename);
FILE* f = fopen(etdump_filename, "w+");
fwrite((uint8_t*)result.buf, 1, result.size, f);
fclose(f);
if (f == nullptr) {
ET_LOG(
Error,
"Could not open etdump file %s (errno: %d)",
etdump_filename,
errno);
} else {
fwrite(reinterpret_cast<uint8_t*>(result.buf), 1, result.size, f);
fclose(f);
Change-Id: Ib114ad67278edd5aea85288cc907a9d64456b534
Signed-off-by: Per Held <per.held@arm.com>
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. module: arm Issues related to arm backend 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