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...
 
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...
 
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  NamesInterface
 
class  Generator
 
class  RegisterGenerator
 
class  ImageParam
 An Image parameter to a halide pipeline. More...
 
struct  ScalarOrBufferT
 
struct  ExternSignature
 
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  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  Buffer
 A templated Buffer class that wraps buffer_t and adds functionality. More...
 
struct  AllInts
 
struct  AllInts<>
 
struct  AllInts< T, Args...>
 
struct  AllInts< float, Args...>
 
struct  AllInts< double, Args...>
 
struct  AllocationHeader
 A struct acting as a header for allocations owned by the Buffer class itself. More...
 
struct  for_each_element_helpers
 Some helpers for for_each_element. 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  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
 Funcs with Tuple values return multiple images when you realize them. 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
 
template<typename T = void, int D = 4>
using Image = Buffer< T, D >
 

Enumerations

enum  DeviceAPI {
  DeviceAPI::None, DeviceAPI::Host, DeviceAPI::Default_GPU, DeviceAPI::CUDA,
  DeviceAPI::OpenCL, DeviceAPI::GLSL, DeviceAPI::Renderscript, DeviceAPI::OpenGLCompute,
  DeviceAPI::Metal, DeviceAPI::Hexagon
}
 An enum describing a type of device API. 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...
 

Functions

template<typename T , int D, typename... Args, typename = std::enable_if<(Internal::all_are_convertible<Expr, Args...>::value)>>
NO_INLINE Expr image_accessor (const Image< T, D > &im, Expr first, Args...rest)
 An adaptor so that it's possible to access a Halide::Image using Exprs. More...
 
template<typename T , int D>
NO_INLINE Expr image_accessor (const Image< T, D > &im, const std::vector< Expr > &args)
 
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 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 (Expr a)
 Cast an expression to the halide type corresponding to the C++ type T. More...
 
Expr cast (Type t, 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! (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 (Expr a, int b)
 Returns an expression representing the greater of an expression and a constant integer. More...
 
Expr max (int a, Expr b)
 Returns an expression representing the greater of a constant integer and an expression. More...
 
Expr min (Expr a, Expr b)
 Returns an expression representing the lesser of the two arguments, after doing any necessary type coercion using Internal::match_types. More...
 
Expr min (Expr a, int b)
 Returns an expression representing the lesser of an expression and a constant integer. More...
 
Expr min (int a, Expr b)
 Returns an expression representing the lesser of a constant integer and an expression. More...
 
Expr clamp (Expr a, Expr min_val, Expr max_val)
 Clamps an expression to lie within the given bounds. More...
 
Expr abs (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...
 
Expr sin (Expr x)
 Return the sine of a floating-point expression. More...
 
Expr asin (Expr x)
 Return the arcsine of a floating-point expression. More...
 
Expr cos (Expr x)
 Return the cosine of a floating-point expression. More...
 
Expr acos (Expr x)
 Return the arccosine of a floating-point expression. More...
 
Expr tan (Expr x)
 Return the tangent of a floating-point expression. More...
 
Expr atan (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 (Expr x)
 Return the hyperbolic sine of a floating-point expression. More...
 
Expr asinh (Expr x)
 Return the hyperbolic arcsinhe of a floating-point expression. More...
 
Expr cosh (Expr x)
 Return the hyperbolic cosine of a floating-point expression. More...
 
Expr acosh (Expr x)
 Return the hyperbolic arccosine of a floating-point expression. More...
 
Expr tanh (Expr x)
 Return the hyperbolic tangent of a floating-point expression. More...
 
Expr atanh (Expr x)
 Return the hyperbolic arctangent of a floating-point expression. More...
 
Expr sqrt (Expr x)
 Return the square root of a floating-point expression. More...
 
Expr hypot (Expr x, Expr y)
 Return the square root of the sum of the squares of two floating-point expressions. More...
 
Expr exp (Expr x)
 Return the exponential of a floating-point expression. More...
 
Expr log (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 (Expr x)
 Evaluate the error function erf. More...
 
EXPORT Expr fast_log (Expr x)
 Fast approximate cleanly vectorizable log for Float(32). More...
 
EXPORT Expr fast_exp (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 (Expr x)
 Fast approximate inverse for Float(32). More...
 
Expr fast_inverse_sqrt (Expr x)
 Fast approximate inverse square root for Float(32). More...
 
Expr floor (Expr x)
 Return the greatest whole number less than or equal to a floating-point expression. More...
 
Expr ceil (Expr x)
 Return the least whole number greater than or equal to a floating-point expression. More...
 
Expr round (Expr x)
 Return the whole number closest to a floating-point expression. More...
 
Expr trunc (Expr x)
 Return the integer part of a floating-point expression. More...
 
Expr is_nan (Expr x)
 Returns true if the argument is a Not a Number (NaN). More...
 
Expr fract (Expr x)
 Return the fractional part of a floating-point expression. More...
 
Expr reinterpret (Type t, Expr e)
 Reinterpret the bits of one value as another type. More...
 
template<typename T >
Expr reinterpret (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~ (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 (Expr x)
 Count the number of set bits in an expression. More...
 
Expr count_leading_zeros (Expr x)
 Count the number of leading zero bits in an expression. More...
 
Expr count_trailing_zeros (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 (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 (Expr seed=Expr())
 Return a random variable representing a uniformly distributed unsigned 32-bit integer. More...
 
Expr random_int (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 (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 (Expr e)
 Equivalent to likely, but only triggers a loop partitioning if found in an innermost loop. More...
 
template<typename T >
Expr saturating_cast (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...
 
template<typename Fn >
void for_each_element (const buffer_t &buf, Fn &&f)
 Call a function at each site in a buffer. More...
 
template<typename Ret , typename T , int D, typename... Args>
Ret image_accessor (const Buffer< T, D > &, Args...)
 
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+ (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, 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- (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, 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* (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, 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/ (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, 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% (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, 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> (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, 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< (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, 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>= (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, 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<= (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, 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== (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, 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!= (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, 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&& (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, 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|| (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, Other b)
 Logical or between between GeneratorParam<T> and any type that supports operator&& with T. More...
 
template<typename Other , typename T >
auto min (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, 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 (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, 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+ (Expr a, int b)
 Add an expression and a constant integer. More...
 
Expr operator+ (int a, Expr b)
 Add a constant integer and an expression. More...
 
Exproperator+= (Expr &a, 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- (Expr a, int b)
 Subtracts a constant integer from an expression. More...
 
Expr operator- (int a, Expr b)
 Subtracts an expression from a constant integer. More...
 
Expr operator- (Expr a)
 Return the negative of the argument. More...
 
Exproperator-= (Expr &a, 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* (Expr a, int b)
 Multiply an expression and a constant integer. More...
 
Expr operator* (int a, Expr b)
 Multiply a constant integer and an expression. More...
 
Exproperator*= (Expr &a, 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, Expr b)
 Modify the first expression to be the ratio of two expressions, without changing its type. More...
 
Expr operator/ (Expr a, int b)
 Divides an expression by a constant integer. More...
 
Expr operator/ (int a, 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% (Expr a, int b)
 Mods an expression by a constant integer. More...
 
Expr operator% (int a, 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> (Expr a, int b)
 Return a boolean expression that tests whether an expression is greater than a constant integer. More...
 
Expr operator> (int a, 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< (Expr a, int b)
 Return a boolean expression that tests whether an expression is less than a constant integer. More...
 
Expr operator< (int a, 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<= (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, 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>= (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, 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== (Expr a, int b)
 Return a boolean expression that tests whether an expression is equal to a constant integer. More...
 
Expr operator== (int a, 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!= (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, 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&& (Expr a, bool b)
 Logical and of an Expr and a bool. More...
 
Expr operator&& (bool a, Expr b)
 Add an expression and a constant integer. More...
 
Expr operator|| (Expr a, bool b)
 Logical or of an Expr and a bool. More...
 
Expr operator|| (bool a, Expr b)
 Logical or of an Expr and a bool. More...
 
Expr operator+ (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator+ (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator- (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator- (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator* (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator* (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator/ (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator/ (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator% (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator% (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator> (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator> (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator< (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator< (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator>= (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator>= (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator<= (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator<= (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator== (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator== (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator!= (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr operator!= (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr min (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr min (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr max (float a, Expr b)
 Operators on floats treats those floats as Exprs. More...
 
Expr max (Expr a, float b)
 Operators on floats treats those floats as Exprs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr c6, Expr v6, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr c6, Expr v6, Expr c7, Expr v7, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr c6, Expr v6, Expr c7, Expr v7, Expr c8, Expr v8, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr c6, Expr v6, Expr c7, Expr v7, Expr c8, Expr v8, Expr c9, Expr v9, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr select (Expr c1, Expr v1, Expr c2, Expr v2, Expr c3, Expr v3, Expr c4, Expr v4, Expr c5, Expr v5, Expr c6, Expr v6, Expr c7, Expr v7, Expr c8, Expr v8, Expr c9, Expr v9, Expr c10, Expr v10, Expr default_val)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs. More...
 
Expr operator<< (Expr x, Expr y)
 Shift the bits of an integer value left. More...
 
Expr operator<< (Expr x, int y)
 Shift the bits of an integer value left. More...
 
Expr operator<< (int x, 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>> (Expr x, int y)
 Shift the bits of an integer value right. More...
 
Expr operator>> (int x, 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 (Expr a, Args &&...args)
 Create an Expr that prints out its value whenever it is evaluated. More...
 
EXPORT Expr print_when (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 (Expr condition, Expr a, Args &&...args)
 Create an Expr that prints whenever it is evaluated, provided that the condition is true. More...
 
template<typename... Args>
NO_INLINE Expr memoize_tag (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 237 of file Func.h.

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

Definition at line 112 of file Module.h.

template<typename T = void, int D = 4>
using Halide::Image = typedef Buffer<T, D>

Definition at line 1456 of file HalideBuffer.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 
Renderscript 
OpenGLCompute 
Metal 
Hexagon 

Definition at line 302 of file Expr.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 24 of file Schedule.h.

Function Documentation

template<typename T , int D, typename... Args, typename = std::enable_if<(Internal::all_are_convertible<Expr, Args...>::value)>>
NO_INLINE Expr Halide::image_accessor ( const Image< T, D > &  im,
Expr  first,
Args...  rest 
)

An adaptor so that it's possible to access a Halide::Image using Exprs.

Definition at line 94 of file BufferPtr.h.

Referenced by Halide::Buffer< T, D >::operator()().

template<typename T , int D>
NO_INLINE Expr Halide::image_accessor ( const Image< T, D > &  im,
const std::vector< Expr > &  args 
)

Definition at line 99 of file BufferPtr.h.

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 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 1879 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 1892 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 1921 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 1937 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+ ( 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 344 of file Generator.h.

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

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

Returns type of underlying operator+.

Definition at line 346 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 - (T)0) Halide::operator- ( 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 353 of file Generator.h.

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

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

Returns type of underlying operator-.

Definition at line 355 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 * (T)0) Halide::operator* ( 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 362 of file Generator.h.

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

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

Returns type of underlying operator*.

Definition at line 364 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 / (T)1) Halide::operator/ ( 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 371 of file Generator.h.

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

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

Returns type of underlying operator/.

Definition at line 373 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 % (T)1) Halide::operator% ( 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 380 of file Generator.h.

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

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

Returns type of underlying operator%.

Definition at line 382 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 > (T)1) Halide::operator> ( 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 389 of file Generator.h.

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

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

Returns type of underlying operator>.

Definition at line 391 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 < (T)1) Halide::operator< ( 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 398 of file Generator.h.

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

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

Returns type of underlying operator<.

Definition at line 400 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 >= (T)1) Halide::operator>= ( 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 407 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 >= (Other)1) Halide::operator>= ( const GeneratorParam< T > &  a,
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 409 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 <= (T)1) Halide::operator<= ( 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 416 of file Generator.h.

template<typename Other , typename T >
decltype((T)0 <= (Other)1) Halide::operator<= ( const GeneratorParam< T > &  a,
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 418 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 == (T)1) Halide::operator== ( 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 425 of file Generator.h.

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

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

Returns type of underlying operator==.

Definition at line 427 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 != (T)1) Halide::operator!= ( 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 434 of file Generator.h.

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

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

Returns type of underlying operator!=.

Definition at line 436 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 && (T)1) Halide::operator&& ( 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 443 of file Generator.h.

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

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

Returns type of underlying operator&&.

Definition at line 445 of file Generator.h.

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

template<typename Other , typename T >
decltype((Other)0 || (T)1) Halide::operator|| ( 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 452 of file Generator.h.

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

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

Returns type of underlying operator||.

Definition at line 454 of file Generator.h.

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

template<typename Other , typename T >
auto Halide::min ( 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,
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 486 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 ( 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 495 of file Generator.h.

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

Referenced by max(), and Halide::Internal::GeneratorMinMax::max_forward().

template<typename Other , typename T >
auto Halide::max ( const GeneratorParam< T > &  a,
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 499 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 506 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 217 of file IROperator.h.

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

Expr Halide::operator+ ( 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 227 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,
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 236 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,
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 245 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 253 of file IROperator.h.

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

Expr Halide::operator- ( 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 262 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,
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 271 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- ( 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 282 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,
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 290 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 298 of file IROperator.h.

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

Expr Halide::operator* ( 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 307 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,
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 316 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,
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 325 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 335 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,
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 346 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/ ( 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 357 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,
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 366 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 378 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% ( 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 388 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,
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 397 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 407 of file IROperator.h.

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

Expr Halide::operator> ( 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 417 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,
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 427 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 436 of file IROperator.h.

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

Expr Halide::operator< ( 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 446 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,
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 456 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 465 of file IROperator.h.

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

Expr Halide::operator<= ( 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 475 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,
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 485 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 494 of file IROperator.h.

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

Expr Halide::operator>= ( 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 504 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,
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 514 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 523 of file IROperator.h.

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

Expr Halide::operator== ( 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 533 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,
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 543 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 552 of file IROperator.h.

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

Expr Halide::operator!= ( 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 562 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,
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 572 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 579 of file IROperator.h.

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

Expr Halide::operator&& ( 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 587 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,
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 596 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 602 of file IROperator.h.

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

Expr Halide::operator|| ( 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 610 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,
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 619 of file IROperator.h.

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

Expr Halide::operator! ( Expr  a)
inline

Returns the logical not the argument.

Definition at line 626 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 634 of file IROperator.h.

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

Expr Halide::max ( 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 646 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,
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 658 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::min ( Expr  a,
Expr  b 
)
inline

Returns an expression representing the lesser 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 668 of file IROperator.h.

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

Expr Halide::min ( 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 680 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,
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 691 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::operator+ ( 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 701 of file IROperator.h.

Expr Halide::operator+ ( float  a,
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 702 of file IROperator.h.

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

Expr Halide::operator- ( 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 703 of file IROperator.h.

Expr Halide::operator- ( float  a,
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 704 of file IROperator.h.

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

Expr Halide::operator* ( 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 705 of file IROperator.h.

Expr Halide::operator* ( float  a,
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 706 of file IROperator.h.

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

Expr Halide::operator/ ( 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 707 of file IROperator.h.

Expr Halide::operator/ ( float  a,
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 708 of file IROperator.h.

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

Expr Halide::operator% ( 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 709 of file IROperator.h.

Expr Halide::operator% ( float  a,
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 710 of file IROperator.h.

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

Expr Halide::operator> ( 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 711 of file IROperator.h.

Expr Halide::operator> ( float  a,
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 712 of file IROperator.h.

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

Expr Halide::operator< ( 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 713 of file IROperator.h.

Expr Halide::operator< ( float  a,
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 714 of file IROperator.h.

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

Expr Halide::operator>= ( 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 715 of file IROperator.h.

Expr Halide::operator>= ( float  a,
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 716 of file IROperator.h.

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

Expr Halide::operator<= ( 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 717 of file IROperator.h.

Expr Halide::operator<= ( float  a,
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 718 of file IROperator.h.

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

Expr Halide::operator== ( 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 719 of file IROperator.h.

Expr Halide::operator== ( float  a,
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 720 of file IROperator.h.

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

Expr Halide::operator!= ( 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 721 of file IROperator.h.

Expr Halide::operator!= ( float  a,
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 722 of file IROperator.h.

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

Expr Halide::min ( float  a,
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 723 of file IROperator.h.

References min().

Expr Halide::min ( 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 724 of file IROperator.h.

References min().

Expr Halide::max ( float  a,
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 725 of file IROperator.h.

References max().

Expr Halide::max ( 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 726 of file IROperator.h.

References max().

Expr Halide::clamp ( Expr  a,
Expr  min_val,
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 731 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 ( 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 747 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 764 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 784 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().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  default_val 
)
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 816 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  default_val 
)
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 822 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  default_val 
)
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 830 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  default_val 
)
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 840 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  c6,
Expr  v6,
Expr  default_val 
)
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 852 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  c6,
Expr  v6,
Expr  c7,
Expr  v7,
Expr  default_val 
)
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 866 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  c6,
Expr  v6,
Expr  c7,
Expr  v7,
Expr  c8,
Expr  v8,
Expr  default_val 
)
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 882 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  c6,
Expr  v6,
Expr  c7,
Expr  v7,
Expr  c8,
Expr  v8,
Expr  c9,
Expr  v9,
Expr  default_val 
)
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 900 of file IROperator.h.

References select().

Expr Halide::select ( Expr  c1,
Expr  v1,
Expr  c2,
Expr  v2,
Expr  c3,
Expr  v3,
Expr  c4,
Expr  v4,
Expr  c5,
Expr  v5,
Expr  c6,
Expr  v6,
Expr  c7,
Expr  v7,
Expr  c8,
Expr  v8,
Expr  c9,
Expr  v9,
Expr  c10,
Expr  v10,
Expr  default_val 
)
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 920 of file IROperator.h.

References select().

Expr Halide::sin ( 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 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::asin ( 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 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::cos ( 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 982 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 ( 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 998 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 ( 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 1014 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 ( 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 1030 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 1046 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 ( 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 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::asinh ( 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 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.

Expr Halide::cosh ( 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 1099 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 ( 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 1115 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 ( 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 1131 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 ( 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 1147 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 ( 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 1163 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 ( Expr  x,
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 1179 of file IROperator.h.

References sqrt().

Expr Halide::exp ( 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 1190 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 ( 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 1210 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 1229 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 ( 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 1254 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 ( 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 ( 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 1275 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 ( 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 1288 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 ( 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 1296 of file IROperator.h.

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

Expr Halide::floor ( 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 1305 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 ( 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 1323 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 ( 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 1342 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 ( 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 1359 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 ( Expr  x)
inline
Expr Halide::fract ( 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 1394 of file IROperator.h.

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

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

Definition at line 1413 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 1420 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 1439 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 1458 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 1490 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<< ( 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 1497 of file IROperator.h.

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

Expr Halide::operator<< ( int  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 1501 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 1516 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>> ( 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 1523 of file IROperator.h.

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

Expr Halide::operator>> ( int  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 1527 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 1599 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 ( Expr  x)
inline
Expr Halide::count_leading_zeros ( 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 1649 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 ( 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 1657 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 1667 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 1686 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 ( 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 1729 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 ( Expr  seed = Expr())
inline

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

See random_float. Vectorizes cleanly.

Definition at line 1751 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 ( Expr  seed = Expr())
inline

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

See random_float. Vectorizes cleanly.

Definition at line 1771 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 ( 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 1801 of file IROperator.h.

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

EXPORT Expr Halide::print_when ( 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 ( Expr  condition,
Expr  a,
Args &&...  args 
)
inline

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

Definition at line 1814 of file IROperator.h.

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

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 1841 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 1848 of file IROperator.h.

References undef().

template<typename... Args>
NO_INLINE Expr Halide::memoize_tag ( 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 1884 of file IROperator.h.

References Halide::Internal::memoize_tag_helper().

Expr Halide::likely ( 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 1903 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 ( Expr  e)
inline

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

Definition at line 1910 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 ( 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 1920 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.

template<typename Fn >
void Halide::for_each_element ( const buffer_t buf,
Fn &&  f 
)

Call a function at each site in a buffer.

This is likely to be much slower than using Halide code to populate a buffer, but is convenient for tests. If the function has more arguments than the buffer has dimensions, the remaining arguments will be zero. If it has fewer arguments than the buffer has dimensions then the last few dimensions of the buffer are not iterated over. For example, the following code exploits this to set a floating point RGB image to red:

Buffer<float, 3> im(100, 100, 3);
for_each_element(im, [&](int x, int y) {
im(x, y, 0) = 1.0f;
im(x, y, 1) = 0.0f;
im(x, y, 2) = 0.0f:
});

The compiled code is equivalent to writing the a nested for loop, and compilers are capable of optimizing it in the same way.

If the callable can be called with an int * as the sole argument, that version is called instead. Each location in the buffer is passed to it in a coordinate array. This version is higher-overhead than the variadic version, but is useful for writing generic code that accepts buffers of arbitrary dimensionality. For example, the following sets the value at all sites in an arbitrary-dimensional buffer to their first coordinate:

for_each_element(im, [&](const int *pos) {im(pos) = pos[0];});

It is also possible to use for_each_element to iterate over entire rows or columns by cropping the buffer to a single column or row respectively and iterating over elements of the result. For example, to set the diagonal of the image to 1 by iterating over the columns:

Buffer<float, 3> im(100, 100, 3);
for_each_element(im.sliced(1, 0), [&](int x, int c) {
im(x, x, c) = 1.0f;
});

Or, assuming the memory layout is known to be dense per row, one can memset each row of an image like so:

Buffer<float, 3> im(100, 100, 3); for_each_element(im.sliced(0, 0), [&](int y, int c) { memset(&im(0, y, c), 0, sizeof(float) * im.width()); });

Definition at line 1451 of file HalideBuffer.h.

Referenced by Halide::Buffer< T, D >::for_each_element().

template<typename Ret , typename T , int D, typename... Args>
Ret Halide::image_accessor ( const Buffer< T, D > &  ,
Args...   
)
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 162 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 170 of file Tuple.h.

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

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

Construct a boolean type.

Definition at line 411 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

Construct a handle type.

Examples:
tutorial/lesson_14_types.cpp.

Definition at line 416 of file Type.h.

Referenced by Halide::Type::is_handle(), Halide::Type::operator!=(), Halide::Type::operator==(), and user_context_value().

template<typename T >
Type Halide::type_of ( )
inline

Construct the halide equivalent of a C type.

Definition at line 422 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::Renderscript,
DeviceAPI::OpenGLCompute,
DeviceAPI::Metal,
DeviceAPI::Hexagon}

An array containing all the device apis.

Useful for iterating through them.

Definition at line 317 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