From 509c944589524708ae83634c9999117ababa7d0f Mon Sep 17 00:00:00 2001 From: Jonathan Deakin Date: Mon, 21 Oct 2024 11:01:35 +0000 Subject: [PATCH] Enable AArch64 CI scripts to be used for local dev - If conda has already been set up, activate rather than rerunning aarch64_ci_setup.sh - Allow user to specify custom ComputeLibrary directory, which is then built rather than checking out a clean copy - Remove `setup.py clean` in build. The CI environment should be clean already, removing this enables incremental rebuilds - Use all cores for building ComputeLibrary Co-authored-by: David Svantesson-Yeung Co-authored-by: Fadi Arafeh --- aarch64_linux/aarch64_ci_build.sh | 7 +++- aarch64_linux/aarch64_wheel_ci_build.py | 43 +++++++++++++------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/aarch64_linux/aarch64_ci_build.sh b/aarch64_linux/aarch64_ci_build.sh index 7ed45c35c..bc811fe75 100644 --- a/aarch64_linux/aarch64_ci_build.sh +++ b/aarch64_linux/aarch64_ci_build.sh @@ -4,7 +4,12 @@ set -eux -o pipefail GPU_ARCH_VERSION=${GPU_ARCH_VERSION:-} SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -source $SCRIPTPATH/aarch64_ci_setup.sh +if [ -d /opt/conda ]; then + source /opt/conda/etc/profile.d/conda.sh + conda activate aarch64_env +else + source $SCRIPTPATH/aarch64_ci_setup.sh +fi tagged_version() { GIT_DESCRIBE="git --git-dir /pytorch/.git describe --tags --match v[0-9]*.[0-9]*.[0-9]*" diff --git a/aarch64_linux/aarch64_wheel_ci_build.py b/aarch64_linux/aarch64_wheel_ci_build.py index d68837737..bf5e0da95 100755 --- a/aarch64_linux/aarch64_wheel_ci_build.py +++ b/aarch64_linux/aarch64_wheel_ci_build.py @@ -32,32 +32,34 @@ def build_ArmComputeLibrary() -> None: "build=native", ] acl_install_dir = "/acl" - acl_checkout_dir = "ComputeLibrary" - os.makedirs(acl_install_dir) - check_call( - [ - "git", - "clone", - "https://github.com/ARM-software/ComputeLibrary.git", - "-b", - "v24.04", - "--depth", - "1", - "--shallow-submodules", - ] - ) + acl_checkout_dir = "/ComputeLibrary" + if os.path.isdir(acl_install_dir): + shutil.rmtree(acl_install_dir) + if not os.path.isdir(acl_checkout_dir) or not len(os.listdir(acl_checkout_dir)): + check_call( + [ + "git", + "clone", + "https://github.com/ARM-software/ComputeLibrary.git", + "-b", + "v24.08", + "--depth", + "1", + "--shallow-submodules", + ] + ) + # patch Winograd conv initialzation to avoid SIGILL crash on Cortex A72 + print("Applying ACL patch to fix SIGILL crash") + with open(os.path.join(os.path.dirname(__file__), "0001-Delay-Winograd-transform-initialization.patch")) as f: + check_call(["patch", "-p1"], stdin=f, cwd=acl_checkout_dir) - # patch Winograd conv initialzation to avoid SIGILL crash on Cortex A72 - print("Applying ACL patch to fix SIGILL crash") - with open(os.path.join(os.path.dirname(__file__), "0001-Delay-Winograd-transform-initialization.patch")) as f: - check_call(["patch", "-p1"], stdin=f, cwd=acl_checkout_dir) check_call( - ["scons", "Werror=1", "-j8", f"build_dir=/{acl_install_dir}/build"] + ["scons", "Werror=1", f"-j{os.cpu_count()}"] + acl_build_flags, cwd=acl_checkout_dir, ) - for d in ["arm_compute", "include", "utils", "support", "src"]: + for d in ["arm_compute", "include", "utils", "support", "src", "build"]: shutil.copytree(f"{acl_checkout_dir}/{d}", f"{acl_install_dir}/{d}") @@ -181,7 +183,6 @@ def parse_arguments(): print("Building PyTorch wheel") build_vars = "MAX_JOBS=5 CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000 " - os.system("cd /pytorch; python setup.py clean") override_package_version = os.getenv("OVERRIDE_PACKAGE_VERSION") if override_package_version is not None: