Halide 22.1.0
A minor release of Halide 22. It adds FreeBSD as a target OS, fixes undefined behavior and memory-safety bugs, and makes the build easier to package for distributions (see #4660).
New features
- FreeBSD target OS (#9642).
Target::FreeBSD(freebsdin target strings, e.g.x86-64-freebsd) uses the FreeBSD LLVM triple and the POSIX runtime. It is detected as the host OS when Halide is built on FreeBSD and is exposed in the Python bindings and inadd_halide_library. x86, ARM/AArch64 and RISC-V are supported. Native builds were tested on FreeBSD 15.1 amd64; AArch64 is untested.FreeBSDis appended toTarget::OS, so existing enum values are unchanged.
Bug fixes
Python
Buffer.copy_fromrejects mismatched buffers (#9635).hl.Bufferandhlr.Buffernow raiseValueErrorwhen the source has a different element size or number of dimensions. Before, release builds (including the wheels) read past the end of the source.- Dimension indices are bounds-checked (#9645).
crop,slice,embed,translate,transpose,dimand their non-mutating variants onhl.Bufferandhlr.Buffernow raiseIndexErrorfor an out-of-range dimension, andValueErrorfor vector arguments with too many entries (or, fortranspose(order), the wrong number). Before, release builds read or wrote past the buffer's shape array.
Compiler and autoschedulers
- Fixed two left shifts of negative values (undefined behavior before C++20) in
ConstantIntervaland the simplifier (#9640). - Anderson2021: fixed an out-of-bounds read in
Strides::dumpand a latent null dereference inunrolled_loops(#9640). - Anderson2021: worked around a clang 22 ThinLTO miscompile (IPSCCP) that made the Anderson2021 generators segfault in LTO builds (#9640).
Build and packaging
These changes let distribution packages drop their local patches (#9641):
- LLD is only required for the in-process WebAssembly JIT. It is now requested only when
Halide_WASM_BACKENDis set. Builds withHalide_WASM_BACKEND=OFFno longer need LLD and may link LLVM statically. - Shared-only FlatBuffers installs (such as Arch's) are supported, and the installed CMake package now finds them for consumers.
- Installed static libraries are built without LTO.
Halide_GenGenandHalide_PyStubsno longer pick up distro-fltoflags, which left compiler-specific bitcode in the shipped archives. - The empty Sphinx-only
doc/subdirectories are no longer installed. test_export_single_symbolno longer depends on$SHELL, which is unset in containers.- The Homebrew build instructions now say
Halide_LLVM_ROOTinstead ofHalide_ROOT.
Compatibility
There are no API or ABI changes. LLVM 21, 22 and 23 are supported, as in 22.0.0. Python code that relied on out-of-bounds Buffer arguments now gets an exception.
Thanks to @soma0212 for the Python Buffer fixes.
Full changelog: v22.0.0.post3...v22.1.0
🤖 Generated with Claude Code