halidoscope 22.0.0__py3-none-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.
|
Binary file
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: halidoscope
|
|
3
|
+
Version: 22.0.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Natural Language :: English
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: POSIX
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
12
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
13
|
+
Summary: An interactive GUI and CLI for working with Halide traces.
|
|
14
|
+
Keywords: halide,trace,profiling,visualization,gui
|
|
15
|
+
Author-email: Parker Ziegler <pziegler@adobe.com>
|
|
16
|
+
Maintainer-email: The Halide team <halide-dev@lists.csail.mit.edu>
|
|
17
|
+
License-Expression: MIT
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
20
|
+
Project-URL: Documentation, https://github.com/halide/Halide/blob/main/tools/halidoscope/README.md
|
|
21
|
+
Project-URL: Homepage, https://halide-lang.org
|
|
22
|
+
Project-URL: Issues, https://github.com/halide/Halide/issues
|
|
23
|
+
Project-URL: Repository, https://github.com/halide/Halide.git
|
|
24
|
+
|
|
25
|
+
# Halidoscope
|
|
26
|
+
|
|
27
|
+
An interactive GUI and CLI for working with Halide traces.
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
You'll need a few prerequisites to get everything working.
|
|
32
|
+
|
|
33
|
+
1. Tauri's
|
|
34
|
+
[system dependencies](https://v2.tauri.app/start/prerequisites/#system-dependencies)
|
|
35
|
+
for your OS.
|
|
36
|
+
- Note that you only need dependencies for desktop targets.
|
|
37
|
+
2. A [Rust](https://rust-lang.org/learn/get-started/) installation.
|
|
38
|
+
3. A [Node.js](https://nodejs.org/en/download) installation.
|
|
39
|
+
4. [PNPM](https://pnpm.io/), a space-efficient package manager for the
|
|
40
|
+
JavaScript ecosystem.
|
|
41
|
+
|
|
42
|
+
## Installing Halidoscope
|
|
43
|
+
|
|
44
|
+
The easiest way to get `halidoscope` on your `PATH` is via pip:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install halidoscope
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This installs a prebuilt binary wheel containing both the GUI and the CLI. Note
|
|
51
|
+
that pip cannot install the system webview Halidoscope's GUI renders into
|
|
52
|
+
(WebKitGTK on Linux, WebView2 on Windows, WKWebView on macOS), so
|
|
53
|
+
[Tauri's system dependencies](https://v2.tauri.app/start/prerequisites/#system-dependencies)
|
|
54
|
+
must be present on Linux; macOS and Windows ship a compatible webview out of the
|
|
55
|
+
box. Currently, `halidoscope` initializes its windowing toolkit unconditionally
|
|
56
|
+
on startup, so on Linux this applies even to the non-interactive CLI subcommands
|
|
57
|
+
(`list`, `stats`, `dot`, `snapshot`) -- running any of them on a Linux host with
|
|
58
|
+
no display attached (e.g., a headless CI runner or container) additionally
|
|
59
|
+
requires a virtual display such as
|
|
60
|
+
[Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml).
|
|
61
|
+
|
|
62
|
+
## Building Halidoscope
|
|
63
|
+
|
|
64
|
+
To get a production build locally, run the following two commands:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm install
|
|
68
|
+
pnpm tauri build
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This will write the Halidoscope executable to
|
|
72
|
+
`tools/halidoscope/src-tauri/target/release/halidoscope`. You can, of course,
|
|
73
|
+
symlink this executable to any directory on your `PATH`. On Unix systems:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
ln -sf tools/halidoscope/src-tauri/target/release/halidoscope /some/dir/on/your/path/halidoscope
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Building the pip package locally
|
|
80
|
+
|
|
81
|
+
Halidoscope's wheel is built with [maturin](https://www.maturin.rs/), which
|
|
82
|
+
compiles `src-tauri`'s `halidoscope` binary and packages it directly (no Python
|
|
83
|
+
extension module involved). The frontend must be built first, since the binary
|
|
84
|
+
embeds `dist/` at compile time:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm install
|
|
88
|
+
pnpm build
|
|
89
|
+
pip install maturin
|
|
90
|
+
maturin build --release
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`pyproject.toml` enables the `tauri/custom-protocol` Cargo feature for this
|
|
94
|
+
build. Without it, the compiled binary always tries to load its UI from Tauri's
|
|
95
|
+
dev server instead of the files embedded from `dist/`, so the resulting wheel's
|
|
96
|
+
GUI can't launch outside of `pnpm tauri dev`.
|
|
97
|
+
|
|
98
|
+
## Using Halidoscope
|
|
99
|
+
|
|
100
|
+
### Calling Halidoscope from a Halide program
|
|
101
|
+
|
|
102
|
+
Halide exposes a member function on the `Pipeline` class,
|
|
103
|
+
`Pipeline::halidoscope`, that allows you to launch Halidoscope directly from an
|
|
104
|
+
executing program. This call will execute the your pipeline once with tracing
|
|
105
|
+
enabled, once with profiling enabled, and then launch an interactive Halidoscope
|
|
106
|
+
session.
|
|
107
|
+
|
|
108
|
+
```cpp
|
|
109
|
+
// Normal algorithm definition and scheduling code.
|
|
110
|
+
|
|
111
|
+
// Create the pipeline.
|
|
112
|
+
Pipeline pipeline(output);
|
|
113
|
+
|
|
114
|
+
// Example call where we explicitly pass the size of output buffer we want
|
|
115
|
+
// Halidoscope to allocate. In this case, we want to match to the dimensions of
|
|
116
|
+
// our input buffer exactly.
|
|
117
|
+
std::vector<int32_t> sizes = {input.width(), input.height(), input.channels()};
|
|
118
|
+
pipeline.halidoscope(sizes);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The first argument to `Pipeline::halidoscope` matches that of
|
|
122
|
+
`Pipeline::realize` and can be one of:
|
|
123
|
+
|
|
124
|
+
1. A `sizes` `std::vector<int32_t>` defining the dimensionality of output
|
|
125
|
+
buffers for Halidoscope (and, under the hood, the Halide runtime) to
|
|
126
|
+
allocate.
|
|
127
|
+
2. An `output` `RealizationArg` representing an already-allocated destination
|
|
128
|
+
(e.g., a `Buffer`) for Halidoscope to write to.
|
|
129
|
+
|
|
130
|
+
As with `Pipeline::realize`, either may be preceded by a `JITUserContext *`.
|
|
131
|
+
|
|
132
|
+
#### Calling Halidoscope from a Generator
|
|
133
|
+
|
|
134
|
+
Generators have a protected `halidoscope` member function that can be called
|
|
135
|
+
from `generate()` once all outputs are defined. It takes the same arguments as
|
|
136
|
+
the `Callable` returned by `compile_to_callable`: an optional
|
|
137
|
+
`JITUserContext *`, then the inputs in order, then the output buffers. The
|
|
138
|
+
inputs are bound to the Generator's input parameters and `get_pipeline()` is
|
|
139
|
+
passed to `Pipeline::halidoscope`. A `HalidoscopeOptions` may be passed as the
|
|
140
|
+
very first argument.
|
|
141
|
+
|
|
142
|
+
```cpp
|
|
143
|
+
void generate() {
|
|
144
|
+
// Define and schedule the outputs.
|
|
145
|
+
|
|
146
|
+
Buffer<float> input_buffer = Halide::Tools::load_and_convert_image("input.png");
|
|
147
|
+
Buffer<float> output_buffer(input_buffer.width(), input_buffer.height());
|
|
148
|
+
halidoscope(input_buffer, 0.5f, output_buffer);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Configuring Halidoscope's behavior
|
|
153
|
+
|
|
154
|
+
The `Pipeline::halidoscope` API also accepts an `options` argument of type
|
|
155
|
+
`HalidoscopeOptions` that can control how Halidoscope behaves. This struct has
|
|
156
|
+
the following shape:
|
|
157
|
+
|
|
158
|
+
| Field | Type | Description |
|
|
159
|
+
| ----------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
160
|
+
| `path` | `std::optional<std::string>` | The path to the Halidoscope binary on disk. By default, `Pipeline::halidoscope` will look for `halidoscope` on the user's `$PATH` and error if not found. |
|
|
161
|
+
| `output_dir` | `std::optional<std::string>` | (Optional.) A path to a non-volatile directory for storing Halidoscope-generated trace binaries and profiler output. By default, Halidoscope will write recorded `.hltrace` and profile JSON files to a temporary directory that is destroyed on process exit. |
|
|
162
|
+
| `profile_runs` | `std::optional<int>` | The number of profiling runs for the Halide profiler to execute on the pipeline. If unset, runs the pipeline repeatedly for at least one second (not counting the first run, which includes JIT compilation). Users can opt out of profiling altogether by specifying 0. |
|
|
163
|
+
| `trace_file_size_limit` | `size_t` | A limit on the size of the compressed trace file, in megabytes (default 1000). If the trace exceeds it, `Pipeline::halidoscope` fails with an error rather than filling the disk. |
|
|
164
|
+
|
|
165
|
+
### Calling Halidoscope from the command line
|
|
166
|
+
|
|
167
|
+
As an alternative to the `Pipeline::halidoscope` API, you can also invoke
|
|
168
|
+
Halidoscope directly from the command line to launch the GUI. To work with a
|
|
169
|
+
pre-recorded trace, simply specify the path to a Halide trace binary file via
|
|
170
|
+
the `--trace` flag. Traces may be raw (e.g. as written by `HL_TRACE_FILE`) or
|
|
171
|
+
compressed (as written by `Pipeline::halidoscope`, using
|
|
172
|
+
`tools/halide_trace_compression.h`).
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
halidoscope --trace <path/to/file.hltrace>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If you'd also like to visualize a pre-recorded profile JSON file, pass the path
|
|
179
|
+
to that file via the `--profile` flag. Note that `--trace` is always required.
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
halidoscope --trace <path/to/file.hltrace> --profile <path/to/profile.json>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Additional CLI commands
|
|
186
|
+
|
|
187
|
+
`halidoscope` also exposes a non-interactive CLI for gathering information about
|
|
188
|
+
your Halide pipeline.
|
|
189
|
+
|
|
190
|
+
#### `list`
|
|
191
|
+
|
|
192
|
+
List the `Func`s in a trace, along with their dimensionality.
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
halidoscope list --trace <path/to/file.hltrace> [--json]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- `-t, --trace <path>` (required): Path to the `.hltrace` file to analyze.
|
|
199
|
+
- `--json`: Print output as JSON instead of a table.
|
|
200
|
+
|
|
201
|
+
#### `stats`
|
|
202
|
+
|
|
203
|
+
Print statistics (minimum/maximum coordinates, minimum/maximum value, maximum
|
|
204
|
+
store/load counts, and thread count) for one or all `Func`s in a trace.
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
halidoscope stats --trace <path/to/file.hltrace> [--func <name>] [--json]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
- `-t, --trace <path>` (required): Path to the `.hltrace` file to analyze.
|
|
211
|
+
- `-f, --func <name>`: Name of the Func to print statistics for. If omitted,
|
|
212
|
+
prints statistics for all Funcs.
|
|
213
|
+
- `--json`: Print output as JSON instead of a table.
|
|
214
|
+
|
|
215
|
+
#### `dot`
|
|
216
|
+
|
|
217
|
+
Generate a [Graphviz DOT](https://graphviz.org/doc/info/lang.html)
|
|
218
|
+
representation of the pipeline's dataflow graph.
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
halidoscope dot --trace <path/to/file.hltrace> [destination]
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- `-t, --trace <path>` (required): Path to the `.hltrace` file to analyze.
|
|
225
|
+
- `destination` (optional): Path to write the DOT file. Must end in `.txt`,
|
|
226
|
+
`.gv`, or `.dot`. If omitted, prints the DOT source to stdout.
|
|
227
|
+
|
|
228
|
+
#### `snapshot`
|
|
229
|
+
|
|
230
|
+
Snapshot a `Func`'s values at a given packet index for a given render mode,
|
|
231
|
+
writing the underlying data to a JSON file.
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
halidoscope snapshot --trace <path/to/file.hltrace> --func <name> [--packet-index <n>] [--mode <mode>] <destination>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
- `-t, --trace <path>` (required): Path to the `.hltrace` file to snapshot.
|
|
238
|
+
- `-f, --func <name>` (required): Name of the Func to snapshot.
|
|
239
|
+
- `-i, --packet-index <n>`: Global packet index to snapshot. Defaults to `0`.
|
|
240
|
+
- `-m, --mode <mode>`: Rendering mode. One of `grayscale` (default), `rgb`
|
|
241
|
+
`store-frequency`, `load-frequency`, `redundant-stores`, or `reuse-distance`.
|
|
242
|
+
- `destination` (required): Path to write the output snapshot. Must end in
|
|
243
|
+
`.json`.
|
|
244
|
+
|
|
245
|
+
## Developing Halidoscope
|
|
246
|
+
|
|
247
|
+
Developing Halidoscope locally should be fairly straightforward. Assuming you've
|
|
248
|
+
installed the [prequisities](#prerequisites), just run the following two
|
|
249
|
+
commands.
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
pnpm install
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
pnpm tauri dev -- -- --trace <path/to/file.hltrace> [--profile <path/to/profile.json>]
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
These commands will install all necessary JavaScript and Rust dependencies,
|
|
260
|
+
build the Rust backend (using the `dev` profile), and start Vite's dev server.
|
|
261
|
+
Changes on both the Rust and TypeScript sides will trigger automatic rebuilds
|
|
262
|
+
with hot reloading — no need to stop your dev server while developing!
|
|
263
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
halidoscope-22.0.0.data/scripts/halidoscope.exe,sha256=gPdrlcPuiARytBhx3NkZu4hEbeJLvgHarYBxBO9NrDw,11106304
|
|
2
|
+
halidoscope-22.0.0.dist-info/METADATA,sha256=LKD4HgY5-_05cyBJ6iqKIoitTUlx22_H2IIYWbR4wyk,11606
|
|
3
|
+
halidoscope-22.0.0.dist-info/WHEEL,sha256=8Aej0W0a6Cz6apA3IzJrTnxLRVLAt-w0Oh8SA3Con_c,94
|
|
4
|
+
halidoscope-22.0.0.dist-info/sboms/halidoscope.cyclonedx.json,sha256=dTg6yOk559RaqPGtpVTrJZ0e-QIsUGr0277jdVCJhOY,671246
|
|
5
|
+
halidoscope-22.0.0.dist-info/RECORD,,
|