@@ -302,6 +302,47 @@ test_torchbench_smoketest() {
302
302
fi
303
303
304
304
done
305
+ echo " Pytorch benchmark on mps device completed"
306
+ }
307
+
308
+ test_aoti_torchbench_smoketest () {
309
+ print_cmake_info
310
+
311
+ echo " Launching AOTInductor torchbench setup"
312
+ pip_benchmark_deps
313
+ # shellcheck disable=SC2119,SC2120
314
+ torchbench_setup_macos
315
+
316
+ TEST_REPORTS_DIR=$( pwd) /test/test-reports
317
+ mkdir -p " $TEST_REPORTS_DIR "
318
+
319
+ local device=mps
320
+ local dtypes=(undefined float16 bfloat16 notset)
321
+ local dtype=${dtypes[$1]}
322
+ local models=(hf_T5 llama BERT_pytorch dcgan hf_GPT2 yolov3 resnet152 sam sam_fast pytorch_unet stable_diffusion_text_encoder speech_transformer Super_SloMo doctr_det_predictor doctr_reco_predictor timm_resnet timm_vovnet vgg16)
323
+
324
+ echo " Launching torchbench inference performance run for AOT Inductor and dtype ${dtype} "
325
+ local dtype_arg=" --${dtype} "
326
+ if [ " $dtype " == notset ]; then
327
+ dtype_arg=" --float32"
328
+ fi
329
+ touch " $TEST_REPORTS_DIR /aot_inductor_torchbench_${dtype} _inference_${device} _performance.csv"
330
+ for model in " ${models[@]} " ; do
331
+ PYTHONPATH=" $( pwd) " /torchbench python benchmarks/dynamo/torchbench.py \
332
+ --performance --only " $model " --export-aot-inductor --inference --devices " $device " " $dtype_arg " \
333
+ --output " $TEST_REPORTS_DIR /aot_inductor_torchbench_${dtype} _inference_${device} _performance.csv" || true
334
+ PYTHONPATH=" $( pwd) " /torchbench python benchmarks/dynamo/torchbench.py \
335
+ --accuracy --only " $model " --export-aot-inductor --inference --devices " $device " " $dtype_arg " \
336
+ --output " $TEST_REPORTS_DIR /aot_inductor_torchbench_${dtype} _inference_${device} _accuracy.csv" || true
337
+ done
338
+
339
+ echo " Launching HuggingFace inference performance run for AOT Inductor and dtype ${dtype} "
340
+ PYTHONPATH=" $( pwd) " /torchbench python benchmarks/dynamo/huggingface.py \
341
+ --performance --export-aot-inductor --inference --devices " $device " " $dtype_arg " \
342
+ --output " $TEST_REPORTS_DIR /aot_inductor_huggingface_${dtype} _inference_${device} _performance.csv" || true
343
+ PYTHONPATH=" $( pwd) " /torchbench python benchmarks/dynamo/huggingface.py \
344
+ --accuracy --export-aot-inductor --inference --devices " $device " " $dtype_arg " \
345
+ --output " $TEST_REPORTS_DIR /aot_inductor_huggingface_${dtype} _inference_${device} _accuracy.csv" || true
305
346
306
347
echo " Pytorch benchmark on mps device completed"
307
348
}
@@ -350,6 +391,8 @@ elif [[ $TEST_CONFIG == *"perf_timm"* ]]; then
350
391
test_timm_perf
351
392
elif [[ $TEST_CONFIG == * " perf_smoketest" * ]]; then
352
393
test_torchbench_smoketest " ${SHARD_NUMBER} "
394
+ elif [[ $TEST_CONFIG == * " aot_inductor_perf_smoketest" * ]]; then
395
+ test_aoti_torchbench_smoketest " ${SHARD_NUMBER} "
353
396
elif [[ $TEST_CONFIG == * " mps" * ]]; then
354
397
test_python_mps
355
398
elif [[ $NUM_TEST_SHARDS -gt 1 ]]; then
0 commit comments