Skip to content

Commit 8ac2608

Browse files
perfacebook-github-bot
authored andcommitted
Add support for Arm tests on MacOS (pytorch#5786)
Summary: Check which platform is used for the extension of the quantization lib and select extensions for dynamic libraries accordingly. Change-Id: I7e4afcccf7f7d8de7416a83e9bfe4511a6540912 Pull Request resolved: pytorch#5786 Reviewed By: mergennachin Differential Revision: D63808512 Pulled By: digantdesai fbshipit-source-id: b27f116605b3d1480049d3b47461b96bcab71bab
1 parent 7559ddd commit 8ac2608

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

backends/arm/test/common.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import logging
88
import os
9+
import platform
910
import shutil
1011
import subprocess
1112
import sys
@@ -57,11 +58,17 @@ def pytest_collection_modifyitems(config, items):
5758

5859

5960
def load_libquantized_ops_aot_lib():
61+
so_ext = {
62+
"Darwin": "dylib",
63+
"Linux": "so",
64+
"Windows": "dll",
65+
}.get(platform.system(), None)
66+
6067
find_lib_cmd = [
6168
"find",
6269
"cmake-out-aot-lib",
6370
"-name",
64-
"libquantized_ops_aot_lib.so",
71+
f"libquantized_ops_aot_lib.{so_ext}",
6572
]
6673
res = subprocess.run(find_lib_cmd, capture_output=True)
6774
if res.returncode == 0:

examples/arm/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ function generate_pte_file() {
9292
pte_file=$(realpath ${output_folder}/${model_filename})
9393
rm -f "${pte_file}"
9494

95+
SO_EXT=$(python3 -c 'import platform; print({"Darwin": "dylib", "Linux": "so", "Windows": "dll"}.get(platform.system(), None))')
9596
# We are using the aot_lib from build_quantization_aot_lib below
96-
SO_LIB=$(find cmake-out-aot-lib -name libquantized_ops_aot_lib.so)
97+
SO_LIB=$(find cmake-out-aot-lib -name libquantized_ops_aot_lib.${SO_EXT})
9798

9899
python3 -m examples.arm.aot_arm_compiler --model_name="${model}" --target=${target} ${model_compiler_flags} --output ${output_folder} --so_library="$SO_LIB" 1>&2
99100
[[ -f ${pte_file} ]] || { >&2 echo "Failed to generate a pte file - ${pte_file}"; exit 1; }

examples/arm/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ root_dir=$(realpath ${root_dir})
109109
function setup_fvp() {
110110
if [[ "${OS}" != "Linux" ]]; then
111111
echo "[${FUNCNAME[0]}] Warning: FVP only supported with Linux OS, skipping FVP setup..."
112+
echo "[${FUNCNAME[0]}] Warning: For MacOS, using https://github.com/Arm-Examples/FVPs-on-Mac is recommended."
113+
echo "[${FUNCNAME[0]}] Warning: Follow the instructions and make sure the path is set correctly."
112114
return 1
113115
fi
114116

0 commit comments

Comments
 (0)