From c5e331c0858e37fedc047707466161dfe0cadff6 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Mon, 23 Oct 2023 20:52:12 -0700 Subject: [PATCH] [aarch64_wheel] Fix readdir crash Probably fixes https://github.com/pytorch/pytorch/issues/111695 --- aarch64_linux/aarch64_wheel_ci_build.py | 2 ++ mkldnn_fix/aarch64-fix-readdir-crash.patch | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 mkldnn_fix/aarch64-fix-readdir-crash.patch diff --git a/aarch64_linux/aarch64_wheel_ci_build.py b/aarch64_linux/aarch64_wheel_ci_build.py index 4a8fcc875..3fc86053c 100755 --- a/aarch64_linux/aarch64_wheel_ci_build.py +++ b/aarch64_linux/aarch64_wheel_ci_build.py @@ -108,6 +108,8 @@ def parse_arguments(): # 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") pytorch_wheel_name = complete_wheel("pytorch") print(f"Build Compelete. Created {pytorch_wheel_name}..") diff --git a/mkldnn_fix/aarch64-fix-readdir-crash.patch b/mkldnn_fix/aarch64-fix-readdir-crash.patch new file mode 100644 index 000000000..81d46d406 --- /dev/null +++ b/mkldnn_fix/aarch64-fix-readdir-crash.patch @@ -0,0 +1,14 @@ +diff --git a/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp b/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp +index cb800b2509..5516373b90 100644 +--- a/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp ++++ b/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp +@@ -170,6 +170,8 @@ int Cpu::getFilePathMaxTailNumPlus1(const char *path) { + fflush(stdout); + + DIR *dir = opendir(dir_path); ++ if (dir == NULL) ++ return 0; + struct dirent *dp; + + dp = readdir(dir); +