Arm backend: Fix CPPCHECK findings in runner and VGF setup#19390
Open
perheld wants to merge 1 commit intopytorch:mainfrom
Open
Arm backend: Fix CPPCHECK findings in runner and VGF setup#19390perheld wants to merge 1 commit intopytorch:mainfrom
perheld wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 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 FailuresAs of commit 798af41 with merge base ada8e35 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
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_DEBUGto 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change-Id: Ib114ad67278edd5aea85288cc907a9d64456b534
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell