Skip to content

Commit 9efc86e

Browse files
committed
Update
[ghstack-poisoned]
2 parents 20407f0 + 0ef91c1 commit 9efc86e

File tree

178 files changed

+1991
-3962
lines changed

Some content is hidden

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

178 files changed

+1991
-3962
lines changed

.Package.swift/kernels_portable/dummy.swift

Whitespace-only changes.

.Package.swift/kernels_portable_debug/dummy.swift

Whitespace-only changes.

.ci/scripts/test_ios_ci.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ say "Installing CoreML Backend Requirements"
4242

4343
./backends/apple/coreml/scripts/install_requirements.sh
4444

45+
say "Installing MPS Backend Requirements"
46+
47+
./backends/apple/mps/install_requirements.sh
48+
4549
say "Exporting Models"
4650

4751
python3 -m examples.portable.scripts.export --model_name="$MODEL_NAME" --segment_alignment=0x4000

.ci/scripts/test_model.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,14 @@ prepare_artifacts_upload() {
4949
}
5050

5151
build_cmake_executor_runner() {
52-
local backend_string_select="${1:-}"
5352
echo "Building executor_runner"
5453
rm -rf ${CMAKE_OUTPUT_DIR}
55-
mkdir ${CMAKE_OUTPUT_DIR}
56-
if [[ "$backend_string_select" == "XNNPACK" ]]; then
57-
echo "Backend $backend_string_select selected"
58-
(cd ${CMAKE_OUTPUT_DIR} \
59-
&& cmake -DCMAKE_BUILD_TYPE=Release \
60-
-DEXECUTORCH_BUILD_XNNPACK=ON \
61-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
62-
cmake --build ${CMAKE_OUTPUT_DIR} -j4
63-
else
64-
cmake -DCMAKE_BUILD_TYPE=Debug \
65-
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
66-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
67-
-B${CMAKE_OUTPUT_DIR} .
68-
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug
69-
fi
54+
cmake -DCMAKE_BUILD_TYPE=Debug \
55+
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
56+
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
57+
-B${CMAKE_OUTPUT_DIR} .
58+
59+
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug
7060
}
7161

7262
run_portable_executor_runner() {
@@ -121,6 +111,19 @@ test_model() {
121111
run_portable_executor_runner
122112
}
123113

114+
build_cmake_xnn_executor_runner() {
115+
echo "Building xnn_executor_runner"
116+
117+
(rm -rf ${CMAKE_OUTPUT_DIR} \
118+
&& mkdir ${CMAKE_OUTPUT_DIR} \
119+
&& cd ${CMAKE_OUTPUT_DIR} \
120+
&& retry cmake -DCMAKE_BUILD_TYPE=Release \
121+
-DEXECUTORCH_BUILD_XNNPACK=ON \
122+
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
123+
124+
cmake --build ${CMAKE_OUTPUT_DIR} -j4
125+
}
126+
124127
test_model_with_xnnpack() {
125128
WITH_QUANTIZATION=$1
126129
WITH_DELEGATION=$2
@@ -145,11 +148,12 @@ test_model_with_xnnpack() {
145148

146149
# Run test model
147150
if [[ "${BUILD_TOOL}" == "buck2" ]]; then
148-
# TODO eventually buck should also use consolidated executor runners
149151
buck2 run //examples/xnnpack:xnn_executor_runner -- --model_path "${OUTPUT_MODEL_PATH}"
150152
elif [[ "${BUILD_TOOL}" == "cmake" ]]; then
151-
build_cmake_executor_runner "XNNPACK"
152-
./${CMAKE_OUTPUT_DIR}/executor_runner --model_path "${OUTPUT_MODEL_PATH}"
153+
if [[ ! -f ${CMAKE_OUTPUT_DIR}/backends/xnnpack/xnn_executor_runner ]]; then
154+
build_cmake_xnn_executor_runner
155+
fi
156+
./${CMAKE_OUTPUT_DIR}/backends/xnnpack/xnn_executor_runner --model_path "${OUTPUT_MODEL_PATH}"
153157
else
154158
echo "Invalid build tool ${BUILD_TOOL}. Only buck2 and cmake are supported atm"
155159
exit 1

.github/scripts/label_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
LABEL_ERR_MSG_TITLE = "This PR needs a `release notes:` label"
2424
LABEL_ERR_MSG = f"""# {LABEL_ERR_MSG_TITLE}
25-
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.
25+
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:`.
26+
27+
If not, please add the `release notes: none` label.
2628
2729
To add a label, you can comment to pytorchbot, for example
2830
`@pytorchbot label "release notes: none"`

.github/scripts/trymerge.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@
5959
patterns_to_regex,
6060
retries_decorator,
6161
)
62-
from label_utils import gh_add_labels, gh_remove_label
62+
from label_utils import (
63+
gh_add_labels,
64+
gh_remove_label,
65+
has_required_labels,
66+
LABEL_ERR_MSG,
67+
)
6368
from trymerge_explainer import get_revert_message, TryMergeExplainer
6469

6570
# labels
@@ -2111,6 +2116,9 @@ def merge(
21112116
# Check for approvals
21122117
find_matching_merge_rule(pr, repo, skip_mandatory_checks=True)
21132118

2119+
if not has_required_labels(pr):
2120+
raise RuntimeError(LABEL_ERR_MSG.lstrip(" #"))
2121+
21142122
if ignore_current:
21152123
checks = pr.get_checkrun_conclusions()
21162124
_, failing, _ = categorize_checks(

.github/workflows/apple-perf.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ jobs:
188188
backends/apple/coreml/scripts/install_requirements.sh
189189
fi
190190
191+
if [[ ${{ matrix.config }} == *"mps"* ]]; then
192+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
193+
backends/apple/mps/install_requirements.sh
194+
fi
195+
191196
# Install requirements for export_llama
192197
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash examples/models/llama/install_requirements.sh
193198
@@ -374,6 +379,10 @@ jobs:
374379
# Install CoreML Backend Requirements
375380
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
376381
backends/apple/coreml/scripts/install_requirements.sh
382+
383+
# Install MPS Backend Requirements
384+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
385+
backends/apple/mps/install_requirements.sh
377386
echo "::endgroup::"
378387
379388
echo "::group::Build ExecuTorch iOS frameworks"

.github/workflows/apple.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ jobs:
154154
"backend_xnnpack"
155155
"kernels_custom"
156156
"kernels_optimized"
157+
"kernels_portable"
157158
"kernels_quantized"
158159
"threadpool"
159160
)
@@ -168,6 +169,10 @@ jobs:
168169
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
169170
backends/apple/coreml/scripts/install_requirements.sh
170171
172+
# Install MPS Backend Requirements
173+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
174+
backends/apple/mps/install_requirements.sh
175+
171176
# Build iOS Frameworks
172177
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output scripts/build_apple_frameworks.sh
173178
@@ -302,6 +307,10 @@ jobs:
302307
# Install CoreML Backend Requirements
303308
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
304309
backends/apple/coreml/scripts/install_requirements.sh
310+
311+
# Install MPS Backend Requirements
312+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
313+
backends/apple/mps/install_requirements.sh
305314
echo "::endgroup::"
306315
307316
echo "::group::Build ExecuTorch iOS frameworks"

.github/workflows/check-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
PR_NUM: ${{ github.event.number || github.event.inputs.pr_number }}
5252
run: |
5353
set -ex
54-
python3 .github/scripts/check_labels.py "${PR_NUM}"
54+
python3 .github/scripts/check_labels.py --exit-non-zero "${PR_NUM}"

.github/workflows/trunk.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ jobs:
305305
# Install requirements
306306
${CONDA_RUN} sh install_requirements.sh
307307
${CONDA_RUN} sh backends/apple/coreml/scripts/install_requirements.sh
308-
${CONDA_RUN} python install_executorch.py
308+
${CONDA_RUN} python install_executorch.py --pybind coreml
309309
${CONDA_RUN} sh examples/models/llama/install_requirements.sh
310310
311311
# Test ANE llama
@@ -414,7 +414,11 @@ jobs:
414414
# Setup executorch
415415
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool cmake
416416
417-
if [[ "${MODE}" == "coreml" ]]; then
417+
if [[ "${MODE}" == "mps" ]]; then
418+
# Install mps delegate
419+
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/mps/install_requirements.sh
420+
echo "Finishing installing mps."
421+
elif [[ "${MODE}" == "coreml" ]]; then
418422
# Install coreml delegate
419423
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/coreml/scripts/install_requirements.sh
420424
echo "Finishing installing coreml."
@@ -500,6 +504,8 @@ jobs:
500504
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool "${BUILD_TOOL}"
501505
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/coreml/scripts/install_requirements.sh
502506
echo "Finishing installing coreml."
507+
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/mps/install_requirements.sh
508+
echo "Finishing installing mps."
503509
504510
# Build and test coreml model
505511
MODELS=(mv3 ic4 resnet50 edsr mobilebert w2l)

0 commit comments

Comments
 (0)