1 #ifndef HALIDE_PARAMETER_H 2 #define HALIDE_PARAMETER_H 18 struct ArgumentEstimates;
30 #ifdef WITH_SERIALIZATION 34 struct ParameterContents;
41 void check_defined()
const;
42 void check_is_buffer()
const;
43 void check_is_scalar()
const;
44 void check_dim_ok(
int dim)
const;
45 void check_type(
const Type &t)
const;
50 #ifdef WITH_SERIALIZATION 51 friend class Internal::Deserializer;
52 friend class Internal::Serializer;
67 std::optional<halide_scalar_value_t>
scalar_data()
const;
84 const std::optional<halide_scalar_value_t> &
scalar_data,
const Expr &scalar_default,
const Expr &scalar_min,
85 const Expr &scalar_max,
const Expr &scalar_estimate);
119 const std::string &
name()
const;
131 memcpy(&t, &sv.u.u64,
sizeof(t));
Expr default_value() const
Get and set the default values for scalar parameters.
Various utility functions used internally Halide.
Parameter()=default
Construct a new undefined handle.
A fragment of Halide syntax.
const std::vector< BufferConstraint > & buffer_constraints() const
Get buffer constraints for all dimensions, only relevant when serializing.
std::optional< halide_scalar_value_t > scalar_data() const
If the Parameter is a scalar, and the scalar data is valid, return the scalar data.
A class representing a Halide pipeline.
Expr min_constraint_estimate(int dim) const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
Parameter & operator=(const Parameter &)=default
void set_min_constraint(int dim, const Expr &e)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
Expr min(const FuncRef &a, const FuncRef &b)
Explicit overloads of min and max for FuncRef.
A reference-counted handle to a parameter to a halide pipeline.
void set_buffer(const Buffer< void > &b)
If the parameter is a buffer parameter, set its current value.
void * memcpy(void *s1, const void *s2, size_t n)
int host_alignment() const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
void set_estimate(Expr e)
Get and set constraints for scalar parameters.
Expr max_value() const
Get and set constraints for scalar parameters.
Internal::IntrusivePtr< Internal::ParameterContents > contents
Expr extent_constraint(int dim) const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
void set_max_value(const Expr &e)
Get and set constraints for scalar parameters.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide's bounds tools to query properties of it.
void set_extent_constraint(int dim, const Expr &e)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
HALIDE_NO_USER_CODE_INLINE void set_scalar(T val)
If the parameter is a scalar parameter, set its current value.
HALIDE_NO_USER_CODE_INLINE T scalar() const
If the parameter is a scalar parameter, get its currently bound value.
Buffer< void > buffer() const
If the parameter is a buffer parameter, get its currently bound buffer.
halide_scalar_value_t scalar_data_checked() const
If the Parameter is a scalar and has a valid scalar value, return it.
void set_extent_constraint_estimate(int dim, const Expr &extent)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
const halide_buffer_t * raw_buffer() const
Get the raw currently-bound buffer.
Expr scalar_expr() const
This returns the current value of scalar<type()>() as an Expr.
halide_scalar_value_t is a simple union able to represent all the well-known scalar values in a filte...
This file declares the routines used by Halide internally in its runtime.
Expr extent_constraint_estimate(int dim) const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
bool operator<(const Parameter &other) const
Order Parameters by their IntrusivePtr so they can be used to index maps.
const std::string & name() const
Get the name of this parameter.
Expr min_constraint(int dim) const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
void set_min_value(const Expr &e)
Get and set constraints for scalar parameters.
union halide_scalar_value_t::@4 u
Expr estimate() const
Get and set constraints for scalar parameters.
#define HALIDE_NO_USER_CODE_INLINE
Not visible externally, similar to 'static' linkage in C.
bool defined() const
Tests if this handle is non-nullptr.
int dimensions() const
Get the dimensionality of this parameter.
void set_host_alignment(int bytes)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
Support classes for reference-counting via intrusive shared pointers.
bool has_scalar_value() const
This returns true if scalar_expr() would return a valid Expr, false if not.
void set_min_constraint_estimate(int dim, const Expr &min)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
MemoryType memory_type() const
void set_default_value(const Expr &e)
Get and set the default values for scalar parameters.
bool same_as(const Parameter &other) const
Tests if this handle is the same as another handle.
Types in the halide type system.
ArgumentEstimates get_argument_estimates() const
Get the ArgumentEstimates appropriate for this Parameter.
bool is_buffer() const
Does this parameter refer to a buffer/image?
void store_in(MemoryType memory_type)
Expr min_value() const
Get and set constraints for scalar parameters.
void set_stride_constraint(int dim, const Expr &e)
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
The raw representation of an image passed around by generated Halide code.
const void * read_only_scalar_address() const
Get the pointer to the current value of the scalar parameter.
Expr stride_constraint(int dim) const
Get and set constraints for the min, extent, stride, and estimates on the min/extent.
Type type() const
Get the type of this parameter.
void check_call_arg_types(const std::string &name, std::vector< Expr > *args, int dims)
Validate arguments to a call to a func, image or imageparam.
MemoryType
An enum describing different address spaces to be used with Func::store_in.