com um clique
binary-size
// Analyze and reduce ExecuTorch binary size. Use when investigating binary size, running size tests, or optimizing the runtime for size-constrained deployments.
// Analyze and reduce ExecuTorch binary size. Use when investigating binary size, running size tests, or optimizing the runtime for size-constrained deployments.
Build, test, or develop the QNN (Qualcomm AI Engine Direct) backend. Use when working on backends/qualcomm/, building QNN (use backends/qualcomm/scripts/build.sh), adding new ops or passes, running QNN delegate tests, or exporting models for Qualcomm HTP/GPU targets. Also exposes a Buck-vs-CMake parity workflow — invoke as `/qualcomm buck-fix`, `/qualcomm buck-cmake fix`, `/qualcomm buck-parity`, or any user request to fix `test-qnn-buck-build-linux` CI failures or check buck/cmake drift in backends/qualcomm/.
Build and configure ExecuTorch as a Zephyr RTOS module for embedded boards. Use when setting up a Zephyr workspace with ET, adding board support (overlays, confs, memory layout), building with west, or debugging linker memory overflow.
Search the ExecuTorch tribal knowledge base covering QNN, XNNPACK, Vulkan, CoreML, Arm, and Cadence backends, quantization recipes, export pitfalls, runtime errors, and SoC compatibility. Use when debugging ExecuTorch errors, choosing quantization configs, checking backend op support, or answering questions about Qualcomm HTP / Snapdragon / Apple Neural Engine behavior.
Build ExecuTorch from source — Python package, C++ runtime, runners, cross-compilation, and backend-specific builds. Use when compiling anything in the ExecuTorch repo, diagnosing build failures, or setting up platform-specific builds.
Export a PyTorch model to .pte format for ExecuTorch. Use when converting models, lowering to edge, or generating .pte files.
Build, test, or develop the Cortex-M (CMSIS-NN) backend. Use when working on backends/cortex_m/, running Cortex-M tests, or exporting models for Cortex-M targets.
| name | binary-size |
| description | Analyze and reduce ExecuTorch binary size. Use when investigating binary size, running size tests, or optimizing the runtime for size-constrained deployments. |
main branch of executorchAsk the user where the executorch repo is.
git checkout main && git pull
conda activate executorch
bash test/build_size_test.sh
strip -o /tmp/size_test_stripped cmake-out/test/size_test
strip -o /tmp/size_test_all_ops_stripped cmake-out/test/size_test_all_ops
ls -la /tmp/size_test_stripped /tmp/size_test_all_ops_stripped
Produces two binaries:
cmake-out/test/size_test — ExecuTorch runtime without operator implementationscmake-out/test/size_test_all_ops — ExecuTorch runtime with portable opsbloaty cmake-out/test/size_test -d symbols -n 30 # by symbol
bloaty cmake-out/test/size_test -d sections # by ELF section
bloaty <after> -- <before> # diff two builds
nm -S <binary> | sort -k2 -rn | head -30 # symbol sizes
strings <binary> | less # string literals in .rodata
Note: bloaty -d compileunits requires debug info (-g). The Release build does not include it.
Set by test/build_size_test.sh:
CMAKE_BUILD_TYPE=ReleaseEXECUTORCH_OPTIMIZE_SIZE=ON — enables -Os, -fno-exceptions, -fno-rtti, unwind table suppressionCXXFLAGS="-fno-exceptions -fno-rtti -Wall -Werror"executorch-ubuntu-22.04-gcc9-nopytorch) and Clang 12 — avoid compiler-specific flags or pragmas without version guardsbuild_size_test.sh for size reductions.text: look for large functions, template bloat, duplicate instantiations.rodata: verbose error messages, format strings, embedded file paths (__FILE__).eh_frame: should already be suppressed when EXECUTORCH_OPTIMIZE_SIZE=ONnm -S <binary> | grep GLOBAL__sub_I): use constexpr constructors to constant-initialize static arraysET_LOG_ENABLED=0 in Release eliminates format strings; ensure it propagates to consumers via PUBLIC compile definitions on cmake targetsET_LOG_ENABLED set in library but not in consumer)git checkout -b binary-size-<N>binary-size-<N>.md:| Binary | This change (N vs N-1) | Cumulative (N vs main) |
|---|---|---|
size_test (stripped) | -X | -Y |
size_test_all_ops (stripped) | -X | -Y |
.github/workflows/pull.yml if sizes decrease