halide 19.0.0__cp39-cp39-win_amd64.whl → 21.0.0__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. halide/__init__.py +10 -6
  2. halide/_generator_helpers.py +190 -127
  3. halide/bin/Halide.dll +0 -0
  4. halide/bin/adams2019_retrain_cost_model.exe +0 -0
  5. halide/bin/adams2019_weightsdir_to_weightsfile.exe +0 -0
  6. halide/bin/anderson2021_retrain_cost_model.exe +0 -0
  7. halide/bin/anderson2021_weightsdir_to_weightsfile.exe +0 -0
  8. halide/bin/featurization_to_sample.exe +0 -0
  9. halide/bin/gengen.exe +0 -0
  10. halide/bin/get_host_target.exe +0 -0
  11. halide/halide_.cp39-win_amd64.pyd +0 -0
  12. halide/imageio.py +1 -1
  13. halide/include/Halide.h +1775 -1477
  14. halide/include/HalideBuffer.h +13 -13
  15. halide/include/HalidePyTorchCudaHelpers.h +1 -1
  16. halide/include/HalideRuntime.h +35 -16
  17. halide/lib/Halide.lib +0 -0
  18. halide/lib/HalidePyStubs.lib +0 -0
  19. halide/lib/Halide_GenGen.lib +0 -0
  20. halide/lib/autoschedule_adams2019.dll +0 -0
  21. halide/lib/autoschedule_anderson2021.dll +0 -0
  22. halide/lib/autoschedule_li2018.dll +0 -0
  23. halide/lib/autoschedule_mullapudi2016.dll +0 -0
  24. halide/lib/cmake/Halide/FindHalide_LLVM.cmake +44 -15
  25. halide/lib/cmake/Halide/FindV8.cmake +0 -12
  26. halide/lib/cmake/Halide/Halide-shared-targets.cmake +1 -1
  27. halide/lib/cmake/Halide/HalideConfig.cmake +1 -1
  28. halide/lib/cmake/Halide/HalideConfigVersion.cmake +3 -3
  29. halide/lib/cmake/HalideHelpers/Halide-Interfaces.cmake +1 -0
  30. halide/lib/cmake/HalideHelpers/HalideGeneratorHelpers.cmake +31 -9
  31. halide/lib/cmake/HalideHelpers/HalideHelpersConfigVersion.cmake +3 -3
  32. halide/lib/cmake/Halide_Python/Halide_PythonConfigVersion.cmake +3 -3
  33. halide/share/doc/Halide/README.md +7 -6
  34. halide/share/doc/Halide/doc/BuildingHalideWithCMake.md +78 -6
  35. halide/share/doc/Halide/doc/HalideCMakePackage.md +9 -2
  36. halide/share/doc/Halide/doc/Python.md +19 -4
  37. halide/share/doc/Halide/doc/RunGen.md +1 -1
  38. {halide-19.0.0.data → halide-21.0.0.data}/data/share/cmake/Halide/HalideConfig.cmake +4 -1
  39. {halide-19.0.0.data → halide-21.0.0.data}/data/share/cmake/Halide/HalideConfigVersion.cmake +3 -3
  40. {halide-19.0.0.data → halide-21.0.0.data}/data/share/cmake/HalideHelpers/HalideHelpersConfig.cmake +4 -1
  41. {halide-19.0.0.data → halide-21.0.0.data}/data/share/cmake/HalideHelpers/HalideHelpersConfigVersion.cmake +3 -3
  42. halide-21.0.0.dist-info/METADATA +302 -0
  43. {halide-19.0.0.dist-info → halide-21.0.0.dist-info}/RECORD +45 -45
  44. {halide-19.0.0.dist-info → halide-21.0.0.dist-info}/WHEEL +1 -1
  45. halide-19.0.0.dist-info/METADATA +0 -301
  46. {halide-19.0.0.dist-info → halide-21.0.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -65,10 +65,12 @@ static_assert(((HALIDE_RUNTIME_BUFFER_ALLOCATION_ALIGNMENT & (HALIDE_RUNTIME_BUF
65
65
  #ifndef HALIDE_RUNTIME_BUFFER_USE_ALIGNED_ALLOC
66
66
 
67
67
  // clang-format off
68
- #ifdef _MSC_VER
68
+ #ifdef _WIN32
69
69
 
70
- // MSVC doesn't implement aligned_alloc(), even in C++17 mode, and
71
- // has stated they probably never will, so, always default it off here.
70
+ // Windows (regardless of which compiler) doesn't implement aligned_alloc(),
71
+ // even in C++17 mode, and has stated they probably never will, as the issue
72
+ // is in the incompatibility that free() needs to be able to free both pointers
73
+ // returned by malloc() and aligned_alloc(). So, always default it off here.
72
74
  #define HALIDE_RUNTIME_BUFFER_USE_ALIGNED_ALLOC 0
73
75
 
74
76
  #elif defined(__ANDROID_API__) && __ANDROID_API__ < 28
@@ -969,7 +971,7 @@ public:
969
971
 
970
972
  /** Allocate a new image of the given size with a runtime
971
973
  * type. Only used when you do know what size you want but you
972
- * don't know statically what type the elements are. Pass zeroes
974
+ * don't know statically what type the elements are. Pass zeros
973
975
  * to make a buffer suitable for bounds query calls. */
974
976
  template<typename... Args,
975
977
  typename = typename std::enable_if<AllInts<Args...>::value>::type>
@@ -988,7 +990,7 @@ public:
988
990
  }
989
991
  }
990
992
 
991
- /** Allocate a new image of the given size. Pass zeroes to make a
993
+ /** Allocate a new image of the given size. Pass zeros to make a
992
994
  * buffer suitable for bounds query calls. */
993
995
  // @{
994
996
 
@@ -1991,9 +1993,12 @@ public:
1991
1993
  /** Make a buffer with the same shape and memory nesting order as
1992
1994
  * another buffer. It may have a different type. */
1993
1995
  template<typename T2, int D2, int S2>
1996
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
1994
1997
  static Buffer<T, Dims, InClassDimStorage> make_with_shape_of(Buffer<T2, D2, S2> src,
1995
1998
  void *(*allocate_fn)(size_t) = nullptr,
1996
1999
  void (*deallocate_fn)(void *) = nullptr) {
2000
+ // Note that src is taken by value because its dims are mutated
2001
+ // in-place by the helper. Do not change to taking it by reference.
1997
2002
  static_assert(Dims == D2 || Dims == AnyDims);
1998
2003
  const halide_type_t dst_type = T_is_void ? src.type() : halide_type_of<typename std::remove_cv<not_void_T>::type>();
1999
2004
  return Buffer<>::make_with_shape_of_helper(dst_type, src.dimensions(), src.buf.dim,
@@ -2059,9 +2064,7 @@ private:
2059
2064
  }
2060
2065
 
2061
2066
  template<typename... Args>
2062
- HALIDE_ALWAYS_INLINE
2063
- storage_T *
2064
- address_of(Args... args) const {
2067
+ HALIDE_ALWAYS_INLINE storage_T *address_of(Args... args) const {
2065
2068
  if (T_is_void) {
2066
2069
  return (storage_T *)(this->buf.host) + offset_of(0, args...) * type().bytes();
2067
2070
  } else {
@@ -2116,8 +2119,7 @@ public:
2116
2119
  }
2117
2120
 
2118
2121
  HALIDE_ALWAYS_INLINE
2119
- const not_void_T &
2120
- operator()() const {
2122
+ const not_void_T &operator()() const {
2121
2123
  static_assert(!T_is_void,
2122
2124
  "Cannot use operator() on Buffer<void> types");
2123
2125
  constexpr int expected_dims = 0;
@@ -2137,9 +2139,7 @@ public:
2137
2139
 
2138
2140
  template<typename... Args,
2139
2141
  typename = typename std::enable_if<AllInts<Args...>::value>::type>
2140
- HALIDE_ALWAYS_INLINE
2141
- not_void_T &
2142
- operator()(int first, Args... rest) {
2142
+ HALIDE_ALWAYS_INLINE not_void_T &operator()(int first, Args... rest) {
2143
2143
  static_assert(!T_is_void,
2144
2144
  "Cannot use operator() on Buffer<void> types");
2145
2145
  constexpr int expected_dims = 1 + (int)(sizeof...(rest));
@@ -17,7 +17,7 @@ namespace PyTorch {
17
17
 
18
18
  typedef struct UserContext {
19
19
  UserContext(int id, CUcontext *ctx, cudaStream_t *stream)
20
- : device_id(id), cuda_context(ctx), stream(stream){};
20
+ : device_id(id), cuda_context(ctx), stream(stream) {};
21
21
 
22
22
  int device_id;
23
23
  CUcontext *cuda_context;
@@ -23,7 +23,7 @@
23
23
  // our CMake build, so that we ensure that the in-build metadata (eg soversion)
24
24
  // matches, but keeping the canonical version here makes it easier to keep
25
25
  // downstream build systems (eg Blaze/Bazel) properly in sync with the source.
26
- #define HALIDE_VERSION_MAJOR 19
26
+ #define HALIDE_VERSION_MAJOR 21
27
27
  #define HALIDE_VERSION_MINOR 0
28
28
  #define HALIDE_VERSION_PATCH 0
29
29
 
@@ -1351,21 +1351,27 @@ extern int halide_error_vscale_invalid(void *user_context, const char *func_name
1351
1351
  // @}
1352
1352
 
1353
1353
  /** Optional features a compilation Target can have.
1354
- * Be sure to keep this in sync with the Feature enum in Target.h and the implementation of
1355
- * get_runtime_compatible_target in Target.cpp if you add a new feature.
1354
+ *
1355
+ * Be sure to keep this in sync with:
1356
+ * 1. the Feature enum in Target.h,
1357
+ * 2. the implementation of get_runtime_compatible_target in Target.cpp,
1358
+ * 3. PyEnums.cpp,
1359
+ * if you add a new feature.
1356
1360
  */
1357
1361
  typedef enum halide_target_feature_t {
1358
- halide_target_feature_jit = 0, ///< Generate code that will run immediately inside the calling process.
1359
- halide_target_feature_debug, ///< Turn on debug info and output for runtime code.
1360
- halide_target_feature_no_asserts, ///< Disable all runtime checks, for slightly tighter code.
1361
- halide_target_feature_no_bounds_query, ///< Disable the bounds querying functionality.
1362
-
1363
- halide_target_feature_sse41, ///< Use SSE 4.1 and earlier instructions. Only relevant on x86.
1364
- halide_target_feature_avx, ///< Use AVX 1 instructions. Only relevant on x86.
1365
- halide_target_feature_avx2, ///< Use AVX 2 instructions. Only relevant on x86.
1366
- halide_target_feature_fma, ///< Enable x86 FMA instruction
1367
- halide_target_feature_fma4, ///< Enable x86 (AMD) FMA4 instruction set
1368
- halide_target_feature_f16c, ///< Enable x86 16-bit float support
1362
+ halide_target_feature_jit = 0, ///< Generate code that will run immediately inside the calling process.
1363
+ halide_target_feature_debug, ///< Turn on debug info and output for runtime code.
1364
+ halide_target_feature_enable_backtraces, ///< Preserve frame pointers and include unwind tables to support accurate backtraces for debugging and profiling.
1365
+ halide_target_feature_no_asserts, ///< Disable all runtime checks, for slightly tighter code.
1366
+ halide_target_feature_no_bounds_query, ///< Disable the bounds querying functionality.
1367
+
1368
+ halide_target_feature_sse41, ///< Use SSE 4.1 and earlier instructions. Only relevant on x86.
1369
+ halide_target_feature_avx, ///< Use AVX 1 instructions. Only relevant on x86.
1370
+ halide_target_feature_avx2, ///< Use AVX 2 instructions. Only relevant on x86.
1371
+ halide_target_feature_avxvnni, ///< Enable the AVX-VNNI features supported by AVX2 instructions. Supports 256-bit VNNI instructions without EVEX encoding.
1372
+ halide_target_feature_fma, ///< Enable x86 FMA instruction
1373
+ halide_target_feature_fma4, ///< Enable x86 (AMD) FMA4 instruction set
1374
+ halide_target_feature_f16c, ///< Enable x86 16-bit float support
1369
1375
 
1370
1376
  halide_target_feature_armv7s, ///< Generate code for ARMv7s. Only relevant for 32-bit ARM.
1371
1377
  halide_target_feature_no_neon, ///< Avoid using NEON instructions. Only relevant for 32-bit ARM.
@@ -1409,6 +1415,7 @@ typedef enum halide_target_feature_t {
1409
1415
  halide_target_feature_avx512_skylake, ///< Enable the AVX512 features supported by Skylake Xeon server processors. This adds AVX512-VL, AVX512-BW, and AVX512-DQ to the base set. The main difference from the base AVX512 set is better support for small integer ops. Note that this does not include the Knight's Landing features. Note also that these features are not available on Skylake desktop and mobile processors.
1410
1416
  halide_target_feature_avx512_cannonlake, ///< Enable the AVX512 features expected to be supported by future Cannonlake processors. This includes all of the Skylake features, plus AVX512-IFMA and AVX512-VBMI.
1411
1417
  halide_target_feature_avx512_zen4, ///< Enable the AVX512 features supported by Zen4 processors. This include all of the Cannonlake features, plus AVX512-VNNI, AVX512-BF16, and more.
1418
+ halide_target_feature_avx512_zen5, ///< Enable the AVX512 features supported by Zen5 processors. This include all of the Cannonlake features, plus AVX512-VNNI, AVX512-BF16, AVX-VNNI and more.
1412
1419
  halide_target_feature_avx512_sapphirerapids, ///< Enable the AVX512 features supported by Sapphire Rapids processors. This include all of the Zen4 features, plus AVX-VNNI and AMX instructions.
1413
1420
  halide_target_feature_trace_loads, ///< Trace all loads done by the pipeline. Equivalent to calling Func::trace_loads on every non-inlined Func.
1414
1421
  halide_target_feature_trace_stores, ///< Trace all stores done by the pipeline. Equivalent to calling Func::trace_stores on every non-inlined Func.
@@ -1463,6 +1470,7 @@ typedef enum halide_target_feature_t {
1463
1470
  halide_target_feature_semihosting, ///< Used together with Target::NoOS for the baremetal target built with semihosting library and run with semihosting mode where minimum I/O communication with a host PC is available.
1464
1471
  halide_target_feature_avx10_1, ///< Intel AVX10 version 1 support. vector_bits is used to indicate width.
1465
1472
  halide_target_feature_x86_apx, ///< Intel x86 APX support. Covers initial set of features released as APX: egpr,push2pop2,ppx,ndd .
1473
+ halide_target_feature_simulator, ///< Target is for a simulator environment. Currently only applies to iOS.
1466
1474
  halide_target_feature_end ///< A sentinel. Every target is considered to have this feature, and setting this feature does nothing.
1467
1475
  } halide_target_feature_t;
1468
1476
 
@@ -1539,8 +1547,19 @@ typedef struct halide_dimension_t {
1539
1547
  } // extern "C"
1540
1548
  #endif
1541
1549
 
1542
- typedef enum { halide_buffer_flag_host_dirty = 1,
1543
- halide_buffer_flag_device_dirty = 2 } halide_buffer_flags;
1550
+ #if __cplusplus > 201100L || _MSVC_LANG > 201100L || __STDC_VERSION__ > 202300L
1551
+ // In C++, an underlying type is required to let the user define their own flag
1552
+ // values, without those values being undefined behavior when passed around as
1553
+ // this enum typedef.
1554
+ #define BUFFER_FLAGS_UNDERLYING_TYPE : uint64_t
1555
+ #else
1556
+ #define BUFFER_FLAGS_UNDERLYING_TYPE
1557
+ #endif
1558
+ typedef enum BUFFER_FLAGS_UNDERLYING_TYPE {
1559
+ halide_buffer_flag_host_dirty = 1,
1560
+ halide_buffer_flag_device_dirty = 2
1561
+ } halide_buffer_flags;
1562
+ #undef BUFFER_FLAGS_UNDERLYING_TYPE
1544
1563
 
1545
1564
  /**
1546
1565
  * The raw representation of an image passed around by generated
halide/lib/Halide.lib CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -9,15 +9,28 @@ set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL MinSizeRel Release RelWithDebInfo "")
9
9
  set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release MinSizeRel "")
10
10
  set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release MinSizeRel RelWithDebInfo "")
11
11
 
12
- find_package(LLVM ${PACKAGE_FIND_VERSION} CONFIG)
12
+ set(llvm_paths "")
13
+ foreach (
14
+ template IN ITEMS
15
+ "/opt/homebrew/opt/llvm@@VERSION@" # Homebrew on macOS
16
+ "/usr/lib/llvm-@VERSION@" # Debian/Ubuntu packages
17
+ "/usr/local/lib/llvm-@VERSION@" # Third-party packages
18
+ "/opt/llvm-@VERSION@" # Third-party packages
19
+ )
20
+ foreach (VERSION RANGE 18 21) # inclusive!
21
+ string(CONFIGURE "${template}" path @ONLY)
22
+ list(APPEND llvm_paths "${path}")
23
+ endforeach ()
24
+ endforeach ()
25
+ list(REVERSE llvm_paths) # search more recent versions first
13
26
 
14
- set(Halide_LLVM_VERSION "${LLVM_PACKAGE_VERSION}")
27
+ find_package(LLVM PATHS ${llvm_paths})
15
28
 
16
- # TODO: deprecated in Halide 19.0.0, remove in Halide 20.0.0
17
- if (NOT DEFINED Halide_LLVM_SHARED_LIBS AND DEFINED Halide_SHARED_LLVM)
18
- set(Halide_LLVM_SHARED_LIBS "${Halide_SHARED_LLVM}")
19
- message(DEPRECATION
20
- "Halide_SHARED_LLVM has been renamed to Halide_LLVM_SHARED_LIBS.")
29
+ # Neither LLVM_VERSION nor LLVM_PACKAGE_VERSION work as find_package arguments
30
+ # in git/development builds as they include a "git" suffix. This applies at
31
+ # time of writing to versions 18-21, inclusive.
32
+ if (LLVM_FOUND)
33
+ set(Halide_LLVM_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
21
34
  endif ()
22
35
 
23
36
  if (NOT DEFINED Halide_LLVM_SHARED_LIBS)
@@ -35,13 +48,35 @@ endif ()
35
48
  option(Halide_LLVM_SHARED_LIBS "Enable to link to shared libLLVM" "${Halide_LLVM_SHARED_LIBS}")
36
49
 
37
50
  if (LLVM_FOUND)
38
- find_package(Clang HINTS "${LLVM_INSTALL_PREFIX}" "${LLVM_DIR}/../clang" "${LLVM_DIR}/../lib/cmake/clang")
51
+ # Package maintainers have some "interesting" ideas as to how they should
52
+ # lay out the -dev packages, especially when they want to support multiple
53
+ # parallel versions. These hints take effect at a lower precedence than
54
+ # Halide_LLVM_ROOT or CMAKE_PREFIX_PATH (which are the standard ways of
55
+ # setting up the dependency search), but at a higher precedence than the
56
+ # system-wide fallback locations.
57
+ find_package(
58
+ Clang "${Halide_LLVM_VERSION}" EXACT
59
+ HINTS
60
+ "${LLVM_INSTALL_PREFIX}" # Same root as the LLVM we found
61
+ "${LLVM_DIR}/../clang" # LLVM found in $ROOT/lib/cmake/llvm
62
+ "${LLVM_DIR}/../lib/cmake/clang" # LLVM found in $ROOT/cmake
63
+ )
39
64
 
40
65
  foreach (comp IN LISTS LLVM_TARGETS_TO_BUILD)
41
66
  if (comp STREQUAL "WebAssembly")
42
67
  set(Halide_LLVM_${comp}_FOUND 0)
43
68
 
44
- find_package(LLD HINTS "${LLVM_INSTALL_PREFIX}" "${LLVM_DIR}/../lld" "${LLVM_DIR}/../lib/cmake/lld")
69
+ find_package(
70
+ LLD "${Halide_LLVM_VERSION}" EXACT
71
+ HINTS
72
+ "${LLVM_INSTALL_PREFIX}"
73
+ # Homebrew split the LLVM and LLD packages as of version 19, so
74
+ # having multiple LLVM versions installed leads to the newest
75
+ # LLD being found without this hint.
76
+ "${LLVM_INSTALL_PREFIX}/../lld@${LLVM_VERSION_MAJOR}"
77
+ "${LLVM_DIR}/../lld"
78
+ "${LLVM_DIR}/../lib/cmake/lld"
79
+ )
45
80
  if (NOT LLD_FOUND)
46
81
  string(APPEND REASON_FAILURE_MESSAGE
47
82
  "WebAssembly was not found because liblld is missing. "
@@ -81,7 +116,6 @@ find_package_handle_standard_args(
81
116
  REASON_FAILURE_MESSAGE "${REASON_FAILURE_MESSAGE}"
82
117
  HANDLE_COMPONENTS
83
118
  HANDLE_VERSION_RANGE
84
- NAME_MISMATCHED
85
119
  )
86
120
 
87
121
  function(_Halide_LLVM_link target visibility)
@@ -122,11 +156,6 @@ if (Halide_LLVM_FOUND)
122
156
  set_property(TARGET Halide_LLVM::Core PROPERTY INTERFACE_CXX_RTTI "${LLVM_ENABLE_RTTI}")
123
157
  set_property(TARGET Halide_LLVM::Core APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL CXX_RTTI)
124
158
 
125
- if (LLVM_LIBCXX GREATER -1)
126
- target_compile_options(Halide_LLVM::Core INTERFACE "$<$<LINK_LANGUAGE:CXX>:-stdlib=libc++>")
127
- target_link_options(Halide_LLVM::Core INTERFACE "$<$<LINK_LANGUAGE:CXX>:-stdlib=libc++>")
128
- endif ()
129
-
130
159
  if (Halide_LLVM_SHARED_LIBS)
131
160
  target_link_libraries(Halide_LLVM::Core INTERFACE LLVM ${CMAKE_DL_LIBS})
132
161
  else ()
@@ -1,17 +1,5 @@
1
- if (EXISTS "${V8_INCLUDE_PATH}")
2
- message(DEPRECATION "V8_INCLUDE_PATH has been renamed to V8_INCLUDE_DIR")
3
- set(V8_INCLUDE_DIR "${V8_INCLUDE_PATH}")
4
- set(V8_INCLUDE_DIR "${V8_INCLUDE_PATH}" CACHE PATH "")
5
- endif ()
6
-
7
1
  find_path(V8_INCLUDE_DIR v8.h)
8
2
 
9
- if (EXISTS "${V8_LIB_PATH}")
10
- message(DEPRECATION "V8_LIB_PATH has been renamed to V8_LIBRARY")
11
- set(V8_LIBRARY "${V8_LIB_PATH}")
12
- set(V8_LIBRARY "${V8_LIB_PATH}" CACHE FILEPATH "")
13
- endif ()
14
-
15
3
  find_library(
16
4
  V8_LIBRARY
17
5
  NAMES v8_monolith
@@ -60,7 +60,7 @@ add_library(Halide::Halide SHARED IMPORTED)
60
60
 
61
61
  set_target_properties(Halide::Halide PROPERTIES
62
62
  COMPATIBLE_INTERFACE_BOOL "CXX_RTTI"
63
- INTERFACE_COMPILE_DEFINITIONS "HALIDE_VERSION_MAJOR=19;HALIDE_VERSION_MINOR=0;HALIDE_VERSION_PATCH=0;HALIDE_ENABLE_RTTI;HALIDE_WITH_EXCEPTIONS"
63
+ INTERFACE_COMPILE_DEFINITIONS "HALIDE_VERSION_MAJOR=21;HALIDE_VERSION_MINOR=0;HALIDE_VERSION_PATCH=0;HALIDE_ENABLE_RTTI;HALIDE_WITH_EXCEPTIONS"
64
64
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
65
65
  INTERFACE_LINK_LIBRARIES "Halide::Runtime"
66
66
  )
@@ -66,7 +66,7 @@ set(Halide_ASAN_ENABLED "")
66
66
  include(CMakeFindDependencyMacro)
67
67
 
68
68
  find_dependency(
69
- HalideHelpers "19.0.0" EXACT
69
+ HalideHelpers "21.0.0" EXACT
70
70
  HINTS "${PACKAGE_PREFIX_DIR}/lib/cmake/HalideHelpers"
71
71
  )
72
72
 
@@ -9,19 +9,19 @@
9
9
  # The variable CVF_VERSION must be set before calling configure_file().
10
10
 
11
11
 
12
- set(PACKAGE_VERSION "19.0.0")
12
+ set(PACKAGE_VERSION "21.0.0")
13
13
 
14
14
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
15
15
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
16
16
  else()
17
17
 
18
- if("19.0.0" MATCHES "^([0-9]+)\\.")
18
+ if("21.0.0" MATCHES "^([0-9]+)\\.")
19
19
  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
20
20
  if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
21
21
  string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
22
22
  endif()
23
23
  else()
24
- set(CVF_VERSION_MAJOR "19.0.0")
24
+ set(CVF_VERSION_MAJOR "21.0.0")
25
25
  endif()
26
26
 
27
27
  if(PACKAGE_FIND_VERSION_RANGE)
@@ -130,6 +130,7 @@ endif()
130
130
  add_library(Halide::RunGenMain INTERFACE IMPORTED)
131
131
 
132
132
  set_target_properties(Halide::RunGenMain PROPERTIES
133
+ INTERFACE_COMPILE_FEATURES "cxx_std_17"
133
134
  INTERFACE_LINK_LIBRARIES "Halide::Runtime;Halide::ImageIO;Halide::Tools"
134
135
  INTERFACE_SOURCES "${_IMPORT_PREFIX}/share/tools/RunGenMain.cpp"
135
136
  )
@@ -68,10 +68,6 @@ function(add_halide_generator TARGET)
68
68
  add_custom_target("${ARG_PACKAGE_NAME}")
69
69
  endif ()
70
70
 
71
- if (NOT Halide_FOUND)
72
- find_package(Halide REQUIRED)
73
- endif ()
74
-
75
71
  if (ARG_SOURCES MATCHES ".py$")
76
72
  if (ARG_LINK_LIBRARIES)
77
73
  message(FATAL_ERROR "You cannot specify LINK_LIBRARIES in conjunction with Python source code.")
@@ -94,6 +90,10 @@ function(add_halide_generator TARGET)
94
90
  else ()
95
91
  add_executable(${TARGET} ${ARG_SOURCES})
96
92
  add_executable(${gen} ALIAS ${TARGET})
93
+
94
+ if (NOT TARGET Halide::Generator)
95
+ find_package(Halide REQUIRED)
96
+ endif ()
97
97
  target_link_libraries(${TARGET} PRIVATE Halide::Generator ${ARG_LINK_LIBRARIES})
98
98
 
99
99
  _Halide_place_dll(${TARGET})
@@ -173,18 +173,26 @@ function(_Halide_library_from_generator TARGET)
173
173
  )
174
174
 
175
175
  ## "hash table" of extra outputs to extensions
176
+ # Keep in sync with Module.cpp
176
177
  set(assembly_extension ".s")
177
178
  set(bitcode_extension ".bc")
179
+ # set(c_header_extension ".h") # handled specially
178
180
  set(c_source_extension ".halide_generated.cpp")
179
181
  set(compiler_log_extension ".halide_compiler_log")
182
+ set(conceptual_stmt_extension ".conceptual.stmt")
183
+ set(conceptual_stmt_html_extension ".conceptual.stmt.html")
184
+ # set(cpp_stub_extension ".stub.h") # not implemented
185
+ set(device_code_extension ".device_code")
180
186
  set(featurization_extension ".featurization")
181
187
  set(function_info_header_extension ".function_info.h")
182
188
  set(hlpipe_extension ".hlpipe")
183
189
  set(llvm_assembly_extension ".ll")
190
+ # set(object_extension (is_windows_coff ? ".obj" : ".o")) # handled specially
184
191
  set(python_extension_extension ".py.cpp")
185
192
  set(pytorch_wrapper_extension ".pytorch.h")
186
193
  set(registration_extension ".registration.cpp")
187
194
  set(schedule_extension ".schedule.h")
195
+ # set(static_library_extension (is_windows_coff ? ".lib" : ".a")) # handled specially
188
196
  set(stmt_extension ".stmt")
189
197
  set(stmt_html_extension ".stmt.html")
190
198
 
@@ -288,6 +296,9 @@ function(_Halide_library_from_generator TARGET)
288
296
  add_library("${TARGET}" STATIC ${local_out_${ARG_TYPE}})
289
297
  set_property(TARGET "${TARGET}" PROPERTY POSITION_INDEPENDENT_CODE ON)
290
298
  set_property(TARGET "${TARGET}" PROPERTY LINKER_LANGUAGE CXX)
299
+ if (ARG_TYPE STREQUAL "c_source")
300
+ set_source_files_properties("${local_out_${ARG_TYPE}}" PROPERTIES SKIP_LINTING ON)
301
+ endif ()
291
302
 
292
303
  if (NOT Halide_NO_DEFAULT_FLAGS)
293
304
  # Silence many useless warnings in generated C++ code compilation
@@ -437,15 +448,17 @@ function(add_halide_library TARGET)
437
448
 
438
449
  # See Module.cpp for list of extra outputs. The following outputs intentionally do not appear:
439
450
  # - `c_header` is always generated
440
- # - `c_source` is selected by C_BACKEND
451
+ # - `cpp_stub` is not available
441
452
  # - `object` is selected for CMake-target-compile
442
453
  # - `static_library` is selected for cross-compile
443
- # - `cpp_stub` is not available
444
454
  set(extra_output_names
445
455
  ASSEMBLY
446
456
  BITCODE
447
457
  COMPILER_LOG
458
+ CONCEPTUAL_STMT
459
+ CONCEPTUAL_STMT_HTML
448
460
  C_SOURCE
461
+ DEVICE_CODE
449
462
  FEATURIZATION
450
463
  FUNCTION_INFO_HEADER
451
464
  HLPIPE
@@ -455,7 +468,8 @@ function(add_halide_library TARGET)
455
468
  REGISTRATION
456
469
  SCHEDULE
457
470
  STMT
458
- STMT_HTML)
471
+ STMT_HTML
472
+ )
459
473
 
460
474
  ##
461
475
  # Parse the arguments and set defaults for missing values.
@@ -472,13 +486,21 @@ function(add_halide_library TARGET)
472
486
 
473
487
  set(options C_BACKEND GRADIENT_DESCENT)
474
488
  set(oneValueArgs FROM GENERATOR FUNCTION_NAME NAMESPACE USE_RUNTIME AUTOSCHEDULER HEADER ${extra_output_names} NO_THREADS NO_DL_LIBS)
475
- set(multiValueArgs TARGETS PARAMS PLUGINS ${features_args})
489
+ set(multiValueArgs DEPENDS TARGETS PARAMS PLUGINS ${features_args})
476
490
  cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
477
491
 
478
492
  if (NOT "${ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
479
493
  message(AUTHOR_WARNING "Arguments to add_halide_library were not recognized: ${ARG_UNPARSED_ARGUMENTS}")
480
494
  endif ()
481
495
 
496
+ set(nonEmptyArgs ${oneValueArgs})
497
+ list(REMOVE_ITEM nonEmptyArgs AUTOSCHEDULER FUNCTION_NAME GENERATOR NAMESPACE USE_RUNTIME)
498
+ foreach (name IN LISTS ARG_KEYWORDS_MISSING_VALUES)
499
+ if (name IN_LIST nonEmptyArgs)
500
+ message(AUTHOR_WARNING "The argument ${name} passed to add_halide_library is undefined")
501
+ endif ()
502
+ endforeach ()
503
+
482
504
  if (ARG_C_BACKEND AND ARG_TARGETS)
483
505
  message(AUTHOR_WARNING "The C backend sources will be compiled with the current CMake toolchain.")
484
506
  endif ()
@@ -610,7 +632,7 @@ function(add_halide_library TARGET)
610
632
 
611
633
  set(generator_args
612
634
  COMMAND ${generator_cmd}
613
- DEPENDS ${generator_cmd_deps}
635
+ DEPENDS ${generator_cmd_deps} ${ARG_DEPENDS}
614
636
  EXTRA_OUTPUTS ${extra_outputs}
615
637
  FUNCTION_NAME "${ARG_FUNCTION_NAME}"
616
638
  GENERATOR "${ARG_GENERATOR}"
@@ -9,19 +9,19 @@
9
9
  # The variable CVF_VERSION must be set before calling configure_file().
10
10
 
11
11
 
12
- set(PACKAGE_VERSION "19.0.0")
12
+ set(PACKAGE_VERSION "21.0.0")
13
13
 
14
14
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
15
15
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
16
16
  else()
17
17
 
18
- if("19.0.0" MATCHES "^([0-9]+)\\.")
18
+ if("21.0.0" MATCHES "^([0-9]+)\\.")
19
19
  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
20
20
  if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
21
21
  string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
22
22
  endif()
23
23
  else()
24
- set(CVF_VERSION_MAJOR "19.0.0")
24
+ set(CVF_VERSION_MAJOR "21.0.0")
25
25
  endif()
26
26
 
27
27
  if(PACKAGE_FIND_VERSION_RANGE)
@@ -9,19 +9,19 @@
9
9
  # The variable CVF_VERSION must be set before calling configure_file().
10
10
 
11
11
 
12
- set(PACKAGE_VERSION "19.0.0")
12
+ set(PACKAGE_VERSION "21.0.0")
13
13
 
14
14
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
15
15
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
16
16
  else()
17
17
 
18
- if("19.0.0" MATCHES "^([0-9]+)\\.")
18
+ if("21.0.0" MATCHES "^([0-9]+)\\.")
19
19
  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
20
20
  if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
21
21
  string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
22
22
  endif()
23
23
  else()
24
- set(CVF_VERSION_MAJOR "19.0.0")
24
+ set(CVF_VERSION_MAJOR "21.0.0")
25
25
  endif()
26
26
 
27
27
  if(PACKAGE_FIND_VERSION_RANGE)
@@ -151,7 +151,7 @@ issue.
151
151
 
152
152
  At any point in time, building Halide requires either the latest stable version
153
153
  of LLVM, the previous stable version of LLVM, or trunk. At the time of writing,
154
- this means versions 19, 18, and 17 are supported, but 16 is not.
154
+ this means versions 20, 19, and 18 are supported, but 17 is not.
155
155
 
156
156
  It is simplest to get a binary release of LLVM on macOS by using
157
157
  [Homebrew](https://brew.sh). Just run `brew install llvm`. On Debian flavors of
@@ -165,10 +165,10 @@ If your OS does not have packages for LLVM, or you want more control over the
165
165
  configuration, you can build it yourself. First check it out from GitHub:
166
166
 
167
167
  ```shell
168
- $ git clone --depth 1 --branch llvmorg-18.1.8 https://github.com/llvm/llvm-project.git
168
+ $ git clone --depth 1 --branch llvmorg-19.1.5 https://github.com/llvm/llvm-project.git
169
169
  ```
170
170
 
171
- (LLVM 18.1.8 is the most recent released LLVM at the time of writing. For
171
+ (LLVM 19.1.5 is the most recent released LLVM at the time of writing. For
172
172
  current trunk, use `main` instead)
173
173
 
174
174
  Then build it like so:
@@ -229,7 +229,8 @@ $ cmake --build build
229
229
 
230
230
  Setting `-DHalide_LLVM_ROOT` is not required if you have a suitable system-wide
231
231
  version installed. However, if you have multiple LLVMs installed, it can pick
232
- between them.
232
+ between them. Do not use a relative path for `Halide_LLVM_ROOT`. It can cause
233
+ problems on some systems.
233
234
 
234
235
  ### Windows
235
236
 
@@ -305,10 +306,10 @@ Subsets of the tests can be selected with `-L` and include `correctness`,
305
306
  #### Building LLVM (optional)
306
307
 
307
308
  Follow these steps if you want to build LLVM yourself. First, download LLVM's
308
- sources (these instructions use the 18.1.8 release).
309
+ sources (these instructions use the 19.1.5 release).
309
310
 
310
311
  ```
311
- D:\> git clone --depth 1 --branch llvm-org-18.1.8 https://github.com/llvm/llvm-project.git
312
+ D:\> git clone --depth 1 --branch llvm-org-19.1.5 https://github.com/llvm/llvm-project.git
312
313
  ```
313
314
 
314
315
  As above, run `vcvarsall.bat` to pick between x86 and x64. Then configure LLVM