Halide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Halide Namespace Reference

Defines methods for manipulating and analyzing boolean expressions. More...

Namespaces

 Internal
 
 BoundaryConditions
 namespace to hold functions for imposing boundary conditions on Halide Funcs.
 
 ConciseCasts
 
 IntegerDivideTable
 Built-in images used for fast_integer_divide below.
 
 Runtime
 

Classes

struct  Argument
 A struct representing an argument to a halide-generated function. More...
 
class  Buffer
 A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer. More...
 
struct  Error
 A base class for Halide errors. More...
 
struct  RuntimeError
 An error that occurs while running a JIT-compiled Halide pipeline. More...
 
struct  CompileError
 An error that occurs while compiling a Halide pipeline that Halide attributes to a user error. More...
 
struct  InternalError
 An error that occurs while compiling a Halide pipeline that Halide attributes to an internal compiler bug, or to an invalid use of Halide's internals. More...
 
class  CompileTimeErrorReporter
 CompileTimeErrorReporter is used at compile time (not runtime) when an error or warning is generated by Halide. More...
 
struct  Expr
 A fragment of Halide syntax. More...
 
struct  ExprCompare
 This lets you use an Expr as a key in a map of the form map<Expr, Foo, ExprCompare> More...
 
class  ExternalCode
 
struct  float16_t
 Class that provides a type that implements half precision floating point (IEEE754 2008 binary16) in software. More...
 
struct  VarOrRVar
 A class that can represent Vars or RVars. More...
 
class  Stage
 A single definition of a Func. More...
 
class  FuncRef
 A fragment of front-end syntax of the form f(x, y, z), where x, y, z are Vars or Exprs. More...
 
class  FuncTupleElementRef
 A fragment of front-end syntax of the form f(x, y, z)[index], where x, y, z are Vars or Exprs. More...
 
class  Func
 A halide function. More...
 
struct  ExternFuncArgument
 An argument to an extern-defined Func. More...
 
class  GeneratorParam
 GeneratorParam is a templated class that can be used to modify the behavior of the Generator at code-generation time. More...
 
class  GeneratorInput
 
class  GeneratorOutput
 
class  GeneratorContext
 GeneratorContext is an abstract interface that is used when constructing a Generator Stub; it is used to allow the outer context (typically, either a Generator or "top-level" code) to specify certain information to the inner context to ensure that inner and outer Generators are compiled in a compatible way; at present, this is used to propagate the outer Target to the inner Generator. More...
 
class  JITGeneratorContext
 JITGeneratorContext is a utility implementation of GeneratorContext that is intended for use when using Generator Stubs with the JIT; it simply allows you to wrap a specific Target in a GeneratorContext for use with a stub, often in conjunction with the Halide::get_target_from_environment() call: More...
 
class  NamesInterface
 
class  Generator
 
class  RegisterGenerator
 
class  ImageParam
 An Image parameter to a halide pipeline. More...
 
class  Module
 A halide module. More...
 
class  OutputImageParam
 A handle on the output buffer of a pipeline. More...
 
struct  Outputs
 A struct specifying a collection of outputs. More...
 
class  Param
 A scalar parameter to a halide pipeline. More...
 
struct  CustomLoweringPass
 A custom lowering pass. More...
 
class  Pipeline
 A class representing a Halide pipeline. More...
 
struct  ExternSignature
 
struct  ExternCFunction
 
struct  JITExtern
 
class  RVar
 A reduction variable represents a single dimension of a reduction domain (RDom). More...
 
class  RDom
 A multi-dimensional domain over which to iterate. More...
 
class  ScheduleParam
 A ScheduleParam is a "Param" that can contain a scalar Expr or a LoopLevel; unlike Param<>, its value cannot be set at runtime. More...
 
class  LoopLevel
 A reference to a site in a Halide statement at the top of the body of a particular for loop. More...
 
struct  Convert
 
struct  Target
 A struct representing a target machine and os to generate code for. More...
 
class  Tuple
 Create a small array of Exprs for defining and calling functions with multiple outputs. More...
 
class  Realization
 A Realization is a vector of references to existing Buffer objects. More...
 
struct  Type
 Types in the halide type system. More...
 
class  Var
 A Halide variable, to be used when defining functions. More...
 

Typedefs

typedef Stage ScheduleHandle
 
typedef std::function< Module(const
std::string &, const Target &)> 
ModuleProducer
 

Enumerations

enum  DeviceAPI {
  DeviceAPI::None, DeviceAPI::Host, DeviceAPI::Default_GPU, DeviceAPI::CUDA,
  DeviceAPI::OpenCL, DeviceAPI::GLSL, DeviceAPI::OpenGLCompute, DeviceAPI::Metal,
  DeviceAPI::Hexagon
}
 An enum describing a type of device API. More...
 
enum  NameMangling { NameMangling::Default, NameMangling::C, NameMangling::CPlusPlus }
 An enum to specify calling convention for extern stages. More...
 
enum  StmtOutputFormat { Text, HTML }
 Used to determine if the output printed to file should be as a normal string or as an HTML file which can be opened in a browerser and manipulated via JS and CSS. More...
 
enum  RoundingMode {
  RoundingMode::TowardZero, RoundingMode::ToNearestTiesToEven, RoundingMode::ToNearestTiesToAway, RoundingMode::TowardPositiveInfinity,
  RoundingMode::TowardNegativeInfinity
}
 Rounding modes (IEEE754 2008 4.3 Rounding-direction attributes) More...
 
enum  TailStrategy { TailStrategy::RoundUp, TailStrategy::GuardWithIf, TailStrategy::ShiftInwards, TailStrategy::Auto }
 Different ways to handle a tail case in a split when the factor does not provably divide the extent. More...
 
enum  PrefetchBoundStrategy { PrefetchBoundStrategy::Clamp, PrefetchBoundStrategy::GuardWithIf, PrefetchBoundStrategy::NonFaulting }
 Different ways to handle accesses outside the original extents in a prefetch. More...
 

Functions

EXPORT std::unique_ptr
< llvm::Module > 
codegen_llvm (const Module &module, llvm::LLVMContext &context)
 Given a Halide module, generate an llvm::Module. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const Expr &)
 Emit an expression on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const Type &)
 Emit a halide type on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const Module &)
 Emit a halide Module on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT const
halide_device_interface_t
get_default_device_interface_for_target (const Target &t)
 Get the appropriate halide_device_interface_t * for a target. More...
 
EXPORT const
halide_device_interface_t
get_device_interface_for_device_api (const DeviceAPI &d, const Target &t=get_jit_target_from_environment())
 Gets the appropriate halide_device_interface_t * for a DeviceAPI. More...
 
EXPORT DeviceAPI get_default_device_api_for_target (const Target &t)
 Get the specific DeviceAPI that Halide would select when presented with DeviceAPI::Default_GPU for a given target. More...
 
EXPORT bool exceptions_enabled ()
 Query whether Halide was compiled with exceptions. More...
 
EXPORT void set_custom_compile_time_error_reporter (CompileTimeErrorReporter *error_reporter)
 The default error reporter logs to stderr, then throws an exception (if WITH_EXCEPTIONS) or calls abort (if not). More...
 
EXPORT Expr fast_integer_divide (Expr numerator, Expr denominator)
 Integer division by small values can be done exactly as multiplies and shifts. More...
 
EXPORT Expr fast_integer_modulo (Expr numerator, Expr denominator)
 Use the fast integer division tables to implement a modulo operation via the Euclidean identity: ab = a - (a/b)*b. More...
 
template<typename T >
NO_INLINEevaluate (Expr e)
 JIT-Compile and run enough code to evaluate a Halide expression. More...
 
template<typename First , typename... Rest>
NO_INLINE void evaluate (Tuple t, First first, Rest &&...rest)
 JIT-compile and run enough code to evaluate a Halide Tuple. More...
 
template<typename T >
NO_INLINEevaluate_may_gpu (Expr e)
 JIT-Compile and run enough code to evaluate a Halide expression. More...
 
template<typename T >
decltype(!(T) 0) operator! (const GeneratorParam< T > &a)
 Not operator for GeneratorParam. More...
 
template<typename T >
Expr cast (const Expr &a)
 Cast an expression to the halide type corresponding to the C++ type T. More...
 
Expr cast (Type t, const Expr &a)
 Cast an expression to a new type. More...
 
Expr operator+ (Expr a, Expr b)
 Return the sum of two expressions, doing any necessary type coercion using Internal::match_types. More...
 
Expr operator|| (Expr a, Expr b)
 Returns the logical or of the two arguments. More...
 
Expr operator! (const Expr &a)
 Returns the logical not the argument. More...
 
Expr max (Expr a, Expr b)
 Returns an expression representing the greater of the two arguments, after doing any necessary type coercion using Internal::match_types. More...
 
Expr max (const Expr &a, int b)
 Returns an expression representing the greater of an expression and a constant integer. More...
 
Expr max (int a, const Expr &b)
 Returns an expression representing the greater of a constant integer and an expression. More...
 
Expr max (float a, const Expr &b)
 
Expr max (const Expr &a, float b)
 
template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest...>::value >::type * = nullptr>
Expr max (const A &a, const B &b, const C &c, Rest &&...rest)
 Returns an expression representing the greater of an expressions vector, after doing any necessary type coersion using Internal::match_types. More...
 
Expr min (Expr a, Expr b)
 
Expr min (const Expr &a, int b)
 Returns an expression representing the lesser of an expression and a constant integer. More...
 
Expr min (int a, const Expr &b)
 Returns an expression representing the lesser of a constant integer and an expression. More...
 
Expr min (float a, const Expr &b)
 
Expr min (const Expr &a, float b)
 
template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest...>::value >::type * = nullptr>
Expr min (const A &a, const B &b, const C &c, Rest &&...rest)
 Returns an expression representing the lesser of an expressions vector, after doing any necessary type coersion using Internal::match_types. More...
 
Expr clamp (const Expr &a, const Expr &min_val, const Expr &max_val)
 Clamps an expression to lie within the given bounds. More...
 
Expr abs (const Expr &a)
 Returns the absolute value of a signed integer or floating-point expression. More...
 
Expr absd (Expr a, Expr b)
 Return the absolute difference between two values. More...
 
Expr select (Expr condition, Expr true_value, Expr false_value)
 Returns an expression similar to the ternary operator in C, except that it always evaluates all arguments. More...
 
template<typename... Args, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Args...>::value >::type * = nullptr>
Expr select (const Expr &c0, const Expr &v0, const Expr &c1, const Expr &v1, Args &&...args)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr sin (const Expr &x)
 Return the sine of a floating-point expression. More...
 
Expr asin (const Expr &x)
 Return the arcsine of a floating-point expression. More...
 
Expr cos (const Expr &x)
 Return the cosine of a floating-point expression. More...
 
Expr acos (const Expr &x)
 Return the arccosine of a floating-point expression. More...
 
Expr tan (const Expr &x)
 Return the tangent of a floating-point expression. More...
 
Expr atan (const Expr &x)
 Return the arctangent of a floating-point expression. More...
 
Expr atan2 (Expr y, Expr x)
 Return the angle of a floating-point gradient. More...
 
Expr sinh (const Expr &x)
 Return the hyperbolic sine of a floating-point expression. More...
 
Expr asinh (const Expr &x)
 Return the hyperbolic arcsinhe of a floating-point expression. More...
 
Expr cosh (const Expr &x)
 Return the hyperbolic cosine of a floating-point expression. More...
 
Expr acosh (const Expr &x)
 Return the hyperbolic arccosine of a floating-point expression. More...
 
Expr tanh (const Expr &x)
 Return the hyperbolic tangent of a floating-point expression. More...
 
Expr atanh (const Expr &x)
 Return the hyperbolic arctangent of a floating-point expression. More...
 
Expr sqrt (const Expr &x)
 Return the square root of a floating-point expression. More...
 
Expr hypot (const Expr &x, const Expr &y)
 Return the square root of the sum of the squares of two floating-point expressions. More...
 
Expr exp (const Expr &x)
 Return the exponential of a floating-point expression. More...
 
Expr log (const Expr &x)
 Return the logarithm of a floating-point expression. More...
 
Expr pow (Expr x, Expr y)
 Return one floating point expression raised to the power of another. More...
 
Expr erf (const Expr &x)
 Evaluate the error function erf. More...
 
EXPORT Expr fast_log (const Expr &x)
 Fast approximate cleanly vectorizable log for Float(32). More...
 
EXPORT Expr fast_exp (const Expr &x)
 Fast approximate cleanly vectorizable exp for Float(32). More...
 
Expr fast_pow (Expr x, Expr y)
 Fast approximate cleanly vectorizable pow for Float(32). More...
 
Expr fast_inverse (const Expr &x)
 Fast approximate inverse for Float(32). More...
 
Expr fast_inverse_sqrt (const Expr &x)
 Fast approximate inverse square root for Float(32). More...
 
Expr floor (const Expr &x)
 Return the greatest whole number less than or equal to a floating-point expression. More...
 
Expr ceil (const Expr &x)
 Return the least whole number greater than or equal to a floating-point expression. More...
 
Expr round (const Expr &x)
 Return the whole number closest to a floating-point expression. More...
 
Expr trunc (const Expr &x)
 Return the integer part of a floating-point expression. More...
 
Expr is_nan (const Expr &x)
 Returns true if the argument is a Not a Number (NaN). More...
 
Expr fract (const Expr &x)
 Return the fractional part of a floating-point expression. More...
 
Expr reinterpret (Type t, const Expr &e)
 Reinterpret the bits of one value as another type. More...
 
template<typename T >
Expr reinterpret (const Expr &e)
 
Expr operator& (Expr x, Expr y)
 Return the bitwise and of two expressions (which need not have the same type). More...
 
Expr operator| (Expr x, Expr y)
 Return the bitwise or of two expressions (which need not have the same type). More...
 
Expr operator^ (Expr x, Expr y)
 Return the bitwise exclusive or of two expressions (which need not have the same type). More...
 
Expr operator~ (const Expr &x)
 Return the bitwise not of an expression. More...
 
Expr lerp (Expr zero_val, Expr one_val, Expr weight)
 Linear interpolate between the two values according to a weight. More...
 
Expr popcount (const Expr &x)
 Count the number of set bits in an expression. More...
 
Expr count_leading_zeros (const Expr &x)
 Count the number of leading zero bits in an expression. More...
 
Expr count_trailing_zeros (const Expr &x)
 Count the number of trailing zero bits in an expression. More...
 
Expr div_round_to_zero (Expr x, Expr y)
 Divide two integers, rounding towards zero. More...
 
Expr mod_round_to_zero (Expr x, Expr y)
 Compute the remainder of dividing two integers, when division is rounding toward zero. More...
 
Expr random_float (const Expr &seed=Expr())
 Return a random variable representing a uniformly distributed float in the half-open interval [0.0f, 1.0f). More...
 
Expr random_uint (const Expr &seed=Expr())
 Return a random variable representing a uniformly distributed unsigned 32-bit integer. More...
 
Expr random_int (const Expr &seed=Expr())
 Return a random variable representing a uniformly distributed 32-bit integer. More...
 
Expr undef (Type t)
 Return an undef value of the given type. More...
 
template<typename T >
Expr undef ()
 
Expr likely (const Expr &e)
 Expressions tagged with this intrinsic are considered to be part of the steady state of some loop with a nasty beginning and end (e.g. More...
 
Expr likely_if_innermost (const Expr &e)
 Equivalent to likely, but only triggers a loop partitioning if found in an innermost loop. More...
 
template<typename T >
Expr saturating_cast (const Expr &e)
 Cast an expression to the halide type corresponding to the C++ type T clamping to the minimum and maximum values of the result type. More...
 
EXPORT Expr saturating_cast (Type t, Expr e)
 Cast an expression to a new type, clamping to the minimum and maximum values of the result type. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const DeviceAPI &)
 Emit a halide device api type in a human readable form. More...
 
Func lambda (Expr e)
 Create a zero-dimensional halide function that returns the given expression. More...
 
Func lambda (Var x, Expr e)
 Create a 1-D halide function in the first argument that returns the second argument. More...
 
Func lambda (Var x, Var y, Expr e)
 Create a 2-D halide function in the first two arguments that returns the last argument. More...
 
Func lambda (Var x, Var y, Var z, Expr e)
 Create a 3-D halide function in the first three arguments that returns the last argument. More...
 
Func lambda (Var x, Var y, Var z, Var w, Expr e)
 Create a 4-D halide function in the first four arguments that returns the last argument. More...
 
Func lambda (Var x, Var y, Var z, Var w, Var v, Expr e)
 Create a 5-D halide function in the first five arguments that returns the last argument. More...
 
EXPORT std::unique_ptr
< llvm::Module > 
compile_module_to_llvm_module (const Module &module, llvm::LLVMContext &context)
 Generate an LLVM module. More...
 
std::unique_ptr
< llvm::raw_fd_ostream > 
make_raw_fd_ostream (const std::string &filename)
 Construct an llvm output stream for writing to files. More...
 
EXPORT void create_static_library (const std::vector< std::string > &src_files, const Target &target, const std::string &dst_file, bool deterministic=true)
 Concatenate the list of src_files into dst_file, using the appropriate static library format for the given target (e.g., .a or .lib). More...
 
EXPORT Module link_modules (const std::string &name, const std::vector< Module > &modules)
 Link a set of modules together into one module. More...
 
EXPORT void compile_standalone_runtime (const std::string &object_filename, Target t)
 Create an object file containing the Halide runtime for a given target. More...
 
EXPORT Outputs compile_standalone_runtime (const Outputs &output_files, Target t)
 Create an object and/or static library file containing the Halide runtime for a given target. More...
 
EXPORT void compile_multitarget (const std::string &fn_name, const Outputs &output_files, const std::vector< Target > &targets, ModuleProducer module_producer, const std::map< std::string, std::string > &suffixes={})
 
Expr user_context_value ()
 Returns an Expr corresponding to the user context passed to the function (if any). More...
 
std::ostream & operator<< (std::ostream &stream, RVar)
 Emit an RVar in a human-readable form. More...
 
std::ostream & operator<< (std::ostream &stream, RDom)
 Emit an RDom in a human-readable form. More...
 
EXPORT Target get_host_target ()
 Return the target corresponding to the host machine. More...
 
EXPORT Target get_target_from_environment ()
 Return the target that Halide will use. More...
 
EXPORT Target get_jit_target_from_environment ()
 Return the target that Halide will use for jit-compilation. More...
 
EXPORT Target::Feature target_feature_for_device_api (DeviceAPI api)
 Get the Target feature corresponding to a DeviceAPI. More...
 
Type Int (int bits, int lanes=1)
 Constructing a signed integer type. More...
 
Type UInt (int bits, int lanes=1)
 Constructing an unsigned integer type. More...
 
Type Float (int bits, int lanes=1)
 Construct a floating-point type. More...
 
Type Bool (int lanes=1)
 Construct a boolean type. More...
 
Type Handle (int lanes=1, const halide_handle_cplusplus_type *handle_type=nullptr)
 Construct a handle type. More...
 
template<typename T >
Type type_of ()
 Construct the halide equivalent of a C type. More...
 
template<typename First , typename... Rest>
NO_INLINE void evaluate_may_gpu (Tuple t, First first, Rest &&...rest)
 JIT-compile and run enough code to evaluate a Halide Tuple. More...
 
template<typename Other , typename T >
decltype((Other) 0+(T) 0) operator+ (const Other &a, const GeneratorParam< T > &b)
 Addition between GeneratorParam<T> and any type that supports operator+ with T. More...
 
template<typename Other , typename T >
decltype((T) 0+(Other) 0) operator+ (const GeneratorParam< T > &a, const Other &b)
 Addition between GeneratorParam<T> and any type that supports operator+ with T. More...
 
template<typename Other , typename T >
decltype((Other) 0-(T) 0) operator- (const Other &a, const GeneratorParam< T > &b)
 Subtraction between GeneratorParam<T> and any type that supports operator- with T. More...
 
template<typename Other , typename T >
decltype((T) 0-(Other) 0) operator- (const GeneratorParam< T > &a, const Other &b)
 Subtraction between GeneratorParam<T> and any type that supports operator- with T. More...
 
template<typename Other , typename T >
decltype((Other) 0 *(T) 0) operator* (const Other &a, const GeneratorParam< T > &b)
 Multiplication between GeneratorParam<T> and any type that supports operator* with T. More...
 
template<typename Other , typename T >
decltype((Other) 0 *(T) 0) operator* (const GeneratorParam< T > &a, const Other &b)
 Multiplication between GeneratorParam<T> and any type that supports operator* with T. More...
 
template<typename Other , typename T >
decltype((Other) 0/(T) 1) operator/ (const Other &a, const GeneratorParam< T > &b)
 Division between GeneratorParam<T> and any type that supports operator/ with T. More...
 
template<typename Other , typename T >
decltype((T) 0/(Other) 1) operator/ (const GeneratorParam< T > &a, const Other &b)
 Division between GeneratorParam<T> and any type that supports operator/ with T. More...
 
template<typename Other , typename T >
decltype((Other) 0%(T) 1) operator% (const Other &a, const GeneratorParam< T > &b)
 Modulo between GeneratorParam<T> and any type that supports operator% with T. More...
 
template<typename Other , typename T >
decltype((T) 0%(Other) 1) operator% (const GeneratorParam< T > &a, const Other &b)
 Modulo between GeneratorParam<T> and any type that supports operator% with T. More...
 
template<typename Other , typename T >
decltype((Other) 0 >(T) 1) operator> (const Other &a, const GeneratorParam< T > &b)
 Greater than comparison between GeneratorParam<T> and any type that supports operator> with T. More...
 
template<typename Other , typename T >
decltype((T) 0 >(Other) 1) operator> (const GeneratorParam< T > &a, const Other &b)
 Greater than comparison between GeneratorParam<T> and any type that supports operator> with T. More...
 
template<typename Other , typename T >
decltype((Other) 0< (T) 1) operator< (const Other &a, const GeneratorParam< T > &b)
 Less than comparison between GeneratorParam<T> and any type that supports operator< with T. More...
 
template<typename Other , typename T >
decltype((T) 0< (Other) 1) operator< (const GeneratorParam< T > &a, const Other &b)
 Less than comparison between GeneratorParam<T> and any type that supports operator< with T. More...
 
template<typename Other , typename T >
decltype((Other) 0 >=(T) 1) operator>= (const Other &a, const GeneratorParam< T > &b)
 Greater than or equal comparison between GeneratorParam<T> and any type that supports operator>= with T. More...
 
template<typename Other , typename T >
decltype((T) 0 >=(Other) 1) operator>= (const GeneratorParam< T > &a, const Other &b)
 Greater than or equal comparison between GeneratorParam<T> and any type that supports operator>= with T. More...
 
template<typename Other , typename T >
decltype((Other) 0<=(T) 1) operator<= (const Other &a, const GeneratorParam< T > &b)
 Less than or equal comparison between GeneratorParam<T> and any type that supports operator<= with T. More...
 
template<typename Other , typename T >
decltype((T) 0<=(Other) 1) operator<= (const GeneratorParam< T > &a, const Other &b)
 Less than or equal comparison between GeneratorParam<T> and any type that supports operator<= with T. More...
 
template<typename Other , typename T >
decltype((Other) 0==(T) 1) operator== (const Other &a, const GeneratorParam< T > &b)
 Equality comparison between GeneratorParam<T> and any type that supports operator== with T. More...
 
template<typename Other , typename T >
decltype((T) 0==(Other) 1) operator== (const GeneratorParam< T > &a, const Other &b)
 Equality comparison between GeneratorParam<T> and any type that supports operator== with T. More...
 
template<typename Other , typename T >
decltype((Other) 0!=(T) 1) operator!= (const Other &a, const GeneratorParam< T > &b)
 Inequality comparison between between GeneratorParam<T> and any type that supports operator!= with T. More...
 
template<typename Other , typename T >
decltype((T) 0!=(Other) 1) operator!= (const GeneratorParam< T > &a, const Other &b)
 Inequality comparison between between GeneratorParam<T> and any type that supports operator!= with T. More...
 
template<typename Other , typename T >
decltype((Other) 0 &&(T) 1) operator&& (const Other &a, const GeneratorParam< T > &b)
 Logical and between between GeneratorParam<T> and any type that supports operator&& with T. More...
 
template<typename Other , typename T >
decltype((T) 0 &&(Other) 1) operator&& (const GeneratorParam< T > &a, const Other &b)
 Logical and between between GeneratorParam<T> and any type that supports operator&& with T. More...
 
template<typename Other , typename T >
decltype((Other) 0||(T) 1) operator|| (const Other &a, const GeneratorParam< T > &b)
 Logical or between between GeneratorParam<T> and any type that supports operator&& with T. More...
 
template<typename Other , typename T >
decltype((T) 0||(Other) 1) operator|| (const GeneratorParam< T > &a, const Other &b)
 Logical or between between GeneratorParam<T> and any type that supports operator&& with T. More...
 
template<typename Other , typename T >
auto min (const Other &a, const GeneratorParam< T > &b) -> decltype(Internal::GeneratorMinMax::min_forward(a, b))
 Compute minimum between GeneratorParam<T> and any type that supports min with T. More...
 
template<typename Other , typename T >
auto min (const GeneratorParam< T > &a, const Other &b) -> decltype(Internal::GeneratorMinMax::min_forward(a, b))
 Compute minimum between GeneratorParam<T> and any type that supports min with T. More...
 
template<typename Other , typename T >
auto max (const Other &a, const GeneratorParam< T > &b) -> decltype(Internal::GeneratorMinMax::max_forward(a, b))
 Compute the maximum value between GeneratorParam<T> and any type that supports max with T. More...
 
template<typename Other , typename T >
auto max (const GeneratorParam< T > &a, const Other &b) -> decltype(Internal::GeneratorMinMax::max_forward(a, b))
 Compute the maximum value between GeneratorParam<T> and any type that supports max with T. More...
 
EXPORT Expr sum (Expr, const std::string &s="sum")
 An inline reduction. More...
 
EXPORT Expr product (Expr, const std::string &s="product")
 An inline reduction. More...
 
EXPORT Expr maximum (Expr, const std::string &s="maximum")
 An inline reduction. More...
 
EXPORT Expr minimum (Expr, const std::string &s="minimum")
 An inline reduction. More...
 
EXPORT Expr sum (RDom, Expr, const std::string &s="sum")
 Variants of the inline reduction in which the RDom is stated explicitly. More...
 
EXPORT Expr product (RDom, Expr, const std::string &s="product")
 Variants of the inline reduction in which the RDom is stated explicitly. More...
 
EXPORT Expr maximum (RDom, Expr, const std::string &s="maximum")
 Variants of the inline reduction in which the RDom is stated explicitly. More...
 
EXPORT Expr minimum (RDom, Expr, const std::string &s="minimum")
 Variants of the inline reduction in which the RDom is stated explicitly. More...
 
EXPORT Tuple argmax (Expr, const std::string &s="argmax")
 Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression. More...
 
EXPORT Tuple argmin (Expr, const std::string &s="argmin")
 Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression. More...
 
EXPORT Tuple argmax (RDom, Expr, const std::string &s="argmax")
 Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression. More...
 
EXPORT Tuple argmin (RDom, Expr, const std::string &s="argmin")
 Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression. More...
 
Expr operator+ (const Expr &a, int b)
 Add an expression and a constant integer. More...
 
Expr operator+ (int a, const Expr &b)
 Add a constant integer and an expression. More...
 
Exproperator+= (Expr &a, const Expr &b)
 Modify the first expression to be the sum of two expressions, without changing its type. More...
 
Expr operator- (Expr a, Expr b)
 Return the difference of two expressions, doing any necessary type coercion using Internal::match_types. More...
 
Expr operator- (const Expr &a, int b)
 Subtracts a constant integer from an expression. More...
 
Expr operator- (int a, const Expr &b)
 Subtracts an expression from a constant integer. More...
 
Expr operator- (const Expr &a)
 Return the negative of the argument. More...
 
Exproperator-= (Expr &a, const Expr &b)
 Modify the first expression to be the difference of two expressions, without changing its type. More...
 
Expr operator* (Expr a, Expr b)
 Return the product of two expressions, doing any necessary type coercion using Internal::match_types. More...
 
Expr operator* (const Expr &a, int b)
 Multiply an expression and a constant integer. More...
 
Expr operator* (int a, const Expr &b)
 Multiply a constant integer and an expression. More...
 
Exproperator*= (Expr &a, const Expr &b)
 Modify the first expression to be the product of two expressions, without changing its type. More...
 
Expr operator/ (Expr a, Expr b)
 Return the ratio of two expressions, doing any necessary type coercion using Internal::match_types. More...
 
Exproperator/= (Expr &a, const Expr &b)
 Modify the first expression to be the ratio of two expressions, without changing its type. More...
 
Expr operator/ (const Expr &a, int b)
 Divides an expression by a constant integer. More...
 
Expr operator/ (int a, const Expr &b)
 Divides a constant integer by an expression. More...
 
Expr operator% (Expr a, Expr b)
 Return the first argument reduced modulo the second, doing any necessary type coercion using Internal::match_types. More...
 
Expr operator% (const Expr &a, int b)
 Mods an expression by a constant integer. More...
 
Expr operator% (int a, const Expr &b)
 Mods a constant integer by an expression. More...
 
Expr operator> (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is greater than the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator> (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is greater than a constant integer. More...
 
Expr operator> (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is greater than an expression. More...
 
Expr operator< (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is less than the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator< (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is less than a constant integer. More...
 
Expr operator< (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is less than an expression. More...
 
Expr operator<= (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is less than or equal to the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator<= (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is less than or equal to a constant integer. More...
 
Expr operator<= (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is less than or equal to an expression. More...
 
Expr operator>= (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is greater than or equal to the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator>= (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is greater than or equal to a constant integer. More...
 
Expr operator>= (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is greater than or equal to an expression. More...
 
Expr operator== (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is equal to the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator== (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is equal to a constant integer. More...
 
Expr operator== (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is equal to an expression. More...
 
Expr operator!= (Expr a, Expr b)
 Return a boolean expression that tests whether the first argument is not equal to the second, after doing any necessary type coercion using Internal::match_types. More...
 
Expr operator!= (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is not equal to a constant integer. More...
 
Expr operator!= (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is not equal to an expression. More...
 
Expr operator&& (Expr a, Expr b)
 Returns the logical and of the two arguments. More...
 
Expr operator&& (const Expr &a, bool b)
 Logical and of an Expr and a bool. More...
 
Expr operator&& (bool a, const Expr &b)
 Add an expression and a constant integer. More...
 
Expr operator|| (const Expr &a, bool b)
 Logical or of an Expr and a bool. More...
 
Expr operator|| (bool a, const Expr &b)
 Logical or of an Expr and a bool. More...
 
Expr operator+ (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator+ (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator- (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator- (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator* (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator* (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator/ (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator/ (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator% (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator% (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator> (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator> (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator< (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator< (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator>= (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator>= (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator<= (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator<= (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator== (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator== (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator!= (const Expr &a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator!= (float a, const Expr &b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator<< (Expr x, Expr y)
 Shift the bits of an integer value left. More...
 
Expr operator<< (const Expr &x, int y)
 Shift the bits of an integer value left. More...
 
Expr operator<< (int x, const Expr &y)
 Shift the bits of an integer value left. More...
 
Expr operator>> (Expr x, Expr y)
 Shift the bits of an integer value right. More...
 
Expr operator>> (const Expr &x, int y)
 Shift the bits of an integer value right. More...
 
Expr operator>> (int x, const Expr &y)
 Shift the bits of an integer value right. More...
 
EXPORT Expr print (const std::vector< Expr > &values)
 Create an Expr that prints out its value whenever it is evaluated. More...
 
template<typename... Args>
NO_INLINE Expr print (const Expr &a, Args &&...args)
 Create an Expr that prints out its value whenever it is evaluated. More...
 
EXPORT Expr print_when (const Expr &condition, const std::vector< Expr > &values)
 Create an Expr that prints whenever it is evaluated, provided that the condition is true. More...
 
template<typename... Args>
NO_INLINE Expr print_when (const Expr &condition, const Expr &a, Args &&...args)
 Create an Expr that prints whenever it is evaluated, provided that the condition is true. More...
 
EXPORT Expr require (const Expr &condition, const std::vector< Expr > &values)
 Create an Expr that that guarantees a precondition. More...
 
template<typename... Args>
NO_INLINE Expr require (const Expr &condition, const Expr &value, Args &&...args)
 Create an Expr that that guarantees a precondition. More...
 
template<typename... Args>
NO_INLINE Expr memoize_tag (const Expr &result, Args &&...args)
 Control the values used in the memoization cache key for memoize. More...
 
EXPORT void compile_llvm_module_to_object (llvm::Module &module, Internal::LLVMOStream &out)
 Compile an LLVM module to native targets (objects, native assembly). More...
 
EXPORT void compile_llvm_module_to_assembly (llvm::Module &module, Internal::LLVMOStream &out)
 Compile an LLVM module to native targets (objects, native assembly). More...
 
EXPORT void compile_llvm_module_to_llvm_bitcode (llvm::Module &module, Internal::LLVMOStream &out)
 Compile an LLVM module to LLVM targets (bitcode, LLVM assembly). More...
 
EXPORT void compile_llvm_module_to_llvm_assembly (llvm::Module &module, Internal::LLVMOStream &out)
 Compile an LLVM module to LLVM targets (bitcode, LLVM assembly). More...
 
Tuple tuple_select (Tuple condition, const Tuple &true_value, const Tuple &false_value)
 Equivalents of some standard operators for tuples. More...
 
Tuple tuple_select (Expr condition, const Tuple &true_value, const Tuple &false_value)
 Equivalents of some standard operators for tuples. More...
 

Variables

const DeviceAPI all_device_apis []
 An array containing all the device apis. More...
 
EXPORT Var _
 A placeholder variable for infered arguments. More...
 
EXPORT Var _0
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _1
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _2
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _3
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _4
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _5
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _6
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _7
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _8
 The first ten implicit Vars for use in scheduling. More...
 
EXPORT Var _9
 The first ten implicit Vars for use in scheduling. More...
 

Detailed Description

Defines methods for manipulating and analyzing boolean expressions.

Typedef Documentation

Definition at line 301 of file Func.h.

typedef std::function<Module(const std::string &, const Target &)> Halide::ModuleProducer

Definition at line 144 of file Module.h.

Enumeration Type Documentation

enum Halide::DeviceAPI
strong

An enum describing a type of device API.

Used by schedules, and in the For loop IR node.

Enumerator
None 
Host 

Used to denote for loops that run on the same device as the containing code.

Default_GPU 
CUDA 
OpenCL 
GLSL 
OpenGLCompute 
Metal 
Hexagon 

Definition at line 306 of file Expr.h.

enum Halide::NameMangling
strong

An enum to specify calling convention for extern stages.

Enumerator
Default 

Match whatever is specified in the Target.

C 

No name mangling.

CPlusPlus 

C++ name mangling.

Definition at line 56 of file Function.h.

Used to determine if the output printed to file should be as a normal string or as an HTML file which can be opened in a browerser and manipulated via JS and CSS.

Enumerator
Text 
HTML 

Definition at line 33 of file Pipeline.h.

enum Halide::RoundingMode
strong

Rounding modes (IEEE754 2008 4.3 Rounding-direction attributes)

Enumerator
TowardZero 

Round towards zero (IEEE754 2008 4.3.2)

ToNearestTiesToEven 

Round to nearest, when there is a tie pick even integral significand (IEEE754 2008 4.3.1)

ToNearestTiesToAway 

Round to nearest, when there is a tie pick value furthest away from zero (IEEE754 2008 4.3.1)

TowardPositiveInfinity 

Round towards positive infinity (IEEE754 2008 4.3.2)

TowardNegativeInfinity 

Round towards negative infinity (IEEE754 2008 4.3.2)

Definition at line 6 of file RoundingMode.h.

enum Halide::TailStrategy
strong

Different ways to handle a tail case in a split when the factor does not provably divide the extent.

Enumerator
RoundUp 

Round up the extent to be a multiple of the split factor.

Not legal for RVars, as it would change the meaning of the algorithm. Pros: generates the simplest, fastest code. Cons: if used on a stage that reads from the input or writes to the output, constrains the input or output size to be a multiple of the split factor.

GuardWithIf 

Guard the inner loop with an if statement that prevents evaluation beyond the original extent.

Always legal. The if statement is treated like a boundary condition, and factored out into a loop epilogue if possible. Pros: no redundant re-evaluation; does not constrain input our output sizes. Cons: increases code size due to separate tail-case handling; vectorization will scalarize in the tail case to handle the if statement.

ShiftInwards 

Prevent evaluation beyond the original extent by shifting the tail case inwards, re-evaluating some points near the end.

Only legal for pure variables in pure definitions. If the inner loop is very simple, the tail case is treated like a boundary condition and factored out into an epilogue.

This is a good trade-off between several factors. Like RoundUp, it supports vectorization well, because the inner loop is always a fixed size with no data-dependent branching. It increases code size slightly for inner loops due to the epilogue handling, but not for outer loops (e.g. loops over tiles). If used on a stage that reads from an input or writes to an output, this stategy only requires that the input/output extent be at least the split factor, instead of a multiple of the split factor as with RoundUp.

Auto 

For pure definitions use ShiftInwards.

For pure vars in update definitions use RoundUp. For RVars in update definitions use GuardWithIf.

Definition at line 28 of file Schedule.h.

Different ways to handle accesses outside the original extents in a prefetch.

Enumerator
Clamp 

Clamp the prefetched exprs by intersecting the prefetched region with the original extents.

This may make the exprs of the prefetched region more complicated.

GuardWithIf 

Guard the prefetch with if-guards that ignores the prefetch if any of the prefetched region ever goes beyond the original extents (i.e.

all or nothing).

NonFaulting 

Leave the prefetched exprs as are (no if-guards around the prefetch and no intersecting with the original extents).

This makes the prefetch exprs simpler but this may cause prefetching of region outside the original extents. This is good if prefetch won't fault when accessing region outside the original extents.

Definition at line 72 of file Schedule.h.

Function Documentation

EXPORT std::unique_ptr<llvm::Module> Halide::codegen_llvm ( const Module &  module,
llvm::LLVMContext &  context 
)

Given a Halide module, generate an llvm::Module.

EXPORT std::ostream & Halide::operator<< ( std::ostream &  stream,
const Expr &   
)

Emit an expression on an output stream (such as std::cout) in a human-readable form.

EXPORT std::ostream & Halide::operator<< ( std::ostream &  stream,
const Type &   
)

Emit a halide type on an output stream (such as std::cout) in a human-readable form.

EXPORT std::ostream & Halide::operator<< ( std::ostream &  stream,
const Module &   
)

Emit a halide Module on an output stream (such as std::cout) in a human-readable form.

EXPORT const halide_device_interface_t* Halide::get_default_device_interface_for_target ( const Target &  t)

Get the appropriate halide_device_interface_t * for a target.

Corresponds to the device interface that would be used for DeviceAPI::Default_GPU. Creates a GPU runtime module for the target if necessary. Returns nullptr if no device APIs are enabled in the target.

Referenced by Halide::Buffer<>::copy_to_device(), and Halide::Buffer<>::device_malloc().

EXPORT const halide_device_interface_t* Halide::get_device_interface_for_device_api ( const DeviceAPI &  d,
const Target &  t = get_jit_target_from_environment() 
)

Gets the appropriate halide_device_interface_t * for a DeviceAPI.

Returns null if that device API is not enabled in the target, or if the argument is None or Host.

Referenced by Halide::Buffer<>::copy_to_device(), and Halide::Buffer<>::device_malloc().

EXPORT DeviceAPI Halide::get_default_device_api_for_target ( const Target &  t)

Get the specific DeviceAPI that Halide would select when presented with DeviceAPI::Default_GPU for a given target.

If no suitable api is enabled in the target, returns DeviceAPI::Host.

EXPORT bool Halide::exceptions_enabled ( )

Query whether Halide was compiled with exceptions.

EXPORT void Halide::set_custom_compile_time_error_reporter ( CompileTimeErrorReporter *  error_reporter)

The default error reporter logs to stderr, then throws an exception (if WITH_EXCEPTIONS) or calls abort (if not).

This allows customization of that behavior if a more gentle response to error reporting is desired. Note that error_reporter is expected to remain valid across all Halide usage; it is up to the caller to ensure that this is the case (and to do any cleanup necessary).

EXPORT Expr Halide::fast_integer_divide ( Expr  numerator,
Expr  denominator 
)

Integer division by small values can be done exactly as multiplies and shifts.

This function does integer division for numerators of various integer types (8, 16, 32 bit signed and unsigned) numerators and uint8 denominators. The type of the result is the type of the numerator. The unsigned version is faster than the signed version, so cast the numerator to an unsigned int if you know it's positive.

If your divisor is compile-time constant, Halide performs a slightly better optimization automatically, so there's no need to use this function (but it won't hurt).

This function vectorizes well on arm, and well on x86 for 16 and 8 bit vectors. For 32-bit vectors on x86 you're better off using native integer division.

Also, this routine treats division by zero as division by

  1. I.e. it interprets the uint8 divisor as a number from 1 to 256 inclusive.
EXPORT Expr Halide::fast_integer_modulo ( Expr  numerator,
Expr  denominator 
)

Use the fast integer division tables to implement a modulo operation via the Euclidean identity: ab = a - (a/b)*b.

template<typename T >
NO_INLINE T Halide::evaluate ( Expr  e)

JIT-Compile and run enough code to evaluate a Halide expression.

This can be thought of as a scalar version of Func::realize

Definition at line 2029 of file Func.h.

References Halide::Expr::type(), and user_assert.

template<typename First , typename... Rest>
NO_INLINE void Halide::evaluate ( Tuple  t,
First  first,
Rest &&...  rest 
)

JIT-compile and run enough code to evaluate a Halide Tuple.

Definition at line 2042 of file Func.h.

References Halide::Internal::assign_results(), Halide::Internal::check_types(), Halide::Func::realize(), and Halide::Runtime::Internal::t.

template<typename T >
NO_INLINE T Halide::evaluate_may_gpu ( Expr  e)

JIT-Compile and run enough code to evaluate a Halide expression.

This can be thought of as a scalar version of Func::realize. Can use GPU if jit target from environment specifies one.

Definition at line 2072 of file Func.h.

References Halide::Internal::schedule_scalar(), Halide::Expr::type(), and user_assert.

template<typename First , typename... Rest>
NO_INLINE void Halide::evaluate_may_gpu ( Tuple  t,
First  first,
Rest &&...  rest 
)

JIT-compile and run enough code to evaluate a Halide Tuple.

Can use GPU if jit target from environment specifies one.

Definition at line 2088 of file Func.h.

References Halide::Internal::assign_results(), Halide::Internal::check_types(), Halide::Func::realize(), Halide::Internal::schedule_scalar(), and Halide::Runtime::Internal::t.

template<typename Other , typename T >
decltype((Other)0 + (T)0) Halide::operator+ ( const Other &  a,
const GeneratorParam< T > &  b 
)

Addition between GeneratorParam<T> and any type that supports operator+ with T.

Returns type of underlying operator+.

Examples:
tutorial/lesson_13_tuples.cpp.

Definition at line 743 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 + (Other)0) Halide::operator+ ( const GeneratorParam< T > &  a,
const Other &  b 
)

Addition between GeneratorParam<T> and any type that supports operator+ with T.

Returns type of underlying operator+.

Definition at line 745 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 - (T)0) Halide::operator- ( const Other &  a,
const GeneratorParam< T > &  b 
)

Subtraction between GeneratorParam<T> and any type that supports operator- with T.

Returns type of underlying operator-.

Definition at line 752 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 - (Other)0) Halide::operator- ( const GeneratorParam< T > &  a,
const Other &  b 
)

Subtraction between GeneratorParam<T> and any type that supports operator- with T.

Returns type of underlying operator-.

Definition at line 754 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 * (T)0) Halide::operator* ( const Other &  a,
const GeneratorParam< T > &  b 
)

Multiplication between GeneratorParam<T> and any type that supports operator* with T.

Returns type of underlying operator*.

Examples:
tutorial/lesson_13_tuples.cpp.

Definition at line 761 of file Generator.h.

template<typename Other , typename T >
decltype((Other)0 * (T)0) Halide::operator* ( const GeneratorParam< T > &  a,
const Other &  b 
)

Multiplication between GeneratorParam<T> and any type that supports operator* with T.

Returns type of underlying operator*.

Definition at line 763 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 / (T)1) Halide::operator/ ( const Other &  a,
const GeneratorParam< T > &  b 
)

Division between GeneratorParam<T> and any type that supports operator/ with T.

Returns type of underlying operator/.

Definition at line 770 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 / (Other)1) Halide::operator/ ( const GeneratorParam< T > &  a,
const Other &  b 
)

Division between GeneratorParam<T> and any type that supports operator/ with T.

Returns type of underlying operator/.

Definition at line 772 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 % (T)1) Halide::operator% ( const Other &  a,
const GeneratorParam< T > &  b 
)

Modulo between GeneratorParam<T> and any type that supports operator% with T.

Returns type of underlying operator%.

Definition at line 779 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 % (Other)1) Halide::operator% ( const GeneratorParam< T > &  a,
const Other &  b 
)

Modulo between GeneratorParam<T> and any type that supports operator% with T.

Returns type of underlying operator%.

Definition at line 781 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 > (T)1) Halide::operator> ( const Other &  a,
const GeneratorParam< T > &  b 
)

Greater than comparison between GeneratorParam<T> and any type that supports operator> with T.

Returns type of underlying operator>.

Definition at line 788 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 > (Other)1) Halide::operator> ( const GeneratorParam< T > &  a,
const Other &  b 
)

Greater than comparison between GeneratorParam<T> and any type that supports operator> with T.

Returns type of underlying operator>.

Definition at line 790 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 < (T)1) Halide::operator< ( const Other &  a,
const GeneratorParam< T > &  b 
)

Less than comparison between GeneratorParam<T> and any type that supports operator< with T.

Returns type of underlying operator<.

Definition at line 797 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 < (Other)1) Halide::operator< ( const GeneratorParam< T > &  a,
const Other &  b 
)

Less than comparison between GeneratorParam<T> and any type that supports operator< with T.

Returns type of underlying operator<.

Definition at line 799 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 >= (T)1) Halide::operator>= ( const Other &  a,
const GeneratorParam< T > &  b 
)

Greater than or equal comparison between GeneratorParam<T> and any type that supports operator>= with T.

Returns type of underlying operator>=.

Definition at line 806 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 >= (Other)1) Halide::operator>= ( const GeneratorParam< T > &  a,
const Other &  b 
)

Greater than or equal comparison between GeneratorParam<T> and any type that supports operator>= with T.

Returns type of underlying operator>=.

Definition at line 808 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 <= (T)1) Halide::operator<= ( const Other &  a,
const GeneratorParam< T > &  b 
)

Less than or equal comparison between GeneratorParam<T> and any type that supports operator<= with T.

Returns type of underlying operator<=.

Definition at line 815 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 <= (Other)1) Halide::operator<= ( const GeneratorParam< T > &  a,
const Other &  b 
)

Less than or equal comparison between GeneratorParam<T> and any type that supports operator<= with T.

Returns type of underlying operator<=.

Definition at line 817 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 == (T)1) Halide::operator== ( const Other &  a,
const GeneratorParam< T > &  b 
)

Equality comparison between GeneratorParam<T> and any type that supports operator== with T.

Returns type of underlying operator==.

Definition at line 824 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 == (Other)1) Halide::operator== ( const GeneratorParam< T > &  a,
const Other &  b 
)

Equality comparison between GeneratorParam<T> and any type that supports operator== with T.

Returns type of underlying operator==.

Definition at line 826 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 != (T)1) Halide::operator!= ( const Other &  a,
const GeneratorParam< T > &  b 
)

Inequality comparison between between GeneratorParam<T> and any type that supports operator!= with T.

Returns type of underlying operator!=.

Definition at line 833 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 != (Other)1) Halide::operator!= ( const GeneratorParam< T > &  a,
const Other &  b 
)

Inequality comparison between between GeneratorParam<T> and any type that supports operator!= with T.

Returns type of underlying operator!=.

Definition at line 835 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 && (T)1) Halide::operator&& ( const Other &  a,
const GeneratorParam< T > &  b 
)

Logical and between between GeneratorParam<T> and any type that supports operator&& with T.

Returns type of underlying operator&&.

Definition at line 842 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 && (Other)1) Halide::operator&& ( const GeneratorParam< T > &  a,
const Other &  b 
)

Logical and between between GeneratorParam<T> and any type that supports operator&& with T.

Returns type of underlying operator&&.

Definition at line 844 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
decltype((Other)0 || (T)1) Halide::operator|| ( const Other &  a,
const GeneratorParam< T > &  b 
)

Logical or between between GeneratorParam<T> and any type that supports operator&& with T.

Returns type of underlying operator||.

Definition at line 851 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 || (Other)1) Halide::operator|| ( const GeneratorParam< T > &  a,
const Other &  b 
)

Logical or between between GeneratorParam<T> and any type that supports operator&& with T.

Returns type of underlying operator||.

Definition at line 853 of file Generator.h.

References Halide::Runtime::Internal::b.

template<typename Other , typename T >
auto Halide::min ( const Other &  a,
const GeneratorParam< T > &  b 
) -> decltype(Internal::GeneratorMinMax::min_forward(a, b))
template<typename Other , typename T >
auto Halide::min ( const GeneratorParam< T > &  a,
const Other &  b 
) -> decltype(Internal::GeneratorMinMax::min_forward(a, b))

Compute minimum between GeneratorParam<T> and any type that supports min with T.

Will automatically import std::min. Returns type of underlying min call.

Definition at line 885 of file Generator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, and Halide::Internal::GeneratorMinMax::min_forward().

template<typename Other , typename T >
auto Halide::max ( const Other &  a,
const GeneratorParam< T > &  b 
) -> decltype(Internal::GeneratorMinMax::max_forward(a, b))

Compute the maximum value between GeneratorParam<T> and any type that supports max with T.

Will automatically import std::max. Returns type of underlying max call.

Examples:
tutorial/lesson_09_update_definitions.cpp, and tutorial/lesson_13_tuples.cpp.

Definition at line 894 of file Generator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, and Halide::Internal::GeneratorMinMax::max_forward().

Referenced by Halide::Runtime::Buffer< T, D >::copy_from(), Halide::Internal::Elf::Section::get_size(), max(), and Halide::Internal::GeneratorMinMax::max_forward().

template<typename Other , typename T >
auto Halide::max ( const GeneratorParam< T > &  a,
const Other &  b 
) -> decltype(Internal::GeneratorMinMax::max_forward(a, b))

Compute the maximum value between GeneratorParam<T> and any type that supports max with T.

Will automatically import std::max. Returns type of underlying max call.

Definition at line 898 of file Generator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, and Halide::Internal::GeneratorMinMax::max_forward().

template<typename T >
decltype(!(T)0) Halide::operator! ( const GeneratorParam< T > &  a)

Not operator for GeneratorParam.

Definition at line 905 of file Generator.h.

EXPORT Expr Halide::sum ( Expr  ,
const std::string &  s = "sum" 
)

An inline reduction.

This is suitable for convolution-type operations - the reduction will be computed in the innermost loop that it is used in. The argument may contain free or implicit variables, and must refer to some reduction domain. The free variables are still free in the return value, but the reduction domain is captured - the result expression does not refer to a reduction domain and can be used in a pure function definition.

An example using sum :

Func f, g;
Var x;
RDom r(0, 10);
f(x) = x*x;
g(x) = sum(f(x + r));

Here g computes some blur of x, but g is still a pure function. The sum is being computed by an anonymous reduction function that is scheduled innermost within g.

Examples:
tutorial/lesson_09_update_definitions.cpp.
EXPORT Expr Halide::product ( Expr  ,
const std::string &  s = "product" 
)

An inline reduction.

This is suitable for convolution-type operations - the reduction will be computed in the innermost loop that it is used in. The argument may contain free or implicit variables, and must refer to some reduction domain. The free variables are still free in the return value, but the reduction domain is captured - the result expression does not refer to a reduction domain and can be used in a pure function definition.

An example using sum :

Func f, g;
Var x;
RDom r(0, 10);
f(x) = x*x;
g(x) = sum(f(x + r));

Here g computes some blur of x, but g is still a pure function. The sum is being computed by an anonymous reduction function that is scheduled innermost within g.

EXPORT Expr Halide::maximum ( Expr  ,
const std::string &  s = "maximum" 
)

An inline reduction.

This is suitable for convolution-type operations - the reduction will be computed in the innermost loop that it is used in. The argument may contain free or implicit variables, and must refer to some reduction domain. The free variables are still free in the return value, but the reduction domain is captured - the result expression does not refer to a reduction domain and can be used in a pure function definition.

An example using sum :

Func f, g;
Var x;
RDom r(0, 10);
f(x) = x*x;
g(x) = sum(f(x + r));

Here g computes some blur of x, but g is still a pure function. The sum is being computed by an anonymous reduction function that is scheduled innermost within g.

Examples:
tutorial/lesson_09_update_definitions.cpp.
EXPORT Expr Halide::minimum ( Expr  ,
const std::string &  s = "minimum" 
)

An inline reduction.

This is suitable for convolution-type operations - the reduction will be computed in the innermost loop that it is used in. The argument may contain free or implicit variables, and must refer to some reduction domain. The free variables are still free in the return value, but the reduction domain is captured - the result expression does not refer to a reduction domain and can be used in a pure function definition.

An example using sum :

Func f, g;
Var x;
RDom r(0, 10);
f(x) = x*x;
g(x) = sum(f(x + r));

Here g computes some blur of x, but g is still a pure function. The sum is being computed by an anonymous reduction function that is scheduled innermost within g.

Examples:
tutorial/lesson_09_update_definitions.cpp.
EXPORT Expr Halide::sum ( RDom  ,
Expr  ,
const std::string &  s = "sum" 
)

Variants of the inline reduction in which the RDom is stated explicitly.

The expression can refer to multiple RDoms, and only the inner one is captured by the reduction. This allows you to write expressions like:

RDom r1(0, 10), r2(0, 10), r3(0, 10);
Expr e = minimum(r1, product(r2, sum(r3, r1 + r2 + r3)));
EXPORT Expr Halide::product ( RDom  ,
Expr  ,
const std::string &  s = "product" 
)

Variants of the inline reduction in which the RDom is stated explicitly.

The expression can refer to multiple RDoms, and only the inner one is captured by the reduction. This allows you to write expressions like:

RDom r1(0, 10), r2(0, 10), r3(0, 10);
Expr e = minimum(r1, product(r2, sum(r3, r1 + r2 + r3)));
EXPORT Expr Halide::maximum ( RDom  ,
Expr  ,
const std::string &  s = "maximum" 
)

Variants of the inline reduction in which the RDom is stated explicitly.

The expression can refer to multiple RDoms, and only the inner one is captured by the reduction. This allows you to write expressions like:

RDom r1(0, 10), r2(0, 10), r3(0, 10);
Expr e = minimum(r1, product(r2, sum(r3, r1 + r2 + r3)));
EXPORT Expr Halide::minimum ( RDom  ,
Expr  ,
const std::string &  s = "minimum" 
)

Variants of the inline reduction in which the RDom is stated explicitly.

The expression can refer to multiple RDoms, and only the inner one is captured by the reduction. This allows you to write expressions like:

RDom r1(0, 10), r2(0, 10), r3(0, 10);
Expr e = minimum(r1, product(r2, sum(r3, r1 + r2 + r3)));
EXPORT Tuple Halide::argmax ( Expr  ,
const std::string &  s = "argmax" 
)

Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression.

The expression must refer to some RDom. Also returns the extreme value of the expression as the last element of the tuple.

EXPORT Tuple Halide::argmin ( Expr  ,
const std::string &  s = "argmin" 
)

Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression.

The expression must refer to some RDom. Also returns the extreme value of the expression as the last element of the tuple.

Examples:
tutorial/lesson_13_tuples.cpp.
EXPORT Tuple Halide::argmax ( RDom  ,
Expr  ,
const std::string &  s = "argmax" 
)

Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression.

The expression must refer to some RDom. Also returns the extreme value of the expression as the last element of the tuple.

EXPORT Tuple Halide::argmin ( RDom  ,
Expr  ,
const std::string &  s = "argmin" 
)

Returns an Expr or Tuple representing the coordinates of the point in the RDom which minimizes or maximizes the expression.

The expression must refer to some RDom. Also returns the extreme value of the expression as the last element of the tuple.

Expr Halide::operator+ ( Expr  a,
Expr  b 
)
inline

Return the sum of two expressions, doing any necessary type coercion using Internal::match_types.

Definition at line 238 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Add::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator+ ( const Expr &  a,
int  b 
)
inline

Add an expression and a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 248 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Add::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator+ ( int  a,
const Expr &  b 
)
inline

Add a constant integer and an expression.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 257 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Add::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr& Halide::operator+= ( Expr &  a,
const Expr &  b 
)
inline

Modify the first expression to be the sum of two expressions, without changing its type.

This casts the second argument to match the type of the first.

Definition at line 266 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Add::make(), and user_assert.

Expr Halide::operator- ( Expr  a,
Expr  b 
)
inline

Return the difference of two expressions, doing any necessary type coercion using Internal::match_types.

Definition at line 274 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Sub::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator- ( const Expr &  a,
int  b 
)
inline

Subtracts a constant integer from an expression.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 283 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Sub::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator- ( int  a,
const Expr &  b 
)
inline

Subtracts an expression from a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 292 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Sub::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator- ( const Expr &  a)
inline

Return the negative of the argument.

Does no type casting, so more formally: return that number which when added to the original, yields zero of the same type. For unsigned integers the negative is still an unsigned integer. E.g. in UInt(8), the negative of 56 is 200, because 56 + 200 == 0

Definition at line 303 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Sub::make(), Halide::Internal::make_zero(), Halide::Expr::type(), and user_assert.

Expr& Halide::operator-= ( Expr &  a,
const Expr &  b 
)
inline

Modify the first expression to be the difference of two expressions, without changing its type.

This casts the second argument to match the type of the first.

Definition at line 311 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Sub::make(), and user_assert.

Expr Halide::operator* ( Expr  a,
Expr  b 
)
inline

Return the product of two expressions, doing any necessary type coercion using Internal::match_types.

Definition at line 319 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Mul::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator* ( const Expr &  a,
int  b 
)
inline

Multiply an expression and a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 328 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Mul::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator* ( int  a,
const Expr &  b 
)
inline

Multiply a constant integer and an expression.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 337 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Mul::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr& Halide::operator*= ( Expr &  a,
const Expr &  b 
)
inline

Modify the first expression to be the product of two expressions, without changing its type.

This casts the second argument to match the type of the first.

Definition at line 346 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Mul::make(), and user_assert.

Expr Halide::operator/ ( Expr  a,
Expr  b 
)
inline

Return the ratio of two expressions, doing any necessary type coercion using Internal::match_types.

Note that signed integer division in Halide rounds towards minus infinity, unlike C, which rounds towards zero.

Definition at line 356 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Div::make(), Halide::Internal::match_types(), and user_assert.

Expr& Halide::operator/= ( Expr &  a,
const Expr &  b 
)
inline

Modify the first expression to be the ratio of two expressions, without changing its type.

This casts the second argument to match the type of the first. Note that signed integer division in Halide rounds towards minus infinity, unlike C, which rounds towards zero.

Definition at line 367 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Runtime::Internal::b, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Div::make(), and user_assert.

Expr Halide::operator/ ( const Expr &  a,
int  b 
)
inline

Divides an expression by a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 378 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Div::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator/ ( int  a,
const Expr &  b 
)
inline

Divides a constant integer by an expression.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 387 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Div::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator% ( Expr  a,
Expr  b 
)
inline

Return the first argument reduced modulo the second, doing any necessary type coercion using Internal::match_types.

For signed integers, the sign of the result matches the sign of the second argument (unlike in C, where it matches the sign of the first argument). For example, this means that x%2 is always either zero or one, even if x is negative.

Definition at line 399 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::is_zero(), Halide::Internal::Mod::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator% ( const Expr &  a,
int  b 
)
inline

Mods an expression by a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 409 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Mod::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator% ( int  a,
const Expr &  b 
)
inline

Mods a constant integer by an expression.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 418 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::is_zero(), Halide::Internal::Mod::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator> ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is greater than the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 428 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GT::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator> ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is greater than a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 438 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GT::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator> ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is greater than an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 448 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GT::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator< ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is less than the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 457 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LT::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator< ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is less than a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 467 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LT::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator< ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is less than an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 477 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LT::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator<= ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is less than or equal to the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 486 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LE::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator<= ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is less than or equal to a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 496 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator<= ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is less than or equal to an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 506 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::LE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator>= ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is greater than or equal to the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 515 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GE::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator>= ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is greater than or equal to a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 525 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator>= ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is greater than or equal to an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 535 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::GE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator== ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is equal to the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 544 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::EQ::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator== ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is equal to a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 554 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::EQ::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator== ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is equal to an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 564 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::EQ::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator!= ( Expr  a,
Expr  b 
)
inline

Return a boolean expression that tests whether the first argument is not equal to the second, after doing any necessary type coercion using Internal::match_types.

Definition at line 573 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::NE::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::operator!= ( const Expr &  a,
int  b 
)
inline

Return a boolean expression that tests whether an expression is not equal to a constant integer.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 583 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::NE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator!= ( int  a,
const Expr &  b 
)
inline

Return a boolean expression that tests whether a constant integer is not equal to an expression.

Coerces the integer to the type of the expression. Errors if the integer is not representable in that type.

Definition at line 593 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::NE::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::operator&& ( Expr  a,
Expr  b 
)
inline

Returns the logical and of the two arguments.

Definition at line 600 of file IROperator.h.

References Halide::Internal::And::make(), and Halide::Internal::match_types().

Expr Halide::operator&& ( const Expr &  a,
bool  b 
)
inline

Logical and of an Expr and a bool.

Either returns the Expr or an Expr representing false, depending on the bool.

Definition at line 608 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::IntrusivePtr< T >::defined(), internal_assert, Halide::Type::is_bool(), Halide::Internal::make_zero(), and Halide::Expr::type().

Expr Halide::operator&& ( bool  a,
const Expr &  b 
)
inline

Add an expression and a constant integer.

Coerces the type of the integer to match the type of the expression. Errors if the integer cannot be represented in the type of the expression.

Definition at line 617 of file IROperator.h.

References Halide::Runtime::Internal::a.

Expr Halide::operator|| ( Expr  a,
Expr  b 
)
inline

Returns the logical or of the two arguments.

Definition at line 623 of file IROperator.h.

References Halide::Internal::Or::make(), and Halide::Internal::match_types().

Expr Halide::operator|| ( const Expr &  a,
bool  b 
)
inline

Logical or of an Expr and a bool.

Either returns the Expr or an Expr representing true, depending on the bool.

Definition at line 631 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::IntrusivePtr< T >::defined(), internal_assert, Halide::Type::is_bool(), Halide::Internal::make_one(), and Halide::Expr::type().

Expr Halide::operator|| ( bool  a,
const Expr &  b 
)
inline

Logical or of an Expr and a bool.

Either returns the Expr or an Expr representing true, depending on the bool.

Definition at line 640 of file IROperator.h.

References Halide::Runtime::Internal::a.

Expr Halide::operator! ( const Expr &  a)
inline

Returns the logical not the argument.

Definition at line 647 of file IROperator.h.

References Halide::Internal::Not::make().

Expr Halide::max ( Expr  a,
Expr  b 
)
inline

Returns an expression representing the greater of the two arguments, after doing any necessary type coercion using Internal::match_types.

Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4).

Definition at line 655 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Max::make(), Halide::Internal::match_types(), and user_assert.

Expr Halide::max ( const Expr &  a,
int  b 
)
inline

Returns an expression representing the greater of an expression and a constant integer.

The integer is coerced to the type of the expression. Errors if the integer is not representable as that type. Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4).

Definition at line 667 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Max::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::max ( int  a,
const Expr &  b 
)
inline

Returns an expression representing the greater of a constant integer and an expression.

The integer is coerced to the type of the expression. Errors if the integer is not representable as that type. Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4).

Definition at line 679 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Max::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::max ( float  a,
const Expr &  b 
)
inline

Definition at line 685 of file IROperator.h.

References max().

Expr Halide::max ( const Expr &  a,
float  b 
)
inline

Definition at line 686 of file IROperator.h.

References max().

template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest...>::value >::type * = nullptr>
Expr Halide::max ( const A &  a,
const B &  b,
const C &  c,
Rest &&...  rest 
)
inline

Returns an expression representing the greater of an expressions vector, after doing any necessary type coersion using Internal::match_types.

Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4). The expressions are folded from right ie. max(.., max(.., ..)). The arguments can be any mix of types but must all be convertible to Expr.

Definition at line 696 of file IROperator.h.

References max().

Expr Halide::min ( Expr  a,
Expr  b 
)
inline
Expr Halide::min ( const Expr &  a,
int  b 
)
inline

Returns an expression representing the lesser of an expression and a constant integer.

The integer is coerced to the type of the expression. Errors if the integer is not representable as that type. Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4).

Definition at line 712 of file IROperator.h.

References Halide::Runtime::Internal::b, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Min::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::min ( int  a,
const Expr &  b 
)
inline

Returns an expression representing the lesser of a constant integer and an expression.

The integer is coerced to the type of the expression. Errors if the integer is not representable as that type. Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4).

Definition at line 723 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::check_representable(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Min::make(), Halide::Internal::make_const(), Halide::Expr::type(), and user_assert.

Expr Halide::min ( float  a,
const Expr &  b 
)
inline

Definition at line 729 of file IROperator.h.

References min().

Expr Halide::min ( const Expr &  a,
float  b 
)
inline

Definition at line 730 of file IROperator.h.

References min().

template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest...>::value >::type * = nullptr>
Expr Halide::min ( const A &  a,
const B &  b,
const C &  c,
Rest &&...  rest 
)
inline

Returns an expression representing the lesser of an expressions vector, after doing any necessary type coersion using Internal::match_types.

Vectorizes cleanly on most platforms (with the exception of integer types on x86 without SSE4). The expressions are folded from right ie. min(.., min(.., ..)). The arguments can be any mix of types but must all be convertible to Expr.

Definition at line 740 of file IROperator.h.

References min().

Expr Halide::operator+ ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 748 of file IROperator.h.

Expr Halide::operator+ ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 749 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator- ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 750 of file IROperator.h.

Expr Halide::operator- ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 751 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator* ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 752 of file IROperator.h.

Expr Halide::operator* ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 753 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator/ ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 754 of file IROperator.h.

Expr Halide::operator/ ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 755 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator% ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 756 of file IROperator.h.

Expr Halide::operator% ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 757 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator> ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 758 of file IROperator.h.

Expr Halide::operator> ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 759 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator< ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 760 of file IROperator.h.

Expr Halide::operator< ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 761 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator>= ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 762 of file IROperator.h.

Expr Halide::operator>= ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 763 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator<= ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 764 of file IROperator.h.

Expr Halide::operator<= ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 765 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator== ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 766 of file IROperator.h.

Expr Halide::operator== ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 767 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::operator!= ( const Expr &  a,
float  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 768 of file IROperator.h.

Expr Halide::operator!= ( float  a,
const Expr &  b 
)
inline

Operators on floats treats those floats as Exprs.

Making these explicit prevents implicit float->int casts that might otherwise occur.

Definition at line 769 of file IROperator.h.

References Halide::Runtime::Internal::b.

Expr Halide::clamp ( const Expr &  a,
const Expr &  min_val,
const Expr &  max_val 
)
inline

Clamps an expression to lie within the given bounds.

The bounds are type-cast to match the expression. Vectorizes as well as min/max.

Examples:
tutorial/lesson_07_multi_stage_pipelines.cpp, tutorial/lesson_09_update_definitions.cpp, and tutorial/lesson_12_using_the_gpu.cpp.

Definition at line 774 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::lossless_cast(), Halide::Internal::Min::make(), Halide::Internal::Max::make(), Halide::Expr::type(), and user_assert.

Expr Halide::abs ( const Expr &  a)
inline

Returns the absolute value of a signed integer or floating-point expression.

Vectorizes cleanly. Unlike in C, abs of a signed integer returns an unsigned integer of the same bit width. This means that abs of the most negative integer doesn't overflow.

Definition at line 790 of file IROperator.h.

References Halide::Runtime::Internal::a, Halide::Internal::Call::abs, Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Runtime::Internal::t, Halide::Expr::type(), Halide::Type::UInt, user_assert, and user_warning.

Referenced by absd(), and Halide::Internal::mod_imp().

Expr Halide::absd ( Expr  a,
Expr  b 
)
inline

Return the absolute difference between two values.

Vectorizes cleanly. Returns an unsigned value of the same bit width. There are various ways to write this yourself, but they contain numerous gotchas and don't always compile to good code, so use this instead.

Definition at line 807 of file IROperator.h.

References Halide::Runtime::Internal::a, abs(), Halide::Internal::Call::absd, Halide::Type::code(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_float(), Halide::Type::is_int(), Halide::Internal::Call::make(), Halide::Internal::match_types(), Halide::Internal::Call::PureIntrinsic, Halide::Runtime::Internal::t, Halide::Expr::type(), Halide::Type::UInt, user_assert, and Halide::Type::with_code().

Expr Halide::select ( Expr  condition,
Expr  true_value,
Expr  false_value 
)
inline

Returns an expression similar to the ternary operator in C, except that it always evaluates all arguments.

If the first argument is true, then return the second, else return the third. Typically vectorizes cleanly, but benefits from SSE41 or newer on x86.

Examples:
tutorial/lesson_13_tuples.cpp.

Definition at line 827 of file IROperator.h.

References Halide::Internal::as_const_int(), Bool(), cast(), Halide::Type::is_bool(), Halide::Internal::Select::make(), Halide::Expr::type(), and user_assert.

Referenced by fast_pow(), select(), and tuple_select().

template<typename... Args, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Args...>::value >::type * = nullptr>
Expr Halide::select ( const Expr &  c0,
const Expr &  v0,
const Expr &  c1,
const Expr &  v1,
Args &&...  args 
)
inline

A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs.

Evaluates to the first value for which the condition is true. Returns the final value if all conditions are false.

Definition at line 860 of file IROperator.h.

References select().

Expr Halide::sin ( const Expr &  x)
inline

Return the sine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Examples:
tutorial/lesson_04_debugging_2.cpp, tutorial/lesson_08_scheduling_2.cpp, tutorial/lesson_13_tuples.cpp, and tutorial/lesson_14_types.cpp.

Definition at line 870 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::asin ( const Expr &  x)
inline

Return the arcsine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 886 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::cos ( const Expr &  x)
inline

Return the cosine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Examples:
tutorial/lesson_04_debugging_2.cpp, and tutorial/lesson_13_tuples.cpp.

Definition at line 902 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::acos ( const Expr &  x)
inline

Return the arccosine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 918 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::tan ( const Expr &  x)
inline

Return the tangent of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 934 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::atan ( const Expr &  x)
inline

Return the arctangent of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 950 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::atan2 ( Expr  y,
Expr  x 
)
inline

Return the angle of a floating-point gradient.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 966 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::sinh ( const Expr &  x)
inline

Return the hyperbolic sine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 987 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::asinh ( const Expr &  x)
inline

Return the hyperbolic arcsinhe of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 1003 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::cosh ( const Expr &  x)
inline

Return the hyperbolic cosine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 1019 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::acosh ( const Expr &  x)
inline

Return the hyperbolic arccosine of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 1035 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::tanh ( const Expr &  x)
inline

Return the hyperbolic tangent of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 1051 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::atanh ( const Expr &  x)
inline

Return the hyperbolic arctangent of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Does not vectorize well.

Definition at line 1067 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::sqrt ( const Expr &  x)
inline

Return the square root of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). Typically vectorizes cleanly.

Definition at line 1083 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Referenced by hypot().

Expr Halide::hypot ( const Expr &  x,
const Expr &  y 
)
inline

Return the square root of the sum of the squares of two floating-point expressions.

If the argument is not floating-point, it is cast to Float(32). Vectorizes cleanly.

Definition at line 1099 of file IROperator.h.

References sqrt().

Expr Halide::exp ( const Expr &  x)
inline

Return the exponential of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). For Float(64) arguments, this calls the system exp function, and does not vectorize well. For Float(32) arguments, this function is vectorizable, does the right thing for extremely small or extremely large inputs, and is accurate up to the last bit of the mantissa. Vectorizes cleanly.

Definition at line 1110 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::log ( const Expr &  x)
inline

Return the logarithm of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). For Float(64) arguments, this calls the system log function, and does not vectorize well. For Float(32) arguments, this function is vectorizable, does the right thing for inputs <= 0 (returns -inf or nan), and is accurate up to the last bit of the mantissa. Vectorizes cleanly.

Definition at line 1130 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::pow ( Expr  x,
Expr  y 
)
inline

Return one floating point expression raised to the power of another.

The type of the result is given by the type of the first argument. If the first argument is not a floating-point type, it is cast to Float(32). For Float(32), cleanly vectorizable, and accurate up to the last few bits of the mantissa. Gets worse when approaching overflow. Vectorizes cleanly.

Examples:
tutorial/lesson_12_using_the_gpu.cpp.

Definition at line 1149 of file IROperator.h.

References Halide::Internal::as_const_int(), Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Internal::raise_to_integer_power(), Halide::Expr::type(), and user_assert.

Expr Halide::erf ( const Expr &  x)
inline

Evaluate the error function erf.

Only available for Float(32). Accurate up to the last three bits of the mantissa. Vectorizes cleanly.

Definition at line 1174 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Float(), Halide::Internal::halide_erf(), Halide::Expr::type(), and user_assert.

EXPORT Expr Halide::fast_log ( const Expr &  x)

Fast approximate cleanly vectorizable log for Float(32).

Returns nonsense for x <= 0.0f. Accurate up to the last 5 bits of the mantissa. Vectorizes cleanly.

Referenced by fast_pow().

EXPORT Expr Halide::fast_exp ( const Expr &  x)

Fast approximate cleanly vectorizable exp for Float(32).

Returns nonsense for inputs that would overflow or underflow. Typically accurate up to the last 5 bits of the mantissa. Gets worse when approaching overflow. Vectorizes cleanly.

Referenced by fast_pow().

Expr Halide::fast_pow ( Expr  x,
Expr  y 
)
inline

Fast approximate cleanly vectorizable pow for Float(32).

Returns nonsense for x < 0.0f. Accurate up to the last 5 bits of the mantissa for typical exponents. Gets worse when approaching overflow. Vectorizes cleanly.

Definition at line 1195 of file IROperator.h.

References Halide::Internal::as_const_int(), fast_exp(), fast_log(), Halide::Internal::raise_to_integer_power(), and select().

Expr Halide::fast_inverse ( const Expr &  x)
inline

Fast approximate inverse for Float(32).

Corresponds to the rcpps instruction on x86, and the vrecpe instruction on ARM. Vectorizes cleanly.

Definition at line 1208 of file IROperator.h.

References Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::fast_inverse_sqrt ( const Expr &  x)
inline

Fast approximate inverse square root for Float(32).

Corresponds to the rsqrtps instruction on x86, and the vrsqrte instruction on ARM. Vectorizes cleanly.

Definition at line 1216 of file IROperator.h.

References Float(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Expr::type(), and user_assert.

Expr Halide::floor ( const Expr &  x)
inline

Return the greatest whole number less than or equal to a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). The return value is still in floating point, despite being a whole number. Vectorizes cleanly.

Definition at line 1225 of file IROperator.h.

References cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::element_of(), Float(), Halide::Type::lanes(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Runtime::Internal::t, Halide::Expr::type(), and user_assert.

Referenced by Halide::Internal::mod_imp< double >().

Expr Halide::ceil ( const Expr &  x)
inline

Return the least whole number greater than or equal to a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). The return value is still in floating point, despite being a whole number. Vectorizes cleanly.

Definition at line 1243 of file IROperator.h.

References cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::element_of(), Float(), Halide::Type::lanes(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Runtime::Internal::t, Halide::Expr::type(), and user_assert.

Expr Halide::round ( const Expr &  x)
inline

Return the whole number closest to a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). The return value is still in floating point, despite being a whole number. On ties, we follow IEEE754 conventions and round to the nearest even number. Vectorizes cleanly.

Definition at line 1262 of file IROperator.h.

References cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::element_of(), Float(), Halide::Type::lanes(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Runtime::Internal::t, Halide::Expr::type(), and user_assert.

Expr Halide::trunc ( const Expr &  x)
inline

Return the integer part of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). The return value is still in floating point, despite being a whole number. Vectorizes cleanly.

Definition at line 1279 of file IROperator.h.

References cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::element_of(), Float(), Halide::Type::lanes(), Halide::Internal::Call::make(), Halide::Internal::Call::PureExtern, Halide::Runtime::Internal::t, Halide::Expr::type(), and user_assert.

Referenced by fract().

Expr Halide::is_nan ( const Expr &  x)
inline
Expr Halide::fract ( const Expr &  x)
inline

Return the fractional part of a floating-point expression.

If the argument is not floating-point, it is cast to Float(32). The return value has the same sign as the original expression. Vectorizes cleanly.

Definition at line 1314 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), trunc(), and user_assert.

Expr Halide::reinterpret ( Type  t,
const Expr &  e 
)
inline
template<typename T >
Expr Halide::reinterpret ( const Expr &  e)
inline

Definition at line 1333 of file IROperator.h.

References reinterpret().

Expr Halide::operator& ( Expr  x,
Expr  y 
)
inline

Return the bitwise and of two expressions (which need not have the same type).

The type of the result is the type of the first argument.

Definition at line 1340 of file IROperator.h.

References Halide::Type::bits(), Halide::Internal::Call::bitwise_and, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_int(), Halide::Type::is_uint(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, reinterpret(), Halide::Expr::type(), user_assert, and Halide::Type::with_bits().

Expr Halide::operator| ( Expr  x,
Expr  y 
)
inline

Return the bitwise or of two expressions (which need not have the same type).

The type of the result is the type of the first argument.

Definition at line 1359 of file IROperator.h.

References Halide::Type::bits(), Halide::Internal::Call::bitwise_or, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_int(), Halide::Type::is_uint(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, reinterpret(), Halide::Expr::type(), user_assert, and Halide::Type::with_bits().

Expr Halide::operator^ ( Expr  x,
Expr  y 
)
inline

Return the bitwise exclusive or of two expressions (which need not have the same type).

The type of the result is the type of the first argument.

Definition at line 1378 of file IROperator.h.

References Halide::Type::bits(), Halide::Internal::Call::bitwise_xor, cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_int(), Halide::Type::is_uint(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, reinterpret(), Halide::Expr::type(), user_assert, and Halide::Type::with_bits().

Expr Halide::operator<< ( Expr  x,
Expr  y 
)
inline

Shift the bits of an integer value left.

This is actually less efficient than multiplying by 2^n, because Halide's optimization passes understand multiplication, and will compile it to shifting. This operator is only for if you really really need bit shifting (e.g. because the exponent is a run-time parameter). The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1410 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_float(), Halide::Internal::Call::make(), Halide::Internal::match_types(), Halide::Internal::Call::PureIntrinsic, Halide::Internal::Call::shift_left, Halide::Expr::type(), and user_assert.

Expr Halide::operator<< ( const Expr &  x,
int  y 
)
inline

Shift the bits of an integer value left.

This is actually less efficient than multiplying by 2^n, because Halide's optimization passes understand multiplication, and will compile it to shifting. This operator is only for if you really really need bit shifting (e.g. because the exponent is a run-time parameter). The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1417 of file IROperator.h.

References Halide::Internal::check_representable(), Halide::Internal::make_const(), and Halide::Expr::type().

Expr Halide::operator<< ( int  x,
const Expr &  y 
)
inline

Shift the bits of an integer value left.

This is actually less efficient than multiplying by 2^n, because Halide's optimization passes understand multiplication, and will compile it to shifting. This operator is only for if you really really need bit shifting (e.g. because the exponent is a run-time parameter). The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1421 of file IROperator.h.

References Halide::Internal::check_representable(), Halide::Internal::make_const(), and Halide::Expr::type().

Expr Halide::operator>> ( Expr  x,
Expr  y 
)
inline

Shift the bits of an integer value right.

Does sign extension for signed integers. This is less efficient than dividing by a power of two. Halide's definition of division (always round to negative infinity) means that all divisions by powers of two get compiled to bit-shifting, and Halide's optimization routines understand division and can work with it. The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1436 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_float(), Halide::Internal::Call::make(), Halide::Internal::match_types(), Halide::Internal::Call::PureIntrinsic, Halide::Internal::Call::shift_right, Halide::Expr::type(), and user_assert.

Expr Halide::operator>> ( const Expr &  x,
int  y 
)
inline

Shift the bits of an integer value right.

Does sign extension for signed integers. This is less efficient than dividing by a power of two. Halide's definition of division (always round to negative infinity) means that all divisions by powers of two get compiled to bit-shifting, and Halide's optimization routines understand division and can work with it. The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1443 of file IROperator.h.

References Halide::Internal::check_representable(), Halide::Internal::make_const(), and Halide::Expr::type().

Expr Halide::operator>> ( int  x,
const Expr &  y 
)
inline

Shift the bits of an integer value right.

Does sign extension for signed integers. This is less efficient than dividing by a power of two. Halide's definition of division (always round to negative infinity) means that all divisions by powers of two get compiled to bit-shifting, and Halide's optimization routines understand division and can work with it. The type of the result is equal to the type of the first argument. Both arguments must have integer type.

Definition at line 1447 of file IROperator.h.

References Halide::Internal::check_representable(), Halide::Internal::make_const(), and Halide::Expr::type().

Expr Halide::lerp ( Expr  zero_val,
Expr  one_val,
Expr  weight 
)
inline

Linear interpolate between the two values according to a weight.

Parameters
zero_valThe result when weight is 0
one_valThe result when weight is 1
weightThe interpolation amount

Both zero_val and one_val must have the same type. All types are supported, including bool.

The weight is treated as its own type and must be float or an unsigned integer type. It is scaled to the bit-size of the type of x and y if they are integer, or converted to float if they are float. Integer weights are converted to float via division by the full-range value of the weight's type. Floating-point weights used to interpolate between integer values must be between 0.0f and 1.0f, and an error may be signaled if it is not provably so. (clamp operators can be added to provide proof. Currently an error is only signalled for constant weights.)

For integer linear interpolation, out of range values cannot be represented. In particular, weights that are conceptually less than 0 or greater than 1.0 are not representable. As such the result is always between x and y (inclusive of course). For lerp with floating-point values and floating-point weight, the full range of a float is valid, however underflow and overflow can still occur.

Ordering is not required between zero_val and one_val: lerp(42, 69, .5f) == lerp(69, 42, .5f) == 56

Results for integer types are for exactly rounded arithmetic. As such, there are cases where 16-bit and float differ because 32-bit floating-point (float) does not have enough precision to produce the exact result. (Likely true for 32-bit integer vs. double-precision floating-point as well.)

At present, double precision and 64-bit integers are not supported.

Generally, lerp will vectorize as if it were an operation on a type twice the bit size of the inferred type for x and y.

Some examples:

// Since Halide does not have direct type delcarations, casts
// below are used to indicate the types of the parameters.
// Such casts not required or expected in actual code where types
// are inferred.
lerp(cast<float>(x), cast<float>(y), cast<float>(w)) ->
x * (1.0f - w) + y * w
lerp(cast<uint8_t>(x), cast<uint8_t>(y), cast<uint8_t>(w)) ->
cast<uint8_t>(cast<uint8_t>(x) * (1.0f - cast<uint8_t>(w) / 255.0f) +
cast<uint8_t>(y) * cast<uint8_t>(w) / 255.0f + .5f)
// Note addition in Halide promoted uint8_t + int8_t to int16_t already,
// the outer cast is added for clarity.
lerp(cast<uint8_t>(x), cast<int8_t>(y), cast<uint8_t>(w)) ->
cast<int16_t>(cast<uint8_t>(x) * (1.0f - cast<uint8_t>(w) / 255.0f) +
cast<int8_t>(y) * cast<uint8_t>(w) / 255.0f + .5f)
lerp(cast<int8_t>(x), cast<int8_t>(y), cast<float>(w)) ->
cast<int8_t>(cast<int8_t>(x) * (1.0f - cast<float>(w)) +
cast<int8_t>(y) * cast<uint8_t>(w))

Definition at line 1519 of file IROperator.h.

References Halide::Internal::as_const_float(), Halide::Internal::as_const_int(), cast(), Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_float(), Halide::Type::is_uint(), Halide::Type::lanes(), Halide::Internal::Call::lerp, Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Expr::type(), and user_assert.

Expr Halide::popcount ( const Expr &  x)
inline
Expr Halide::count_leading_zeros ( const Expr &  x)
inline

Count the number of leading zero bits in an expression.

The result is undefined if the value of the expression is zero.

Definition at line 1569 of file IROperator.h.

References Halide::Internal::Call::count_leading_zeros, Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Expr::type(), and user_assert.

Expr Halide::count_trailing_zeros ( const Expr &  x)
inline

Count the number of trailing zero bits in an expression.

The result is undefined if the value of the expression is zero.

Definition at line 1577 of file IROperator.h.

References Halide::Internal::Call::count_trailing_zeros, Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Expr::type(), and user_assert.

Expr Halide::div_round_to_zero ( Expr  x,
Expr  y 
)
inline

Divide two integers, rounding towards zero.

This is the typical behavior of most hardware architectures, which differs from Halide's division operator, which is Euclidean (rounds towards -infinity).

Definition at line 1587 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Internal::Call::div_round_to_zero, Halide::Type::is_int(), Halide::Type::is_uint(), Halide::Internal::Call::make(), Halide::Internal::match_types(), Halide::Internal::Call::PureIntrinsic, Halide::Expr::type(), and user_assert.

Expr Halide::mod_round_to_zero ( Expr  x,
Expr  y 
)
inline

Compute the remainder of dividing two integers, when division is rounding toward zero.

This is the typical behavior of most hardware architectures, which differs from Halide's mod operator, which is Euclidean (produces the remainder when division rounds towards -infinity).

Definition at line 1606 of file IROperator.h.

References Halide::Internal::IntrusivePtr< T >::defined(), Halide::Type::is_int(), Halide::Type::is_uint(), Halide::Internal::Call::make(), Halide::Internal::match_types(), Halide::Internal::Call::mod_round_to_zero, Halide::Internal::Call::PureIntrinsic, Halide::Expr::type(), and user_assert.

Expr Halide::random_float ( const Expr &  seed = Expr())
inline

Return a random variable representing a uniformly distributed float in the half-open interval [0.0f, 1.0f).

For random numbers of other types, use lerp with a random float as the last parameter.

Optionally takes a seed.

Note that:

Expr x = random_float();
Expr y = x + x;

is very different to

Expr y = random_float() + random_float();

The first doubles a random variable, and the second adds two independent random variables.

A given random variable takes on a unique value that depends deterministically on the pure variables of the function they belong to, the identity of the function itself, and which definition of the function it is used in. They are, however, shared across tuple elements.

This function vectorizes cleanly.

Definition at line 1649 of file IROperator.h.

References Float(), Int(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Internal::Call::random, and user_assert.

Expr Halide::random_uint ( const Expr &  seed = Expr())
inline

Return a random variable representing a uniformly distributed unsigned 32-bit integer.

See random_float. Vectorizes cleanly.

Definition at line 1671 of file IROperator.h.

References Int(), Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, Halide::Internal::Call::random, UInt(), and user_assert.

Referenced by random_int().

Expr Halide::random_int ( const Expr &  seed = Expr())
inline

Return a random variable representing a uniformly distributed 32-bit integer.

See random_float. Vectorizes cleanly.

Definition at line 1691 of file IROperator.h.

References random_uint().

EXPORT Expr Halide::print ( const std::vector< Expr > &  values)

Create an Expr that prints out its value whenever it is evaluated.

It also prints out everything else in the arguments list, separated by spaces. This can include string literals.

Examples:
tutorial/lesson_04_debugging_2.cpp.

Referenced by print().

template<typename... Args>
NO_INLINE Expr Halide::print ( const Expr &  a,
Args &&...  args 
)
inline

Create an Expr that prints out its value whenever it is evaluated.

It also prints out everything else in the arguments list, separated by spaces. This can include string literals.

Definition at line 1721 of file IROperator.h.

References Halide::Internal::collect_print_args(), and print().

EXPORT Expr Halide::print_when ( const Expr &  condition,
const std::vector< Expr > &  values 
)

Create an Expr that prints whenever it is evaluated, provided that the condition is true.

Examples:
tutorial/lesson_04_debugging_2.cpp.

Referenced by print_when().

template<typename... Args>
NO_INLINE Expr Halide::print_when ( const Expr &  condition,
const Expr &  a,
Args &&...  args 
)
inline

Create an Expr that prints whenever it is evaluated, provided that the condition is true.

Definition at line 1734 of file IROperator.h.

References Halide::Internal::collect_print_args(), and print_when().

EXPORT Expr Halide::require ( const Expr &  condition,
const std::vector< Expr > &  values 
)

Create an Expr that that guarantees a precondition.

If 'condition' is true, the return value is equal to the first Expr. If 'condition' is false, halide_error() is called, and the return value is arbitrary. Any additional arguments after the first Expr are stringified and passed as a user-facing message to halide_error(), similar to print().

Note that this essentially always inserts a runtime check into the generated code (except when the condition can be proven at compile time); as such, it should be avoided inside inner loops, except for debugging or testing purposes.

However, using this to make assertions about (say) input values can be useful, both in terms of correctness and (potentially) in terms of code generation, e.g.

Param<int> p;
Expr y = require(p > 0, p);

will allow the optimizer to assume positive, nonzero values for y.

Referenced by require().

template<typename... Args>
NO_INLINE Expr Halide::require ( const Expr &  condition,
const Expr &  value,
Args &&...  args 
)
inline

Create an Expr that that guarantees a precondition.

If 'condition' is true, the return value is equal to the first Expr. If 'condition' is false, halide_error() is called, and the return value is arbitrary. Any additional arguments after the first Expr are stringified and passed as a user-facing message to halide_error(), similar to print().

Note that this essentially always inserts a runtime check into the generated code (except when the condition can be proven at compile time); as such, it should be avoided inside inner loops, except for debugging or testing purposes.

However, using this to make assertions about (say) input values can be useful, both in terms of correctness and (potentially) in terms of code generation, e.g.

Param<int> p;
Expr y = require(p > 0, p);

will allow the optimizer to assume positive, nonzero values for y.

Definition at line 1766 of file IROperator.h.

References Halide::Internal::collect_print_args(), and require().

Expr Halide::undef ( Type  t)
inline

Return an undef value of the given type.

Halide skips stores that depend on undef values, so you can use this to mean "do not modify this memory location". This is an escape hatch that can be used for several things:

You can define a reduction with no pure step, by setting the pure step to undef. Do this only if you're confident that the update steps are sufficient to correctly fill in the domain.

For a tuple-valued reduction, you can write an update step that only updates some tuple elements.

You can define single-stage pipeline that only has update steps, and depends on the values already in the output buffer.

Use this feature with great caution, as you can use it to load from uninitialized memory.

Definition at line 1793 of file IROperator.h.

References Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, and Halide::Internal::Call::undef.

Referenced by undef().

template<typename T >
Expr Halide::undef ( )
inline

Definition at line 1800 of file IROperator.h.

References undef().

template<typename... Args>
NO_INLINE Expr Halide::memoize_tag ( const Expr &  result,
Args &&...  args 
)
inline

Control the values used in the memoization cache key for memoize.

Normally parameters and other external dependencies are automatically inferred and added to the cache key. The memoize_tag operator allows computing one expression and using either the computed value, or one or more other expressions in the cache key instead of the parameter dependencies of the computation. The single argument version is completely safe in that the cache key will use the actual computed value – it is difficult or imposible to produce erroneous caching this way. The more-than-one argument version allows generating cache keys that do not uniquely identify the computation and thus can result in caching errors.

A potential use for the single argument version is to handle a floating-point parameter that is quantized to a small integer. Mutliple values of the float will produce the same integer and moving the caching to using the integer for the key is more efficient.

The main use for the more-than-one argument version is to provide cache key information for Handles and ImageParams, which otherwise are not allowed inside compute_cached operations. E.g. when passing a group of parameters to an external array function via a Handle, memoize_tag can be used to isolate the actual values used by that computation. If an ImageParam is a constant image with a persistent digest, memoize_tag can be used to key computations using that image on the digest.

Definition at line 1836 of file IROperator.h.

References Halide::Internal::memoize_tag_helper().

Expr Halide::likely ( const Expr &  e)
inline

Expressions tagged with this intrinsic are considered to be part of the steady state of some loop with a nasty beginning and end (e.g.

a boundary condition). When Halide encounters likely intrinsics, it splits the containing loop body into three, and tries to simplify down all conditions that lead to the likely. For example, given the expression: select(x < 1, bar, x > 10, bar, likely(foo)), Halide will split the loop over x into portions where x < 1, 1 <= x <= 10, and x > 10.

You're unlikely to want to call this directly. You probably want to use the boundary condition helpers in the BoundaryConditions namespace instead.

Definition at line 1855 of file IROperator.h.

References Halide::Internal::Call::likely, Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, and Halide::Expr::type().

Expr Halide::likely_if_innermost ( const Expr &  e)
inline

Equivalent to likely, but only triggers a loop partitioning if found in an innermost loop.

Definition at line 1862 of file IROperator.h.

References Halide::Internal::Call::likely_if_innermost, Halide::Internal::Call::make(), Halide::Internal::Call::PureIntrinsic, and Halide::Expr::type().

template<typename T >
Expr Halide::saturating_cast ( const Expr &  e)

Cast an expression to the halide type corresponding to the C++ type T clamping to the minimum and maximum values of the result type.

Definition at line 1872 of file IROperator.h.

Referenced by Halide::ConciseCasts::i16_sat(), Halide::ConciseCasts::i32_sat(), Halide::ConciseCasts::i64_sat(), Halide::ConciseCasts::i8_sat(), Halide::ConciseCasts::u16_sat(), Halide::ConciseCasts::u32_sat(), Halide::ConciseCasts::u64_sat(), and Halide::ConciseCasts::u8_sat().

EXPORT Expr Halide::saturating_cast ( Type  t,
Expr  e 
)

Cast an expression to a new type, clamping to the minimum and maximum values of the result type.

EXPORT std::ostream& Halide::operator<< ( std::ostream &  stream,
const DeviceAPI &   
)

Emit a halide device api type in a human readable form.

Func Halide::lambda ( Expr  e)
inline

Create a zero-dimensional halide function that returns the given expression.

The function may have more dimensions if the expression contains implicit arguments.

Definition at line 17 of file Lambda.h.

References _, and Halide::Internal::unique_name().

Referenced by Halide::BoundaryConditions::Internal::func_like_to_func().

Func Halide::lambda ( Var  x,
Expr  e 
)
inline

Create a 1-D halide function in the first argument that returns the second argument.

The function may have more dimensions if the expression contains implicit arguments and the list of Var arguments contains a placeholder ("_").

Definition at line 27 of file Lambda.h.

References Halide::Internal::unique_name().

Func Halide::lambda ( Var  x,
Var  y,
Expr  e 
)
inline

Create a 2-D halide function in the first two arguments that returns the last argument.

The function may have more dimensions if the expression contains implicit arguments and the list of Var arguments contains a placeholder ("_").

Definition at line 37 of file Lambda.h.

References Halide::Internal::unique_name().

Func Halide::lambda ( Var  x,
Var  y,
Var  z,
Expr  e 
)
inline

Create a 3-D halide function in the first three arguments that returns the last argument.

The function may have more dimensions if the expression contains implicit arguments and the list of Var arguments contains a placeholder ("_").

Definition at line 47 of file Lambda.h.

References Halide::Internal::unique_name().

Func Halide::lambda ( Var  x,
Var  y,
Var  z,
Var  w,
Expr  e 
)
inline

Create a 4-D halide function in the first four arguments that returns the last argument.

The function may have more dimensions if the expression contains implicit arguments and the list of Var arguments contains a placeholder ("_").

Definition at line 57 of file Lambda.h.

References Halide::Internal::unique_name().

Func Halide::lambda ( Var  x,
Var  y,
Var  z,
Var  w,
Var  v,
Expr  e 
)
inline

Create a 5-D halide function in the first five arguments that returns the last argument.

The function may have more dimensions if the expression contains implicit arguments and the list of Var arguments contains a placeholder ("_").

Definition at line 67 of file Lambda.h.

References Halide::Internal::unique_name().

EXPORT std::unique_ptr<llvm::Module> Halide::compile_module_to_llvm_module ( const Module &  module,
llvm::LLVMContext &  context 
)

Generate an LLVM module.

std::unique_ptr<llvm::raw_fd_ostream> Halide::make_raw_fd_ostream ( const std::string &  filename)

Construct an llvm output stream for writing to files.

EXPORT void Halide::compile_llvm_module_to_object ( llvm::Module &  module,
Internal::LLVMOStream &  out 
)

Compile an LLVM module to native targets (objects, native assembly).

EXPORT void Halide::compile_llvm_module_to_assembly ( llvm::Module &  module,
Internal::LLVMOStream &  out 
)

Compile an LLVM module to native targets (objects, native assembly).

EXPORT void Halide::compile_llvm_module_to_llvm_bitcode ( llvm::Module &  module,
Internal::LLVMOStream &  out 
)

Compile an LLVM module to LLVM targets (bitcode, LLVM assembly).

EXPORT void Halide::compile_llvm_module_to_llvm_assembly ( llvm::Module &  module,
Internal::LLVMOStream &  out 
)

Compile an LLVM module to LLVM targets (bitcode, LLVM assembly).

EXPORT void Halide::create_static_library ( const std::vector< std::string > &  src_files,
const Target &  target,
const std::string &  dst_file,
bool  deterministic = true 
)

Concatenate the list of src_files into dst_file, using the appropriate static library format for the given target (e.g., .a or .lib).

If deterministic is true, emit 0 for all GID/UID/timestamps, and 0644 for all modes (equivalent to the ar -D option).

EXPORT Module Halide::link_modules ( const std::string &  name,
const std::vector< Module > &  modules 
)

Link a set of modules together into one module.

EXPORT void Halide::compile_standalone_runtime ( const std::string &  object_filename,
Target  t 
)

Create an object file containing the Halide runtime for a given target.

For use with Target::NoRuntime.

EXPORT Outputs Halide::compile_standalone_runtime ( const Outputs &  output_files,
Target  t 
)

Create an object and/or static library file containing the Halide runtime for a given target.

For use with Target::NoRuntime. Return an Outputs with just the actual outputs filled in (typically, object_name and/or static_library_name).

EXPORT void Halide::compile_multitarget ( const std::string &  fn_name,
const Outputs &  output_files,
const std::vector< Target > &  targets,
ModuleProducer  module_producer,
const std::map< std::string, std::string > &  suffixes = {} 
)
Expr Halide::user_context_value ( )
inline

Returns an Expr corresponding to the user context passed to the function (if any).

It is rare that this function is necessary (e.g. to pass the user context to an extern function written in C).

Definition at line 169 of file Param.h.

References Handle(), and Halide::Internal::Variable::make().

std::ostream& Halide::operator<< ( std::ostream &  stream,
RVar   
)

Emit an RVar in a human-readable form.

std::ostream& Halide::operator<< ( std::ostream &  stream,
RDom   
)

Emit an RDom in a human-readable form.

EXPORT Target Halide::get_host_target ( )

Return the target corresponding to the host machine.

Examples:
tutorial/lesson_12_using_the_gpu.cpp.
EXPORT Target Halide::get_target_from_environment ( )

Return the target that Halide will use.

If HL_TARGET is set it uses that. Otherwise calls get_host_target

EXPORT Target Halide::get_jit_target_from_environment ( )

Return the target that Halide will use for jit-compilation.

If HL_JIT_TARGET is set it uses that. Otherwise calls get_host_target. Throws an error if the architecture, bit width, and OS of the target do not match the host target, so this is only useful for controlling the feature set.

Referenced by Halide::Internal::schedule_scalar().

EXPORT Target::Feature Halide::target_feature_for_device_api ( DeviceAPI  api)

Get the Target feature corresponding to a DeviceAPI.

For device apis that do not correspond to any single target feature, returns Target::FeatureEnd

Tuple Halide::tuple_select ( Tuple  condition,
const Tuple &  true_value,
const Tuple &  false_value 
)
inline

Equivalents of some standard operators for tuples.

Definition at line 114 of file Tuple.h.

References select(), and Halide::Tuple::size().

Tuple Halide::tuple_select ( Expr  condition,
const Tuple &  true_value,
const Tuple &  false_value 
)
inline

Equivalents of some standard operators for tuples.

Definition at line 122 of file Tuple.h.

References select(), and Halide::Tuple::size().

Type Halide::Bool ( int  lanes = 1)
inline

Construct a boolean type.

Definition at line 442 of file Type.h.

References UInt().

Referenced by Halide::NamesInterface::Bool(), is_nan(), and select().

Type Halide::Handle ( int  lanes = 1,
const halide_handle_cplusplus_type handle_type = nullptr 
)
inline
template<typename T >
Type Halide::type_of ( )
inline

Construct the halide equivalent of a C type.

Definition at line 453 of file Type.h.

Variable Documentation

const DeviceAPI Halide::all_device_apis[]
Initial value:
DeviceAPI::Host,
DeviceAPI::Default_GPU,
DeviceAPI::CUDA,
DeviceAPI::OpenCL,
DeviceAPI::GLSL,
DeviceAPI::OpenGLCompute,
DeviceAPI::Metal,
DeviceAPI::Hexagon}

An array containing all the device apis.

Useful for iterating through them.

Definition at line 320 of file Expr.h.

EXPORT Var Halide::_

A placeholder variable for infered arguments.

See Var::implicit

Referenced by Halide::Func::Func(), Halide::BoundaryConditions::Internal::func_like_to_func(), and lambda().

EXPORT Var Halide::_0

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_1

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_2

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_3

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_4

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_5

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_6

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_7

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_8

The first ten implicit Vars for use in scheduling.

See Var::implicit

EXPORT Var Halide::_9

The first ten implicit Vars for use in scheduling.

See Var::implicit