zephyr: sync stdint guard define and FLOAT16 dependency - #329
Open
XenuIsWatching wants to merge 1 commit into
Open
zephyr: sync stdint guard define and FLOAT16 dependency#329XenuIsWatching wants to merge 1 commit into
XenuIsWatching wants to merge 1 commit into
Conversation
The Zephyr integration files in this module were forked from the zephyr tree in d8bad7d ("Reworked zephyr module"). Three details drifted from what zephyr itself carries, each of which breaks the build once zephyr drops its own copies in favour of these. The optimization flag was written out as a literal -Ofast, where zephyr used $<TARGET_PROPERTY:compiler,optimization_fast>. zephyr defines that property per toolchain, as -Ofast for gcc but -O3 -ffast-math for clang, precisely because clang deprecated -Ofast. Since zephyr builds with -Werror, hardcoding the flag fails every clang build, for example native_sim with the host/llvm toolchain: clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast] zephyr later renamed the include guard of include/zephyr/toolchain/zephyr_stdint.h from ZEPHYR_INCLUDE_TOOLCHAIN_STDINT_H_ to ZEPHYR_INCLUDE_TOOLCHAIN_ZEPHYR_STDINT_H_ (zephyr commit b04eb25b786), updating its in-tree modules/cmsis-dsp/CMakeLists.txt at the same time. The define here no longer suppresses that header, so the -imacros force-include redefines __INT32_TYPE__ from the toolchain's native 'long int' to 'int'. GCC resolves its polymorphic MVE intrinsics through _Generic associations keyed on the native int32_t, so 'const q31_t *' matches no association and Helium targets fail with: error: passing 'const q31_t *' {aka 'const int *'} to argument 1 of 'vld1q', but 'q31_t' {aka 'int'} is not a valid MVE element type zephyr also introduced CONFIG_FP16_ARITHMETIC (zephyr commit 659069617b2) to distinguish half-precision storage from half-precision arithmetic, and narrowed CMSIS_DSP_FLOAT16 to depend on it. FP16 alone is set on cores with storage-only fp16 such as Cortex-R52, where building the F16 sources lets -Ofast vectorize a _Float16 compare into a vector form the backend cannot emit, causing an internal compiler error in arm_clip_f16.c. Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
XenuIsWatching
force-pushed
the
zephyr-4.5
branch
from
August 14, 2026 20:37
43b5095 to
45d2328
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Zephyr integration files in this module were forked from the zephyr tree in d8bad7d ("Reworked zephyr module"). Two later zephyr-side changes updated the in-tree copies but could not reach the copies here, so both are stale and break the build once zephyr drops its own copies in favour of these.
zephyr renamed the include guard of
include/zephyr/toolchain/zephyr_stdint.h from
ZEPHYR_INCLUDE_TOOLCHAIN_STDINT_H_ to
ZEPHYR_INCLUDE_TOOLCHAIN_ZEPHYR_STDINT_H_ (zephyr commit b04eb25b786), updating its in-tree modules/cmsis-dsp/CMakeLists.txt at the same time. The define here no longer suppresses that header, so the -imacros force-include redefines INT32_TYPE from the toolchain's native 'long int' to 'int'. GCC resolves its polymorphic MVE intrinsics through _Generic associations keyed on the native int32_t, so 'const q31_t *' matches no association and Helium targets fail with:
error: passing 'const q31_t *' {aka 'const int *'} to argument 1 of
'vld1q', but 'q31_t' {aka 'int'} is not a valid MVE element type
zephyr then introduced CONFIG_FP16_ARITHMETIC (zephyr commit 659069617b2) to distinguish half-precision storage from half-precision arithmetic, and narrowed CMSIS_DSP_FLOAT16 to depend on it. FP16 alone is set on cores with storage-only fp16 such as Cortex-R52, where building the F16 sources lets -Ofast vectorize a _Float16 compare into a vector form the backend cannot emit, causing an internal compiler error in arm_clip_f16.c.