Skip to content

Commit

Permalink
try building halide 16
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Moreau committed Nov 6, 2023
1 parent 48f541c commit 6fcc60a
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/halide-prebuilt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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'
Expand All @@ -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') {
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions patches/halide-16-add-clang-no-unknown-warning-option.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 44bdc4bfa85a83c5bee9bc497f7cb5b88dcc6ff2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= <[email protected]>
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(
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-undefined-func-template>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unused-member-function>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unused-template>
+ $<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unknown-warning-option>

# This warning was removed in Clang 13
$<$<AND:$<CXX_COMPILER_ID:Clang,AppleClang>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,13.0>>:-Wno-return-std-move-in-c++11>
--
2.25.1

51 changes: 51 additions & 0 deletions patches/halide-16-add-halide-host-tools-dir-cmake-option.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 58ad85758391a8058d6fdfebfefc0abae5539630 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= <[email protected]>
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 $<$<CXX_COMPILER_ID:MSVC>:/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 $<$<CXX_COMPILER_ID:MSVC>:/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 $<$<CXX_COMPILER_ID:MSVC>:/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 $<$<CXX_COMPILER_ID:MSVC>:/wd4996>)
+
+ add_executable(binary2cpp binary2cpp.cpp)
+ target_compile_options(binary2cpp PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/wd4996>)
+
+ add_executable(regexp_replace regexp_replace.cpp)
+ target_compile_options(regexp_replace PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/wd4996>)
+endif()

##
# Interface target for enabling PNG/JPEG support in Halide
--
2.25.1

27 changes: 27 additions & 0 deletions patches/halide-16-disable-autoschedulers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 644b27083565e1f6f2b010dc3cdc21259ade9880 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= <[email protected]>
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

34 changes: 34 additions & 0 deletions patches/halide-16-disable-imported-clang-llvm-executables.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From dfcb3a317b420e1e5b4f98506f0e9d12a4adb406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= <[email protected]>
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

0 comments on commit 6fcc60a

Please sign in to comment.