Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
InferArguments.h
Go to the documentation of this file.
1#ifndef HALIDE_INFER_ARGUMENTS_H
2#define HALIDE_INFER_ARGUMENTS_H
3
4#include <vector>
5
6#include "Argument.h"
7#include "Buffer.h"
8#include "Expr.h"
9#include "Parameter.h"
10
11/** \file
12 *
13 * Interface for a visitor to infer arguments used in a body Stmt.
14 */
15
16 namespace Halide {
17 namespace Internal {
18
19/** An inferred argument. Inferred args are either Params,
20 * ImageParams, or Buffers. The first two are handled by the param
21 * field, and global images are tracked via the buf field. These
22 * are used directly when jitting, or used for validation when
23 * compiling with an explicit argument list. */
24 struct InferredArgument {
25 Argument arg;
26 Parameter param;
27 Buffer<> buffer;
28
29 bool operator<(const InferredArgument &other) const {
30 if (arg.is_buffer() && !other.arg.is_buffer()) {
31 return true;
32 } else if (other.arg.is_buffer() && !arg.is_buffer()) {
33 return false;
34 } else {
35 return arg.name < other.arg.name;
36 }
37 }
38};
39
40 class Function;
41
42std::vector<InferredArgument> infer_arguments(const Stmt &body, const std::vector<Function> &outputs);
43
44} // namespace Internal
45} // namespace Halide
46
47#endif
Argument.h
Defines a type used for expressing the type signature of a generated halide pipeline.
Buffer.h
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Parameter.h
Defines the internal representation of parameters to halide piplines.
Halide::Buffer<>
Halide::Parameter
A reference-counted handle to a parameter to a halide pipeline.
Definition Parameter.h:40
Halide::Internal::infer_arguments
std::vector< InferredArgument > infer_arguments(const Stmt &body, const std::vector< Function > &outputs)
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::cast
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
Halide::Argument
A struct representing an argument to a halide-generated function.
Definition Argument.h:37
Halide::Argument::is_buffer
bool is_buffer() const
Definition Argument.h:89
Halide::Argument::name
std::string name
The name of the argument.
Definition Argument.h:39
Halide::Internal::InferredArgument
An inferred argument.
Definition InferArguments.h:24
Halide::Internal::InferredArgument::buffer
Buffer buffer
Definition InferArguments.h:27
Halide::Internal::InferredArgument::arg
Argument arg
Definition InferArguments.h:25
Halide::Internal::InferredArgument::operator<
bool operator<(const InferredArgument &other) const
Definition InferArguments.h:29
Halide::Internal::InferredArgument::param
Parameter param
Definition InferArguments.h:26
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition Expr.h:427