From 8f3eb7fe3b81a346f2bcd05cf934ed4101680d8b Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Tue, 28 Nov 2023 09:13:23 -0600 Subject: [PATCH 1/3] build ACL fixed format kernels --- aarch64_linux/aarch64_wheel_ci_build.py | 4 ++-- aarch64_linux/build_aarch64_wheel.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aarch64_linux/aarch64_wheel_ci_build.py b/aarch64_linux/aarch64_wheel_ci_build.py index 3fc86053c..a8ab7e78c 100755 --- a/aarch64_linux/aarch64_wheel_ci_build.py +++ b/aarch64_linux/aarch64_wheel_ci_build.py @@ -20,9 +20,9 @@ def build_ArmComputeLibrary(git_clone_flags: str = "") -> None: ''' print('Building Arm Compute Library') os.system("cd / && mkdir /acl") - os.system(f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v23.05.1 {git_clone_flags}") + os.system(f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v23.08 {git_clone_flags}") os.system("cd ComputeLibrary; export acl_install_dir=/acl; " - "scons Werror=1 -j8 debug=0 neon=1 opencl=0 os=linux openmp=1 cppthreads=0 arch=armv8a multi_isa=1 build=native build_dir=$acl_install_dir/build; " + "scons Werror=1 -j8 debug=0 neon=1 opencl=0 os=linux openmp=1 cppthreads=0 arch=armv8a multi_isa=1 fixed_format_kernels=1 build=native build_dir=$acl_install_dir/build; " "cp -r arm_compute $acl_install_dir; " "cp -r include $acl_install_dir; " "cp -r utils $acl_install_dir; " diff --git a/aarch64_linux/build_aarch64_wheel.py b/aarch64_linux/build_aarch64_wheel.py index dd43bf218..140bd3dac 100755 --- a/aarch64_linux/build_aarch64_wheel.py +++ b/aarch64_linux/build_aarch64_wheel.py @@ -226,8 +226,8 @@ def build_OpenBLAS(host: RemoteHost, git_clone_flags: str = "") -> None: def build_ArmComputeLibrary(host: RemoteHost, git_clone_flags: str = "") -> None: print('Building Arm Compute Library') - acl_build_flags="debug=0 neon=1 opencl=0 os=linux openmp=1 cppthreads=0 arch=armv8a multi_isa=1 build=native" - host.run_cmd(f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v23.05.1 {git_clone_flags}") + acl_build_flags="debug=0 neon=1 opencl=0 os=linux openmp=1 cppthreads=0 arch=armv8a multi_isa=1 fixed_format_kernels=1 build=native" + host.run_cmd(f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v23.08 {git_clone_flags}") host.run_cmd(f"cd ComputeLibrary && scons Werror=1 -j8 {acl_build_flags}") From 18725f9092b540faaae3835861edb6626852d2b6 Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Fri, 1 Dec 2023 14:15:48 -0600 Subject: [PATCH 2/3] [aarch64] update openBLAS to 0.3.25 and numpy to 1.26.2 --- aarch64_linux/aarch64_ci_setup.sh | 4 ++-- aarch64_linux/build_aarch64_wheel.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aarch64_linux/aarch64_ci_setup.sh b/aarch64_linux/aarch64_ci_setup.sh index 88029c940..53c8a5320 100755 --- a/aarch64_linux/aarch64_ci_setup.sh +++ b/aarch64_linux/aarch64_ci_setup.sh @@ -28,9 +28,9 @@ conda activate "${CONDA_ENV_NAME}" if [[ "$DESIRED_PYTHON" == "3.8" ]]; then NUMPY_VERSION="1.24.4" else - NUMPY_VERSION="1.26.0" + NUMPY_VERSION="1.26.2" fi -conda install -y -c conda-forge numpy==${NUMPY_VERSION} pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 openblas==0.3.24 ninja==1.11.1 scons==4.5.2 +conda install -y -c conda-forge numpy==${NUMPY_VERSION} pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 openblas==0.3.25 ninja==1.11.1 scons==4.5.2 python --version conda --version diff --git a/aarch64_linux/build_aarch64_wheel.py b/aarch64_linux/build_aarch64_wheel.py index 140bd3dac..4a0f183cc 100755 --- a/aarch64_linux/build_aarch64_wheel.py +++ b/aarch64_linux/build_aarch64_wheel.py @@ -219,7 +219,7 @@ def install_condaforge_python(host: RemoteHost, python_version="3.8") -> None: def build_OpenBLAS(host: RemoteHost, git_clone_flags: str = "") -> None: print('Building OpenBLAS') - host.run_cmd(f"git clone https://github.com/xianyi/OpenBLAS -b v0.3.20 {git_clone_flags}") + host.run_cmd(f"git clone https://github.com/xianyi/OpenBLAS -b v0.3.25 {git_clone_flags}") make_flags = "NUM_THREADS=64 USE_OPENMP=1 NO_SHARED=1 DYNAMIC_ARCH=1 TARGET=ARMV8" host.run_cmd(f"pushd OpenBLAS && make {make_flags} -j8 && sudo make {make_flags} install && popd && rm -rf OpenBLAS") From b9d33ecc8ffab0ede6cac8c753f9f7b24527783a Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Tue, 28 Nov 2023 09:25:16 -0600 Subject: [PATCH 3/3] remove the mkldnn build flag patching the changes are upstreamed, so no need for patching the wheel builder. --- aarch64_linux/aarch64_wheel_ci_build.py | 2 -- aarch64_linux/build_aarch64_wheel.py | 1 - ...4-fix-default-build-flags-to-armv8-a.patch | 29 ------------------- 3 files changed, 32 deletions(-) delete mode 100644 mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch diff --git a/aarch64_linux/aarch64_wheel_ci_build.py b/aarch64_linux/aarch64_wheel_ci_build.py index a8ab7e78c..3b772847c 100755 --- a/aarch64_linux/aarch64_wheel_ci_build.py +++ b/aarch64_linux/aarch64_wheel_ci_build.py @@ -106,8 +106,6 @@ def parse_arguments(): print("build pytorch without mkldnn backend") # work around to fix Raspberry pie crash - print("Applying mkl-dnn patch to fix Raspberry pie crash") - os.system("cd /pytorch/third_party/ideep/mkl-dnn && patch -p1 < /builder/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch") print("Applying mkl-dnn patch to fix readdir crash") os.system("cd /pytorch/third_party/ideep/mkl-dnn && patch -p1 < /builder/mkldnn_fix/aarch64-fix-readdir-crash.patch") os.system(f"cd /pytorch; {build_vars} python3 setup.py bdist_wheel") diff --git a/aarch64_linux/build_aarch64_wheel.py b/aarch64_linux/build_aarch64_wheel.py index 4a0f183cc..9efd2e6ae 100755 --- a/aarch64_linux/build_aarch64_wheel.py +++ b/aarch64_linux/build_aarch64_wheel.py @@ -555,7 +555,6 @@ def start_build(host: RemoteHost, *, print("build pytorch with mkldnn+acl backend") build_vars += " USE_MKLDNN=ON USE_MKLDNN_ACL=ON" host.run_cmd(f"cd $HOME && git clone https://github.com/pytorch/builder.git") - host.run_cmd(f"cd $HOME/pytorch/third_party/ideep/mkl-dnn && patch -p1 < $HOME/builder/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch") host.run_cmd(f"cd $HOME/pytorch && export ACL_ROOT_DIR=$HOME/ComputeLibrary && {build_vars} python3 setup.py bdist_wheel{build_opts}") print('Repair the wheel') pytorch_wheel_name = host.list_dir("pytorch/dist")[0] diff --git a/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch b/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch deleted file mode 100644 index f6e91010a..000000000 --- a/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- - cmake/platform.cmake | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/cmake/platform.cmake b/cmake/platform.cmake -index 8630460ce..602eafe8e 100644 ---- a/cmake/platform.cmake -+++ b/cmake/platform.cmake -@@ -198,7 +198,7 @@ elseif(UNIX OR MINGW) - endif() - # For native compilation tune for the host processor - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) -- append(DEF_ARCH_OPT_FLAGS "-mcpu=native") -+ append(DEF_ARCH_OPT_FLAGS "-march=armv8-a") - endif() - elseif(DNNL_TARGET_ARCH STREQUAL "PPC64") - if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") -@@ -295,7 +295,7 @@ elseif(UNIX OR MINGW) - endif() - # For native compilation tune for the host processor - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) -- append(DEF_ARCH_OPT_FLAGS "-mcpu=native") -+ append(DEF_ARCH_OPT_FLAGS "-march=armv8-a") - endif() - elseif(DNNL_TARGET_ARCH STREQUAL "PPC64") - if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") --- -2.34.1 -