Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
IROperator.h File Reference

Defines various operator overloads and utility functions that make it more pleasant to work with Halide expressions. More...

#include <cmath>
#include <map>
#include <optional>
#include "Expr.h"
#include "Target.h"
#include "Tuple.h"

Go to the source code of this file.

Classes

struct  Halide::Internal::BufferBuilder
 A builder to help create Exprs representing halide_buffer_t structs (e.g. More...
 
struct  Halide::Internal::is_printable_arg< T >
 
struct  Halide::Internal::all_are_printable_args< Args >
 

Namespaces

namespace  Halide
 This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide's bounds tools to query properties of it.
 
namespace  Halide::Internal
 

Functions

bool Halide::Internal::is_const (const Expr &e)
 Is the expression either an IntImm, a FloatImm, a StringImm, or a Cast of the same, or a Ramp or Broadcast of the same.
 
bool Halide::Internal::is_const (const Expr &e, int64_t v)
 Is the expression an IntImm, FloatImm of a particular value, or a Cast, or Broadcast of the same.
 
std::optional< int64_tHalide::Internal::as_const_int (const Expr &e)
 If an expression is an IntImm or a Broadcast of an IntImm, return a its value.
 
std::optional< uint64_tHalide::Internal::as_const_uint (const Expr &e)
 If an expression is a UIntImm or a Broadcast of a UIntImm, return its value.
 
std::optional< double > Halide::Internal::as_const_float (const Expr &e)
 If an expression is a FloatImm or a Broadcast of a FloatImm, return its value.
 
std::optional< int > Halide::Internal::is_const_power_of_two_integer (const Expr &e)
 Is the expression a constant integer power of two.
 
std::optional< int > Halide::Internal::is_const_power_of_two_integer (uint64_t)
 
std::optional< int > Halide::Internal::is_const_power_of_two_integer (int64_t)
 
bool Halide::Internal::is_positive_const (const Expr &e)
 Is the expression a const (as defined by is_const), and also strictly greater than zero (in all lanes, if a vector expression)
 
bool Halide::Internal::is_negative_const (const Expr &e)
 Is the expression a const (as defined by is_const), and also strictly less than zero (in all lanes, if a vector expression)
 
bool Halide::Internal::is_undef (const Expr &e)
 Is the expression an undef.
 
bool Halide::Internal::is_const_zero (const Expr &e)
 Is the expression a const (as defined by is_const), and also equal to zero (in all lanes, if a vector expression)
 
bool Halide::Internal::is_const_one (const Expr &e)
 Is the expression a const (as defined by is_const), and also equal to one (in all lanes, if a vector expression)
 
bool Halide::Internal::is_no_op (const Stmt &s)
 Is the statement a no-op (which we represent as either an undefined Stmt, or as an Evaluate node of a constant)
 
bool Halide::Internal::is_pure (const Expr &e)
 Does the expression 1) Take on the same value no matter where it appears in a Stmt, and 2) Evaluating it has no side-effects.
 
Expr Halide::Internal::make_const (Type t, int64_t val)
 Construct an immediate of the given type from any numeric C++ type.
 
Expr Halide::Internal::make_const (Type t, uint64_t val)
 
Expr Halide::Internal::make_const (Type t, double val)
 
Expr Halide::Internal::make_const (Type t, int32_t val)
 
Expr Halide::Internal::make_const (Type t, uint32_t val)
 
Expr Halide::Internal::make_const (Type t, int16_t val)
 
Expr Halide::Internal::make_const (Type t, uint16_t val)
 
Expr Halide::Internal::make_const (Type t, int8_t val)
 
Expr Halide::Internal::make_const (Type t, uint8_t val)
 
Expr Halide::Internal::make_const (Type t, bool val)
 
Expr Halide::Internal::make_const (Type t, float val)
 
Expr Halide::Internal::make_const (Type t, float16_t val)
 
Expr Halide::Internal::make_signed_integer_overflow (Type type)
 Construct a unique signed_integer_overflow Expr.
 
bool Halide::Internal::is_signed_integer_overflow (const Expr &expr)
 Check if an expression is a signed_integer_overflow.
 
void Halide::Internal::check_representable (Type t, int64_t val)
 Check if a constant value can be correctly represented as the given type.
 
Expr Halide::Internal::make_bool (bool val, int lanes=1)
 Construct a boolean constant from a C++ boolean value.
 
Expr Halide::Internal::make_zero (Type t)
 Construct the representation of zero in the given type.
 
Expr Halide::Internal::make_one (Type t)
 Construct the representation of one in the given type.
 
Expr Halide::Internal::make_two (Type t)
 Construct the representation of two in the given type.
 
Expr Halide::Internal::const_true (int lanes=1)
 Construct the constant boolean true.
 
Expr Halide::Internal::const_false (int lanes=1)
 Construct the constant boolean false.
 
Expr Halide::Internal::lossless_cast (Type t, Expr e, std::map< Expr, ConstantInterval, ExprCompare > *cache=nullptr)
 Attempt to cast an expression to a smaller type while provably not losing information.
 
Expr Halide::Internal::lossless_negate (const Expr &x)
 Attempt to negate x without introducing new IR and without overflow.
 
void Halide::Internal::match_types (Expr &a, Expr &b)
 Coerce the two expressions to have the same type, using C-style casting rules.
 
void Halide::Internal::match_types_bitwise (Expr &a, Expr &b, const char *op_name)
 Asserts that both expressions are integer types and are either both signed or both unsigned.
 
Expr Halide::Internal::halide_log (const Expr &a)
 Halide's vectorizable transcendentals.
 
Expr Halide::Internal::halide_exp (const Expr &a)
 
Expr Halide::Internal::halide_erf (const Expr &a)
 
Expr Halide::Internal::raise_to_integer_power (Expr a, int64_t b)
 Raise an expression to an integer power by repeatedly multiplying it by itself.
 
void Halide::Internal::split_into_ands (const Expr &cond, std::vector< Expr > &result)
 Split a boolean condition into vector of ANDs.
 
Expr Halide::Internal::strided_ramp_base (const Expr &e, int stride=1)
 If e is a ramp expression with stride, default 1, return the base, otherwise undefined.
 
template<typename T >
Halide::Internal::mod_imp (T a, T b)
 Implementations of division and mod that are specific to Halide.
 
template<typename T >
Halide::Internal::div_imp (T a, T b)
 
template<>
float Halide::Internal::mod_imp< float > (float a, float b)
 
template<>
double Halide::Internal::mod_imp< double > (double a, double b)
 
template<>
float Halide::Internal::div_imp< float > (float a, float b)
 
template<>
double Halide::Internal::div_imp< double > (double a, double b)
 
Expr Halide::Internal::remove_likelies (const Expr &e)
 Return an Expr that is identical to the input Expr, but with all calls to likely() and likely_if_innermost() removed.
 
Stmt Halide::Internal::remove_likelies (const Stmt &s)
 Return a Stmt that is identical to the input Stmt, but with all calls to likely() and likely_if_innermost() removed.
 
Expr Halide::Internal::remove_promises (const Expr &e)
 Return an Expr that is identical to the input Expr, but with all calls to promise_clamped() and unsafe_promise_clamped() removed.
 
Stmt Halide::Internal::remove_promises (const Stmt &s)
 Return a Stmt that is identical to the input Stmt, but with all calls to promise_clamped() and unsafe_promise_clamped() removed.
 
Expr Halide::Internal::unwrap_tags (const Expr &e)
 If the expression is a tag helper call, remove it and return the tagged expression.
 
HALIDE_NO_USER_CODE_INLINE void Halide::Internal::collect_print_args (std::vector< Expr > &args)
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE void Halide::Internal::collect_print_args (std::vector< Expr > &args, const char *arg, Args &&...more_args)
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE void Halide::Internal::collect_print_args (std::vector< Expr > &args, Expr arg, Args &&...more_args)
 
Expr Halide::Internal::requirement_failed_error (Expr condition, const std::vector< Expr > &args)
 
Expr Halide::Internal::memoize_tag_helper (Expr result, const std::vector< Expr > &cache_key_values)
 
void Halide::Internal::reset_random_counters ()
 Reset the counters used for random-number seeds in random_float/int/uint.
 
template<typename T >
Expr Halide::cast (Expr a)
 Cast an expression to the halide type corresponding to the C++ type T.
 
Expr Halide::cast (Type t, Expr a)
 Cast an expression to a new type.
 
Expr Halide::operator+ (Expr a, Expr b)
 Return the sum of two expressions, doing any necessary type coercion using Internal::match_types.
 
Expr Halide::operator+ (Expr a, int b)
 Add an expression and a constant integer.
 
Expr Halide::operator+ (int a, Expr b)
 Add a constant integer and an expression.
 
ExprHalide::operator+= (Expr &a, Expr b)
 Modify the first expression to be the sum of two expressions, without changing its type.
 
Expr Halide::operator- (Expr a, Expr b)
 Return the difference of two expressions, doing any necessary type coercion using Internal::match_types.
 
Expr Halide::operator- (Expr a, int b)
 Subtracts a constant integer from an expression.
 
Expr Halide::operator- (int a, Expr b)
 Subtracts an expression from a constant integer.
 
Expr Halide::operator- (Expr a)
 Return the negative of the argument.
 
ExprHalide::operator-= (Expr &a, Expr b)
 Modify the first expression to be the difference of two expressions, without changing its type.
 
Expr Halide::operator* (Expr a, Expr b)
 Return the product of two expressions, doing any necessary type coercion using Internal::match_types.
 
Expr Halide::operator* (Expr a, int b)
 Multiply an expression and a constant integer.
 
Expr Halide::operator* (int a, Expr b)
 Multiply a constant integer and an expression.
 
ExprHalide::operator*= (Expr &a, Expr b)
 Modify the first expression to be the product of two expressions, without changing its type.
 
Expr Halide::operator/ (Expr a, Expr b)
 Return the ratio of two expressions, doing any necessary type coercion using Internal::match_types.
 
ExprHalide::operator/= (Expr &a, Expr b)
 Modify the first expression to be the ratio of two expressions, without changing its type.
 
Expr Halide::operator/ (Expr a, int b)
 Divides an expression by a constant integer.
 
Expr Halide::operator/ (int a, Expr b)
 Divides a constant integer by an expression.
 
Expr Halide::operator% (Expr a, Expr b)
 Return the first argument reduced modulo the second, doing any necessary type coercion using Internal::match_types.
 
Expr Halide::operator% (Expr a, int b)
 Mods an expression by a constant integer.
 
Expr Halide::operator% (int a, Expr b)
 Mods a constant integer by an expression.
 
Expr Halide::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.
 
Expr Halide::operator> (Expr a, int b)
 Return a boolean expression that tests whether an expression is greater than a constant integer.
 
Expr Halide::operator> (int a, Expr b)
 Return a boolean expression that tests whether a constant integer is greater than an expression.
 
Expr Halide::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.
 
Expr Halide::operator< (Expr a, int b)
 Return a boolean expression that tests whether an expression is less than a constant integer.
 
Expr Halide::operator< (int a, Expr b)
 Return a boolean expression that tests whether a constant integer is less than an expression.
 
Expr Halide::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.
 
Expr Halide::operator<= (Expr a, int b)
 Return a boolean expression that tests whether an expression is less than or equal to a constant integer.
 
Expr Halide::operator<= (int a, Expr b)
 Return a boolean expression that tests whether a constant integer is less than or equal to an expression.
 
Expr Halide::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.
 
Expr Halide::operator>= (const Expr &a, int b)
 Return a boolean expression that tests whether an expression is greater than or equal to a constant integer.
 
Expr Halide::operator>= (int a, const Expr &b)
 Return a boolean expression that tests whether a constant integer is greater than or equal to an expression.
 
Expr Halide::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.
 
Expr Halide::operator== (Expr a, int b)
 Return a boolean expression that tests whether an expression is equal to a constant integer.
 
Expr Halide::operator== (int a, Expr b)
 Return a boolean expression that tests whether a constant integer is equal to an expression.
 
Expr Halide::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.
 
Expr Halide::operator!= (Expr a, int b)
 Return a boolean expression that tests whether an expression is not equal to a constant integer.
 
Expr Halide::operator!= (int a, Expr b)
 Return a boolean expression that tests whether a constant integer is not equal to an expression.
 
Expr Halide::operator&& (Expr a, Expr b)
 Returns the logical and of the two arguments.
 
Expr Halide::operator&& (Expr a, bool b)
 Logical and of an Expr and a bool.
 
Expr Halide::operator&& (bool a, Expr b)
 
Expr Halide::operator|| (Expr a, Expr b)
 Returns the logical or of the two arguments.
 
Expr Halide::operator|| (Expr a, bool b)
 Logical or of an Expr and a bool.
 
Expr Halide::operator|| (bool a, Expr b)
 
Expr Halide::operator! (Expr a)
 Returns the logical not the argument.
 
Expr Halide::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.
 
Expr Halide::max (Expr a, int b)
 Returns an expression representing the greater of an expression and a constant integer.
 
Expr Halide::max (int a, Expr b)
 Returns an expression representing the greater of a constant integer and an expression.
 
Expr Halide::max (float a, Expr b)
 
Expr Halide::max (Expr a, float b)
 
template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest... >::value >::type * = nullptr>
Expr Halide::max (A &&a, B &&b, C &&c, Rest &&...rest)
 Returns an expression representing the greater of an expressions vector, after doing any necessary type coersion using Internal::match_types.
 
Expr Halide::min (Expr a, Expr b)
 
Expr Halide::min (Expr a, int b)
 Returns an expression representing the lesser of an expression and a constant integer.
 
Expr Halide::min (int a, Expr b)
 Returns an expression representing the lesser of a constant integer and an expression.
 
Expr Halide::min (float a, Expr b)
 
Expr Halide::min (Expr a, float b)
 
template<typename A , typename B , typename C , typename... Rest, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Rest... >::value >::type * = nullptr>
Expr Halide::min (A &&a, B &&b, C &&c, Rest &&...rest)
 Returns an expression representing the lesser of an expressions vector, after doing any necessary type coersion using Internal::match_types.
 
Expr Halide::operator+ (Expr a, float b)
 Operators on floats treats those floats as Exprs.
 
Expr Halide::operator+ (float a, Expr b)
 
Expr Halide::operator- (Expr a, float b)
 
Expr Halide::operator- (float a, Expr b)
 
Expr Halide::operator* (Expr a, float b)
 
Expr Halide::operator* (float a, Expr b)
 
Expr Halide::operator/ (Expr a, float b)
 
Expr Halide::operator/ (float a, Expr b)
 
Expr Halide::operator% (Expr a, float b)
 
Expr Halide::operator% (float a, Expr b)
 
Expr Halide::operator> (Expr a, float b)
 
Expr Halide::operator> (float a, Expr b)
 
Expr Halide::operator< (Expr a, float b)
 
Expr Halide::operator< (float a, Expr b)
 
Expr Halide::operator>= (Expr a, float b)
 
Expr Halide::operator>= (float a, Expr b)
 
Expr Halide::operator<= (Expr a, float b)
 
Expr Halide::operator<= (float a, Expr b)
 
Expr Halide::operator== (Expr a, float b)
 
Expr Halide::operator== (float a, Expr b)
 
Expr Halide::operator!= (Expr a, float b)
 
Expr Halide::operator!= (float a, Expr b)
 
Expr Halide::clamp (Expr a, const Expr &min_val, const Expr &max_val)
 Clamps an expression to lie within the given bounds.
 
Expr Halide::abs (Expr a)
 Returns the absolute value of a signed integer or floating-point expression.
 
Expr Halide::absd (Expr a, Expr b)
 Return the absolute difference between two values.
 
Expr Halide::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.
 
template<typename... Args, typename std::enable_if< Halide::Internal::all_are_convertible< Expr, Args... >::value >::type * = nullptr>
Expr Halide::select (Expr c0, Expr v0, Expr c1, Expr v1, Args &&...args)
 A multi-way variant of select similar to a switch statement in C, which can accept multiple conditions and values in pairs.
 
Tuple Halide::select (const Tuple &condition, const Tuple &true_value, const Tuple &false_value)
 Equivalent of ternary select(), but taking/returning tuples.
 
Tuple Halide::select (const Expr &condition, const Tuple &true_value, const Tuple &false_value)
 
template<typename... Args>
Tuple Halide::select (const Tuple &c0, const Tuple &v0, const Tuple &c1, const Tuple &v1, Args &&...args)
 Equivalent of multiway select(), but taking/returning tuples.
 
template<typename... Args>
Tuple Halide::select (const Expr &c0, const Tuple &v0, const Expr &c1, const Tuple &v1, Args &&...args)
 
Expr Halide::select (const Expr &condition, const FuncRef &true_value, const FuncRef &false_value)
 select applied to FuncRefs (e.g.
 
template<typename... Args>
Expr Halide::select (const Expr &c0, const FuncRef &v0, const Expr &c1, const FuncRef &v1, Args &&...args)
 
Expr Halide::mux (const Expr &id, const std::initializer_list< Expr > &values)
 Oftentimes we want to pack a list of expressions with the same type into a channel dimension, e.g., img(x, y, c) = select(c == 0, 100, // Red c == 1, 50, // Green 25); // Blue This is tedious when the list is long.
 
Expr Halide::mux (const Expr &id, const std::vector< Expr > &values)
 
Expr Halide::mux (const Expr &id, const Tuple &values)
 
Expr Halide::mux (const Expr &id, const std::initializer_list< FuncRef > &values)
 
Tuple Halide::mux (const Expr &id, const std::initializer_list< Tuple > &values)
 
Tuple Halide::mux (const Expr &id, const std::vector< Tuple > &values)
 
Expr Halide::sin (Expr x)
 Return the sine of a floating-point expression.
 
Expr Halide::asin (Expr x)
 Return the arcsine of a floating-point expression.
 
Expr Halide::cos (Expr x)
 Return the cosine of a floating-point expression.
 
Expr Halide::acos (Expr x)
 Return the arccosine of a floating-point expression.
 
Expr Halide::tan (Expr x)
 Return the tangent of a floating-point expression.
 
Expr Halide::atan (Expr x)
 Return the arctangent of a floating-point expression.
 
Expr Halide::atan2 (Expr y, Expr x)
 Return the angle of a floating-point gradient.
 
Expr Halide::sinh (Expr x)
 Return the hyperbolic sine of a floating-point expression.
 
Expr Halide::asinh (Expr x)
 Return the hyperbolic arcsinhe of a floating-point expression.
 
Expr Halide::cosh (Expr x)
 Return the hyperbolic cosine of a floating-point expression.
 
Expr Halide::acosh (Expr x)
 Return the hyperbolic arccosine of a floating-point expression.
 
Expr Halide::tanh (Expr x)
 Return the hyperbolic tangent of a floating-point expression.
 
Expr Halide::atanh (Expr x)
 Return the hyperbolic arctangent of a floating-point expression.
 
Expr Halide::sqrt (Expr x)
 Return the square root of a floating-point expression.
 
Expr Halide::hypot (const Expr &x, const Expr &y)
 Return the square root of the sum of the squares of two floating-point expressions.
 
Expr Halide::exp (Expr x)
 Return the exponential of a floating-point expression.
 
Expr Halide::log (Expr x)
 Return the logarithm of a floating-point expression.
 
Expr Halide::pow (Expr x, Expr y)
 Return one floating point expression raised to the power of another.
 
Expr Halide::erf (const Expr &x)
 Evaluate the error function erf.
 
Expr Halide::fast_sin (const Expr &x)
 Fast vectorizable approximation to some trigonometric functions for Float(32).
 
Expr Halide::fast_cos (const Expr &x)
 
Expr Halide::fast_log (const Expr &x)
 Fast approximate cleanly vectorizable log for Float(32).
 
Expr Halide::fast_exp (const Expr &x)
 Fast approximate cleanly vectorizable exp for Float(32).
 
Expr Halide::fast_pow (Expr x, Expr y)
 Fast approximate cleanly vectorizable pow for Float(32).
 
Expr Halide::fast_inverse (Expr x)
 Fast approximate inverse for Float(32).
 
Expr Halide::fast_inverse_sqrt (Expr x)
 Fast approximate inverse square root for Float(32).
 
Expr Halide::floor (Expr x)
 Return the greatest whole number less than or equal to a floating-point expression.
 
Expr Halide::ceil (Expr x)
 Return the least whole number greater than or equal to a floating-point expression.
 
Expr Halide::round (Expr x)
 Return the whole number closest to a floating-point expression.
 
Expr Halide::trunc (Expr x)
 Return the integer part of a floating-point expression.
 
Expr Halide::is_nan (Expr x)
 Returns true if the argument is a Not a Number (NaN).
 
Expr Halide::is_inf (Expr x)
 Returns true if the argument is Inf or -Inf.
 
Expr Halide::is_finite (Expr x)
 Returns true if the argument is a finite value (ie, neither NaN nor Inf).
 
Expr Halide::fract (const Expr &x)
 Return the fractional part of a floating-point expression.
 
Expr Halide::reinterpret (Type t, Expr e)
 Reinterpret the bits of one value as another type.
 
template<typename T >
Expr Halide::reinterpret (Expr e)
 
Expr Halide::operator& (Expr x, Expr y)
 Return the bitwise and of two expressions (which need not have the same type).
 
Expr Halide::operator& (Expr x, int y)
 Return the bitwise and of an expression and an integer.
 
Expr Halide::operator& (int x, Expr y)
 
Expr Halide::operator| (Expr x, Expr y)
 Return the bitwise or of two expressions (which need not have the same type).
 
Expr Halide::operator| (Expr x, int y)
 Return the bitwise or of an expression and an integer.
 
Expr Halide::operator| (int x, Expr y)
 
Expr Halide::operator^ (Expr x, Expr y)
 Return the bitwise xor of two expressions (which need not have the same type).
 
Expr Halide::operator^ (Expr x, int y)
 Return the bitwise xor of an expression and an integer.
 
Expr Halide::operator^ (int x, Expr y)
 
Expr Halide::operator~ (Expr x)
 Return the bitwise not of an expression.
 
Expr Halide::operator<< (Expr x, Expr y)
 Shift the bits of an integer value left.
 
Expr Halide::operator<< (Expr x, int y)
 
Expr Halide::operator>> (Expr x, Expr y)
 Shift the bits of an integer value right.
 
Expr Halide::operator>> (Expr x, int y)
 
Expr Halide::lerp (Expr zero_val, Expr one_val, Expr weight)
 Linear interpolate between the two values according to a weight.
 
Expr Halide::popcount (Expr x)
 Count the number of set bits in an expression.
 
Expr Halide::count_leading_zeros (Expr x)
 Count the number of leading zero bits in an expression.
 
Expr Halide::count_trailing_zeros (Expr x)
 Count the number of trailing zero bits in an expression.
 
Expr Halide::div_round_to_zero (Expr x, Expr y)
 Divide two integers, rounding towards zero.
 
Expr Halide::mod_round_to_zero (Expr x, Expr y)
 Compute the remainder of dividing two integers, when division is rounding toward zero.
 
Expr Halide::random_float (Expr seed=Expr())
 Return a random variable representing a uniformly distributed float in the half-open interval [0.0f, 1.0f).
 
Expr Halide::random_uint (Expr seed=Expr())
 Return a random variable representing a uniformly distributed unsigned 32-bit integer.
 
Expr Halide::random_int (Expr seed=Expr())
 Return a random variable representing a uniformly distributed 32-bit integer.
 
Expr Halide::print (const std::vector< Expr > &values)
 Create an Expr that prints out its value whenever it is evaluated.
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE Expr Halide::print (Expr a, Args &&...args)
 
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.
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE Expr Halide::print_when (Expr condition, Expr a, Args &&...args)
 
Expr Halide::require (Expr condition, const std::vector< Expr > &values)
 Create an Expr that that guarantees a precondition.
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE Expr Halide::require (Expr condition, Expr value, Args &&...args)
 
Expr Halide::undef (Type t)
 Return an undef value of the given type.
 
template<typename T >
Expr Halide::undef ()
 
Expr Halide::Internal::unreachable (Type t=Int(32))
 Return an expression that should never be evaluated.
 
template<typename T >
Expr Halide::Internal::unreachable ()
 
template<typename... Args>
HALIDE_NO_USER_CODE_INLINE Expr Halide::memoize_tag (Expr result, Args &&...args)
 Control the values used in the memoization cache key for memoize.
 
Expr Halide::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.
 
Expr Halide::likely_if_innermost (Expr e)
 Equivalent to likely, but only triggers a loop partitioning if found in an innermost loop.
 
template<typename T >
Expr Halide::saturating_cast (Expr e)
 Cast an expression to the halide type corresponding to the C++ type T.
 
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.
 
Expr Halide::strict_float (Expr e)
 Makes a best effort attempt to preserve IEEE floating-point semantics in evaluating an expression.
 
Expr Halide::unsafe_promise_clamped (const Expr &value, const Expr &min, const Expr &max)
 Create an Expr that that promises another Expr is clamped but do not generate code to check the assertion or modify the value.
 
Expr Halide::Internal::promise_clamped (const Expr &value, const Expr &min, const Expr &max)
 FOR INTERNAL USE ONLY.
 
Expr Halide::scatter (const std::vector< Expr > &args)
 Scatter and gather are used for update definition which must store multiple values to distinct locations at the same time.
 
Expr Halide::gather (const std::vector< Expr > &args)
 
template<typename... Args>
Expr Halide::scatter (const Expr &e, Args &&...args)
 
template<typename... Args>
Expr Halide::gather (const Expr &e, Args &&...args)
 
Expr Halide::extract_bits (Type t, const Expr &e, const Expr &lsb)
 Extract a contiguous subsequence of the bits of 'e', starting at the bit index given by 'lsb', where zero is the least-significant bit, returning a value of type 't'.
 
template<typename T >
Expr Halide::extract_bits (const Expr &e, const Expr &lsb)
 
Expr Halide::concat_bits (const std::vector< Expr > &e)
 Given a number of Exprs of the same type, concatenate their bits producing a single Expr of the same type code of the input but with more bits.
 
Expr Halide::widen_right_add (Expr a, Expr b)
 Below is a collection of intrinsics for fixed-point programming.
 
Expr Halide::widen_right_mul (Expr a, Expr b)
 Compute a * widen(b).
 
Expr Halide::widen_right_sub (Expr a, Expr b)
 Compute a - widen(b).
 
Expr Halide::widening_add (Expr a, Expr b)
 Compute widen(a) + widen(b).
 
Expr Halide::widening_mul (Expr a, Expr b)
 Compute widen(a) * widen(b).
 
Expr Halide::widening_sub (Expr a, Expr b)
 Compute widen(a) - widen(b).
 
Expr Halide::widening_shift_left (Expr a, Expr b)
 Compute widen(a) << b.
 
Expr Halide::widening_shift_left (Expr a, int b)
 
Expr Halide::widening_shift_right (Expr a, Expr b)
 Compute widen(a) >> b.
 
Expr Halide::widening_shift_right (Expr a, int b)
 
Expr Halide::rounding_shift_left (Expr a, Expr b)
 Compute saturating_narrow(widening_add(a, (1 >> min(b, 0)) / 2) << b).
 
Expr Halide::rounding_shift_left (Expr a, int b)
 
Expr Halide::rounding_shift_right (Expr a, Expr b)
 Compute saturating_narrow(widening_add(a, (1 << max(b, 0)) / 2) >> b).
 
Expr Halide::rounding_shift_right (Expr a, int b)
 
Expr Halide::saturating_add (Expr a, Expr b)
 Compute saturating_narrow(widen(a) + widen(b))
 
Expr Halide::saturating_sub (Expr a, Expr b)
 Compute saturating_narrow(widen(a) - widen(b))
 
Expr Halide::halving_add (Expr a, Expr b)
 Compute narrow((widen(a) + widen(b)) / 2)
 
Expr Halide::rounding_halving_add (Expr a, Expr b)
 Compute narrow((widen(a) + widen(b) + 1) / 2)
 
Expr Halide::halving_sub (Expr a, Expr b)
 Compute narrow((widen(a) - widen(b)) / 2)
 
Expr Halide::mul_shift_right (Expr a, Expr b, Expr q)
 Compute saturating_narrow(shift_right(widening_mul(a, b), q))
 
Expr Halide::mul_shift_right (Expr a, Expr b, int q)
 
Expr Halide::rounding_mul_shift_right (Expr a, Expr b, Expr q)
 Compute saturating_narrow(rounding_shift_right(widening_mul(a, b), q))
 
Expr Halide::rounding_mul_shift_right (Expr a, Expr b, int q)
 
Expr Halide::target_arch_is (Target::Arch arch)
 Return a boolean Expr for the corresponding field of the Target being used during lowering; they can be useful in writing library code without having to plumb a Target through call sites, so that you can do things like.
 
Expr Halide::target_os_is (Target::OS os)
 
Expr Halide::target_has_feature (Target::Feature feat)
 
Expr Halide::target_bits ()
 Return the bit width of the Target used during lowering; this can be useful in writing library code without having to plumb a Target through call sites, so that you can do things like.
 
Expr Halide::target_natural_vector_size (Type t)
 Return the natural vector width for the given Type for the Target being used during lowering; this can be useful in writing library code without having to plumb a Target through call sites, so that you can do things like.
 
template<typename data_t >
Expr Halide::target_natural_vector_size ()
 

Detailed Description

Defines various operator overloads and utility functions that make it more pleasant to work with Halide expressions.

Definition in file IROperator.h.