Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ in Python without C++.

Halide requires C++17 (or later) to use.

For more detail about what Halide is, see https://halide-lang.org.
For more detail about what Halide is, see <https://halide-lang.org>.

For API documentation see https://halide-lang.org/docs.
For API documentation see <https://halide-lang.org/docs>.

For some example code, read through the tutorials online
at https://halide-lang.org/tutorials. The corresponding code is in the
at <https://halide-lang.org/tutorials>. The corresponding code is in the
`tutorials/` directory. Larger examples are in the `apps/` directory.

If you've acquired a full source distribution and want to build Halide, see the
Expand All @@ -39,14 +39,14 @@ the easiest way to get a binary build of Halide.
Full releases may be installed with `pip` like so:

```shell
$ pip install halide
pip install halide
```

Every commit to `main` is published to Test PyPI as a development version and
these may be installed with a few extra flags:

```shell
$ pip install halide --pre --extra-index-url https://test.pypi.org/simple
pip install halide --pre --extra-index-url https://test.pypi.org/simple
```

Currently, we provide wheels for: Windows x86-64, macOS x86-64, macOS arm64, and
Expand All @@ -59,7 +59,7 @@ installed it in. On Windows, you will need to add the virtual environment root
directory to `CMAKE_PREFIX_PATH`. This can be done by running
`set CMAKE_PREFIX_PATH=%VIRTUAL_ENV%` in `cmd`.

Other build systems can find the Halide root path by running `python -c
Other build systems can find the Halide root path by running `python -c
"import halide; print(halide.install_dir())"`.

## Homebrew
Expand All @@ -68,13 +68,13 @@ Alternatively, if you use macOS, you can install Halide via
[Homebrew](https://brew.sh/) like so:

```
$ brew install halide
brew install halide
```

## Binary tarballs

The latest version of Halide can always be found on GitHub
at https://github.com/halide/Halide/releases
at <https://github.com/halide/Halide/releases>

We provide binary releases for many popular platforms and architectures,
including 32/64-bit x86 Windows, 64-bit x86/ARM macOS, and 32/64-bit x86/ARM
Expand All @@ -86,24 +86,24 @@ need to adjust compiler options accordingly if you're using an older XCode which
does not default to libc++.

We use a recent Ubuntu LTS to build the Linux releases; if your distribution is
too old, it might not have the requisite glibc.
too old, it might not have the requisite glibc.

Nightly builds of Halide and the LLVM versions we use in CI are also available
at https://buildbot.halide-lang.org/
at <https://buildbot.halide-lang.org/>

## Vcpkg

If you use [vcpkg](https://github.com/microsoft/vcpkg) to manage dependencies,
you can install Halide via:

```
$ vcpkg install halide:x64-windows # or x64-linux/x64-osx
vcpkg install halide:x64-windows # or x64-linux/x64-osx
```

One caveat: vcpkg installs only the minimum Halide backends required to compile
code for the active platform. If you want to include all the backends, you
should install `halide[target-all]:x64-windows` instead. Note that since this
will build LLVM, it will take a _lot_ of disk space (up to 100GB).
will build LLVM, it will take a *lot* of disk space (up to 100GB).

## Other package managers

Expand All @@ -118,7 +118,7 @@ you have experience publishing packages we would be happy to work with you!

There are two sets of platform requirements relevant to Halide: those required
to run the compiler library in either JIT or AOT mode, and those required to run
the _binary outputs_ of the AOT compiler.
the *binary outputs* of the AOT compiler.

These are the **tested** host toolchain and platform combinations for building
and running the Halide compiler library.
Expand All @@ -137,7 +137,7 @@ MSVC. We do not actively test these scenarios, however, so your mileage may
vary.

Beyond these, we are willing to support (by accepting PRs for) platform and
toolchain combinations that still receive _active, first-party, public support_
toolchain combinations that still receive *active, first-party, public support*
from their original vendors. For instance, at time of writing, this excludes
Windows 7 and includes Ubuntu 18.04 LTS.

Expand All @@ -158,14 +158,14 @@ It is simplest to get a binary release of LLVM on macOS by using
Linux, the [LLVM APT repo](https://apt.llvm.org) is best; use the provided
installation script. We know of no suitable official binary releases for
Windows, however the ones we use in CI can usually be found at
https://buildbot.halide-lang.org, along with tarballs for our other tested
<https://buildbot.halide-lang.org>, along with tarballs for our other tested
platforms. See [the section on Windows](#windows) below for further advice.

If your OS does not have packages for LLVM, or you want more control over the
configuration, you can build it yourself. First check it out from GitHub:

```shell
$ git clone --depth 1 --branch llvmorg-21.1.1 https://github.com/llvm/llvm-project.git
git clone --depth 1 --branch llvmorg-21.1.1 https://github.com/llvm/llvm-project.git
```

(LLVM 21.1.1 is the most recent released LLVM at the time of writing. For
Expand Down Expand Up @@ -202,8 +202,8 @@ parallelism. If you choose to omit `-G Ninja`, Makefiles will be generated
instead. In this case, enable parallelism with `cmake --build build -j NNN`
where `NNN` is the number of parallel jobs, i.e. the number of CPUs you have.

Note that you _must_ add `clang` and `lld` to `LLVM_ENABLE_PROJECTS` and
`WebAssembly` and `X86` _must_ be included in `LLVM_TARGETS_TO_BUILD`.
Note that you *must* add `clang` and `lld` to `LLVM_ENABLE_PROJECTS` and
`WebAssembly` and `X86` *must* be included in `LLVM_TARGETS_TO_BUILD`.
`LLVM_ENABLE_RUNTIMES=compiler-rt` is only required to build the fuzz tests, and
`clang-tools-extra` is only necessary if you plan to contribute code to Halide
(so that you can run `clang-tidy` on your pull requests). You can disable
Expand All @@ -223,7 +223,7 @@ Follow the above instructions to build LLVM or acquire a suitable binary
release. Then change directory to the Halide repository and run:

```shell
$ cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release -DHalide_LLVM_ROOT=$LLVM_ROOT
$ cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release -DHalide_LLVM_ROOT=$LLVM_ROOT
$ cmake --build build
```

Expand Down Expand Up @@ -274,7 +274,7 @@ to build. You can manually delete the build trees afterward, but vcpkg will not
do this automatically.

See [BuildingHalideWithCMake.md](./doc/BuildingHalideWithCMake.md#vcpkg-presets)
for directions to use Vcpkg for everything _except_ LLVM.
for directions to use Vcpkg for everything *except* LLVM.

#### Building Halide

Expand Down Expand Up @@ -352,9 +352,9 @@ must add two flags to Halide's CMake configure command line. First, disable LLVM
with `-DVCPKG_OVERLAY_PORTS=cmake/vcpkg`. Second, point CMake to our newly built
Halide with `-DHalide_LLVM_ROOT=D:/llvm-install`.

#### If all else fails...
#### If all else fails

Do what the buildbots do: https://buildbot.halide-lang.org/master/#/builders
Do what the buildbots do: <https://buildbot.halide-lang.org/master/#/builders>

If the row that best matches your system is red, then maybe things aren't just
broken for you. If it's green, then you can click through to the latest build
Expand All @@ -377,25 +377,25 @@ want to use a different LLVM, such as a custom-built one following the
instructions above, set the following environment variable:

```shell
$ export LLVM_CONFIG="$LLVM_ROOT/bin/llvm-config"
export LLVM_CONFIG="$LLVM_ROOT/bin/llvm-config"
```

Now you should be able to just run `make` in the root directory of the Halide
source tree. `make run_tests` will run the JIT test suite, and `make test_apps`
will make sure all the apps compile and run (but won't check their output).

When building the tests, you can set the AOT compilation target with the
When building the tests, you can set the AOT compilation target with the
`HL_TARGET` environment variable.

### Building Halide out-of-tree with make

If you wish to build Halide in a separate directory, you can do that like so:

```shell
$ cd ..
$ mkdir halide_build
$ cd halide_build
$ make -f ../Halide/Makefile
cd ..
mkdir halide_build
cd halide_build
make -f ../Halide/Makefile
```

# Some useful environment variables
Expand Down
54 changes: 27 additions & 27 deletions doc/BuildingHalideWithCMake.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ We recommend installing CMake using [pipx] to avoid package conflicts and
redundant installations. After installing pipx, run:

```shell
$ pipx install cmake
pipx install cmake
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the drive-by. My vs code auto-formatted this entire file - but for the better I think.

```

Alternatively, you can use a normal virtual environment:

```shell
$ python -m pip install cmake
python -m pip install cmake
```

If you don't want Python to manage your CMake installation, you can either
Expand All @@ -84,6 +84,7 @@ On Windows, there are two primary methods for installing an up-to-date CMake:

1. You can get CMake through the Visual Studio 2022 installer.
2. You can use Windows's built-in package manager, [winget][winget]:

```shell
winget install Kitware.CMake
```
Expand All @@ -96,7 +97,7 @@ Microsoft's [documentation][vs-cmake-docs] for more details.
[Homebrew] keeps its [CMake package][brew-cmake] up to date. Simply run:

```shell
$ brew install cmake
brew install cmake
```

## Ubuntu Linux
Expand Down Expand Up @@ -219,7 +220,7 @@ To build the documentation, you will need to install [Doxygen]. This can be done
either from the [Doxygen website][doxygen-download] or through [winget][winget]:

```shell
$ winget install DimitriVanHeesch.Doxygen
winget install DimitriVanHeesch.Doxygen
```

To build the Python bindings, you will need to install Python 3. This should be
Expand All @@ -234,7 +235,7 @@ Once Python is installed, you can install the Python module dependencies either
globally or in a [virtual environment][venv] by running

```shell
$ python -m pip install -r requirements.txt
python -m pip install -r requirements.txt
```

from the root of the repository.
Expand All @@ -244,14 +245,13 @@ from the root of the repository.
On macOS, it is possible to install all dependencies via [Homebrew][homebrew]:

```shell
$ brew install llvm flatbuffers wabt python pybind11 doxygen eigen libpng libjpeg-turbo openblas
brew install clang-format lld llvm flatbuffers wabt python pybind11 doxygen eigen libpng libjpeg-turbo openblas
```

The `llvm` package includes `clang`, `clang-format`, and `lld`, too. To ensure
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homebrew pulled these out long ago.

CMake can find LLVM, set the following cache variable:
To ensure that CMake can find LLVM, set the following cache variable:

```shell
$ cmake ... -DHalide_ROOT=/opt/homebrew/opt/llvm
cmake ... -DHalide_LLVM_ROOT=/opt/homebrew/opt/llvm
```

Or use the `macOS` CMake preset, which does this for you.
Expand All @@ -275,8 +275,8 @@ dependencies. These are tabulated in `requirements.txt` and may be installed
with:

```shell
$ python -m pip install -U pip "setuptools[core]" wheel
$ python -m pip install -r requirements.txt
python -m pip install -U pip "setuptools[core]" wheel
python -m pip install -r requirements.txt
```

# Building Halide
Expand All @@ -299,16 +299,16 @@ You should either open the correct Developer Command Prompt directly or run the
following:

```shell
$ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
$ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_x86
$ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_arm
"C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
"C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_x86
"C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_arm
```

Then, assuming that vcpkg is installed to `D:\vcpkg`, simply run:

```shell
$ cmake -G Ninja -S . -B build --toolchain D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build .\build
cmake -G Ninja -S . -B build --toolchain D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .\build
```

Valid values of [`CMAKE_BUILD_TYPE`][cmake_build_type] are `Debug`,
Expand Down Expand Up @@ -351,8 +351,8 @@ The instructions here are straightforward. Assuming your environment is set up
correctly, just run:

```shell
$ cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
```

If you omit `-G Ninja`, a Makefile-based generator will likely be used instead.
Expand All @@ -368,11 +368,11 @@ convenient. The following CMake preset commands correspond to the longer ones
above.

```shell
$ cmake --preset=win64 # VS 2022 generator, 64-bit build, vcpkg deps
$ cmake --preset=win32 # VS 2022 generator, 32-bit build, vcpkg deps
$ cmake --preset=macOS # Ninja generator, macOS host build, Homebrew deps
$ cmake --preset=debug # Debug mode, any single-config generator / compiler
$ cmake --preset=release # Release mode, any single-config generator / compiler
cmake --preset=win64 # VS 2022 generator, 64-bit build, vcpkg deps
cmake --preset=win32 # VS 2022 generator, 32-bit build, vcpkg deps
cmake --preset=macOS # Ninja generator, macOS host build, Homebrew deps
cmake --preset=debug # Debug mode, any single-config generator / compiler
cmake --preset=release # Release mode, any single-config generator / compiler
```

### Vcpkg presets
Expand Down Expand Up @@ -481,15 +481,15 @@ separate project. On any platform, this means running the
single-configuration generator (like Ninja), run either:

```shell
$ cmake --install ./build --prefix /path/to/Halide-install
$ cmake --install .\build --prefix X:\path\to\Halide-install
cmake --install ./build --prefix /path/to/Halide-install
cmake --install .\build --prefix X:\path\to\Halide-install
```

For a multi-configuration generator (like Visual Studio) run:

```shell
$ cmake --install ./build --prefix /path/to/Halide-install --config Release
$ cmake --install .\build --prefix X:\path\to\Halide-install --config Release
cmake --install ./build --prefix /path/to/Halide-install --config Release
cmake --install .\build --prefix X:\path\to\Halide-install --config Release
```

Of course, make sure that you build the corresponding config before attempting
Expand Down
7 changes: 0 additions & 7 deletions python_bindings/src/halide/halide_/PyBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ Halide::Runtime::Buffer<T, Dims, InClassDimStorage> pybufferinfo_to_halidebuffer
return Halide::Runtime::Buffer<T, Dims, InClassDimStorage>(t, info.ptr, (int)info.ndim, dims);
}

template<typename T = void,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer used.

int Dims = AnyDims,
int InClassDimStorage = (Dims == AnyDims ? 4 : std::max(Dims, 1))>
Halide::Runtime::Buffer<T, Dims, InClassDimStorage> pybuffer_to_halidebuffer(const py::buffer &pyb, bool writable, bool reverse_axes) {
return pybufferinfo_to_halidebuffer(pyb.request(writable), reverse_axes);
}

} // namespace PythonBindings
} // namespace Halide

Expand Down
Loading
Loading