halide 19.0.0__cp312-cp312-macosx_11_0_arm64.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 (84) hide show
  1. halide/__init__.py +39 -0
  2. halide/_generator_helpers.py +835 -0
  3. halide/bin/adams2019_retrain_cost_model +0 -0
  4. halide/bin/adams2019_weightsdir_to_weightsfile +0 -0
  5. halide/bin/anderson2021_retrain_cost_model +0 -0
  6. halide/bin/anderson2021_weightsdir_to_weightsfile +0 -0
  7. halide/bin/featurization_to_sample +0 -0
  8. halide/bin/gengen +0 -0
  9. halide/bin/get_host_target +0 -0
  10. halide/halide_.cpython-312-darwin.so +0 -0
  11. halide/imageio.py +60 -0
  12. halide/include/Halide.h +35293 -0
  13. halide/include/HalideBuffer.h +2618 -0
  14. halide/include/HalidePyTorchCudaHelpers.h +64 -0
  15. halide/include/HalidePyTorchHelpers.h +120 -0
  16. halide/include/HalideRuntime.h +2221 -0
  17. halide/include/HalideRuntimeCuda.h +89 -0
  18. halide/include/HalideRuntimeD3D12Compute.h +91 -0
  19. halide/include/HalideRuntimeHexagonDma.h +104 -0
  20. halide/include/HalideRuntimeHexagonHost.h +157 -0
  21. halide/include/HalideRuntimeMetal.h +112 -0
  22. halide/include/HalideRuntimeOpenCL.h +119 -0
  23. halide/include/HalideRuntimeQurt.h +32 -0
  24. halide/include/HalideRuntimeVulkan.h +137 -0
  25. halide/include/HalideRuntimeWebGPU.h +44 -0
  26. halide/lib/cmake/Halide/FindHalide_LLVM.cmake +152 -0
  27. halide/lib/cmake/Halide/FindV8.cmake +33 -0
  28. halide/lib/cmake/Halide/Halide-shared-deps.cmake +0 -0
  29. halide/lib/cmake/Halide/Halide-shared-targets-release.cmake +29 -0
  30. halide/lib/cmake/Halide/Halide-shared-targets.cmake +154 -0
  31. halide/lib/cmake/Halide/HalideConfig.cmake +162 -0
  32. halide/lib/cmake/Halide/HalideConfigVersion.cmake +65 -0
  33. halide/lib/cmake/HalideHelpers/FindHalide_WebGPU.cmake +27 -0
  34. halide/lib/cmake/HalideHelpers/Halide-Interfaces-release.cmake +116 -0
  35. halide/lib/cmake/HalideHelpers/Halide-Interfaces.cmake +236 -0
  36. halide/lib/cmake/HalideHelpers/HalideGeneratorHelpers.cmake +1056 -0
  37. halide/lib/cmake/HalideHelpers/HalideHelpersConfig.cmake +28 -0
  38. halide/lib/cmake/HalideHelpers/HalideHelpersConfigVersion.cmake +54 -0
  39. halide/lib/cmake/HalideHelpers/HalideTargetHelpers.cmake +99 -0
  40. halide/lib/cmake/HalideHelpers/MutexCopy.ps1 +31 -0
  41. halide/lib/cmake/HalideHelpers/TargetExportScript.cmake +55 -0
  42. halide/lib/cmake/Halide_Python/Halide_Python-targets-release.cmake +30 -0
  43. halide/lib/cmake/Halide_Python/Halide_Python-targets.cmake +125 -0
  44. halide/lib/cmake/Halide_Python/Halide_PythonConfig.cmake +26 -0
  45. halide/lib/cmake/Halide_Python/Halide_PythonConfigVersion.cmake +65 -0
  46. halide/lib/libHalide.dylib +0 -0
  47. halide/lib/libHalidePyStubs.a +0 -0
  48. halide/lib/libHalide_GenGen.a +0 -0
  49. halide/lib/libautoschedule_adams2019.so +0 -0
  50. halide/lib/libautoschedule_anderson2021.so +0 -0
  51. halide/lib/libautoschedule_li2018.so +0 -0
  52. halide/lib/libautoschedule_mullapudi2016.so +0 -0
  53. halide/share/doc/Halide/LICENSE.txt +233 -0
  54. halide/share/doc/Halide/README.md +439 -0
  55. halide/share/doc/Halide/doc/BuildingHalideWithCMake.md +626 -0
  56. halide/share/doc/Halide/doc/CodeStyleCMake.md +393 -0
  57. halide/share/doc/Halide/doc/FuzzTesting.md +104 -0
  58. halide/share/doc/Halide/doc/HalideCMakePackage.md +812 -0
  59. halide/share/doc/Halide/doc/Hexagon.md +73 -0
  60. halide/share/doc/Halide/doc/Python.md +844 -0
  61. halide/share/doc/Halide/doc/RunGen.md +283 -0
  62. halide/share/doc/Halide/doc/Testing.md +125 -0
  63. halide/share/doc/Halide/doc/Vulkan.md +287 -0
  64. halide/share/doc/Halide/doc/WebAssembly.md +228 -0
  65. halide/share/doc/Halide/doc/WebGPU.md +128 -0
  66. halide/share/tools/RunGen.h +1470 -0
  67. halide/share/tools/RunGenMain.cpp +642 -0
  68. halide/share/tools/adams2019_autotune_loop.sh +227 -0
  69. halide/share/tools/anderson2021_autotune_loop.sh +591 -0
  70. halide/share/tools/halide_benchmark.h +240 -0
  71. halide/share/tools/halide_image.h +31 -0
  72. halide/share/tools/halide_image_info.h +318 -0
  73. halide/share/tools/halide_image_io.h +2794 -0
  74. halide/share/tools/halide_malloc_trace.h +102 -0
  75. halide/share/tools/halide_thread_pool.h +161 -0
  76. halide/share/tools/halide_trace_config.h +559 -0
  77. halide-19.0.0.data/data/share/cmake/Halide/HalideConfig.cmake +6 -0
  78. halide-19.0.0.data/data/share/cmake/Halide/HalideConfigVersion.cmake +65 -0
  79. halide-19.0.0.data/data/share/cmake/HalideHelpers/HalideHelpersConfig.cmake +6 -0
  80. halide-19.0.0.data/data/share/cmake/HalideHelpers/HalideHelpersConfigVersion.cmake +54 -0
  81. halide-19.0.0.dist-info/METADATA +301 -0
  82. halide-19.0.0.dist-info/RECORD +84 -0
  83. halide-19.0.0.dist-info/WHEEL +5 -0
  84. halide-19.0.0.dist-info/licenses/LICENSE.txt +233 -0
@@ -0,0 +1,283 @@
1
+ # Running and Benchmarking Halide Generators
2
+
3
+ ## Overview
4
+
5
+ `RunGen` is a simple(ish) wrapper that allows an arbitrary Generator to be built
6
+ into a single executable that can be run directly from bash, without needing to
7
+ wrap it in your own custom main() driver. It also implements a rudimentary
8
+ benchmarking and memory-usage functionality.
9
+
10
+ If you use the standard CMake rules for Generators, you get RunGen functionality
11
+ automatically. (If you use Make, you might need to add an extra rule or two to
12
+ your Makefile; all the examples in `apps/` already have these rules.)
13
+
14
+ For every `halide_library` (or `halide_library_from_generator`) rule, there is
15
+ an implicit `name.rungen` rule that generates an executable that wraps the
16
+ Generator library:
17
+
18
+ ```
19
+ # In addition to defining a static library named "local_laplacian", this rule
20
+ # also implicitly defines an executable target named "local_laplacian.rungen"
21
+ halide_library(
22
+ local_laplacian
23
+ SRCS local_laplacian_generator.cc
24
+ )
25
+ ```
26
+
27
+ You can build and run this like any other executable:
28
+
29
+ ```
30
+ $ make bin/local_laplacian.rungen && ./bin/local_laplacian.rungen
31
+ Usage: local_laplacian.rungen argument=value [argument=value... ] [flags]
32
+ ...typical "usage" text...
33
+ ```
34
+
35
+ To be useful, you need to pass in values for the Generator's inputs (and
36
+ locations for the output(s)) on the command line, of course. You can use the
37
+ `--describe` flag to see the names and expected types:
38
+
39
+ ```
40
+ # ('make bin/local_laplacian.rungen && ' prefix omitted henceforth for clarity)
41
+ $ ./bin/local_laplacian.rungen --describe
42
+ Filter name: "local_laplacian"
43
+ Input "input" is of type Buffer<uint16> with 3 dimensions
44
+ Input "levels" is of type int32
45
+ Input "alpha" is of type float32
46
+ Input "beta" is of type float32
47
+ Output "local_laplacian" is of type Buffer<uint16> with 3 dimensions
48
+ ```
49
+
50
+ Warning: Outputs may have `$X` (where `X` is a small integer) appended to their
51
+ names in some cases (or, in the case of Generators that don't explicitly declare
52
+ outputs via `Output<>`, an autogenerated name of the form `fX`). If this
53
+ happens, don't forget to escape the `$` with a backslash as necessary. These are
54
+ both bugs we intend to fix; see https://github.com/halide/Halide/issues/2194
55
+
56
+ As a convenience, there is also an implicit target that builds-and-runs, named
57
+ simply "NAME.run":
58
+
59
+ ```
60
+ # This is equivalent to "make bin/local_laplacian.rungen && ./bin/local_laplacian.rungen"
61
+ $ make bin/local_laplacian.run
62
+ Usage: local_laplacian.rungen argument=value [argument=value... ] [flags]
63
+
64
+ # To pass arguments to local_laplacian.rungen, set the RUNARGS var:
65
+ $ make bin/local_laplacian.run RUNARGS=--describe
66
+ Filter name: "local_laplacian"
67
+ Input "input" is of type Buffer<uint16> with 3 dimensions
68
+ Input "levels" is of type int32
69
+ Input "alpha" is of type float32
70
+ Input "beta" is of type float32
71
+ Output "local_laplacian" is of type Buffer<uint16> with 3 dimensions
72
+ ```
73
+
74
+ Inputs are specified as `name=value` pairs, in any order. Scalar inputs are
75
+ specified the typical text form, while buffer inputs (and outputs) are specified
76
+ via paths to image files. RunGen currently can read/write image files in any
77
+ format supported by halide_image_io.h; at this time, that means .png, .jpg,
78
+ .ppm, .pgm, and .tmp formats. (We plan to add .tiff and .mat (level 5) in the
79
+ future.)
80
+
81
+ ```
82
+ $ ./bin/local_laplacian.rungen input=../images/rgb_small16.png levels=8 alpha=1 beta=1 output=/tmp/out.png
83
+ $ display /tmp/out.png
84
+ ```
85
+
86
+ You can also specify any scalar input as `default` or `estimate`, which will use
87
+ the default value specified for the input, or the value specified by
88
+ `set_estimate` for that input. (If the relevant value isn't set for that input,
89
+ a runtime error occurs.)
90
+
91
+ ```
92
+ $ ./bin/local_laplacian.rungen input=../images/rgb_small16.png levels=8 alpha=estimate beta=default output=/tmp/out.png
93
+ $ display /tmp/out.png
94
+ ```
95
+
96
+ If you specify an input or output file format that doesn't match the required
97
+ type/dimensions for an argument (e.g., using an 8-bit PNG for an Input<float>,
98
+ or a grayscale image for a 3-dimensional input), RunGen will try to coerce the
99
+ inputs to something sensible; that said, it's hard to always get this right, so
100
+ warnings are **always** issued whenever an input or output is modified in any
101
+ way.
102
+
103
+ ```
104
+ # This filter expects a 16-bit RGB image as input, but we're giving it an 8-bit grayscale image:
105
+ $ ./bin/local_laplacian.rungen input=../images/gray.png levels=8 alpha=1 beta=1 output=/tmp/out.png
106
+ Warning: Image for Input "input" has 2 dimensions, but this argument requires at least 3 dimensions: adding dummy dimensions of extent 1.
107
+ Warning: Image loaded for argument "input" is type uint8 but this argument expects type uint16; data loss may have occurred.
108
+ ```
109
+
110
+ By default, we try to guess a suitable size for the output image(s), based
111
+ mainly on the size of the input images (if any); you can also specify explicit
112
+ output extents. (Note that output_extents are subject to constraints already
113
+ imposed by the particular Generator's logic, so arbitrary values for
114
+ --output_extents may produce runtime errors.)
115
+
116
+ ```
117
+ # Constrain output extents to 100x200x3
118
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=../images/rgb_small16.png levels=8 alpha=1 beta=1 output=/tmp/out.png
119
+ ```
120
+
121
+ Sometimes you don't care what the particular element values for an input are
122
+ (e.g. for benchmarking), and you just want an image of a particular size; in
123
+ that case, you can use the `zero:[]` pseudo-file; it infers the _type_ from the
124
+ Generator, and inits every element to zero:
125
+
126
+ ```
127
+ # Input is a 3-dimensional image with extent 123, 456, and 3
128
+ # (bluring an image of all zeroes isn't very interesting, of course)
129
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=zero:[123,456,3] levels=8 alpha=1 beta=1 output=/tmp/out.png
130
+ ```
131
+
132
+ You can also specify arbitrary (nonzero) constants:
133
+
134
+ ```
135
+ # Input is a 3-dimensional image with extent 123, 456, and 3,
136
+ # filled with a constant value of 42
137
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=constant:42:[123,456,3] levels=8 alpha=1 beta=1 output=/tmp/out.png
138
+ ```
139
+
140
+ Similarly, you can create identity images where only the diagonal elements are
141
+ 1-s (rest are 0-s) by invoking `identity:[]`. Diagonal elements are defined as
142
+ those whose first two coordinates are equal.
143
+
144
+ There's also a `random:SEED:[]` pseudo-file, which fills the image with uniform
145
+ noise based on a specific random-number seed:
146
+
147
+ ```
148
+ # Input is a 3-dimensional image with extent 123, 456, and 3
149
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=random:42:[123,456,3] levels=8 alpha=1 beta=1 output=/tmp/out.png
150
+ ```
151
+
152
+ Instead of specifying an explicit set of extents for a pseudo-input, you can use
153
+ the string `auto`, which will run a bounds query to choose a legal set of
154
+ extents for that input given the known output extents. (This is only useful when
155
+ used in conjunction with the `--output_extents` flag.)
156
+
157
+ ```
158
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=zero:auto levels=8 alpha=1 beta=1 output=/tmp/out.png
159
+ ```
160
+
161
+ You can also specify `estimate` for the extents, which will use the estimate
162
+ values provided, typically (but not necessarily) for auto_schedule. (If there
163
+ aren't estimates for all of the buffer's dimensions, a runtime error occurs.)
164
+
165
+ ```
166
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=zero:auto levels=8 alpha=1 beta=1 output=/tmp/out.png
167
+ ```
168
+
169
+ You can combine the two and specify `estimate_then_auto` for the extents, which
170
+ will attempt to use the estimate values; if a given input buffer has no
171
+ estimates, it will fall back to the bounds-query result for that input:
172
+
173
+ ```
174
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] input=zero:estimate_then_auto levels=8 alpha=1 beta=1 output=/tmp/out.png
175
+ ```
176
+
177
+ Similarly, you can use `estimate` for `--output_extents`, which will use the
178
+ estimate values for each output. (If there aren't estimates for all of the
179
+ outputs, a runtime error occurs.)
180
+
181
+ ```
182
+ $ ./bin/local_laplacian.rungen --output_extents=estimate input=zero:auto levels=8 alpha=1 beta=1 output=/tmp/out.png
183
+ ```
184
+
185
+ If you don't want to explicitly specify all (or any!) of the input values, you
186
+ can use the `--default_input_buffers` and `--default_input_scalars` flags, which
187
+ provide wildcards for any omitted inputs:
188
+
189
+ ```
190
+ $ ./bin/local_laplacian.rungen --output_extents=[100,200,3] --default_input_buffers=random:0:auto --default_input_scalars=estimate output=/tmp/out.png
191
+ ```
192
+
193
+ In this case, all input buffers will be sized according to bounds query, and
194
+ filled with a random seed; all input scalars will be initialized to their
195
+ declared default values. (If they have no declared default value, a zero of the
196
+ appropriate type will be used.)
197
+
198
+ Note: `--default_input_buffers` can produce surprising sizes! For instance, any
199
+ input that uses `BoundaryConditions::repeat_edge` to wrap itself can legally be
200
+ set to almost any size, so you may legitimately get an input with extent=1 in
201
+ all dimensions; whether this is useful to you or not depends on the code. It's
202
+ highly recommended you do testing with the `--verbose` flag (which will log the
203
+ calculated sizes) to reality-check that you are getting what you expect,
204
+ especially for benchmarking.
205
+
206
+ A common case (especially for benchmarking) is to specify using estimates for
207
+ all inputs and outputs; for this, you can specify `--estimate_all`, which is
208
+ just a shortcut for
209
+ `--default_input_buffers=estimate_then_auto --default_input_scalars=estimate --output_extents=estimate`.
210
+
211
+ ## Benchmarking
212
+
213
+ To run a benchmark, use the `--benchmarks=all` flag:
214
+
215
+ ```
216
+ $ ./bin/local_laplacian.rungen --benchmarks=all input=zero:[1920,1080,3] levels=8 alpha=1 beta=1 --output_extents=[100,200,3]
217
+ Benchmark for local_laplacian produces best case of 0.0494629 sec/iter, over 3 blocks of 10 iterations.
218
+ Best output throughput is 39.9802 mpix/sec.
219
+ ```
220
+
221
+ You can use `--default_input_buffers` and `--default_input_scalars` here as
222
+ well:
223
+
224
+ ```
225
+ $ ./bin/local_laplacian.rungen --benchmarks=all --default_input_buffers --default_input_scalars --output_extents=estimate
226
+ Benchmark for local_laplacian produces best case of 0.0494629 sec/iter, over 3 blocks of 10 iterations.
227
+ Best output throughput is 39.9802 mpix/sec.
228
+ ```
229
+
230
+ Note: `halide_benchmark.h` is known to be inaccurate for GPU filters; see
231
+ https://github.com/halide/Halide/issues/2278
232
+
233
+ ## Measuring Memory Usage
234
+
235
+ To track memory usage, use the `--track_memory` flag, which measures the
236
+ high-water-mark of CPU memory usage.
237
+
238
+ ```
239
+ $ ./bin/local_laplacian.rungen --track_memory input=zero:[1920,1080,3] levels=8 alpha=1 beta=1 --output_extents=[100,200,3]
240
+ Maximum Halide memory: 82688420 bytes for output of 1.97754 mpix.
241
+ ```
242
+
243
+ Warning: `--track_memory` may degrade performance; don't combine it with
244
+ `--benchmark` or expect meaningful timing measurements when using it.
245
+
246
+ ## Using RunGen in Make
247
+
248
+ To add support for RunGen to your Makefile, you need to add rules something like
249
+ this (see `apps/support/Makefile.inc` for an example):
250
+
251
+ ```
252
+ HALIDE_DISTRIB ?= /path/to/halide/distrib/folder
253
+
254
+ $(BIN)/RunGenMain.o: $(HALIDE_DISTRIB)/tools/RunGenMain.cpp
255
+ @mkdir -p $(@D)
256
+ @$(CXX) -c $< $(CXXFLAGS) $(LIBPNG_CXX_FLAGS) $(LIBJPEG_CXX_FLAGS) -I$(BIN) -o $@
257
+
258
+ .PRECIOUS: $(BIN)/%.rungen
259
+ $(BIN)/%.rungen: $(BIN)/%.a $(BIN)/%.registration.cpp $(BIN)/RunGenMain.o
260
+ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBPNG_LIBS) $(LIBJPEG_LIBS) $(LDFLAGS)
261
+
262
+ RUNARGS ?=
263
+
264
+ $(BIN)/%.run: $(BIN)/%.rungen
265
+ @$(CURDIR)/$< $(RUNARGS)
266
+ ```
267
+
268
+ Note that the `%.registration.cpp` file is created by running a generator and
269
+ specifying `registration` in the comma-separated list of files to emit; these
270
+ are also generated by default if `-e` is not used on the generator command line.
271
+
272
+ ## Known Issues & Caveats
273
+
274
+ - If your Generator uses `define_extern()`, you must have all link-time
275
+ dependencies declared properly via `FILTER_DEPS`; otherwise, you'll fail to
276
+ link.
277
+ - The code does its best to detect when inputs or outputs need to be
278
+ chunky/interleaved (rather than planar), but in unusual cases it might guess
279
+ wrong; if your Generator uses buffers with unusual stride setups, RunGen might
280
+ fail at runtime. (If this happens, please file a bug!)
281
+ - The code for deducing good output sizes is rudimentary and needs to be
282
+ smartened; it will sometimes make bad decisions which will prevent the filter
283
+ from executing. (If this happens, please file a bug!)
@@ -0,0 +1,125 @@
1
+ # Testing
2
+
3
+ Halide uses CTest as its primary test platform and runner.
4
+
5
+ ## Organization
6
+
7
+ Halide's tests are organized beneath the top-level `test/` directory. These
8
+ folders are described below:
9
+
10
+ | Folder | Description |
11
+ |----------------------|----------------------------------------------------------------------------------|
12
+ | `autoschedulers/$AS` | Test for the `$AS` (e.g. `adams2019`) autoscheduler |
13
+ | `common` | Code that may be shared across multiple tests |
14
+ | `correctness` | Tests that check correctness of various compiler properties |
15
+ | `error` | Tests that expect an exception to be thrown (or `abort()` to be called) |
16
+ | `failing_with_issue` | Correctness tests that are associated with a particular issue on GitHub |
17
+ | `fuzz` | Fuzz tests. Read more at [FuzzTesting.md](FuzzTesting.md) |
18
+ | `generator` | Tests of Halide's AOT compilation infrastructure. |
19
+ | `integration` | Tests of Halide's CMake package for downstream use, including cross compilation. |
20
+ | `performance` | Tests that check that certain schedules indeed improve performance. |
21
+ | `runtime` | Unit tests for the Halide runtime library |
22
+ | `warning` | Tests that expected warnings are indeed issued. |
23
+
24
+ The tests in each of these directories are given CTest labels corresponding to
25
+ the directory name. Thus, one can use `ctest -L generator` to run only the
26
+ `generator` tests. The `performance` tests configure CTest to not run them
27
+ concurrently with other tests (including each other).
28
+
29
+ The vast majority of our tests are simple C++ executables that link to Halide,
30
+ perform some checks, and print the special line `Success!` upon successful
31
+ completion. There are three main exceptions to this:
32
+
33
+ First, the `warning` tests are expected to print a line that reads
34
+ `Warning:` and do not look for `Success!`.
35
+
36
+ Second, some tests cannot run in all scenarios; for example, a test that
37
+ measures CUDA performance requires a CUDA-capable GPU. In these cases, tests are
38
+ expected to print `[SKIP]` and exit and not print `Success!` or `Warning:`.
39
+
40
+ Finally, the `error` tests are expected to throw an (uncaught) exception that is
41
+ not a `Halide::InternalError` (i.e. from a failing `internal_assert`). The logic
42
+ for translating uncaught exceptions into successful tests is in
43
+ `test/common/expect_abort.cpp`.
44
+
45
+ ## Debugging with LLDB
46
+
47
+ We provide helpers for pretty-printing Halide's IR types in LLDB. The
48
+ `.lldbinit` file at the repository root will load automatically if you launch
49
+ `lldb` from this directory and your `~/.lldbinit` file contains the line,
50
+
51
+ ```
52
+ settings set target.load-cwd-lldbinit true
53
+ ```
54
+
55
+ If you prefer to avoid such global configuration, you can directly load the
56
+ helpers with the LLDB command,
57
+
58
+ ```
59
+ command script import ./tools/lldbhalide.py
60
+ ```
61
+
62
+ again assuming that the repository root is your current working directory.
63
+
64
+ To see the benefit of using these helpers, let us debug `correctness_bounds`:
65
+
66
+ ```
67
+ $ lldb ./build/test/correctness/correctness_bounds
68
+ (lldb) breakpoint set --file bounds.cpp --line 18
69
+ Breakpoint 1: where = correctness_bounds`main + 864 at bounds.cpp:18:12, address = 0x0000000100002054
70
+ (lldb) run
71
+ Process 29325 launched: '/Users/areinking/dev/Halide/build/test/correctness/correctness_bounds' (arm64)
72
+ Defining function...
73
+ Process 29325 stopped
74
+ * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
75
+ frame #0: 0x0000000100002054 correctness_bounds`main(argc=1, argv=0x000000016fdff160) at bounds.cpp:18:12
76
+ 15 g(x, y) = min(x, y);
77
+ 16 h(x, y) = clamp(x + y, 20, 100);
78
+ 17
79
+ -> 18 Var xo("xo"), yo("yo"), xi("xi"), yi("yi");
80
+ 19
81
+ 20 Target target = get_jit_target_from_environment();
82
+ 21 if (target.has_gpu_feature()) {
83
+ Target 0: (correctness_bounds) stopped.
84
+ (lldb)
85
+ ```
86
+
87
+ Now we can try to inspect the Func `h`. Without the helpers, we see:
88
+
89
+ ```
90
+ (lldb) v h
91
+ (Halide::Func) {
92
+ func = {
93
+ contents = {
94
+ strong = (ptr = 0x0000600002486a20)
95
+ weak = nullptr
96
+ idx = 0
97
+ }
98
+ }
99
+ pipeline_ = {
100
+ contents = (ptr = 0x0000000000000000)
101
+ }
102
+ }
103
+ ```
104
+
105
+ But if we load the helpers and try again, we get a much more useful output:
106
+
107
+ ```
108
+ (lldb) command script import ./tools/lldbhalide.py
109
+ (lldb) v h
110
+ ... lots of output ...
111
+ ```
112
+
113
+ The amount of output here is maybe a bit _too_ much, but we gain the ability to
114
+ more narrowly inspect data about the func:
115
+
116
+ ```
117
+ (lldb) v h.func.init_def.values
118
+ ...
119
+ (std::vector<Halide::Expr>) h.func.init_def.values = size=1 {
120
+ [0] = max(min(x + y, 100), 20)
121
+ }
122
+ ```
123
+
124
+ These helpers are particularly useful when using graphical debuggers, such as
125
+ the one found in CLion.