Add Zephyr RTOS (Generic) platform support#10060
Merged
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Recognize CMAKE_SYSTEM_NAME="Generic" as a valid platform (used by Zephyr RTOS and other baremetal targets). Also add Zephyr to the STDERR_FILENO/STDOUT_FILENO fallback path in log.c, matching the existing Hexagon pattern. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
54f080e to
bf188a3
Compare
dsharlet
approved these changes
Apr 28, 2026
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.
This PR adds XNNPACK build support for the Zephyr RTOS. Zephyr sets
CMAKE_SYSTEM_NAME to "Generic" (per CMake convention for baremetal/
RTOS cross-compilation targets), which XNNPACK's CMakeLists.txt
currently rejects as "Unrecognized".
Changes:
CMakeLists.txt: recognise "Generic" as a valid platform.
src/xnnpack/common.h: guard the default XNN_HAS_MMAP definition
with #ifndef so platforms without mmap (including Zephyr baremetal)
can set XNN_HAS_MMAP=0 at the command line.
src/log.c: add Zephyr to the STDERR_FILENO/STDOUT_FILENO fallback
path (matches the existing Hexagon pattern — on both platforms
those file descriptors aren't meaningful for log output).
Motivation: this is part of enabling ExecuTorch + XNNPACK inference
on Arm Cortex-A class cores running Zephyr (specifically the Arm
Corstone-1000 Edge-AI platform with Cortex-A320 + Ethos-U85).
Tested: XNNPACK builds and runs a CPU-only
addmodel via theExecuTorch XNNPACK backend on the Corstone-1000-A320 FVP, selecting
NEON microkernels (
xnn_f32_vadd_ukernel__neon_u8).Follow-up: a small follow-up PR will add a Cortex-A320 case to
cpuinfo_to_xnn_uarch()insrc/configs/hardware-config.c. Thatchange depends on cpuinfo adding the
cpuinfo_uarch_cortex_a320enum first, which is tracked in pytorch/cpuinfo#379.