File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 55
55
QE=OFF
56
56
fi
57
57
58
+ if [[ " ${MODE} " =~ .* mps.* ]]; then
59
+ MPS=ON
60
+ else
61
+ MPS=OFF
62
+ fi
63
+
64
+ echo " MPS option ${MPS} "
65
+
58
66
if [[ -z " ${BUCK:- } " ]]; then
59
67
BUCK=buck2
60
68
fi
@@ -77,6 +85,7 @@ cmake_install_executorch_libraries() {
77
85
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
78
86
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
79
87
-DEXECUTORCH_BUILD_XNNPACK=" $XNNPACK " \
88
+ -DEXECUTORCH_BUILD_MPS=" $MPS " \
80
89
-DPYTHON_EXECUTABLE=" $PYTHON_EXECUTABLE " \
81
90
-Bcmake-out .
82
91
cmake --build cmake-out -j9 --target install --config Debug
142
151
if [[ " ${QE} " == " ON" ]]; then
143
152
EXPORT_ARGS=" ${EXPORT_ARGS} --embedding-quantize 8,1024"
144
153
fi
154
+ if [[ " ${MPS} " == " ON" ]]; then
155
+ EXPORT_ARGS=" ${EXPORT_ARGS} -kv -v --mps --disable_dynamic_shape"
156
+ fi
145
157
# Add dynamically linked library location
146
158
$PYTHON_EXECUTABLE -m examples.models.llama2.export_llama ${EXPORT_ARGS}
147
159
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ jobs:
225
225
matrix :
226
226
dtype : [fp32]
227
227
build-tool : [buck2, cmake]
228
- mode : [portable, xnnpack+kv+custom]
228
+ mode : [portable, xnnpack+kv+custom, mps ]
229
229
fail-fast : false
230
230
with :
231
231
runner : macos-m1-stable
@@ -234,15 +234,31 @@ jobs:
234
234
ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
235
235
timeout : 900
236
236
script : |
237
- bash .ci/scripts/setup-conda.sh
238
237
239
238
DTYPE=${{ matrix.dtype }}
240
239
BUILD_TOOL=${{ matrix.build-tool }}
241
240
MODE=${{ matrix.mode }}
242
241
242
+ if [[ "${BUILD_TOOL}" == "buck2" ]]; then
243
+ # TODO: Will add more modes that don't support buck2
244
+ if [[ "${MODE}" == "mps" ]]; then
245
+ echo "mps doesn't support buck2."
246
+ exit 0
247
+ fi
248
+ fi
249
+
250
+ bash .ci/scripts/setup-conda.sh
251
+
243
252
# Setup executorch
244
253
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}"
245
254
255
+ if [[ "${MODE}" == "mps" ]]; then
256
+ PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/mps/install_requirements.sh
257
+ echo "Finishing installing mps."
258
+ else
259
+ echo "Not mps mode, skip installing mps."
260
+ fi
261
+
246
262
# Install requirements for export_llama
247
263
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash examples/models/llama2/install_requirements.sh
248
264
# Test llama2
You can’t perform that action at this time.
0 commit comments