Repository navigation
Build operator lookup names without snprintf - #24217
Conversation
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24217
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 74ccc1d with merge base 149bba5 ( BROKEN TRUNK - The following job 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. |
### Summary Operator lookup uses `snprintf` to join the operator name and optional overload. Replace it with checked string copies so builds with no other printf users can discard the formatter. The lookup format and error behavior are preserved, including empty overloads and embedded NULs. A named `uint64_t needed_size` makes the capacity check explicit and keeps the addition safe on 32-bit targets. With the preceding minimal-PAL configuration and GNU nano libraries, this removes 1,736 bytes from the GNU runtime and 10,224 bytes from Zephyr. Lower their runtime size limits from 34,000 to 32,000 bytes and from 57,000 to 47,000 bytes respectively. ### Test plan Cross-compiled both size targets before and after the helper change on base `0549e1ee61`, with the same configuration on both sides: Cortex-M55, C++17, Release, size optimization, logging disabled, and minimal PAL; GNU Arm 15.2.Rel1 with nano.specs and Zephyr SDK 1.0.1 (GCC 14.3.0). Stripped ELF file sizes in bytes: | Configuration | Binary | Before | After | Saved | |---|---|---:|---:|---:| | GNU bare-metal | `size_test` | 33,372 | 31,636 | 1,736 | | GNU bare-metal | `size_test_all_ops` | 1,156,180 | 1,154,444 | 1,736 | | Zephyr | `size_test` | 55,800 | 45,576 | 10,224 | | Zephyr | `size_test_all_ops` | 1,154,512 | 1,144,296 | 10,216 | None of the four binaries retains printf-family symbols after the change. Both existing kernel-resolution tests pass. An ad hoc differential harness passed 1,237,804 cases against the original helper, including missing and empty strings, embedded NULs, and buffer boundaries; guard pages detect output overruns. The helper implementation has not changed since those checks. Formatting, workflow YAML parsing, embedded shell syntax, and both size limits pass. Authored with AI assistance using Codex. ghstack-source-id: 10178e0 ghstack-comment-id: 6455173898 Pull-Request: #24217
This PR needs a
|
### Summary Operator lookup uses `snprintf` to join the operator name and optional overload. Replace it with checked string copies so builds with no other printf users can discard the formatter. The lookup format and error behavior are preserved, including empty overloads and embedded NULs. A named `uint64_t needed_size` makes the capacity check explicit and keeps the addition safe on 32-bit targets. With minimal PAL and GNU nano libraries, the measurements below show a reduction of 1,736 bytes for the GNU runtime and 10,224 bytes for Zephyr. Set the runtime size limits to 35,000 bytes for GNU and 50,000 bytes for Zephyr, leaving roughly 8–9% headroom above the measured CI sizes for small runtime changes. ### Test plan Cross-compiled both size targets before and after the helper change on base `0549e1ee61`, with the same configuration on both sides: Cortex-M55, C++17, Release, size optimization, logging disabled, and minimal PAL; GNU Arm 15.2.Rel1 with nano.specs and Zephyr SDK 1.0.1 (GCC 14.3.0). Stripped ELF file sizes in bytes: | Configuration | Binary | Before | After | Saved | |---|---|---:|---:|---:| | GNU bare-metal | `size_test` | 33,372 | 31,636 | 1,736 | | GNU bare-metal | `size_test_all_ops` | 1,156,180 | 1,154,444 | 1,736 | | Zephyr | `size_test` | 55,800 | 45,576 | 10,224 | | Zephyr | `size_test_all_ops` | 1,154,512 | 1,144,296 | 10,216 | None of the four binaries retains printf-family symbols after the change. Both existing kernel-resolution tests pass. An ad hoc differential harness passed 1,237,804 cases against the original helper, including missing and empty strings, embedded NULs, and buffer boundaries; guard pages detect output overruns. The helper implementation has not changed since those checks. Workflow YAML parsing and embedded shell syntax pass. The updated limits pass against the CI measurements from `320adcd3bf`: 32,180 bytes for GNU and 46,112 bytes for Zephyr, leaving 2,820 and 3,888 bytes of headroom respectively. Authored with AI assistance using Codex. ghstack-source-id: 4ee6121 ghstack-comment-id: 6455173898 Pull-Request: #24217
Summary
Operator lookup uses
snprintfto join the operator name and optional overload. Replace it with checked string copies so builds with no other printf users can discard the formatter. The lookup format and error behavior are preserved, including empty overloads and embedded NULs. A nameduint64_t needed_sizemakes the capacity check explicit and keeps the addition safe on 32-bit targets.With minimal PAL and GNU nano libraries, the measurements below show a reduction of 1,736 bytes for the GNU runtime and 10,224 bytes for Zephyr. Set the runtime size limits to 35,000 bytes for GNU and 50,000 bytes for Zephyr, leaving roughly 8–9% headroom above the measured CI sizes for small runtime changes.
Test plan
Cross-compiled both size targets before and after the helper change on base
0549e1ee61, with the same configuration on both sides: Cortex-M55, C++17, Release, size optimization, logging disabled, and minimal PAL; GNU Arm 15.2.Rel1 with nano.specs and Zephyr SDK 1.0.1 (GCC 14.3.0). Stripped ELF file sizes in bytes:size_testsize_test_all_opssize_testsize_test_all_opsNone of the four binaries retains printf-family symbols after the change. Both existing kernel-resolution tests pass. An ad hoc differential harness passed 1,237,804 cases against the original helper, including missing and empty strings, embedded NULs, and buffer boundaries; guard pages detect output overruns. The helper implementation has not changed since those checks. Workflow YAML parsing and embedded shell syntax pass. The updated limits pass against the CI measurements from
320adcd3bf: 32,180 bytes for GNU and 46,112 bytes for Zephyr, leaving 2,820 and 3,888 bytes of headroom respectively.Authored with AI assistance using Codex.