From 17b99e62233861d968d92933be4215b7dd1471d6 Mon Sep 17 00:00:00 2001 From: RJ Ascani Date: Tue, 27 Oct 2026 15:28:54 -0700 Subject: [PATCH 1/2] Update [ghstack-poisoned] --- .github/workflows/pull.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 33cc9bfc466..36214dc9a14 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -649,12 +649,12 @@ jobs: setup_script_args="" if [[ ${{ matrix.os}} == "bare_metal" ]]; then toolchain_prefix=arm-none-eabi- - threshold="118000" # GCC 15.2 baseline: 115868 bytes, 2026-05-13 + threshold="34000" # GCC 15.2, minimal PAL + nano baseline: 33292 bytes, 2026-10-27 toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then setup_script_args="--target-toolchain zephyr" toolchain_prefix=arm-zephyr-eabi- - threshold="136020" # 136 KiB + threshold="57000" # Zephyr SDK 1.0.1, minimal PAL baseline: 55704 bytes, 2026-10-27 toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Unsupported OS selection: ${{ matrix.os }}" @@ -672,11 +672,17 @@ jobs: # Setup cmake target to desired toolchain toolchain_cmake=$(realpath ${toolchain_cmake}) - # Build and run size test + # Measure the embedded runtime with minimal PAL. if [[ ${{ matrix.os}} == "bare_metal" ]]; then - bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON" + # Use nano libc and libstdc++ without exception support. + bash test/build_size_test.sh \ + "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake}" \ + -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON \ + -DEXECUTORCH_PAL_DEFAULT=minimal \ + -DCMAKE_C_FLAGS_INIT=--specs=nano.specs \ + -DCMAKE_CXX_FLAGS_INIT=--specs=nano.specs elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then - CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out . + CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DEXECUTORCH_PAL_DEFAULT=minimal -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out . cmake --build cmake-out -j9 --target install --config Release CXXFLAGS=${cxx_flags} cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_SIZE_TEST_NO_OS_LINK=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test cmake --build cmake-out/test -j9 --config Release From def700cd794a2f2d8ac038c2fb9535eba9a5a06e Mon Sep 17 00:00:00 2001 From: RJ Ascani Date: Tue, 27 Oct 2026 15:29:00 -0700 Subject: [PATCH 2/2] Update [ghstack-poisoned] --- .github/workflows/pull.yml | 4 ++-- runtime/executor/method.cpp | 31 +++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 36214dc9a14..e0c55319a5a 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -649,12 +649,12 @@ jobs: setup_script_args="" if [[ ${{ matrix.os}} == "bare_metal" ]]; then toolchain_prefix=arm-none-eabi- - threshold="34000" # GCC 15.2, minimal PAL + nano baseline: 33292 bytes, 2026-10-27 + threshold="32000" # GCC 15.2, minimal PAL + nano baseline: 31548 bytes, 2026-10-27 toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then setup_script_args="--target-toolchain zephyr" toolchain_prefix=arm-zephyr-eabi- - threshold="57000" # Zephyr SDK 1.0.1, minimal PAL baseline: 55704 bytes, 2026-10-27 + threshold="47000" # Zephyr SDK 1.0.1, minimal PAL baseline: 45480 bytes, 2026-10-27 toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Unsupported OS selection: ${{ matrix.os }}" diff --git a/runtime/executor/method.cpp b/runtime/executor/method.cpp index c56a55f35bd..8bcbeb941b0 100644 --- a/runtime/executor/method.cpp +++ b/runtime/executor/method.cpp @@ -13,7 +13,7 @@ #include #include // @donotremove #include -#include +#include #include #include @@ -758,26 +758,29 @@ Error populate_operator_name( ET_CHECK_OR_RETURN_ERROR( op->name() != nullptr, InvalidProgram, "Missing operator name"); - int cx = snprintf( - operator_name, - operator_name_size, - "%s%s%s", - op->name()->c_str(), - // Don't append any overload if the overload string is empty. - has_overload ? "." : "", - has_overload ? op->overload()->c_str() : ""); - ET_CHECK_OR_RETURN_ERROR(cx >= 0, Internal, "snprintf failed: %d", cx); + // Avoid pulling printf formatting code into builds that otherwise omit it. + const size_t name_size = strlen(op->name()->c_str()); + const size_t overload_size = + has_overload ? strlen(op->overload()->c_str()) : 0; + const uint64_t needed_size = static_cast(name_size) + + overload_size + (has_overload ? 1 : 0) + 1; ET_CHECK_OR_RETURN_ERROR( - static_cast(cx) < operator_name_size, + needed_size <= operator_name_size, Internal, - "Operator name %s%s%s with length %d " - "truncated to %" ET_PRIsize_t " due to internal buffer limit.", + "Operator name %s%s%s exceeds internal buffer limit of %" ET_PRIsize_t, op->name()->c_str(), has_overload ? "." : "", has_overload ? op->overload()->c_str() : "", - cx, operator_name_size); + memcpy(operator_name, op->name()->c_str(), name_size); + size_t pos = name_size; + if (has_overload) { + operator_name[pos++] = '.'; + memcpy(operator_name + pos, op->overload()->c_str(), overload_size); + pos += overload_size; + } + operator_name[pos] = '\0'; return Error::Ok; } } // namespace