Halide 22.0.0 Halide compiler and libraries

Profiling.h
Go to the documentation of this file.
1#ifndef HALIDE_PROFILING_H
2#define HALIDE_PROFILING_H
3
4/** \file
5 * Defines the lowering pass that injects print statements when profiling is turned on.
6 * The profiler will print out per-pipeline and per-func stats, such as total time
7 * spent and heap/stack allocation information. To turn on the profiler, set
8 * HL_TARGET/HL_JIT_TARGET flags to 'host-profile'.
9 *
10 * Output format:
11 * <pipeline_name>
12 * <total time spent in this pipeline> <# of samples taken> <# of runs> <avg time/run>
13 * <# of heap allocations> <peak heap allocation>
14 * <func_name> <total time spent in this func> <percentage of time spent>
15 * (<peak heap alloc by this func> <num of allocs> <average alloc size> |
16 * <worst-case peak stack alloc by this func>)?
17 *
18 * Sample output:
19 * memory_profiler_mandelbrot
20 * total time: 59.832336 ms samples: 43 runs: 1000 time/run: 0.059832 ms
21 * heap allocations: 104000 peak heap usage: 505344 bytes
22 * f0: 0.025673ms (42%)
23 * mandelbrot: 0.006444ms (10%) peak: 505344 num: 104000 avg: 5376
24 * argmin: 0.027715ms (46%) stack: 20
25 */
26#include <map>
27#include <string>
28
29#include "Expr.h"
30
31 namespace Halide {
32 namespace Internal {
33
34 class Function;
35
36/** Take a statement representing a halide pipeline insert
37 * high-resolution timing into the generated code (via spawning a
38 * thread that acts as a sampling profiler); summaries of execution
39 * times and counts will be logged at the end. Should be done before
40 * storage flattening, but after all bounds inference.
41 *
42 */
43 Stmt inject_profiling(const Stmt &, const std::string &, const std::map<std::string, Function> &env);
44
45} // namespace Internal
46} // namespace Halide
47
48#endif
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Halide::Internal::ArgInfoKind::Function
@ Function
Halide::Internal::inject_profiling
Stmt inject_profiling(const Stmt &, const std::string &, const std::map< std::string, Function > &env)
Take a statement representing a halide pipeline insert high-resolution timing into the generated code...
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition: Expr.h:427