Skip to content

Fix size test build on gcc11#17905

Merged
lucylq merged 5 commits intomainfrom
gh/lucylq/135/head
Mar 6, 2026
Merged

Fix size test build on gcc11#17905
lucylq merged 5 commits intomainfrom
gh/lucylq/135/head

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Mar 5, 2026

Summary

Fix size-test on gcc11 (not a binary size improvement)

It fails with stringop-overread from flatbuffer. gcc-9 doesn't have this and doesn't throw error.

In static member function ‘static constexpr std::size_t std::char_traits<char>::length(const char_type*)’,
    inlined from ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>]’ at /usr/include/c++/11/string_view:132:35,
    inlined from ‘executorch::runtime::Result<void*> executorch::runtime::deserialization::getTensorDataPtr(const executorch_flatbuffer::Tensor*, const executorch::runtime::Program*, size_t, executorch::runtime::HierarchicalAllocator*, const executorch::runtime::NamedDataMap*, executorch::runtime::Span<executorch::runtime::deserialization::NamedData>)’ at /data/users/lfq/binary-size/executorch/runtime/executor/tensor_parser_exec_aten.cpp:218:41:
/usr/include/c++/11/bits/char_traits.h:399:32: error: ‘long unsigned int __builtin_strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  399 |         return __builtin_strlen(__s);
      |                ~~~~~~~~~~~~~~~~^~~~~
In file included from /data/users/lfq/binary-size/executorch/../executorch/runtime/executor/tensor_parser.h:21,
                 from /data/users/lfq/binary-size/executorch/runtime/executor/tensor_parser_exec_aten.cpp:9:
/data/users/lfq/binary-size/executorch/cmake-out/schema/include/executorch/schema/program_generated.h: In function ‘executorch::runtime::Result<void*> executorch::runtime::deserialization::getTensorDataPtr(const executorch_flatbuffer::Tensor*, const executorch::runtime::Program*, size_t, executorch::runtime::HierarchicalAllocator*, const executorch::runtime::NamedDataMap*, executorch::runtime::Span<executorch::runtime::deserialization::NamedData>)’:
/data/users/lfq/binary-size/executorch/cmake-out/schema/include/executorch/schema/program_generated.h:568:8: note: at offset 5 into source object ‘executorch_flatbuffer::ExtraTensorInfo::<anonymous>’ of size 1
  568 | struct ExtraTensorInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {

Test plan

Flatbuffer should be ok - add -Wno-stringop-overread to suppress the error. Use pragma because adding it in CXX_ARGS causes a failure, as gcc-9 doesn't recognize it and -Werror is enabled.

size results after stripping

sh test/build_size_test.sh 

(executorch) [lfq@devvm11764.nha0 /data/users/lfq/binary-size/executorch (binary-size)]$ ls -la cmake-out/test/size_test_all_ops
-rwxr-xr-x 1 lfq users 1670416 Mar  4 22:37 cmake-out/test/size_test_all_ops

(executorch) [lfq@devvm11764.nha0 /data/users/lfq/binary-size/executorch (binary-size)]$ ls -la cmake-out/test/size_test
-rwxr-xr-x 1 lfq users 56240 Mar  4 22:38 cmake-out/test/size_test

[ghstack-poisoned]
Copilot AI review requested due to automatic review settings March 5, 2026 17:08
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 5, 2026

🔗 Helpful Links

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

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

❌ 2 New Failures, 13 Pending, 2 Unrelated Failures

As of commit cf6ca45 with merge base 75f5a76 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@lucylq lucylq requested a review from Copilot March 5, 2026 17:30
Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Github Executorch added 2 commits March 5, 2026 10:54
[ghstack-poisoned]
[ghstack-poisoned]
Copilot AI review requested due to automatic review settings March 5, 2026 19:26
[ghstack-poisoned]
@lucylq lucylq requested a review from JacobSzwejbka as a code owner March 6, 2026 00:32
Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

[ghstack-poisoned]
@lucylq lucylq merged commit 411061f into main Mar 6, 2026
183 of 192 checks passed
@lucylq lucylq deleted the gh/lucylq/135/head branch March 6, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants