Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
OutputImageParam.h
Go to the documentation of this file.
1#ifndef HALIDE_OUTPUT_IMAGE_PARAM_H
2#define HALIDE_OUTPUT_IMAGE_PARAM_H
3
4/** \file
5 *
6 * Classes for declaring output image parameters to halide pipelines
7 */
8
9#include "Argument.h"
10#include "Dimension.h"
11#include "Func.h"
12#include "Var.h"
14
15namespace Halide {
16
17/** A handle on the output buffer of a pipeline. Used to make static
18 * promises about the output size and stride. */
20protected:
21 friend class Func;
22
23 /** A reference-counted handle on the internal parameter object */
25
26 /** Is this an input or an output? OutputImageParam is the base class for both. */
28
29 /** If Input: Func representation of the ImageParam.
30 * If Output: Func that creates this OutputImageParam.
31 */
33
34 void add_implicit_args_if_placeholder(std::vector<Expr> &args,
35 Expr last_arg,
36 int total_args,
37 bool *placeholder_seen) const;
38
39 /** Construct an OutputImageParam that wraps an Internal Parameter object. */
41
42public:
43 /** Construct a null image parameter handle. */
44 OutputImageParam() = default;
45
46 /** Get the name of this Param */
47 const std::string &name() const;
48
49 /** Get the type of the image data this Param refers to */
50 Type type() const;
51
52 /** Is this parameter handle non-nullptr */
53 bool defined() const;
54
55 /** Get a handle on one of the dimensions for the purposes of
56 * inspecting or constraining its min, extent, or stride. */
58
59 /** Get a handle on one of the dimensions for the purposes of
60 * inspecting its min, extent, or stride. */
62
63 /** Get the alignment of the host pointer in bytes. Defaults to
64 * the size of type. */
65 int host_alignment() const;
66
67 /** Set the expected alignment of the host pointer in bytes. */
69
70 /** Get the dimensionality of this image parameter */
71 int dimensions() const;
72
73 /** Get an expression giving the minimum coordinate in dimension 0, which
74 * by convention is the coordinate of the left edge of the image */
75 Expr left() const;
76
77 /** Get an expression giving the maximum coordinate in dimension 0, which
78 * by convention is the coordinate of the right edge of the image */
79 Expr right() const;
80
81 /** Get an expression giving the minimum coordinate in dimension 1, which
82 * by convention is the top of the image */
83 Expr top() const;
84
85 /** Get an expression giving the maximum coordinate in dimension 1, which
86 * by convention is the bottom of the image */
87 Expr bottom() const;
88
89 /** Get an expression giving the extent in dimension 0, which by
90 * convention is the width of the image */
91 Expr width() const;
92
93 /** Get an expression giving the extent in dimension 1, which by
94 * convention is the height of the image */
95 Expr height() const;
96
97 /** Get an expression giving the extent in dimension 2, which by
98 * convention is the channel-count of the image */
99 Expr channels() const;
100
101 /** Get at the internal parameter object representing this ImageParam. */
103
104 /** Construct the appropriate argument matching this parameter,
105 * for the purpose of generating the right type signature when
106 * statically compiling halide pipelines. */
107 operator Argument() const;
108
109 /** Using a param as the argument to an external stage treats it
110 * as an Expr */
111 operator ExternFuncArgument() const;
112
113 /** Set (min, extent) estimates for all dimensions in the ImageParam
114 * at once; this is equivalent to calling `dim(n).set_estimate(min, extent)`
115 * repeatedly, but slightly terser. The size of the estimates vector
116 * must match the dimensionality of the ImageParam. */
118
119 /** Set the desired storage type for this parameter. Only useful
120 * for MemoryType::GPUTexture at present */
122};
123
124} // namespace Halide
125
126#endif
Defines a type used for expressing the type signature of a generated halide pipeline.
Defines the Dimension utility class for Halide pipelines.
Defines Func - the front-end handle on a halide function, and related classes.
This file declares the routines used by Halide internally in its runtime.
Defines the Var - the front-end variable.
A halide function.
Definition Func.h:700
A handle on the output buffer of a pipeline.
Expr right() const
Get an expression giving the maximum coordinate in dimension 0, which by convention is the coordinate...
Type type() const
Get the type of the image data this Param refers to.
Expr left() const
Get an expression giving the minimum coordinate in dimension 0, which by convention is the coordinate...
const std::string & name() const
Get the name of this Param.
Internal::Dimension dim(int i) const
Get a handle on one of the dimensions for the purposes of inspecting its min, extent,...
OutputImageParam & set_host_alignment(int)
Set the expected alignment of the host pointer in bytes.
void add_implicit_args_if_placeholder(std::vector< Expr > &args, Expr last_arg, int total_args, bool *placeholder_seen) const
int dimensions() const
Get the dimensionality of this image parameter.
OutputImageParam(const Parameter &p, Argument::Kind k, Func f)
Construct an OutputImageParam that wraps an Internal Parameter object.
OutputImageParam & store_in(MemoryType type)
Set the desired storage type for this parameter.
bool defined() const
Is this parameter handle non-nullptr.
int host_alignment() const
Get the alignment of the host pointer in bytes.
Expr width() const
Get an expression giving the extent in dimension 0, which by convention is the width of the image.
Expr top() const
Get an expression giving the minimum coordinate in dimension 1, which by convention is the top of the...
Expr bottom() const
Get an expression giving the maximum coordinate in dimension 1, which by convention is the bottom of ...
Expr channels() const
Get an expression giving the extent in dimension 2, which by convention is the channel-count of the i...
Internal::Dimension dim(int i)
Get a handle on one of the dimensions for the purposes of inspecting or constraining its min,...
Parameter param
A reference-counted handle on the internal parameter object.
OutputImageParam()=default
Construct a null image parameter handle.
Argument::Kind kind
Is this an input or an output? OutputImageParam is the base class for both.
OutputImageParam & set_estimates(const Region &estimates)
Set (min, extent) estimates for all dimensions in the ImageParam at once; this is equivalent to calli...
Expr height() const
Get an expression giving the extent in dimension 1, which by convention is the height of the image.
Func func
If Input: Func representation of the ImageParam.
Parameter parameter() const
Get at the internal parameter object representing this ImageParam.
A reference-counted handle to a parameter to a halide pipeline.
Definition Parameter.h:40
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
std::vector< Range > Region
A multi-dimensional box.
Definition Expr.h:350
MemoryType
An enum describing different address spaces to be used with Func::store_in.
Definition Expr.h:353
A struct representing an argument to a halide-generated function.
Definition Argument.h:37
Kind
An argument is either a primitive type (for parameters), or a buffer pointer.
Definition Argument.h:52
A fragment of Halide syntax.
Definition Expr.h:258
An argument to an extern-defined Func.
Types in the halide type system.
Definition Type.h:283