Skip to content

Cadence Xtensa OSS CI: gflags-free ISS runner + cross-compile build workflow#20205

Closed
aliafzal wants to merge 1 commit into
pytorch:mainfrom
aliafzal:cadence_executor_runner
Closed

Cadence Xtensa OSS CI: gflags-free ISS runner + cross-compile build workflow#20205
aliafzal wants to merge 1 commit into
pytorch:mainfrom
aliafzal:cadence_executor_runner

Conversation

@aliafzal

@aliafzal aliafzal commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds OSS CI to cross-compile and run the Cadence (Xtensa) backend, so backend changes can be validated in CI rather than only through internal flows.

Two commits, review in order:

  1. gflags-free ISS runner — the upstream executor_runner can't cross-compile to Xtensa (gflags pulls in mkdir(2), absent from Xtensa newlib). Adds a small argv-only runner (same approach as the Arm/NXP backends) that loads a .pte and runs it on the simulator. Also registers the quantized_depthwise_conv1d ops the HiFi4 codegen references but the operators CMake omitted (broke the link).

  2. Xtensa cross-compile CI (build stage) — mirrors the host cadence CI in build-cadence-runner.yml (build stage now; ISS test stage to follow, cf. cpu-buildcpu-test). The licensed toolchain/core artifacts are fetched at runtime from an auth-gated store via a short-lived OIDC credential; store/role/region/approval-environment are supplied through CI variables and are not committed. PR runs are gated behind an approval environment; fork PRs are skipped.

Matrix covers hifi4 and vision. fusion_g3 is omitted until an upstream operator/nnlib API skew is resolved (its runner does not link yet).

Test plan

Validated locally end to end: setup + cross-compile produce an Xtensa ELF runner for vision; the HiFi4 op sweep passes 15/15 on the simulator and a trivial model returns the expected output.

cc @mcremon-meta

@pytorch-bot

pytorch-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20205

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 263 Pending

As of commit 3fef334 with merge base 193574d (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 10, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@aliafzal aliafzal force-pushed the cadence_executor_runner branch from 4f3edc3 to c327767 Compare June 10, 2026 21:22
@aliafzal aliafzal added the module: cadence Issues related to the Cadence/Xtensa backend label Jun 10, 2026
@aliafzal aliafzal force-pushed the cadence_executor_runner branch from c327767 to 7603185 Compare June 10, 2026 21:39
The upstream executor_runner cannot cross-compile to Xtensa because gflags pulls
in mkdir(2), absent from Xtensa newlib. Add cadence_executor_runner, a
gflags-free ExecuTorch runner for the Cadence Xtensa cores targeting the
Instruction Set Simulator (xt-run): it uses plain argv parsing like the Arm and
NXP backends, loads a .pte via xt-run semi-hosting, runs the first method with
all-ones inputs, and prints outputs. EXECUTORCH_BUILD_CADENCE_RUNNER builds it,
linking cadence_ops_lib transitively (no --whole-archive, which would double-run
static kernel registration); -lidma is linked only for Vision/Fusion-G3 cores,
whose ops reference iDMA and whose LSPs ship libidma, while HiFi4 does not. Also
register op_quantized_depthwise_conv1d_{ncl,nlc}.cpp in the HiFi4 operators
CMakeLists, which codegen references (omitting the sources broke the
cross-compile link).

Add an xtensa-build job to the Cadence Build & Test workflow
(build-cadence-runner.yml), alongside the existing host cpu-build/cpu-test, to
cross-compile the backend for the Xtensa cores. It is a build stage producing a
runner artifact; the ISS test stage follows separately (cf. cpu-build ->
cpu-test). The Xtensa toolchain and core configs are licensed and fetched at
runtime from an auth-gated object store via a short-lived OIDC credential; the
store, role, and region are provided through CI variables and are not committed.
Fork PRs are skipped because they cannot mint the OIDC token to assume the role.
setup-xtensa-tools.sh downloads and installs the toolchain/core for a backend,
rewrites the vendor params to local paths, and exports the Xtensa env;
build-cadence-xtensa.sh cross-compiles cadence_executor_runner. The job builds a
[hifi4, vision] matrix and uploads the runner.

fusion_g3 is omitted from the matrix until the upstream fusion_g3 <-> nnlib API
skew is fixed (its runner does not link).
@aliafzal aliafzal force-pushed the cadence_executor_runner branch from 7603185 to 3fef334 Compare June 10, 2026 21:40
@aliafzal

Copy link
Copy Markdown
Contributor Author

Superseded by #20208. Moved to an upstream same-repo branch so the Cadence Xtensa CI runs pre-merge instead of being skipped on fork PRs. Same single commit.

@aliafzal aliafzal closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: cadence Issues related to the Cadence/Xtensa backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant