You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df8386b
Browse filesBrowse the repository at this point in the historyBrowse files
Fix -Werror diagnostics in vendored runtime and kernel sources
On toolchains where int32_t and uint32_t are long (the Xtensa and RISC-V
ESP-IDF toolchains, and arm-none-eabi-gcc), log and check messages that pass
them to %d or %u trip -Wformat. ESP-IDF builds with -Werror, so its component
currently compiles the vendored ExecuTorch sources with a blanket -Wno-error;
these fixes let the next change narrow that.
The runtime, flat_tensor and portable kernel sources now use PRId32/PRIu32, or
cast to int or int64_t where the rest of a message already does
(Tensor::SizesType and StridesType differ between lean and ATen mode). The
ET_CHECK_CONTIGUOUS and ET_CHECK_SAME_STRIDES macros in tensor_util.h get the
same fix, since kernels outside this tree expand them. The size_t values in the
messages touched here print with ET_PRIsize_t instead of %zu, which the Cadence
Xtensa toolchain's C library does not support.
Other diagnostics that ESP-IDF turns into errors are fixed in the same sources:
an always-true `index >= 0` on a uint32_t in flat_tensor, a cast to a
const-qualified type in native_dropout, prod's `*=` on bool outputs
(-Wint-in-bool-context), missing parentheses in ET_CHECK_SAME_SHAPE3, and
always_inline on non-inline templates in the Cadence generic im2row operators.
The bool product is now `&&` through a template helper, because `if constexpr`
only discards a branch inside a template; results are unchanged for every
dtype.
Verified by compiling every vendored runtime and kernel source (275) with the
ESP-IDF 6.1 flags for esp32s3 and esp32c6 at -Og and -Os, under -Werror with
format and type-limits errors enabled: all clean. On host, portable_kernels_test
(1891 tests) and the exec_aten util tests pass.
Authored with Claude Code.
0 commit comments