Skip to content

Commit 8029941

Browse files
authored
Merge branch 'main' into g4-opt-prefill-window-sdpa
2 parents ac2968b + c5bf380 commit 8029941

328 files changed

Lines changed: 17206 additions & 3909 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ esac
102102
TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt)
103103
BUILD_DOCS=1
104104

105-
if [[ "${GCC_VERSION:-}" == "11" && -z "${SKIP_PYTORCH:-}" ]]; then
105+
if [[ -n "${GCC_VERSION:-}" && -z "${SKIP_PYTORCH:-}" ]]; then
106106
PYTORCH_BUILD_MAX_JOBS=6
107107
fi
108108

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
#
8+
# Cross-compile cadence_executor_runner for a Cadence Xtensa core and (by
9+
# default) smoke-test it on the Instruction Set Simulator with a trivial model.
10+
#
11+
# Requires the Xtensa toolchain env to already be set (run
12+
# .ci/scripts/setup-xtensa-tools.sh <backend> first): XTENSA_TOOLCHAIN,
13+
# TOOLCHAIN_VER, XTENSA_SYSTEM, XTENSA_CORE, XTENSAD_LICENSE_FILE,
14+
# CADENCE_OPT_FLAG, and xt-clang on PATH.
15+
#
16+
# Usage:
17+
# .ci/scripts/build-cadence-xtensa.sh [--no-run]
18+
# --no-run : compile only, skip the ISS smoke test
19+
20+
set -euo pipefail
21+
22+
RUN_SMOKE=1
23+
[[ "${1:-}" == "--no-run" ]] && RUN_SMOKE=0
24+
25+
: "${XTENSA_TOOLCHAIN:?run setup-xtensa-tools.sh first}"
26+
: "${TOOLCHAIN_VER:?run setup-xtensa-tools.sh first}"
27+
: "${XTENSA_CORE:?run setup-xtensa-tools.sh first}"
28+
: "${CADENCE_OPT_FLAG:?run setup-xtensa-tools.sh first}"
29+
30+
NPROC=$(nproc)
31+
echo "=== building cadence_executor_runner for ${XTENSA_CORE} (${CADENCE_OPT_FLAG}) ==="
32+
xt-clang --version | head -1
33+
34+
rm -rf cmake-out
35+
CXXFLAGS="-fno-exceptions -fno-rtti" cmake \
36+
-DCMAKE_TOOLCHAIN_FILE=./backends/cadence/cadence.cmake \
37+
-DCMAKE_INSTALL_PREFIX=cmake-out \
38+
-DCMAKE_BUILD_TYPE=Release \
39+
-DEXECUTORCH_BUILD_CADENCE=ON \
40+
"-D${CADENCE_OPT_FLAG}=ON" \
41+
-DEXECUTORCH_BUILD_PORTABLE_OPS=ON \
42+
-DEXECUTORCH_BUILD_CADENCE_RUNNER=ON \
43+
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
44+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
45+
-DEXECUTORCH_ENABLE_LOGGING=ON \
46+
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
47+
-DEXECUTORCH_BUILD_CPUINFO=OFF \
48+
-DEXECUTORCH_USE_DL=OFF \
49+
-DEXECUTORCH_BUILD_KERNELS_LLM=OFF \
50+
-DEXECUTORCH_BUILD_DEVTOOLS=OFF \
51+
-DHAVE_FNMATCH_H=OFF \
52+
-DFLATCC_ALLOW_WERROR=OFF \
53+
-DPYTHON_EXECUTABLE="$(which python3)" \
54+
-Bcmake-out .
55+
56+
cmake --build cmake-out --target cadence_executor_runner -j"${NPROC}"
57+
58+
RUNNER="cmake-out/backends/cadence/cadence_executor_runner"
59+
if [[ ! -f "${RUNNER}" ]]; then
60+
echo "ERROR: ${RUNNER} was not produced" >&2
61+
exit 1
62+
fi
63+
command -v file >/dev/null 2>&1 && file "${RUNNER}" || true
64+
echo "Build OK: ${RUNNER}"
65+
66+
if [[ "${RUN_SMOKE}" == "0" ]]; then
67+
echo "Skipping ISS smoke test (--no-run)."
68+
exit 0
69+
fi
70+
71+
echo "=== ISS smoke test: export add.pte and run on xt-run --turbo ==="
72+
python3 -m examples.portable.scripts.export --model_name=add >/dev/null
73+
LOG=$(mktemp)
74+
xt-run --turbo "${RUNNER}" --model_path=add.pte 2>&1 | tee "${LOG}"
75+
if ! grep -q "Model executed successfully" "${LOG}"; then
76+
echo "ERROR: ISS smoke test did not report success for ${XTENSA_CORE}" >&2
77+
exit 1
78+
fi
79+
echo "ISS smoke test passed for ${XTENSA_CORE}."
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (c) Qualcomm Innovation Center, Inc.
3+
# All rights reserved
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -eux
9+
10+
source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh"
11+
12+
setup_android_ndk
13+
install_qnn
14+
install_hexagon_sdk
15+
16+
bash backends/qualcomm/scripts/build.sh \
17+
--build_direct_mode 3 --soc_model SM8750 \
18+
--skip_x86_64 --skip_linux_android \
19+
--release
20+
21+
ARTIFACT="build-direct/backends/qualcomm/libqnn_executorch_backend.so"
22+
if [ ! -f "${ARTIFACT}" ]; then
23+
echo "ERROR: direct-mode build did not produce ${ARTIFACT}" >&2
24+
exit 1
25+
fi
26+
27+
MAX_SIZE_BYTES=$((200 * 1024))
28+
ARTIFACT_SIZE=$(stat -c%s "${ARTIFACT}")
29+
if [ "${ARTIFACT_SIZE}" -gt "${MAX_SIZE_BYTES}" ]; then
30+
echo "ERROR: ${ARTIFACT} is ${ARTIFACT_SIZE} bytes, exceeds ${MAX_SIZE_BYTES}-byte (200 KiB) limit" >&2
31+
exit 1
32+
fi
33+
echo "PASSED: direct-mode build produced ${ARTIFACT} (${ARTIFACT_SIZE} bytes, under ${MAX_SIZE_BYTES}-byte limit)"

.ci/scripts/setup-webgpu-linux-deps.sh

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,93 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8+
# Vendor Dawn (Tint) + SwiftShader for the WebGPU backend CI WITHOUT hosting a
9+
# private prebuilt:
10+
# * Dawn : Google's official nightly prebuilt, downloaded directly from
11+
# github.com/google/dawn/releases (pinned tag+rev+sha256) -- the same
12+
# "fetch a pinned upstream prebuilt" pattern used for other CI deps.
13+
# * SwiftShader : built from source at a pinned rev compatible with the Dawn
14+
# above (the ossci prebuilt is from 2020, too old for current Dawn). No S3.
15+
# Dawn (Chrome's WebGPU impl; its WGSL compiler Tint is the spec reference) on
16+
# SwiftShader gives a headless, deterministic, spec-faithful CLI backend.
17+
#
18+
# Exports Dawn_DIR / VK_ICD_FILENAMES / LD_LIBRARY_PATH for the cmake build+run.
19+
# Local/rig override: set DAWN_PREBUILT_DIR=<dir containing lib64/cmake/Dawn> to
20+
# skip the Dawn download.
821
set -ex
922

10-
# SwiftShader: software Vulkan adapter for GPU-less CI (LunarG SDK not needed).
11-
install_swiftshader() {
12-
_https_amazon_aws=https://ossci-android.s3.amazonaws.com
13-
_swiftshader_archive=swiftshader-abe07b943-prebuilt.tar.gz
14-
_swiftshader_dir=/tmp/swiftshader
15-
mkdir -p $_swiftshader_dir
23+
# --- pinned versions (bump rev+sha together when upgrading Dawn) --------------
24+
DAWN_TAG="${DAWN_TAG:-v20260423.175430}"
25+
DAWN_REV="${DAWN_REV:-31e25af254ab572c77054edec4946d2244e184dd}"
26+
DAWN_SHA256="${DAWN_SHA256:-ac76fac090162dc1ecea5ed0f28a557bb8f49efc47faab01886105ace82b7b64}"
27+
# SwiftShader rev verified compatible with DAWN_REV (the old ossci prebuilt is
28+
# from 2020 and is incompatible with current Dawn -> no adapter / zero compute).
29+
SWIFTSHADER_REV="${SWIFTSHADER_REV:-9898204d91d6a60b6a08ad74fe4ac52a6913111b}"
1630

17-
_tmp_archive="/tmp/${_swiftshader_archive}"
31+
_dawn_dir="${DAWN_PREBUILT_DIR:-/tmp/dawn-ci}"
32+
_ss_dir=/tmp/swiftshader
1833

19-
curl --silent --show-error --location --fail --retry 3 --retry-all-errors \
20-
--output "${_tmp_archive}" "$_https_amazon_aws/${_swiftshader_archive}"
34+
# --- toolchain prereqs --------------------------------------------------------
35+
# Dawn dlopens the system Vulkan loader at runtime (libvulkan1). And the
36+
# ubuntu-latest prebuilt is built with a bleeding-edge GCC: it references
37+
# libstdc++ symbols newer than ubuntu-22.04's default (e.g. _M_replace_cold,
38+
# GCC 13+), so the static .a won't link against the stock runtime. Pull a current
39+
# libstdc++ from the ubuntu-toolchain-r PPA when the symbol floor isn't met. All
40+
# of this is scoped to the WebGPU CI job; newer libstdc++ is backward-compatible.
41+
if command -v apt-get >/dev/null 2>&1; then
42+
_SUDO=""; command -v sudo >/dev/null 2>&1 && _SUDO="sudo"
43+
${_SUDO} apt-get update -y || true
44+
${_SUDO} apt-get install -y libvulkan1 software-properties-common || true
45+
if ! strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 2>/dev/null \
46+
| grep -q "GLIBCXX_3.4.32"; then
47+
${_SUDO} add-apt-repository -y ppa:ubuntu-toolchain-r/test || true
48+
${_SUDO} apt-get update -y || true
49+
${_SUDO} apt-get install -y libstdc++6 || true # newest GCC runtime
50+
fi
51+
fi
2152

22-
tar -C "${_swiftshader_dir}" -xzf "${_tmp_archive}"
53+
# The native binaries / pybind lib run INSIDE the CI conda env, whose libstdc++
54+
# predates GLIBCXX_3.4.32 (the Dawn prebuilt's floor) -- the same wall ssjia hit
55+
# for the vulkan op tests. Upgrade the conda runtime libstdc++ so the loaded
56+
# libstdc++.so.6 (conda's, not the system one) satisfies Dawn at run time.
57+
if command -v conda >/dev/null 2>&1; then
58+
conda install -y -c conda-forge "libstdcxx-ng>=14" || true
59+
fi
60+
61+
# --- Dawn: official prebuilt from GitHub (no S3) ------------------------------
62+
mkdir -p "${_dawn_dir}"
63+
if [[ ! -d "${_dawn_dir}/lib64/cmake/Dawn" ]]; then
64+
_dawn_tar="/tmp/Dawn-${DAWN_REV}-ubuntu-latest-Release.tar.gz"
65+
curl --silent --show-error --location --fail --retry 3 --retry-all-errors \
66+
--output "${_dawn_tar}" \
67+
"https://github.com/google/dawn/releases/download/${DAWN_TAG}/Dawn-${DAWN_REV}-ubuntu-latest-Release.tar.gz"
68+
echo "${DAWN_SHA256} ${_dawn_tar}" | sha256sum -c -
69+
# archive top dir is Dawn-<rev>-ubuntu-latest-Release/{lib64,include,bin}
70+
tar -C "${_dawn_dir}" --strip-components=1 -xzf "${_dawn_tar}"
71+
fi
2372

24-
export VK_ICD_FILENAMES="${_swiftshader_dir}/swiftshader/build/Linux/vk_swiftshader_icd.json"
25-
export LD_LIBRARY_PATH="${_swiftshader_dir}/swiftshader/build/Linux/:${LD_LIBRARY_PATH}"
26-
export ETVK_USING_SWIFTSHADER=1
27-
}
73+
# --- SwiftShader: build from source at a pinned rev (no S3) -------------------
74+
# The old ossci prebuilt (swiftshader-abe07b943, 2020) is incompatible with the
75+
# current Dawn; build a matching modern SwiftShader instead. Self-contained
76+
# cmake build (vendored LLVM); the ICD lands under build/<OS>/.
77+
if [[ ! -d "${_ss_dir}/build" ]]; then
78+
if [[ ! -d "${_ss_dir}/.git" ]]; then
79+
git clone https://github.com/google/swiftshader "${_ss_dir}"
80+
fi
81+
git -C "${_ss_dir}" checkout "${SWIFTSHADER_REV}"
82+
# vk_swiftshader's deps are vendored in-tree; tolerate unreachable
83+
# disabled-feature submodules (angle, test-only) failing to fetch.
84+
git -C "${_ss_dir}" submodule update --init --recursive || true
85+
cmake -S "${_ss_dir}" -B "${_ss_dir}/build" -DCMAKE_BUILD_TYPE=Release \
86+
-DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_PVR=OFF \
87+
-DSWIFTSHADER_BUILD_BENCHMARKS=OFF
88+
cmake --build "${_ss_dir}/build" --parallel "$(nproc)" --target vk_swiftshader
89+
fi
90+
_ss_icd="$(find "${_ss_dir}/build" -name vk_swiftshader_icd.json 2>/dev/null | head -1)"
91+
[[ -n "${_ss_icd}" ]] || { echo "ERROR: SwiftShader ICD not found after build" >&2; exit 1; }
2892

29-
install_swiftshader
30-
bash backends/webgpu/scripts/setup-wgpu-native.sh
93+
_ss_libdir="$(dirname "${_ss_icd}")"
94+
export Dawn_DIR="${_dawn_dir}/lib64/cmake/Dawn"
95+
export VK_ICD_FILENAMES="${_ss_icd}"
96+
export LD_LIBRARY_PATH="${_ss_libdir}:${LD_LIBRARY_PATH:-}"
97+
export WEBGPU_USING_SWIFTSHADER=1

.ci/scripts/setup-xtensa-tools.sh

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
#
8+
# Download and install the licensed Cadence Xtensa toolchain + core config for
9+
# a given backend, then export the environment that
10+
# backends/cadence/cadence.cmake and xt-run need.
11+
#
12+
# The artifacts (host tools, the core tarball, and the bundled license) cannot
13+
# be hosted publicly, so they are fetched at runtime from an auth-gated object
14+
# store. The store location is provided by the caller via XTENSA_S3_BUCKET (set
15+
# from a CI variable); credentials are obtained out of band before this runs.
16+
#
17+
# Usage:
18+
# XTENSA_S3_BUCKET=<bucket> .ci/scripts/setup-xtensa-tools.sh <backend>
19+
# backend = hifi4 | vision | fusion_g3
20+
#
21+
# In GitHub Actions this appends the toolchain env to $GITHUB_ENV so later
22+
# steps inherit it. Run locally to populate a workspace for manual builds.
23+
#
24+
# Modeled on .ci/scripts/setup-arm-baremetal-tools.sh.
25+
26+
set -euo pipefail
27+
28+
BACKEND="${1:-}"
29+
if [[ -z "${BACKEND}" ]]; then
30+
echo "ERROR: usage: XTENSA_S3_BUCKET=<bucket> $0 <hifi4|vision|fusion_g3>" >&2
31+
exit 1
32+
fi
33+
34+
S3_BUCKET="${XTENSA_S3_BUCKET:-}"
35+
if [[ -z "${S3_BUCKET}" ]]; then
36+
echo "ERROR: XTENSA_S3_BUCKET is not set (provide it from a CI variable)." >&2
37+
exit 1
38+
fi
39+
# Objects live flat at the bucket root by default; set these to put toolchains
40+
# and cores under key prefixes instead.
41+
S3_TOOLCHAIN_PREFIX="${XTENSA_S3_TOOLCHAIN_PREFIX:-}"
42+
S3_CORE_PREFIX="${XTENSA_S3_CORE_PREFIX:-}"
43+
44+
# Per-backend mapping: core tarball, toolchain tarball, core name, OPT flag.
45+
# The toolchain's clang major must match the core's codegen plugin:
46+
# hifi4 / fusion_g3 cores (RI-2022.10, clang 10) -> RI-2022.9 host tools
47+
# vision core (RJ-2025.5, clang 15) -> RJ-2025.5 host tools
48+
case "${BACKEND}" in
49+
hifi4)
50+
CORE_NAME="hifi4_ss_spfpu_7_et_ci2"
51+
CORE_TARBALL="hifi4_ss_spfpu_7_et_ci2_linux.tgz"
52+
TOOLCHAIN_TARBALL="XtensaTools_RI_2022_9_linux.tgz"
53+
TOOLCHAIN_VER="RI-2022.9-linux"
54+
OPT_FLAG="EXECUTORCH_NNLIB_OPT"
55+
;;
56+
fusion_g3)
57+
CORE_NAME="XRC_FuG3_TYP_SPVFPU_et_c2"
58+
CORE_TARBALL="XRC_FuG3_TYP_SPVFPU_et_c2_linux.tgz"
59+
TOOLCHAIN_TARBALL="XtensaTools_RI_2022_9_linux.tgz"
60+
TOOLCHAIN_VER="RI-2022.9-linux"
61+
OPT_FLAG="EXECUTORCH_FUSION_G3_OPT"
62+
;;
63+
vision)
64+
CORE_NAME="XRC_Vision_110_AO_et_ci2"
65+
CORE_TARBALL="XRC_Vision_110_AO_et_ci2_linux.tgz"
66+
TOOLCHAIN_TARBALL="XtensaTools_RJ_2025_5_linux.tgz"
67+
TOOLCHAIN_VER="RJ-2025.5-linux"
68+
OPT_FLAG="EXECUTORCH_VISION_OPT"
69+
;;
70+
*)
71+
echo "ERROR: unknown backend '${BACKEND}' (expected hifi4|vision|fusion_g3)" >&2
72+
exit 1
73+
;;
74+
esac
75+
76+
XTENSA_ROOT="${XTENSA_ROOT:-/tmp/xtensa}"
77+
TOOLS_ROOT="${XTENSA_ROOT}/tools" # contains <ver>-linux/XtensaTools
78+
CORES_ROOT="${XTENSA_ROOT}/cores" # contains <corever>-linux/<core>
79+
REGISTRY_ROOT="${XTENSA_ROOT}/registry/${CORE_NAME}"
80+
DL_DIR="${XTENSA_ROOT}/download"
81+
mkdir -p "${TOOLS_ROOT}" "${CORES_ROOT}" "${REGISTRY_ROOT}" "${DL_DIR}"
82+
83+
s3_get() {
84+
# $1 = s3 key, $2 = local dest
85+
local key="$1" dest="$2"
86+
echo "Downloading s3://${S3_BUCKET}/${key} ..."
87+
aws s3 cp "s3://${S3_BUCKET}/${key}" "${dest}" --only-show-errors
88+
}
89+
90+
extract_tgz() {
91+
# $1 = .tgz, $2 = dest dir. Some vendor core tarballs carry trailing bytes
92+
# after a valid gzip stream; gzip then exits 2 ("trailing garbage ignored")
93+
# even though the archive decompressed fully, which aborts `tar xzf`. Key the
94+
# success check off tar's exit, not gzip's.
95+
local tgz="$1" dest="$2" rc
96+
set +o pipefail
97+
gzip -dc "${tgz}" 2>/dev/null | tar xf - -C "${dest}"
98+
rc=${PIPESTATUS[1]}
99+
set -o pipefail
100+
[[ "${rc}" -eq 0 ]] || { echo "ERROR: failed to extract ${tgz} (tar rc=${rc})" >&2; exit 1; }
101+
}
102+
103+
# 1. Toolchain (host xt-clang/xt-run). Skip re-extract if already present.
104+
if [[ ! -d "${TOOLS_ROOT}/${TOOLCHAIN_VER}/XtensaTools" ]]; then
105+
s3_get "${S3_TOOLCHAIN_PREFIX:+${S3_TOOLCHAIN_PREFIX}/}${TOOLCHAIN_TARBALL}" "${DL_DIR}/${TOOLCHAIN_TARBALL}"
106+
extract_tgz "${DL_DIR}/${TOOLCHAIN_TARBALL}" "${TOOLS_ROOT}"
107+
fi
108+
TOOLCHAIN_HOME="${TOOLS_ROOT}/${TOOLCHAIN_VER}/XtensaTools"
109+
if [[ ! -x "${TOOLCHAIN_HOME}/bin/xt-clang" ]]; then
110+
echo "ERROR: xt-clang not found at ${TOOLCHAIN_HOME}/bin after extract" >&2
111+
exit 1
112+
fi
113+
114+
# 2. Core config (ISA libs, params, examples, bundled magic-key license).
115+
s3_get "${S3_CORE_PREFIX:+${S3_CORE_PREFIX}/}${CORE_TARBALL}" "${DL_DIR}/${CORE_TARBALL}"
116+
extract_tgz "${DL_DIR}/${CORE_TARBALL}" "${CORES_ROOT}"
117+
CORE_DIR=$(echo "${CORES_ROOT}"/*/"${CORE_NAME}")
118+
if [[ ! -d "${CORE_DIR}" ]]; then
119+
echo "ERROR: core dir for ${CORE_NAME} not found under ${CORES_ROOT}" >&2
120+
exit 1
121+
fi
122+
123+
# 3. Build a local Xtensa core registry with the XPG-internal build paths in
124+
# the params file rewritten to our extracted toolchain + core locations.
125+
# The vendor ships params referencing /././home/xpgcust/... build paths.
126+
PARAMS_SRC="${CORE_DIR}/config/${CORE_NAME}-params"
127+
TOOLS_PFX=$(sed -n 's/^install-prefix = //p' "${PARAMS_SRC}" | head -1)
128+
TOOLSUB_PFX=$(sed -n 's/^xtensa-tools = //p' "${PARAMS_SRC}" | head -1)
129+
CFG_PFX=$(sed -n 's/^config-prefix = //p' "${PARAMS_SRC}" | head -1)
130+
sed \
131+
-e "s|${TOOLS_PFX}|${TOOLCHAIN_HOME}|g" \
132+
-e "s|${TOOLSUB_PFX}|${TOOLCHAIN_HOME}/Tools|g" \
133+
-e "s|${CFG_PFX}|${CORE_DIR}|g" \
134+
"${PARAMS_SRC}" > "${REGISTRY_ROOT}/${CORE_NAME}-params"
135+
ln -sf "${CORE_NAME}-params" "${REGISTRY_ROOT}/default-params"
136+
137+
LICENSE_FILE="${CORE_DIR}/misc/license.dat"
138+
139+
# 4. Export environment. cadence.cmake reads XTENSA_TOOLCHAIN/TOOLCHAIN_VER;
140+
# xt-clang/xt-run read XTENSA_SYSTEM/XTENSA_CORE; xtensad reads
141+
# XTENSAD_LICENSE_FILE (the bundled uncounted magic key, no server needed).
142+
emit() {
143+
# Export into the current shell (so callers that `source` this script get the
144+
# vars) and append to $GITHUB_ENV (so later workflow steps inherit them too).
145+
echo "$1"
146+
export "${1?}"
147+
if [[ -n "${GITHUB_ENV:-}" ]]; then echo "$1" >> "${GITHUB_ENV}"; fi
148+
}
149+
echo "=== Xtensa env for backend '${BACKEND}' (core ${CORE_NAME}) ==="
150+
emit "XTENSA_TOOLCHAIN=${TOOLS_ROOT}"
151+
emit "TOOLCHAIN_VER=${TOOLCHAIN_VER}"
152+
emit "XTENSA_SYSTEM=${REGISTRY_ROOT}"
153+
emit "XTENSA_CORE=${CORE_NAME}"
154+
emit "XTENSAD_LICENSE_FILE=${LICENSE_FILE}"
155+
emit "CADENCE_OPT_FLAG=${OPT_FLAG}"
156+
if [[ -n "${GITHUB_PATH:-}" ]]; then
157+
echo "${TOOLCHAIN_HOME}/bin" >> "${GITHUB_PATH}"
158+
fi
159+
export PATH="${TOOLCHAIN_HOME}/bin:${PATH}"
160+
161+
echo "=== sanity ==="
162+
xt-clang --version 2>&1 | head -1
163+
xt-run --show-config=cores 2>&1 | sed -n '/available/,/registry/p' | head -6
164+
echo "Xtensa toolchain ready for ${BACKEND}."

0 commit comments

Comments
 (0)