Skip to content

Commit ec66112

Browse files
committed
Update (base update)
[ghstack-poisoned]
2 parents ee95f0b + cc9acaa commit ec66112

1,820 files changed

Lines changed: 240679 additions & 32753 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ fi
116116
# Copy requirements-lintrunner.txt from root to here
117117
cp ../../requirements-lintrunner.txt ./
118118

119+
# Copy the Arm setup scripts that pin the FVP and toolchain downloads
120+
mkdir -p arm-setup
121+
cp ../../backends/arm/scripts/{utils,fvp_utils,toolchain_utils}.sh arm-setup/
122+
119123
# OSDC runners have no docker daemon, so the build runs on the in-cluster
120124
# BuildKit pool via a remote buildx builder. That builder has nowhere to load
121125
# an image into, so the result has to go straight to the registry.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
# Cache the developer.arm.com downloads of examples/arm/setup.sh, so CI jobs
9+
# copy them from ARM_SETUP_DOWNLOAD_CACHE instead of fetching them each run.
10+
# Jobs download whatever is missing, so a failed download only costs the cache.
11+
12+
set -exu
13+
14+
ARCH="$(uname -m)"
15+
OS="$(uname -s)"
16+
ARM_SETUP_CURL_PROGRESS_ARGS=(--no-progress-meter)
17+
# Fill the cache rather than read from it
18+
cache_dir="${ARM_SETUP_DOWNLOAD_CACHE}"
19+
unset ARM_SETUP_DOWNLOAD_CACHE
20+
source ./arm-setup/fvp_utils.sh
21+
source ./arm-setup/toolchain_utils.sh
22+
23+
cache_download() {
24+
local url=$1
25+
local md5=$2
26+
local output="${cache_dir}/$(basename "${url}")"
27+
download_with_retry "cache" "${url}" "${output}" "${md5}" || rm -f "${output}"
28+
}
29+
30+
mkdir -p "${cache_dir}"
31+
cache_download "${corstone300_url}" "${corstone300_md5_checksum}"
32+
cache_download "${corstone320_url}" "${corstone320_md5_checksum}"
33+
gcc_select_toolchain
34+
cache_download "${toolchain_url}" "${toolchain_md5_checksum}"

‎.ci/docker/ubuntu/Dockerfile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ COPY ./common/utils.sh utils.sh
103103
RUN if [ -n "${ZEPHYR_SDK}" ]; then bash ./install_zephyr.sh; fi
104104
RUN rm install_zephyr.sh zephyr_sdk_release_proxy.py utils.sh
105105

106+
# Cache the developer.arm.com downloads of examples/arm/setup.sh, which the
107+
# Arm and Zephyr jobs run.
108+
ENV ARM_SETUP_DOWNLOAD_CACHE=/opt/arm-download-cache
109+
COPY ./common/install_arm_downloads.sh install_arm_downloads.sh
110+
COPY ./arm-setup arm-setup
111+
RUN if [ -n "${ARM_SDK}${ZEPHYR_SDK}" ]; then \
112+
bash ./install_arm_downloads.sh || echo "Arm download cache not populated"; \
113+
fi
114+
RUN rm -r install_arm_downloads.sh arm-setup
115+
106116
ARG QNN_SDK
107117

108118
ARG MEDIATEK_SDK

‎.ci/scripts/download_hf_hub.sh‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ export HF_HUB_DISABLE_XET=1
77
# Arguments:
88
# 1. model_id: The Hugging Face repository ID (e.g., "organization/model_name")
99
# 2. subdir: The optional subdirectory in the repo to look for files (pass "" if not used)
10-
# 3. file_names: A space-separated list of filenames to be downloaded
10+
# 3. revision: The commit hash to download
11+
# 4. file_names: A space-separated list of filenames to be downloaded
1112
# Returns:
1213
# The directory containing the downloaded files
1314
function download_hf_files() {
1415
local model_id="$1"
1516
local subdir="$2"
16-
shift 2
17+
local revision="$3"
18+
shift 3
1719
local file_names=("$@") # Capture all remaining arguments as an array
1820

1921
local download_dir
@@ -24,7 +26,8 @@ from huggingface_hub import hf_hub_download
2426
# Download the first file and get its directory
2527
path = hf_hub_download(
2628
repo_id='${model_id}',
27-
filename='${subdir:+${subdir}/}${file_names[0]}'
29+
filename='${subdir:+${subdir}/}${file_names[0]}',
30+
revision='${revision}'
2831
)
2932
import os
3033
print(os.path.dirname(path))")
@@ -41,7 +44,8 @@ from huggingface_hub import hf_hub_download
4144
# Download the file
4245
hf_hub_download(
4346
repo_id='${model_id}',
44-
filename='${subdir:+${subdir}/}${file_name}'
47+
filename='${subdir:+${subdir}/}${file_name}',
48+
revision='${revision}'
4549
)"
4650

4751
if [ $? -ne 0 ]; then
@@ -67,6 +71,10 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
6771
SUBDIR="$2"
6872
shift 2
6973
;;
74+
--revision)
75+
REVISION="$2"
76+
shift 2
77+
;;
7078
--files)
7179
shift
7280
FILES_TO_DOWNLOAD=()
@@ -83,13 +91,13 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
8391
done
8492

8593
# Validate required arguments
86-
if [ -z "$MODEL_ID" ] || [ ${#FILES_TO_DOWNLOAD[@]} -eq 0 ]; then
87-
echo "Usage: $0 --model_id <model_id> --subdir <subdir> --files <file1> [<file2> ...]" >&2
94+
if [ -z "$MODEL_ID" ] || [ -z "$REVISION" ] || [ ${#FILES_TO_DOWNLOAD[@]} -eq 0 ]; then
95+
echo "Usage: $0 --model_id <model_id> --revision <commit> --subdir <subdir> --files <file1> [<file2> ...]" >&2
8896
exit 1
8997
fi
9098

9199
# Call the function
92-
DOWNLOAD_DIR=$(download_hf_files "$MODEL_ID" "$SUBDIR" "${FILES_TO_DOWNLOAD[@]}")
100+
DOWNLOAD_DIR=$(download_hf_files "$MODEL_ID" "$SUBDIR" "$REVISION" "${FILES_TO_DOWNLOAD[@]}")
93101
if [ $? -eq 0 ]; then
94102
echo "$DOWNLOAD_DIR"
95103
else

‎.ci/scripts/export_model_artifact.sh‎

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Arguments:
5050
- vr-streaming: Voxtral Realtime streaming mode
5151
- vr-offline: Voxtral Realtime offline mode
5252
- solo-text: Muse Glimmer solo text mode
53-
- solo-text-batching: Muse Glimmer text on the CUDA batching runtime
53+
- dflash-image-batching: Muse Glimmer DFlash text and image on the CUDA batching runtime
5454
- dflash-image: Muse Glimmer DFlash vision mode
5555
5656
Examples:
@@ -105,7 +105,7 @@ if [ -n "$MODE" ]; then
105105
exit 1
106106
fi
107107
;;
108-
solo-text|solo-text-batching|dflash-image)
108+
solo-text|dflash-image-batching|dflash-image)
109109
if [ "$HF_MODEL" != "meta-models/Muse-Glimmer-30B-GGUF" ]; then
110110
echo "Error: Mode '$MODE' can only be used with Muse Glimmer model"
111111
echo "Provided model: $HF_MODEL"
@@ -114,7 +114,7 @@ if [ -n "$MODE" ]; then
114114
;;
115115
*)
116116
echo "Error: Unsupported mode '$MODE'"
117-
echo "Supported modes: vr-streaming, vr-offline, solo-text, solo-text-batching, dflash-image"
117+
echo "Supported modes: vr-streaming, vr-offline, solo-text, dflash-image-batching, dflash-image"
118118
exit 1
119119
;;
120120
esac
@@ -354,8 +354,8 @@ if [ "$MODEL_NAME" = "muse_glimmer" ]; then
354354
echo "Error: Muse Glimmer requires quantization 'kquant-17gb' or 'kquant-dynamic'"
355355
exit 1
356356
fi
357-
if [ "$MODE" != "solo-text" ] && [ "$MODE" != "solo-text-batching" ] && [ "$MODE" != "dflash-image" ]; then
358-
echo "Error: Muse Glimmer requires mode 'solo-text', 'solo-text-batching' or 'dflash-image'"
357+
if [ "$MODE" != "solo-text" ] && [ "$MODE" != "dflash-image-batching" ] && [ "$MODE" != "dflash-image" ]; then
358+
echo "Error: Muse Glimmer requires mode 'solo-text', 'dflash-image-batching' or 'dflash-image'"
359359
exit 1
360360
fi
361361
fi
@@ -707,23 +707,17 @@ if [ "$MODEL_NAME" = "muse_glimmer" ]; then
707707
--backend cuda \
708708
--output-dir "${OUTPUT_DIR}"
709709
;;
710-
solo-text-batching)
711-
# The off-graph cache exports the batching methods CudaExecutor drives:
712-
# Static forward_{N}, dynamic forward_others and the device samplers.
713-
EXPORT_START_SECONDS=$SECONDS
714-
TMPDIR="$INDUCTOR_TMPDIR" \
715-
TORCHINDUCTOR_CACHE_DIR="$INDUCTOR_CACHE" \
716-
python -m executorch.examples.models.muse_glimmer.export.export_solo \
717-
--gguf "$TARGET_GGUF_PATH" \
718-
--backend cuda \
719-
--use-offgraph-kv-cache \
720-
--output-dir "${OUTPUT_DIR}"
721-
;;
722-
dflash-image)
710+
dflash-image|dflash-image-batching)
723711
DRAFT_GGUF_FILE="dflash-Muse-Glimmer-30B-Q4_K_M.gguf"
724712
MMPROJ_GGUF_FILE="mmproj-Muse-Glimmer-30B-Q4_K_M.gguf"
725713
python -c "from huggingface_hub import hf_hub_download; hf_hub_download('${HF_MODEL}', '${DRAFT_GGUF_FILE}', local_dir='${LOCAL_MODEL_DIR}')"
726714
python -c "from huggingface_hub import hf_hub_download; hf_hub_download('${HF_MODEL}', '${MMPROJ_GGUF_FILE}', local_dir='${LOCAL_MODEL_DIR}')"
715+
# The off-graph cache exports the batching methods the CUDA DFlash
716+
# executor drives, plus the vision encoder and forward_from_embeddings.
717+
OFFGRAPH_FLAG=""
718+
if [ "$MODE" = "dflash-image-batching" ]; then
719+
OFFGRAPH_FLAG="--use-offgraph-kv-cache"
720+
fi
727721
EXPORT_START_SECONDS=$SECONDS
728722
TMPDIR="$INDUCTOR_TMPDIR" \
729723
TORCHINDUCTOR_CACHE_DIR="$INDUCTOR_CACHE" \
@@ -732,10 +726,11 @@ if [ "$MODEL_NAME" = "muse_glimmer" ]; then
732726
--draft-gguf "${LOCAL_MODEL_DIR}/${DRAFT_GGUF_FILE}" \
733727
--mmproj "${LOCAL_MODEL_DIR}/${MMPROJ_GGUF_FILE}" \
734728
--backend cuda \
729+
$OFFGRAPH_FLAG \
735730
--output-dir "${OUTPUT_DIR}"
736731
;;
737732
*)
738-
echo "Error: Muse Glimmer requires mode 'solo-text', 'solo-text-batching' or 'dflash-image'"
733+
echo "Error: Muse Glimmer requires mode 'solo-text', 'dflash-image-batching' or 'dflash-image'"
739734
exit 1
740735
;;
741736
esac
@@ -746,7 +741,7 @@ if [ "$MODEL_NAME" = "muse_glimmer" ]; then
746741

747742
test -f "${OUTPUT_DIR}/model.pte"
748743
test -f "${OUTPUT_DIR}/aoti_cuda_blob.ptd"
749-
if [ "$MODE" = "dflash-image" ]; then
744+
if [ "$MODE" = "dflash-image" ] || [ "$MODE" = "dflash-image-batching" ]; then
750745
test -f "${OUTPUT_DIR}/pos_embed.bin"
751746
fi
752747
ls -al "${OUTPUT_DIR}"

‎.ci/scripts/muse_glimmer_batching_smoke.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DECLARE_string(pte);
2020
DECLARE_string(tokenizer);
2121
DECLARE_string(data_path);
2222
DECLARE_string(backend);
23+
DECLARE_bool(dflash);
2324
DECLARE_int32(max_sessions);
2425
DECLARE_int32(max_session_tokens);
2526
DECLARE_uint64(bos_id);
@@ -64,6 +65,7 @@ int main(int argc, char** argv) {
6465
config.max_sessions = FLAGS_max_sessions;
6566
config.max_session_tokens = FLAGS_max_session_tokens;
6667
config.bos_id = FLAGS_bos_id;
68+
config.use_dflash = FLAGS_dflash;
6769
auto backend = llm::create_muse_glimmer_backend(config);
6870
if (!backend.ok()) {
6971
throw std::runtime_error(

‎.ci/scripts/setup-openvino.sh‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,27 @@ for arg in "$@"; do
1818
esac
1919
done
2020

21-
# Download and install OpenVINO from release packages
22-
OPENVINO_VERSION="2026.0"
23-
OPENVINO_BUILD="2026.0.0.20965.c6d6a13a886"
24-
OPENVINO_STABLE_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/${OPENVINO_VERSION}/linux/openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64.tgz"
25-
26-
OPENVINO_NIGHTLY_BUILD_ID="2026.1.0-21310-c694fbc2b6d"
27-
OPENVINO_NIGHTLY_BUILD="2026.1.0.dev20260312"
28-
OPENVINO_NIGHTLY_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/${OPENVINO_NIGHTLY_BUILD_ID}/openvino_toolkit_ubuntu22_${OPENVINO_NIGHTLY_BUILD}_x86_64.tgz"
29-
21+
OPENVINO_PACKAGES_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages"
3022
if [ "${USE_NIGHTLY}" = true ]; then
31-
OPENVINO_URL="${OPENVINO_NIGHTLY_URL}"
32-
OPENVINO_EXTRACTED_DIR="openvino_toolkit_ubuntu22_${OPENVINO_NIGHTLY_BUILD}_x86_64"
33-
echo "Using OpenVINO nightly build: ${OPENVINO_NIGHTLY_BUILD_ID}"
23+
# Only for quick testing. OpenVINO deletes nightlies after a few months, so
24+
# take the newest one instead of pinning a build that will disappear.
25+
OPENVINO_URL=$(curl -fsSL --retry 3 --retry-all-errors "${OPENVINO_PACKAGES_URL}/nightly/latest.txt" | sed -n 's/^ubuntu22_x86_64://p')
26+
: "${OPENVINO_URL:?could not get the ubuntu22_x86_64 nightly from latest.txt}"
27+
OPENVINO_SHA256=$(curl -fsSL --retry 3 --retry-all-errors "${OPENVINO_URL}.sha256" | sed -nE 's/^([0-9a-f]{64}).*/\1/p')
28+
: "${OPENVINO_SHA256:?could not get the SHA-256 of the nightly from its .sha256 file}"
3429
else
35-
OPENVINO_URL="${OPENVINO_STABLE_URL}"
36-
OPENVINO_EXTRACTED_DIR="openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64"
37-
echo "Using OpenVINO stable release: ${OPENVINO_BUILD}"
30+
OPENVINO_VERSION="2026.4.1"
31+
OPENVINO_BUILD="2026.4.1.22982.07f9c262b05"
32+
OPENVINO_SHA256="e2541afe65a81d5aabe981f9a86ad2c7efe557922b71e5649b6aafffec7c982b"
33+
OPENVINO_URL="${OPENVINO_PACKAGES_URL}/${OPENVINO_VERSION}/linux/openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64.tgz"
3834
fi
35+
OPENVINO_EXTRACTED_DIR=$(basename "${OPENVINO_URL}" .tgz)
36+
echo "Using OpenVINO: ${OPENVINO_EXTRACTED_DIR}"
3937

40-
curl -Lo /tmp/openvino_toolkit.tgz --retry 3 --retry-all-errors --fail ${OPENVINO_URL}
38+
curl -Lo /tmp/openvino_toolkit.tgz --retry 3 --retry-all-errors --fail "${OPENVINO_URL}"
39+
# The storage server answers a missing file with an HTML page and HTTP 200, so
40+
# compare the download with the expected hash before extracting it.
41+
echo "${OPENVINO_SHA256} /tmp/openvino_toolkit.tgz" | sha256sum -c -
4142
tar -xzf /tmp/openvino_toolkit.tgz
4243
mv "${OPENVINO_EXTRACTED_DIR}" openvino
4344

‎.ci/scripts/setup-qnn-deps.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ set -ex
99

1010
source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh"
1111

12-
setup_libcpp 12
1312
setup_android_ndk
1413
install_qnn
1514
pip install -r backends/qualcomm/requirements.txt

‎.ci/scripts/test-native.sh‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env 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+
set -euxo pipefail
9+
10+
component="${1:?Usage: test-native.sh <runtime|cpu|ggml|vulkan> [cmake options]}"
11+
shift
12+
build_dir="cmake-out/native-${component}"
13+
build_jobs="${CMAKE_BUILD_PARALLEL_LEVEL:-$(nproc)}"
14+
cmake_args=()
15+
targets=()
16+
17+
case "${component}" in
18+
runtime)
19+
targets+=(native_runtime_test)
20+
test_regex='^native_runtime_test$'
21+
;;
22+
cpu)
23+
cmake_args+=(
24+
-DEXECUTORCH_BUILD_NATIVE_CPU=ON
25+
-DEXECUTORCH_BUILD_XNNPACK=ON
26+
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON
27+
-DEXECUTORCH_BUILD_NATIVE_VISION_RUNNER=ON
28+
)
29+
targets+=(native_cpu_engine_test run_classification_cpu)
30+
test_regex='^native_cpu_engine_test$'
31+
;;
32+
ggml)
33+
cmake_args+=(
34+
-DEXECUTORCH_BUILD_NATIVE_GGML=ON
35+
-DEXECUTORCH_BUILD_NATIVE_LLM_RUNNER=ON
36+
-DEXECUTORCH_BUILD_NATIVE_VISION_RUNNER=ON
37+
-DGGML_NATIVE=OFF
38+
)
39+
targets+=(run_hf_llm_ggml native_ggml_engine_test native_llm_runner_utils_test run_classification_ggml_cpu)
40+
test_regex='^native_(ggml_engine|llm_runner_utils)_test$'
41+
;;
42+
vulkan)
43+
cmake_args+=(
44+
-DEXECUTORCH_BUILD_NATIVE_VULKAN=ON
45+
-DEXECUTORCH_BUILD_NATIVE_VISION_RUNNER=ON
46+
-DEXECUTORCH_BUILD_NATIVE_LLM_RUNNER=ON
47+
-DEXECUTORCH_VULKAN_SHADER_COMPILE_NTHREADS="${build_jobs}"
48+
)
49+
targets+=(native_vulkan_engine run_classification run_hf_llm_vulkan native_vulkan_passes_test native_runner_utils_test)
50+
test_regex='^native_(vulkan_passes|runner_utils)_test$'
51+
;;
52+
*)
53+
echo "Unknown native component: ${component}" >&2
54+
exit 1
55+
;;
56+
esac
57+
58+
cmake -S . -B "${build_dir}" -G Ninja \
59+
-DCMAKE_BUILD_TYPE=Release \
60+
-DPYTHON_EXECUTABLE="$(command -v python)" \
61+
-DEXECUTORCH_BUILD_TESTS=ON \
62+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
63+
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
64+
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
65+
-DEXECUTORCH_BUILD_NATIVE=ON \
66+
"${cmake_args[@]}" "$@"
67+
cmake --build "${build_dir}" \
68+
--parallel "${build_jobs}" \
69+
--target "${targets[@]}"
70+
ctest --test-dir "${build_dir}/backends/native/test" \
71+
-R "${test_regex}" --output-on-failure --no-tests=error --timeout 120
72+
73+
if [[ "${component}" == "ggml" ]]; then
74+
PYTHONPATH="${PWD}/src:${PYTHONPATH:-}" \
75+
FLATC_EXECUTABLE="${FLATC_EXECUTABLE:-${PWD}/${build_dir}/third-party/flatc_ep/bin/flatc}" \
76+
python .ci/scripts/test_native_llm_runner.py \
77+
--runner "${build_dir}/backends/native/examples/hf_llm/runtime/run_hf_llm_ggml"
78+
fi

0 commit comments

Comments
 (0)