@@ -4,10 +4,10 @@ Halide is a programming language designed to make it easier to write
4
4
high-performance image and array processing code on modern machines. Halide
5
5
currently targets:
6
6
7
- - CPU architectures: X86, ARM, MIPS, Hexagon, PowerPC
8
- - Operating systems: Linux, Windows, Mac OS X , Android, iOS, Qualcomm QuRT
9
- - GPU Compute APIs: CUDA, OpenCL, OpenGL Compute Shaders, Apple Metal,
10
- Microsoft Direct X 12
7
+ - CPU architectures: X86, ARM, MIPS, Hexagon, PowerPC, RISC-V
8
+ - Operating systems: Linux, Windows, macOS , Android, iOS, Qualcomm QuRT
9
+ - GPU Compute APIs: CUDA, OpenCL, OpenGL Compute Shaders, Apple Metal, Microsoft
10
+ Direct X 12
11
11
12
12
Rather than being a standalone programming language, Halide is embedded in C++.
13
13
This means you write C++ code that builds an in-memory representation of a
@@ -29,10 +29,10 @@ If you've acquired a full source distribution and want to build Halide, see the
29
29
30
30
## Binary tarballs
31
31
32
- The latest version of Halide is ** Halide 11 .0.1 ** . We provide binary releases
32
+ The latest version of Halide is ** Halide 12 .0.0 ** . We provide binary releases
33
33
for many popular platforms and architectures, including 32/64-bit x86 Windows,
34
34
64-bit macOS, and 32/64-bit x86/ARM Ubuntu Linux. See the releases tab on the
35
- right (or click [ here] ( https://github.com/halide/Halide/releases/tag/v10 .0.0 ) ).
35
+ right (or click [ here] ( https://github.com/halide/Halide/releases/tag/v12 .0.0 ) ).
36
36
37
37
## Vcpkg
38
38
@@ -43,13 +43,10 @@ you can install Halide via:
43
43
$ vcpkg install halide:x64-windows # or x64-linux/x64-osx
44
44
```
45
45
46
- Note two caveats: first, at time of writing,
47
- [ MSVC mis-compiles LLVM] ( https://github.com/halide/Halide/issues/5039 ) on
48
- x86-windows, so Halide cannot be used in vcpkg on that platform at this time;
49
- second, vcpkg installs only the minimum Halide backends required to compile code
50
- for the active platform. If you want to include all the backends, you should
51
- install ` halide[target-all]:x64-windows ` instead. Note that since this will
52
- build LLVM, it will take a _ lot_ of disk space (up to 100GB).
46
+ One caveat: vcpkg installs only the minimum Halide backends required to compile
47
+ code for the active platform. If you want to include all the backends, you
48
+ should install ` halide[target-all]:x64-windows ` instead. Note that since this
49
+ will build LLVM, it will take a _ lot_ of disk space (up to 100GB).
53
50
54
51
## Homebrew
55
52
@@ -62,60 +59,93 @@ $ brew install halide
62
59
63
60
## Other package managers
64
61
65
- We are interested in bringing Halide 10 to other popular package managers
66
- and Linux distribution repositories including, but not limited to, Conan,
62
+ We are interested in bringing Halide 12 to other popular package managers and
63
+ Linux distribution repositories including, but not limited to, Conan,
67
64
Debian, [ Ubuntu (or PPA)] ( https://github.com/halide/Halide/issues/5285 ) ,
68
- CentOS/Fedora, and Arch. If you have experience publishing packages we
69
- would be happy to work with you!
65
+ CentOS/Fedora, and Arch. If you have experience publishing packages we would be
66
+ happy to work with you!
70
67
71
- If you are a maintainer of any other package distribution platform, we would
72
- be excited to work with you, too.
68
+ If you are a maintainer of any other package distribution platform, we would be
69
+ excited to work with you, too.
70
+
71
+ # Platform Support
72
+
73
+ There are two sets of platform requirements relevant to Halide: those required
74
+ to run the compiler library in either JIT or AOT mode, and those required to run
75
+ the _ binary outputs_ of the AOT compiler.
76
+
77
+ These are the ** tested** host toolchain and platform combinations for building
78
+ and running the Halide compiler library.
79
+
80
+ | Compiler | Version | OS | Architectures |
81
+ | ---------- | ------------ | ---------------------- | --------------- |
82
+ | GCC | 7.5 | Ubuntu Linux 20.04 LTS | x86, x64, ARM32 |
83
+ | GCC | 7.5 | Ubuntu Linux 18.04 LTS | ARM32, ARM64 |
84
+ | MSVC | 2019 (19.28) | Windows 10 (20H2) | x86, x64 |
85
+ | AppleClang | 12.0.0 | macOS 10.15 | x86_64 |
86
+ | AppleClang | 12.0.0 | macOS 11.1 | ARM64 |
87
+
88
+ Some users have successfully built Halide for Linux using Clang 9.0.0+, for
89
+ Windows using ClangCL 11.0.0+, and for Windows ARM64 by cross-compiling with
90
+ MSVC. We do not actively test these scenarios, however, so your mileage may
91
+ vary.
92
+
93
+ Beyond these, we are willing to support (by accepting PRs for) platform and
94
+ toolchain combinations that still receive _ active, first-party, public support_
95
+ from their original vendors. For instance, at time of writing, this excludes
96
+ Windows 7 and includes Ubuntu 18.04 LTS.
97
+
98
+ Compiled AOT pipelines are expected to have much broader platform support. The
99
+ binaries use the C ABI, and we expect any compliant C compiler to be able to use
100
+ the generated headers correctly. The C++ bindings currently require C++11. If
101
+ you discover a compatibility problem with a generated pipeline, please open an
102
+ issue.
73
103
74
104
# Building Halide with Make
75
105
76
106
### TL;DR
77
107
78
- Have llvm-9 .0 (or greater) installed and run ` make ` in the root directory of the
79
- repository (where this README is).
108
+ Have llvm-11 .0 (or greater) installed and run ` make ` in the root directory of
109
+ the repository (where this README is).
80
110
81
111
### Acquiring LLVM
82
112
83
113
At any point in time, building Halide requires either the latest stable version
84
114
of LLVM, the previous stable version of LLVM, and trunk. At the time of writing,
85
- this means versions 11 .0 and 10 .0 are supported, but 9 .0 is not. The commands
115
+ this means versions 12 .0 and 11 .0 are supported, but 10 .0 is not. The commands
86
116
` llvm-config ` and ` clang ` must be somewhere in the path.
87
117
88
- If your OS does not have packages for llvm , you can find binaries for it at
118
+ If your OS does not have packages for LLVM , you can find binaries for it at
89
119
http://llvm.org/releases/download.html . Download an appropriate package and then
90
120
either install it, or at least put the ` bin ` subdirectory in your path. (This
91
121
works well on OS X and Ubuntu.)
92
122
93
123
If you want to build it yourself, first check it out from GitHub:
94
124
95
125
```
96
- % git clone --depth 1 --branch llvmorg-11 .0.0 https://github.com/llvm/llvm-project.git
126
+ % git clone --depth 1 --branch llvmorg-12 .0.0 https://github.com/llvm/llvm-project.git
97
127
```
98
128
99
- (If you want to build LLVM 10 .x, use branch ` llvmorg-10.0.1 ` ; for current trunk,
129
+ (If you want to build LLVM 11 .x, use branch ` llvmorg-11.1.0 ` ; for current trunk,
100
130
use ` main ` )
101
131
102
132
Then build it like so:
103
133
104
134
```
105
135
% cmake -DCMAKE_BUILD_TYPE=Release \
106
136
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" \
107
- -DLLVM_TARGETS_TO_BUILD="X86;ARM;NVPTX;AArch64;Mips;Hexagon" \
137
+ -DLLVM_TARGETS_TO_BUILD="X86;ARM;NVPTX;AArch64;Mips;Hexagon;WebAssembly " \
108
138
-DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ASSERTIONS=ON \
109
139
-DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_32_BITS=OFF \
110
140
-S llvm-project/llvm -B llvm-build
111
141
% cmake --build llvm-build
112
142
% cmake --install llvm-build --prefix llvm-install
113
143
```
144
+
114
145
Running a serial build will be slow. To improve speed, try running a parallel
115
146
build. That's done by default in Ninja; for make, use the option -j NNN,
116
- where NNN is the number of parallel jobs, e.g. the number of CPUs you have.
117
-
118
- then to point Halide to it:
147
+ where NNN is the number of parallel jobs, e.g. the number of CPUs you have.
148
+ Then, point Halide to it:
119
149
120
150
```
121
151
% export LLVM_ROOT=$PWD/llvm-install
@@ -125,8 +155,8 @@ then to point Halide to it:
125
155
Note that you _ must_ add ` clang ` to ` LLVM_ENABLE_PROJECTS ` ; adding ` lld ` to
126
156
` LLVM_ENABLE_PROJECTS ` is only required when using WebAssembly, and adding
127
157
` clang-tools-extra ` is only necessary if you plan to contribute code to Halide
128
- (so that you can run clang-tidy on your pull requests). We recommend enabling
129
- both in all cases, to simplify builds. You can disable exception handling (EH)
158
+ (so that you can run ` clang-tidy ` on your pull requests). We recommend enabling
159
+ both in all cases to simplify builds. You can disable exception handling (EH)
130
160
and RTTI if you don't want the Python bindings.
131
161
132
162
### Building Halide with make
@@ -136,8 +166,7 @@ just run `make` in the root directory of the Halide source tree.
136
166
` make run_tests ` will run the JIT test suite, and ` make test_apps ` will make
137
167
sure all the apps compile and run (but won't check their output).
138
168
139
- There is no ` make install ` yet. If you want to make an install package, run
140
- ` make distrib ` .
169
+ There is no ` make install ` . If you want to make an install package, use CMake.
141
170
142
171
### Building Halide out-of-tree with make
143
172
@@ -156,16 +185,16 @@ Follow the above instructions to build LLVM or acquire a suitable binary
156
185
release. Then change directory to the Halide repository and run:
157
186
158
187
```
159
- % cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=$LLVM_ROOT/lib/cmake/llvm -S . -B build
188
+ % cmake -G Ninja - DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=$LLVM_ROOT/lib/cmake/llvm -S . -B build
160
189
% cmake --build build
161
190
```
162
191
163
192
` LLVM_DIR ` is the folder in the LLVM installation tree ** (do not use the build
164
193
tree by mistake)** that contains ` LLVMConfig.cmake ` . It is not required to set
165
194
this variable if you have a suitable system-wide version installed. If you have
166
195
multiple system-wide versions installed, you can specify the version with
167
- ` Halide_REQUIRE_LLVM_VERSION ` . Add ` -G Ninja ` if you prefer to build with the
168
- Ninja generator.
196
+ ` Halide_REQUIRE_LLVM_VERSION ` . Remove ` -G Ninja ` if you prefer to build with a
197
+ different generator.
169
198
170
199
### Windows
171
200
@@ -236,7 +265,7 @@ this by specifying, for example:
236
265
Then run the build with:
237
266
238
267
```
239
- D:\Halide> cmake --build build --config Release -j %NUMBER_OF_PROCESSORS%
268
+ D:\Halide> cmake --build build --config Release
240
269
```
241
270
242
271
To run all the tests:
@@ -252,10 +281,10 @@ Subsets of the tests can be selected with `-L` and include `correctness`,
252
281
#### Building LLVM (optional)
253
282
254
283
Follow these steps if you want to build LLVM yourself. First, download LLVM's
255
- sources (these instructions use the latest 11 .0 release)
284
+ sources (these instructions use the latest 12 .0 release)
256
285
257
286
```
258
- D:\> git clone --depth 1 --branch llvmorg-11 .0.0 https://github.com/llvm/llvm-project.git
287
+ D:\> git clone --depth 1 --branch llvmorg-12 .0.0 https://github.com/llvm/llvm-project.git
259
288
```
260
289
261
290
For a 64-bit build, run:
@@ -291,7 +320,7 @@ D:\> cmake -G Ninja ^
291
320
Finally, run:
292
321
293
322
```
294
- D:\> cmake --build llvm-build --config Release -j %NUMBER_OF_PROCESSORS%
323
+ D:\> cmake --build llvm-build --config Release
295
324
D:\> cmake --install llvm-build --prefix llvm-install
296
325
```
297
326
@@ -337,47 +366,44 @@ Apple clang 500.2.76. This means that we link against libc++ instead of
337
366
libstdc++. You may need to adjust compiler options accordingly if you're using
338
367
an older XCode which does not default to libc++.
339
368
340
- # Halide OpenGL/GLSL backend
341
-
342
- TODO(https://github.com/halide/Halide/issues/5633 ): update this for OpenGLCompute, which is staying
343
-
344
369
# Halide for Hexagon HVX
345
370
346
371
Halide supports offloading work to Qualcomm Hexagon DSP on Qualcomm Snapdragon
347
- 835 devices or newer. The Hexagon DSP provides a set of 128 byte vector instruction
348
- extensions - the Hexagon Vector eXtensions (HVX). HVX is well suited for image
349
- processing, and Halide for Hexagon HVX will generate the appropriate HVX vector
350
- instructions from a program authored in Halide.
372
+ 835 devices or newer. The Hexagon DSP provides a set of 128 byte vector
373
+ instruction extensions - the Hexagon Vector eXtensions (HVX). HVX is well suited
374
+ for image processing, and Halide for Hexagon HVX will generate the appropriate
375
+ HVX vector instructions from a program authored in Halide.
351
376
352
377
Halide can be used to compile Hexagon object files directly, by using a target
353
378
such as ` hexagon-32-qurt-hvx ` .
354
379
355
380
Halide can also be used to offload parts of a pipeline to Hexagon using the
356
381
` hexagon ` scheduling directive. To enable the ` hexagon ` scheduling directive,
357
- include the ` hvx ` target feature in your target. The currently
358
- supported combination of targets is to use the HVX target features with an x86
359
- linux host (to use the simulator) or with an ARM android target (to use Hexagon
360
- DSP hardware). For examples of using the ` hexagon ` scheduling directive on both
361
- the simulator and a Hexagon DSP, see the blur example app.
382
+ include the ` hvx ` target feature in your target. The currently supported
383
+ combination of targets is to use the HVX target features with an x86 linux
384
+ host (to use the simulator) or with an ARM android target (to use Hexagon DSP
385
+ hardware). For examples of using the ` hexagon ` scheduling directive on both the
386
+ simulator and a Hexagon DSP, see the blur example app.
362
387
363
388
To build and run an example app using the Hexagon target,
364
389
365
390
1 . Obtain and build trunk LLVM and Clang. (Earlier versions of LLVM may work but
366
391
are not actively tested and thus not recommended.)
367
- 2 . Download and install the Hexagon SDK and Hexagon Tools. Hexagon SDK 3.4.1 or later
368
- is needed. Hexagon Tools 8.2 or later is needed.
392
+ 2 . Download and install the Hexagon SDK and Hexagon Tools. Hexagon SDK 3.4.1 or
393
+ later is needed. Hexagon Tools 8.2 or later is needed.
369
394
3 . Build and run an example for Hexagon HVX
370
395
371
396
### 1. Obtain and build trunk LLVM and Clang
372
397
373
- (Instructions given previous, just be sure to check out the ` master ` branch.)
398
+ (Follow the instructions given previously, just be sure to check out the ` main `
399
+ branch.)
374
400
375
401
### 2. Download and install the Hexagon SDK and Hexagon Tools
376
402
377
403
Go to https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools
378
404
379
- 1 . Select the Hexagon Series 600 Software and download the 3.4.1 version or later
380
- for Linux.
405
+ 1 . Select the Hexagon Series 600 Software and download the 3.4.1 version or
406
+ later for Linux.
381
407
2 . untar the installer
382
408
3 . Run the extracted installer to install the Hexagon SDK and Hexagon Tools,
383
409
selecting Installation of Hexagon SDK into ` /location/of/SDK/Hexagon_SDK/3.x `
@@ -405,7 +431,8 @@ LD_LIBRARY_PATH=../../src/runtime/hexagon_remote/bin/host/:$HL_HEXAGON_TOOLS/lib
405
431
406
432
To build the example for Android, first ensure that you have Android NDK r19b or
407
433
later installed, and the ANDROID_NDK_ROOT environment variable points to it.
408
- (Note that Qualcomm Hexagon SDK v3.5.2 includes Android NDK r19c, which is fine.)
434
+ (Note that Qualcomm Hexagon SDK v3.5.2 includes Android NDK r19c, which is
435
+ fine.)
409
436
410
437
Now build and run the blur example using the script to run it on device:
411
438
0 commit comments