From 6fcc60acabd4a790c82cce221fdad1a08ee65478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 6 Nov 2023 16:36:28 -0500 Subject: [PATCH] try building halide 16 --- .github/workflows/halide-prebuilt.yml | 25 +++++---- ...-add-clang-no-unknown-warning-option.patch | 24 +++++++++ ...d-halide-host-tools-dir-cmake-option.patch | 51 +++++++++++++++++++ .../halide-16-disable-autoschedulers.patch | 27 ++++++++++ ...able-imported-clang-llvm-executables.patch | 34 +++++++++++++ 5 files changed, 151 insertions(+), 10 deletions(-) create mode 100644 patches/halide-16-add-clang-no-unknown-warning-option.patch create mode 100644 patches/halide-16-add-halide-host-tools-dir-cmake-option.patch create mode 100644 patches/halide-16-disable-autoschedulers.patch create mode 100644 patches/halide-16-disable-imported-clang-llvm-executables.patch diff --git a/.github/workflows/halide-prebuilt.yml b/.github/workflows/halide-prebuilt.yml index 645eb74..e253543 100644 --- a/.github/workflows/halide-prebuilt.yml +++ b/.github/workflows/halide-prebuilt.yml @@ -15,7 +15,7 @@ jobs: matrix: arch: [ x86_64, aarch64 ] os: [ windows, macos, ubuntu-20.04, ubuntu-22.04 ] - version: [ 14.0.0 ] + version: [ 16.0.0 ] include: - os: windows @@ -68,7 +68,7 @@ jobs: run: | $LlvmPlatform='${{matrix.os}}' $LlvmArch='x86_64' - $LlvmVersion='14.0.6' + $LlvmVersion = if ('${{matrix.version}}' -eq "14.0.0") { "14.0.6" } else { "16.0.6" } $LlvmName="clang+llvm-${LlvmVersion}-${LlvmArch}-${LlvmPlatform}" $RunId = '${{ github.event.inputs.run_id }}' if ($RunId -eq 'latest') { @@ -97,9 +97,7 @@ jobs: echo "LLVM_DIR=$LLVM_DIR" >> $Env:GITHUB_ENV echo "CLANG_DIR=$CLANG_DIR" >> $Env:GITHUB_ENV - if (-Not $IsWindows) { - echo "PATH=$LLVM_BIN_PATH$([IO.Path]::PathSeparator)$Env:PATH" >> $Env:GITHUB_ENV - } + echo "PATH=$LLVM_BIN_PATH$([IO.Path]::PathSeparator)$Env:PATH" >> $Env:GITHUB_ENV - name: Install target clang+llvm if: matrix.arch == 'aarch64' @@ -109,7 +107,7 @@ jobs: run: | $LlvmPlatform='${{matrix.os}}' $LlvmArch='${{matrix.arch}}' - $LlvmVersion='14.0.6' + $LlvmVersion = if ('${{matrix.version}}' -eq "14.0.0") { "14.0.6" } else { "16.0.6" } $LlvmName="clang+llvm-${LlvmVersion}-${LlvmArch}-${LlvmPlatform}" $RunId = '${{ github.event.inputs.run_id }}' if ($RunId -eq 'latest') { @@ -152,10 +150,17 @@ jobs: - name: Patch Halide shell: pwsh run: | - git -C halide apply ../llvm-prebuilt/patches/halide-14-add-halide-host-tools-dir-cmake-option.patch - git -C halide apply ../llvm-prebuilt/patches/halide-14-disable-autoschedulers.patch - git -C halide apply ../llvm-prebuilt/patches/halide-14-disable-imported-clang-llvm-executables.patch - git -C halide apply ../llvm-prebuilt/patches/halide-14-add-clang-no-unknown-warning-option.patch + if ('${{matrix.version}}' -eq '14.0.0') { + git -C halide apply ../llvm-prebuilt/patches/halide-14-add-halide-host-tools-dir-cmake-option.patch + git -C halide apply ../llvm-prebuilt/patches/halide-14-disable-autoschedulers.patch + git -C halide apply ../llvm-prebuilt/patches/halide-14-disable-imported-clang-llvm-executables.patch + git -C halide apply ../llvm-prebuilt/patches/halide-14-add-clang-no-unknown-warning-option.patch + } else { + git -C halide apply ../llvm-prebuilt/patches/halide-16-add-halide-host-tools-dir-cmake-option.patch + git -C halide apply ../llvm-prebuilt/patches/halide-16-disable-autoschedulers.patch + git -C halide apply ../llvm-prebuilt/patches/halide-16-disable-imported-clang-llvm-executables.patch + git -C halide apply ../llvm-prebuilt/patches/halide-16-add-clang-no-unknown-warning-option.patch + } - name: Build Halide host tools shell: pwsh diff --git a/patches/halide-16-add-clang-no-unknown-warning-option.patch b/patches/halide-16-add-clang-no-unknown-warning-option.patch new file mode 100644 index 0000000..8f3be85 --- /dev/null +++ b/patches/halide-16-add-clang-no-unknown-warning-option.patch @@ -0,0 +1,24 @@ +From 44bdc4bfa85a83c5bee9bc497f7cb5b88dcc6ff2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= +Date: Mon, 6 Nov 2023 16:29:33 -0500 +Subject: [PATCH] [PATCH] add clang no unknown warning option + +--- + src/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 84f98033a..9db6c08f5 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -521,6 +521,7 @@ target_compile_options( + $<$:-Wno-undefined-func-template> + $<$:-Wno-unused-member-function> + $<$:-Wno-unused-template> ++ $<$:-Wno-unknown-warning-option> + + # This warning was removed in Clang 13 + $<$,$,13.0>>:-Wno-return-std-move-in-c++11> +-- +2.25.1 + diff --git a/patches/halide-16-add-halide-host-tools-dir-cmake-option.patch b/patches/halide-16-add-halide-host-tools-dir-cmake-option.patch new file mode 100644 index 0000000..7c3d604 --- /dev/null +++ b/patches/halide-16-add-halide-host-tools-dir-cmake-option.patch @@ -0,0 +1,51 @@ +From 58ad85758391a8058d6fdfebfefc0abae5539630 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= +Date: Sat, 21 Jan 2023 10:15:38 -0500 +Subject: [PATCH] add HALIDE_HOST_TOOLS_DIR cmake option + +--- + tools/CMakeLists.txt | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 0d8ff8e8b..23d7b2496 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -2,14 +2,28 @@ + # Build time tools + ## + +-add_executable(build_halide_h build_halide_h.cpp) +-target_compile_options(build_halide_h PRIVATE $<$:/wd4996>) ++if(DEFINED HALIDE_HOST_TOOLS_DIR) ++ add_executable(build_halide_h IMPORTED GLOBAL) ++ set_property(TARGET build_halide_h PROPERTY IMPORTED_LOCATION ++ "${HALIDE_HOST_TOOLS_DIR}/build_halide_h${CMAKE_EXECUTABLE_SUFFIX}") + +-add_executable(binary2cpp binary2cpp.cpp) +-target_compile_options(binary2cpp PRIVATE $<$:/wd4996>) ++ add_executable(binary2cpp IMPORTED GLOBAL) ++ set_property(TARGET binary2cpp PROPERTY IMPORTED_LOCATION ++ "${HALIDE_HOST_TOOLS_DIR}/binary2cpp${CMAKE_EXECUTABLE_SUFFIX}") + +-add_executable(regexp_replace regexp_replace.cpp) +-target_compile_options(regexp_replace PRIVATE $<$:/wd4996>) ++ add_executable(regexp_replace IMPORTED GLOBAL) ++ set_property(TARGET regexp_replace PROPERTY IMPORTED_LOCATION ++ "${HALIDE_HOST_TOOLS_DIR}/regexp_replace${CMAKE_EXECUTABLE_SUFFIX}") ++else() ++ add_executable(build_halide_h build_halide_h.cpp) ++ target_compile_options(build_halide_h PRIVATE $<$:/wd4996>) ++ ++ add_executable(binary2cpp binary2cpp.cpp) ++ target_compile_options(binary2cpp PRIVATE $<$:/wd4996>) ++ ++ add_executable(regexp_replace regexp_replace.cpp) ++ target_compile_options(regexp_replace PRIVATE $<$:/wd4996>) ++endif() + + ## + # Interface target for enabling PNG/JPEG support in Halide +-- +2.25.1 + diff --git a/patches/halide-16-disable-autoschedulers.patch b/patches/halide-16-disable-autoschedulers.patch new file mode 100644 index 0000000..5817edd --- /dev/null +++ b/patches/halide-16-disable-autoschedulers.patch @@ -0,0 +1,27 @@ +From 644b27083565e1f6f2b010dc3cdc21259ade9880 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= +Date: Sun, 22 Jan 2023 08:01:56 -0500 +Subject: [PATCH] disable autoschedulers + +--- + src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 809b3efdd..8202c49d5 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -524,8 +524,8 @@ endif () + ## + + if (BUILD_SHARED_LIBS) +- message(STATUS "Building autoschedulers enabled") +- add_subdirectory(autoschedulers) ++ #message(STATUS "Building autoschedulers enabled") ++ #add_subdirectory(autoschedulers) + else () + message(STATUS "Building autoschedulers disabled (static Halide)") + endif () +-- +2.25.1 + diff --git a/patches/halide-16-disable-imported-clang-llvm-executables.patch b/patches/halide-16-disable-imported-clang-llvm-executables.patch new file mode 100644 index 0000000..1ccaaa5 --- /dev/null +++ b/patches/halide-16-disable-imported-clang-llvm-executables.patch @@ -0,0 +1,34 @@ +From dfcb3a317b420e1e5b4f98506f0e9d12a4adb406 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= +Date: Sun, 22 Jan 2023 14:40:59 -0500 +Subject: [PATCH] disable imported clang+llvm executable promotion + +--- + dependencies/llvm/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dependencies/llvm/CMakeLists.txt b/dependencies/llvm/CMakeLists.txt +index 248aaf9ea..a8e613a37 100644 +--- a/dependencies/llvm/CMakeLists.txt ++++ b/dependencies/llvm/CMakeLists.txt +@@ -42,6 +42,8 @@ cmake_dependent_option(Halide_BUNDLE_LLVM "When built as a static library, inclu + # Promote LLVM/Clang executable targets + ## + ++if(PROMOTE_IMPORTED_CLANG_LLVM) ++ + set_target_properties(llvm-as clang PROPERTIES IMPORTED_GLOBAL TRUE) + + # clang-tools-extra is optional, but provides the clang-format target +@@ -49,6 +51,8 @@ if (TARGET clang-format) + set_target_properties(clang-format PROPERTIES IMPORTED_GLOBAL TRUE) + endif () + ++endif() ++ + ## + # Create options for including or excluding LLVM backends. + ## +-- +2.25.1 +