Halide 22.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"
13#include "runtime/HalideRuntime.h"
14
15 namespace Halide {
16
17/** A handle on the output buffer of a pipeline. Used to make static
18 * promises about the output size and stride. */
19 class OutputImageParam {
20 protected:
21 friend class Func;
22
23 /** A reference-counted handle on the internal parameter object */
24 Parameter param;
25
26 /** Is this an input or an output? OutputImageParam is the base class for both. */
27 Argument::Kind kind = Argument::InputScalar;
28
29 /** If Input: Func representation of the ImageParam.
30 * If Output: Func that creates this OutputImageParam.
31 */
32 Func func;
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. */
40 OutputImageParam(const Parameter &p, Argument::Kind k, Func f);
41
42 public:
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. */
57 Internal::Dimension dim(int i);
58
59 /** Get a handle on one of the dimensions for the purposes of
60 * inspecting its min, extent, or stride. */
61 Internal::Dimension dim(int i) const;
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. */
68 OutputImageParam &set_host_alignment(int);
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. */
102 Parameter parameter() const;
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. */
117 OutputImageParam &set_estimates(const Region &estimates);
118
119 /** Set the desired storage type for this parameter. Only useful
120 * for MemoryType::GPUTexture at present */
121 OutputImageParam &store_in(MemoryType type);
122};
123
124} // namespace Halide
125
126#endif
Argument.h
Defines a type used for expressing the type signature of a generated halide pipeline.
Dimension.h
Defines the Dimension utility class for Halide pipelines.
Func.h
Defines Func - the front-end handle on a halide function, and related classes.
HalideRuntime.h
This file declares the routines used by Halide internally in its runtime.
Var.h
Defines the Var - the front-end variable.
Halide::Func
A halide function.
Definition Func.h:728
Halide::Internal::Dimension
Definition Dimension.h:16
Halide::OutputImageParam
A handle on the output buffer of a pipeline.
Definition OutputImageParam.h:19
Halide::OutputImageParam::right
Expr right() const
Get an expression giving the maximum coordinate in dimension 0, which by convention is the coordinate...
Halide::OutputImageParam::type
Type type() const
Get the type of the image data this Param refers to.
Halide::OutputImageParam::left
Expr left() const
Get an expression giving the minimum coordinate in dimension 0, which by convention is the coordinate...
Halide::OutputImageParam::name
const std::string & name() const
Get the name of this Param.
Halide::OutputImageParam::dim
Internal::Dimension dim(int i) const
Get a handle on one of the dimensions for the purposes of inspecting its min, extent,...
Halide::OutputImageParam::set_host_alignment
OutputImageParam & set_host_alignment(int)
Set the expected alignment of the host pointer in bytes.
Halide::OutputImageParam::add_implicit_args_if_placeholder
void add_implicit_args_if_placeholder(std::vector< Expr > &args, Expr last_arg, int total_args, bool *placeholder_seen) const
Halide::OutputImageParam::dimensions
int dimensions() const
Get the dimensionality of this image parameter.
Halide::OutputImageParam::OutputImageParam
OutputImageParam(const Parameter &p, Argument::Kind k, Func f)
Construct an OutputImageParam that wraps an Internal Parameter object.
Halide::OutputImageParam::store_in
OutputImageParam & store_in(MemoryType type)
Set the desired storage type for this parameter.
Halide::OutputImageParam::defined
bool defined() const
Is this parameter handle non-nullptr.
Halide::OutputImageParam::host_alignment
int host_alignment() const
Get the alignment of the host pointer in bytes.
Halide::OutputImageParam::width
Expr width() const
Get an expression giving the extent in dimension 0, which by convention is the width of the image.
Halide::OutputImageParam::top
Expr top() const
Get an expression giving the minimum coordinate in dimension 1, which by convention is the top of the...
Halide::OutputImageParam::bottom
Expr bottom() const
Get an expression giving the maximum coordinate in dimension 1, which by convention is the bottom of ...
Halide::OutputImageParam::channels
Expr channels() const
Get an expression giving the extent in dimension 2, which by convention is the channel-count of the i...
Halide::OutputImageParam::dim
Internal::Dimension dim(int i)
Get a handle on one of the dimensions for the purposes of inspecting or constraining its min,...
Halide::OutputImageParam::param
Parameter param
A reference-counted handle on the internal parameter object.
Definition OutputImageParam.h:24
Halide::OutputImageParam::OutputImageParam
OutputImageParam()=default
Construct a null image parameter handle.
Halide::OutputImageParam::kind
Argument::Kind kind
Is this an input or an output? OutputImageParam is the base class for both.
Definition OutputImageParam.h:27
Halide::OutputImageParam::set_estimates
OutputImageParam & set_estimates(const Region &estimates)
Set (min, extent) estimates for all dimensions in the ImageParam at once; this is equivalent to calli...
Halide::OutputImageParam::height
Expr height() const
Get an expression giving the extent in dimension 1, which by convention is the height of the image.
Halide::OutputImageParam::func
Func func
If Input: Func representation of the ImageParam.
Definition OutputImageParam.h:32
Halide::OutputImageParam::parameter
Parameter parameter() const
Get at the internal parameter object representing this ImageParam.
Halide::Parameter
A reference-counted handle to a parameter to a halide pipeline.
Definition Parameter.h:40
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
Halide::cast
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
Halide::Region
std::vector< Range > Region
A multi-dimensional box.
Definition Expr.h:350
Halide::MemoryType
MemoryType
An enum describing different address spaces to be used with Func::store_in.
Definition Expr.h:353
Halide::Argument
A struct representing an argument to a halide-generated function.
Definition Argument.h:37
Halide::Argument::Kind
Kind
An argument is either a primitive type (for parameters), or a buffer pointer.
Definition Argument.h:52
Halide::Argument::InputScalar
@ InputScalar
Definition Argument.h:53
Halide::Expr
A fragment of Halide syntax.
Definition Expr.h:258
Halide::ExternFuncArgument
An argument to an extern-defined Func.
Definition ExternFuncArgument.h:17
Halide::Type
Types in the halide type system.
Definition Type.h:281