Halide
Halide::Internal Namespace Reference

Namespaces

 Elf
 
 GeneratorMinMax
 
 IntegerDivision
 
 Introspection
 

Classes

struct  Add
 The sum of two expressions. More...
 
struct  all_are_convertible
 
struct  all_ints_and_optional_name
 
struct  all_ints_and_optional_name< First, Rest... >
 
struct  all_ints_and_optional_name< T >
 
struct  all_ints_and_optional_name<>
 
struct  Allocate
 Allocate a scratch area called with the given name, type, and size. More...
 
struct  And
 Logical and - are both expressions true. More...
 
struct  ApplySplitResult
 
struct  AssertStmt
 If the 'condition' is false, then evaluate and return the message, which should be a call to an error function. More...
 
struct  AssociativeOp
 Represent the equivalent associative op of an update definition. More...
 
struct  AssociativePattern
 Represent an associative op with its identity. More...
 
struct  BaseExprNode
 A base class for expression nodes. More...
 
struct  BaseStmtNode
 IR nodes are split into expressions and statements. More...
 
struct  Block
 A sequence of statements to be executed in-order. More...
 
struct  Bound
 
struct  Box
 Represents the bounds of a region of arbitrary dimension. More...
 
struct  Broadcast
 A vector with 'lanes' elements, in which every element is 'value'. More...
 
struct  BufferBuilder
 A builder to help create Exprs representing halide_buffer_t structs (e.g. More...
 
struct  BufferContents
 
struct  Call
 A function call. More...
 
struct  Cast
 The actual IR nodes begin here. More...
 
class  Closure
 A helper class to manage closures. More...
 
class  CodeGen_ARM
 A code generator that emits ARM code from a given Halide stmt. More...
 
class  CodeGen_C
 This class emits C++ code equivalent to a halide Stmt. More...
 
class  CodeGen_GLSL
 Compile one statement into GLSL. More...
 
class  CodeGen_GLSLBase
 This class handles GLSL arithmetic, shared by CodeGen_GLSL and CodeGen_OpenGLCompute_C. More...
 
struct  CodeGen_GPU_Dev
 A code generator that emits GPU code from a given Halide stmt. More...
 
class  CodeGen_GPU_Host
 A code generator that emits GPU code from a given Halide stmt. More...
 
class  CodeGen_Hexagon
 A code generator that emits Hexagon code from a given Halide stmt. More...
 
class  CodeGen_LLVM
 A code generator abstract base class. More...
 
class  CodeGen_Metal_Dev
 
class  CodeGen_MIPS
 A code generator that emits mips code from a given Halide stmt. More...
 
class  CodeGen_OpenCL_Dev
 
class  CodeGen_OpenGL_Dev
 
class  CodeGen_OpenGLCompute_Dev
 
class  CodeGen_Posix
 A code generator that emits posix code from a given Halide stmt. More...
 
class  CodeGen_PowerPC
 A code generator that emits mips code from a given Halide stmt. More...
 
class  CodeGen_PTX_Dev
 A code generator that emits GPU code from a given Halide stmt. More...
 
class  CodeGen_X86
 A code generator that emits x86 code from a given Halide stmt. More...
 
struct  cond
 
struct  Cost
 
class  debug
 For optional debugging during codegen, use the debug class as follows: More...
 
class  Definition
 A Function definition which can either represent a init or an update definition. More...
 
struct  DeviceArgument
 A DeviceArgument looks similar to an Halide::Argument, but has behavioral differences that make it specific to the GPU pipeline; the fact that neither is-a nor has-a Halide::Argument is deliberate. More...
 
struct  Dim
 
class  Dimension
 
struct  Div
 The ratio of two expressions. More...
 
struct  EQ
 Is the first expression equal to the second. More...
 
struct  ErrorReport
 
struct  Evaluate
 Evaluate and discard an expression, presumably because it has some side-effect. More...
 
struct  ExprNode
 We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes. More...
 
class  ExprUsesVars
 
struct  ExprWithCompareCache
 A wrapper about Exprs so that they can be deeply compared with a cache for known-equal subexpressions. More...
 
struct  FileStat
 
class  FindAllCalls
 Visitor for keeping track of functions that are directly called and the arguments with which they are called. More...
 
struct  FloatImm
 Floating point constants. More...
 
struct  For
 A for loop. More...
 
struct  Free
 Free the resources associated with the given buffer. More...
 
class  FuncSchedule
 A schedule for a Function of a Halide pipeline. More...
 
class  Function
 A reference-counted handle to Halide's internal representation of a function. More...
 
struct  FunctionPtr
 A possibly-weak pointer to a Halide function. More...
 
struct  GE
 Is the first expression greater than or equal to the second. More...
 
class  GeneratorBase
 
class  GeneratorInput_Arithmetic
 
class  GeneratorInput_Buffer
 
class  GeneratorInput_Func
 
class  GeneratorInput_Scalar
 
class  GeneratorInputBase
 
class  GeneratorInputImpl
 
class  GeneratorOutput_Arithmetic
 
class  GeneratorOutput_Buffer
 
class  GeneratorOutput_Func
 
class  GeneratorOutputBase
 
class  GeneratorOutputImpl
 
class  GeneratorParam_Arithmetic
 
class  GeneratorParam_Bool
 
class  GeneratorParam_Enum
 
class  GeneratorParam_MachineParams
 
class  GeneratorParam_Synthetic
 
class  GeneratorParam_Target
 
class  GeneratorParam_Type
 
class  GeneratorParamBase
 
class  GeneratorParamImpl
 
class  GeneratorRegistry
 
class  GeneratorStub
 
class  GIOBase
 GIOBase is the base class for all GeneratorInput<> and GeneratorOutput<> instantiations; it is not part of the public API and should never be used directly by user code. More...
 
struct  GT
 Is the first expression greater than the second. More...
 
struct  has_static_halide_type_method
 
struct  has_static_halide_type_method< T2, typename type_sink< decltype(T2::static_halide_type())>::type >
 
class  HostClosure
 A Closure modified to inspect GPU-specific memory accesses, and produce a vector of DeviceArgument objects. More...
 
struct  IfThenElse
 An if-then-else block. More...
 
struct  InferredArgument
 An inferred argument. More...
 
struct  integer_sequence
 
struct  Interval
 A class to represent ranges of Exprs. More...
 
struct  IntImm
 Integer constants. More...
 
struct  IntrusivePtr
 Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself. More...
 
class  IRCompareCache
 Lossily track known equal exprs with a cache. More...
 
struct  IRDeepCompare
 A compare struct suitable for use in std::map and std::set that computes a lexical ordering on IR nodes. More...
 
class  IRGraphMutator
 Deprecated for new use: please use IRGraphMutator2 instead. More...
 
class  IRGraphMutator2
 A mutator that caches and reapplies previously-done mutations, so that it can handle graphs of IR that have not had CSE done to them. More...
 
class  IRGraphVisitor
 A base class for algorithms that walk recursively over the IR without visiting the same node twice. More...
 
struct  IRHandle
 IR nodes are passed around opaque handles to them. More...
 
class  IRMutator
 Deprecated for new use: please use IRMutator2 instead. More...
 
class  IRMutator2
 A base class for passes over the IR which modify it (e.g. More...
 
struct  IRNode
 The abstract base classes for a node in the Halide IR. More...
 
class  IRPrinter
 An IRVisitor that emits IR to the given output stream in a human readable form. More...
 
class  IRVisitor
 A base class for algorithms that need to recursively walk over the IR. More...
 
struct  JITHandlers
 
struct  JITModule
 
class  JITSharedRuntime
 
struct  JITUserContext
 
struct  LE
 Is the first expression less than or equal to the second. More...
 
struct  Let
 A let expression, like you might find in a functional language. More...
 
struct  LetStmt
 The statement form of a let node. More...
 
struct  Load
 Load a value from a named symbol if predicate is true. More...
 
struct  LoweredArgument
 Definition of an argument to a LoweredFunc. More...
 
struct  LoweredFunc
 Definition of a lowered function. More...
 
struct  LT
 Is the first expression less than the second. More...
 
struct  make_integer_sequence_helper
 
struct  make_integer_sequence_helper< T, N, N >
 
struct  Max
 The greater of two values. More...
 
struct  meta_and
 
struct  meta_and< T1, Args... >
 
struct  meta_or
 
struct  meta_or< T1, Args... >
 
struct  Min
 The lesser of two values. More...
 
struct  Mod
 The remainder of a / b. More...
 
struct  ModulusRemainder
 The result of modulus_remainder analysis. More...
 
struct  Mul
 The product of two expressions. More...
 
struct  NE
 Is the first expression not equal to the second. More...
 
struct  next_integer_sequence
 
struct  next_integer_sequence< integer_sequence< T, Ints... > >
 
struct  NoRealizations
 
struct  NoRealizations< T, Args... >
 
struct  NoRealizations<>
 
struct  Not
 Logical not - true if the expression false. More...
 
class  ObjectInstanceRegistry
 
struct  Or
 Logical or - is at least one of the expression true. More...
 
class  Parameter
 A reference-counted handle to a parameter to a halide pipeline. More...
 
struct  Prefetch
 Represent a multi-dimensional region of a Func or an ImageParam that needs to be prefetched. More...
 
struct  PrefetchDirective
 
struct  ProducerConsumer
 This node is a helpful annotation to do with permissions. More...
 
struct  Provide
 This defines the value of a function at a multi-dimensional location. More...
 
struct  Ramp
 A linear ramp vector node. More...
 
struct  Range
 A single-dimensional span. More...
 
struct  Realize
 Allocate a multi-dimensional buffer of the given type and size. More...
 
class  ReductionDomain
 A reference-counted handle on a reduction domain, which is just a vector of ReductionVariable. More...
 
struct  ReductionVariable
 A single named dimension of a reduction domain. More...
 
class  RefCount
 A class representing a reference count to be used with IntrusivePtr. More...
 
struct  RegionCosts
 Auto scheduling component which is used to assign costs for computing a region of a function or one of its stages. More...
 
class  RegisterGenerator
 
class  ScheduleParamBase
 
class  Scope
 A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Let or a LetStmt, and that it should hide previous values with the same name until you leave the Let or LetStmt nodes This class helps with that. More...
 
struct  ScopedBinding
 Helper class for pushing/popping Scope<> values, to allow for early-exit in Visitor/Mutators that preserves correctness. More...
 
struct  ScopedValue
 Helper class for saving/restoring variable values on the stack, to allow for early-exit that preserves correctness. More...
 
struct  Select
 A ternary operator. More...
 
struct  select_type
 
struct  select_type< First >
 
struct  Shuffle
 Construct a new vector by taking elements from another sequence of vectors. More...
 
class  SmallStack
 A stack which can store one item very efficiently. More...
 
struct  SolverResult
 
struct  Specialization
 
struct  Split
 
class  StageSchedule
 A schedule for a single stage of a Halide pipeline. More...
 
struct  Stmt
 A reference-counted handle to a statement node. More...
 
struct  StmtNode
 
struct  StorageDim
 
struct  Store
 Store a 'value' to the buffer called 'name' at a given 'index' if 'predicate' is true. More...
 
struct  StringImm
 String constants. More...
 
class  StubInput
 
class  StubInputBuffer
 StubInputBuffer is the placeholder that a Stub uses when it requires a Buffer for an input (rather than merely a Func or Expr). More...
 
class  StubOutputBuffer
 StubOutputBuffer is the placeholder that a Stub uses when it requires a Buffer for an output (rather than merely a Func). More...
 
class  StubOutputBufferBase
 
struct  Sub
 The difference of two expressions. More...
 
class  SubstituteVarEstimates
 Substitute every variable with its estimate if specified. More...
 
class  TemporaryFile
 A simple utility class that creates a temporary file in its ctor and deletes that file in its dtor; this is useful for temporary files that you want to ensure are deleted when exiting a certain scope. More...
 
class  ThreadPool
 
struct  type_sink
 
struct  UIntImm
 Unsigned integer constants. More...
 
class  ValueTracker
 ValueTracker is an internal utility class that attempts to track and flag certain obvious Stub-related errors at Halide compile time: it tracks the constraints set on any Parameter-based argument (i.e., Input<Buffer> and Output<Buffer>) to ensure that incompatible values aren't set. More...
 
struct  Variable
 A named variable. More...
 
class  Voidifier
 

Typedefs

typedef std::map< std::string, IntervalDimBounds
 
typedef std::map< std::pair< std::string, int >, IntervalFuncValueBounds
 
template<typename T , typename T2 >
using add_const_if_T_is_const = typename std::conditional< std::is_const< T >::value, const T2, T2 >::type
 
template<typename T >
using GeneratorParamImplBase = typename select_type< cond< std::is_same< T, Target >::value, GeneratorParam_Target< T > >, cond< std::is_same< T, MachineParams >::value, GeneratorParam_MachineParams< T > >, cond< std::is_same< T, Type >::value, GeneratorParam_Type< T > >, cond< std::is_same< T, bool >::value, GeneratorParam_Bool< T > >, cond< std::is_arithmetic< T >::value, GeneratorParam_Arithmetic< T > >, cond< std::is_enum< T >::value, GeneratorParam_Enum< T > > >::type
 
template<typename T , typename TBase = typename std::remove_all_extents<T>::type>
using GeneratorInputImplBase = typename select_type< cond< has_static_halide_type_method< TBase >::value, GeneratorInput_Buffer< T > >, cond< std::is_same< TBase, Func >::value, GeneratorInput_Func< T > >, cond< std::is_arithmetic< TBase >::value, GeneratorInput_Arithmetic< T > >, cond< std::is_scalar< TBase >::value, GeneratorInput_Scalar< T > > >::type
 
template<typename T , typename TBase = typename std::remove_all_extents<T>::type>
using GeneratorOutputImplBase = typename select_type< cond< has_static_halide_type_method< TBase >::value, GeneratorOutput_Buffer< T > >, cond< std::is_same< TBase, Func >::value, GeneratorOutput_Func< T > >, cond< std::is_arithmetic< TBase >::value, GeneratorOutput_Arithmetic< T > > >::type
 
using GeneratorFactory = std::function< std::unique_ptr< GeneratorBase >(const GeneratorContext &)>
 
typedef std::vector< RangeRegion
 A multi-dimensional box. More...
 
typedef int(* halide_task) (void *user_context, int, uint8_t *)
 
typedef llvm::raw_pwrite_stream LLVMOStream
 
template<typename T , T N>
using make_integer_sequence = typename make_integer_sequence_helper< T, 0, N >::type
 
template<size_t... Ints>
using index_sequence = integer_sequence< size_t, Ints... >
 
template<size_t N>
using make_index_sequence = make_integer_sequence< size_t, N >
 

Enumerations

enum  Direction { Direction::Upper, Direction::Lower }
 
enum  IRNodeType {
  IRNodeType::IntImm, IRNodeType::UIntImm, IRNodeType::FloatImm, IRNodeType::StringImm,
  IRNodeType::Cast, IRNodeType::Variable, IRNodeType::Add, IRNodeType::Sub,
  IRNodeType::Mul, IRNodeType::Div, IRNodeType::Mod, IRNodeType::Min,
  IRNodeType::Max, IRNodeType::EQ, IRNodeType::NE, IRNodeType::LT,
  IRNodeType::LE, IRNodeType::GT, IRNodeType::GE, IRNodeType::And,
  IRNodeType::Or, IRNodeType::Not, IRNodeType::Select, IRNodeType::Load,
  IRNodeType::Ramp, IRNodeType::Broadcast, IRNodeType::Call, IRNodeType::Let,
  IRNodeType::LetStmt, IRNodeType::AssertStmt, IRNodeType::ProducerConsumer, IRNodeType::For,
  IRNodeType::Store, IRNodeType::Provide, IRNodeType::Allocate, IRNodeType::Free,
  IRNodeType::Realize, IRNodeType::Block, IRNodeType::IfThenElse, IRNodeType::Evaluate,
  IRNodeType::Shuffle, IRNodeType::Prefetch
}
 All our IR node types get unique IDs for the purposes of RTTI. More...
 
enum  ForType {
  ForType::Serial, ForType::Parallel, ForType::Vectorized, ForType::Unrolled,
  ForType::GPUBlock, ForType::GPUThread
}
 An enum describing a type of loop traversal. More...
 
enum  IOKind { IOKind::Scalar, IOKind::Function, IOKind::Buffer }
 
enum  Monotonic { Monotonic::Constant, Monotonic::Increasing, Monotonic::Decreasing, Monotonic::Unknown }
 Detect whether an expression is monotonic increasing in a variable, decreasing, or unknown. More...
 

Functions

Stmt add_image_checks (Stmt s, const std::vector< Function > &outputs, const Target &t, const std::vector< std::string > &order, const std::map< std::string, Function > &env, const FuncValueBounds &fb)
 Insert checks to make sure a statement doesn't read out of bounds on inputs or outputs, and that the inputs and outputs conform to the format required (e.g. More...
 
Stmt add_parameter_checks (Stmt s, const Target &t)
 Insert checks to make sure that all referenced parameters meet their constraints. More...
 
Stmt align_loads (Stmt s, int alignment)
 Attempt to rewrite unaligned loads from buffers which are known to be aligned to instead load aligned vectors that cover the original load, and then slice the original load out of the aligned vectors. More...
 
Stmt allocation_bounds_inference (Stmt s, const std::map< std::string, Function > &env, const std::map< std::pair< std::string, int >, Interval > &func_bounds)
 Take a partially statement with Realize nodes in terms of variables, and define values for those variables. More...
 
std::vector< ApplySplitResultapply_split (const Split &split, bool is_update, std::string prefix, std::map< std::string, Expr > &dim_extent_alignment)
 Given a Split schedule on a definition (init or update), return a list of of predicates on the definition, substitutions that needs to be applied to the definition (in ascending order of application), and let stmts which defined the values of variables referred by the predicates and substitutions (ordered from innermost to outermost let). More...
 
std::vector< std::pair< std::string, Expr > > compute_loop_bounds_after_split (const Split &split, std::string prefix)
 Compute the loop bounds of the new dimensions resulting from applying the split schedules using the loop bounds of the old dimensions. More...
 
const std::vector< AssociativePattern > & get_ops_table (const std::vector< Expr > &exprs)
 
AssociativeOp prove_associativity (const std::string &f, std::vector< Expr > args, std::vector< Expr > exprs)
 Given an update definition of a Func 'f', determine its equivalent associative binary/unary operator if there is any. More...
 
EXPORT void associativity_test ()
 
EXPORT std::string generate_schedules (const std::vector< Function > &outputs, const Target &target, const MachineParams &arch_params)
 Generate schedules for Funcs within a pipeline. More...
 
Expr get_extent (const Interval &i)
 Return the size of an interval. More...
 
Expr box_size (const Box &b)
 Return the size of an n-d box. More...
 
void disp_regions (const std::map< std::string, Box > &regions)
 Helper function to print the bounds of a region. More...
 
Definition get_stage_definition (const Function &f, int stage_num)
 Return the corresponding definition of a function given the stage. More...
 
void combine_load_costs (std::map< std::string, Expr > &result, const std::map< std::string, Expr > &partial)
 Add partial load costs to the corresponding function in the result costs. More...
 
DimBounds get_stage_bounds (Function f, int stage_num, const DimBounds &pure_bounds)
 Return the required bounds of an intermediate stage (f, stage_num) of function 'f' given the bounds of the pure dimensions. More...
 
std::vector< DimBoundsget_stage_bounds (Function f, const DimBounds &pure_bounds)
 Return the required bounds for all the stages of the function 'f'. More...
 
Expr perform_inline (Expr e, const std::map< std::string, Function > &env, const std::set< std::string > &inlines=std::set< std::string >())
 Recursively inline all the functions in the set 'inlines' into the expression 'e' and return the resulting expression. More...
 
std::set< std::string > get_parents (Function f, int stage)
 Return all functions that are directly called by a function stage (f, stage). More...
 
Interval bounds_of_expr_in_scope (Expr expr, const Scope< Interval > &scope, const FuncValueBounds &func_bounds=FuncValueBounds(), bool const_bound=false)
 Given an expression in some variables, and a map from those variables to their bounds (in the form of (minimum possible value, maximum possible value)), compute two expressions that give the minimum possible value and the maximum possible value of this expression. More...
 
Expr find_constant_bound (Expr e, Direction d, const Scope< Interval > &scope=Scope< Interval >())
 
void merge_boxes (Box &a, const Box &b)
 Expand box a to encompass box b. More...
 
bool boxes_overlap (const Box &a, const Box &b)
 Test if box a could possibly overlap box b. More...
 
Box box_union (const Box &a, const Box &b)
 The union of two boxes. More...
 
Box box_intersection (const Box &a, const Box &b)
 The intersection of two boxes. More...
 
bool box_contains (const Box &a, const Box &b)
 Test if box a provably contains box b. More...
 
FuncValueBounds compute_function_value_bounds (const std::vector< std::string > &order, const std::map< std::string, Function > &env)
 Compute the maximum and minimum possible value for each function in an environment. More...
 
EXPORT void bounds_test ()
 
Stmt bounds_inference (Stmt, const std::vector< Function > &outputs, const std::vector< std::string > &realization_order, const std::map< std::string, Function > &environment, const std::map< std::pair< std::string, int >, Interval > &func_bounds, const Target &target)
 Take a partially lowered statement that includes symbolic representations of the bounds over which things should be realized, and inject expressions defining those bounds. More...
 
EXPORT Expr buffer_accessor (const Buffer<> &buf, const std::vector< Expr > &args)
 
template<typename T , typename = typename std::enable_if<!std::is_convertible<T, std::string>::value>::type>
std::string get_name_from_end_of_parameter_pack (T &&)
 
std::string get_name_from_end_of_parameter_pack (const std::string &n)
 
std::string get_name_from_end_of_parameter_pack ()
 
template<typename First , typename Second , typename ... Args>
std::string get_name_from_end_of_parameter_pack (First first, Second second, Args &&... rest)
 
void get_shape_from_start_of_parameter_pack_helper (std::vector< int > &, const std::string &)
 
void get_shape_from_start_of_parameter_pack_helper (std::vector< int > &)
 
template<typename ... Args>
void get_shape_from_start_of_parameter_pack_helper (std::vector< int > &result, int x, Args &&... rest)
 
template<typename ... Args>
std::vector< int > get_shape_from_start_of_parameter_pack (Args &&... args)
 
Stmt canonicalize_gpu_vars (Stmt s)
 Canonicalize GPU var names into some pre-determined block/thread names (i.e. More...
 
llvm::StructType * build_closure_type (const Closure &closure, llvm::StructType *buffer_t, llvm::LLVMContext *context)
 The llvm type of a struct containing all of the externally referenced state of a Closure. More...
 
void pack_closure (llvm::StructType *type, llvm::Value *dst, const Closure &closure, const Scope< llvm::Value *> &src, llvm::StructType *buffer_t, llvm::IRBuilder<> *builder)
 Emit code that builds a struct containing all the externally referenced state. More...
 
void unpack_closure (const Closure &closure, Scope< llvm::Value *> &dst, llvm::StructType *type, llvm::Value *src, llvm::IRBuilder<> *builder)
 Emit code that unpacks a struct containing all the externally referenced state into a symbol table. More...
 
llvm::Type * llvm_type_of (llvm::LLVMContext *context, Halide::Type t)
 Get the llvm type equivalent to a given halide type. More...
 
bool function_takes_user_context (const std::string &name)
 Which built-in functions require a user-context first argument? More...
 
bool can_allocation_fit_on_stack (int64_t size)
 Given a size (in bytes), return True if the allocation size can fit on the stack; otherwise, return False. More...
 
Stmt unpredicate_loads_stores (Stmt s)
 Replace predicated loads/stores with unpredicated equivalents inside branches. More...
 
void get_target_options (const llvm::Module &module, llvm::TargetOptions &options, std::string &mcpu, std::string &mattrs)
 Given an llvm::Module, set llvm:TargetOptions, cpu and attr information. More...
 
void clone_target_options (const llvm::Module &from, llvm::Module &to)
 Given two llvm::Modules, clone target options from one to the other. More...
 
std::unique_ptr< llvm::TargetMachine > make_target_machine (const llvm::Module &module)
 Given an llvm::Module, get or create an llvm:TargetMachine. More...
 
void set_function_attributes_for_target (llvm::Function *, Target)
 Set the appropriate llvm Function attributes given a Target. More...
 
EXPORT std::string cplusplus_function_mangled_name (const std::string &name, const std::vector< std::string > &namespaces, Type return_type, const std::vector< ExternFuncArgument > &args, const Target &target)
 Return the mangled C++ name for a function. More...
 
EXPORT void cplusplus_mangle_test ()
 
EXPORT Expr common_subexpression_elimination (Expr)
 Replace each common sub-expression in the argument with a variable, and wrap the resulting expr in a let statement giving a value to that variable. More...
 
EXPORT Stmt common_subexpression_elimination (Stmt)
 Do common-subexpression-elimination on each expression in a statement. More...
 
EXPORT void cse_test ()
 
EXPORT std::ostream & operator<< (std::ostream &stream, const Stmt &)
 Emit a halide statement on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &, const LoweredFunc &)
 
void debug_arguments (LoweredFunc *func)
 Injects debug prints in a LoweredFunc that describe the arguments. More...
 
Stmt debug_to_file (Stmt s, const std::vector< Function > &outputs, const std::map< std::string, Function > &env)
 Takes a statement with Realize nodes still unlowered. More...
 
EXPORT Expr extract_odd_lanes (Expr a)
 Extract the odd-numbered lanes in a vector. More...
 
EXPORT Expr extract_even_lanes (Expr a)
 Extract the even-numbered lanes in a vector. More...
 
EXPORT Expr extract_lane (Expr vec, int lane)
 Extract the nth lane of a vector. More...
 
Stmt rewrite_interleavings (Stmt s)
 Look through a statement for expressions of the form select(ramp % 2 == 0, a, b) and replace them with calls to an interleave intrinsic. More...
 
EXPORT void deinterleave_vector_test ()
 
Expr make_device_interface_call (DeviceAPI device_api)
 Get an Expr which evaluates to the device interface for the given device api at runtime. More...
 
Stmt inject_early_frees (Stmt s)
 Take a statement with allocations and inject markers (of the form of calls to "mark buffer dead") after the last use of each allocation. More...
 
EXPORT Type eliminated_bool_type (Type bool_type, Type other_type)
 If a type is a boolean vector, find the type that it has been changed to by eliminate_bool_vectors. More...
 
template<>
EXPORT RefCountref_count< IRNode > (const IRNode *n)
 
template<>
EXPORT void destroy< IRNode > (const IRNode *n)
 
template<typename StmtOrExpr >
bool stmt_or_expr_uses_var (StmtOrExpr e, const std::string &v)
 Test if a statement or expression references the given variable. More...
 
template<typename StmtOrExpr , typename T >
bool stmt_or_expr_uses_vars (StmtOrExpr e, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
 Test if a statement or expression references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument. More...
 
bool expr_uses_var (Expr e, const std::string &v)
 Test if an expression references the given variable. More...
 
bool stmt_uses_var (Stmt s, const std::string &v)
 Test if a statement references the given variable. More...
 
template<typename T >
bool expr_uses_vars (Expr e, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
 Test if an expression references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument. More...
 
template<typename T >
bool stmt_uses_vars (Stmt e, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
 Test if a statement references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument. More...
 
std::map< std::string, Functionfind_direct_calls (Function f)
 Construct a map from name to Function definition object for all Halide functions called directly in the definition of the Function f, including in update definitions, update index expressions, and RDom extents. More...
 
std::map< std::string, Functionfind_transitive_calls (Function f)
 Construct a map from name to Function definition object for all Halide functions called directly in the definition of the Function f, or indirectly in those functions' definitions, recursively. More...
 
void populate_environment (Function f, std::map< std::string, Function > &env)
 Find all Functions transitively referenced by f in any way and add them to the given map. More...
 
template<typename Last >
void check_types (const Tuple &t, int idx)
 
template<typename First , typename Second , typename... Rest>
void check_types (const Tuple &t, int idx)
 
template<typename Last >
void assign_results (Realization &r, int idx, Last last)
 
template<typename First , typename Second , typename... Rest>
void assign_results (Realization &r, int idx, First first, Second second, Rest &&... rest)
 
void schedule_scalar (Func f)
 
std::pair< std::vector< Function >, std::map< std::string, Function > > deep_copy (const std::vector< Function > &outputs, const std::map< std::string, Function > &env)
 Deep copy an entire Function DAG. More...
 
Stmt zero_gpu_loop_mins (Stmt s)
 Rewrite all GPU loops to have a min of zero. More...
 
Stmt fuse_gpu_thread_loops (Stmt s)
 Converts Halide's GPGPU IR to the OpenCL/CUDA/Metal model. More...
 
Stmt fuzz_float_stores (Stmt s)
 On every store of a floating point value, mask off the least-significant-bit of the mantissa. More...
 
EXPORT void generator_test ()
 
EXPORT std::vector< Exprparameter_constraints (const Parameter &p)
 
template<typename T >
NO_INLINE std::string enum_to_string (const std::map< std::string, T > &enum_map, const T &t)
 
template<typename T >
enum_from_string (const std::map< std::string, T > &enum_map, const std::string &s)
 
EXPORT const std::map< std::string, Halide::Type > & get_halide_type_enum_map ()
 
std::string halide_type_to_enum_string (const Type &t)
 
EXPORT const std::map< std::string, Halide::LoopLevel > & get_halide_looplevel_enum_map ()
 
std::string halide_looplevel_to_enum_string (const LoopLevel &loop_level)
 
EXPORT std::string halide_type_to_c_source (const Type &t)
 
EXPORT std::string halide_type_to_c_type (const Type &t)
 
EXPORT int generate_filter_main (int argc, char **argv, std::ostream &cerr)
 generate_filter_main() is a convenient wrapper for GeneratorRegistry::create() + compile_to_files(); it can be trivially wrapped by a "real" main() to produce a command-line utility for ahead-of-time filter compilation. More...
 
template<typename T >
parse_scalar (const std::string &value)
 
EXPORT std::vector< Typeparse_halide_type_list (const std::string &types)
 
Stmt inject_hexagon_rpc (Stmt s, const Target &host_target, Module &module)
 Pull loops marked with the Hexagon device API to a separate module, and call them through the Hexagon host runtime module. More...
 
Buffer< uint8_tcompile_module_to_hexagon_shared_object (const Module &device_code)
 
EXPORT Stmt optimize_hexagon_shuffles (Stmt s, int lut_alignment)
 Replace indirect and other loads with simple loads + vlut calls. More...
 
EXPORT Stmt vtmpy_generator (Stmt s)
 Generate vtmpy instruction if possible. More...
 
EXPORT Stmt optimize_hexagon_instructions (Stmt s, Target t)
 Hexagon deinterleaves when performing widening operations, and interleaves when performing narrowing operations. More...
 
std::vector< InferredArgumentinfer_arguments (Stmt body, const std::vector< Function > &outputs)
 
EXPORT Stmt call_extern_and_assert (const std::string &name, const std::vector< Expr > &args)
 A helper function to call an extern function, and assert that it returns 0. More...
 
EXPORT Stmt inject_host_dev_buffer_copies (Stmt s, const Target &t)
 Inject calls to halide_device_malloc, halide_copy_to_device, and halide_copy_to_host as needed. More...
 
Stmt inject_opengl_intrinsics (Stmt s)
 Take a statement with for kernel for loops and turn loads and stores inside the loops into OpenGL texture load and store intrinsics. More...
 
void validate_schedule_inlined_function (Function f)
 Check if the schedule of an inlined function is legal, throwing an error if it is not. More...
 
EXPORT void interval_test ()
 
EXPORT void ir_equality_test ()
 
EXPORT bool expr_match (Expr pattern, Expr expr, std::vector< Expr > &result)
 Does the first expression have the same structure as the second? Variables in the first expression with the name * are interpreted as wildcards, and their matching equivalent in the second expression is placed in the vector give as the third argument. More...
 
EXPORT bool expr_match (Expr pattern, Expr expr, std::map< std::string, Expr > &result)
 Does the first expression have the same structure as the second? Variables are matched consistently. More...
 
EXPORT void expr_match_test ()
 
EXPORT bool 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. More...
 
EXPORT bool 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. More...
 
EXPORT const int64_tas_const_int (const Expr &e)
 If an expression is an IntImm or a Broadcast of an IntImm, return a pointer to its value. More...
 
EXPORT const uint64_tas_const_uint (const Expr &e)
 If an expression is a UIntImm or a Broadcast of a UIntImm, return a pointer to its value. More...
 
EXPORT const double * as_const_float (const Expr &e)
 If an expression is a FloatImm or a Broadcast of a FloatImm, return a pointer to its value. More...
 
EXPORT bool is_const_power_of_two_integer (const Expr &e, int *bits)
 Is the expression a constant integer power of two. More...
 
EXPORT bool 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) More...
 
EXPORT bool 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) More...
 
EXPORT bool is_negative_negatable_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) and is its negative value representable. More...
 
EXPORT bool is_undef (const Expr &e)
 Is the expression an undef. More...
 
EXPORT bool is_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) More...
 
EXPORT bool is_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) More...
 
EXPORT bool is_two (const Expr &e)
 Is the expression a const (as defined by is_const), and also equal to two (in all lanes, if a vector expression) More...
 
EXPORT bool 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) More...
 
bool 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. More...
 
EXPORT void check_representable (Type t, int64_t val)
 Check if a constant value can be correctly represented as the given type. More...
 
EXPORT Expr make_bool (bool val, int lanes=1)
 Construct a boolean constant from a C++ boolean value. More...
 
EXPORT Expr make_zero (Type t)
 Construct the representation of zero in the given type. More...
 
EXPORT Expr make_one (Type t)
 Construct the representation of one in the given type. More...
 
EXPORT Expr make_two (Type t)
 Construct the representation of two in the given type. More...
 
EXPORT Expr const_true (int lanes=1)
 Construct the constant boolean true. More...
 
EXPORT Expr const_false (int lanes=1)
 Construct the constant boolean false. More...
 
EXPORT Expr lossless_cast (Type t, Expr e)
 Attempt to cast an expression to a smaller type while provably not losing information. More...
 
EXPORT void match_types (Expr &a, Expr &b)
 Coerce the two expressions to have the same type, using C-style casting rules. More...
 
EXPORT Expr raise_to_integer_power (Expr a, int64_t b)
 Raise an expression to an integer power by repeatedly multiplying it by itself. More...
 
EXPORT void split_into_ands (const Expr &cond, std::vector< Expr > &result)
 Split a boolean condition into vector of ANDs. More...
 
Expr strided_ramp_base (Expr e, int stride=1)
 If e is a ramp expression with stride, default 1, return the base, otherwise undefined. More...
 
NO_INLINE void collect_print_args (std::vector< Expr > &args)
 
template<typename ... Args>
NO_INLINE void collect_print_args (std::vector< Expr > &args, const char *arg, Args &&... more_args)
 
template<typename ... Args>
NO_INLINE void collect_print_args (std::vector< Expr > &args, Expr arg, Args &&... more_args)
 
EXPORT Expr memoize_tag_helper (Expr result, const std::vector< Expr > &cache_key_values)
 
EXPORT std::ostream & operator<< (std::ostream &stream, const AssociativePattern &)
 Emit a halide associative pattern on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const AssociativeOp &)
 Emit a halide associative op on an output stream (such as std::cout) in a human-readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const ForType &)
 Emit a halide for loop type (vectorized, serial, etc) in a human readable form. More...
 
EXPORT std::ostream & operator<< (std::ostream &stream, const NameMangling &)
 Emit a halide name mangling value in a human readable format. More...
 
Expr EXPORT lower_lerp (Expr zero_val, Expr one_val, Expr weight)
 Build Halide IR that computes a lerp. More...
 
Stmt loop_invariant_code_motion (Stmt)
 Hoist loop-invariants out of inner loops. More...
 
template<typename T >
auto iterator_to_pointer (T iter) -> decltype(&*std::declval< T >())
 
llvm::Triple get_triple_for_target (const Target &target)
 Return the llvm::Triple that corresponds to the given Halide Target. More...
 
std::unique_ptr< llvm::Module > get_initial_module_for_target (Target, llvm::LLVMContext *, bool for_shared_jit_runtime=false, bool just_gpu=false)
 Create an llvm module containing the support code for a given target. More...
 
std::unique_ptr< llvm::Module > get_initial_module_for_ptx_device (Target, llvm::LLVMContext *c)
 Create an llvm module containing the support code for ptx device. More...
 
void add_bitcode_to_module (llvm::LLVMContext *context, llvm::Module &module, const std::vector< uint8_t > &bitcode, const std::string &name)
 Link a block of llvm bitcode into an llvm module. More...
 
Stmt loop_carry (Stmt, int max_carried_values=8)
 Reuse loads done on previous loop iterations by stashing them in induction variables instead of redoing the load. More...
 
EXPORT Module lower (const std::vector< Function > &output_funcs, const std::string &pipeline_name, const Target &t, const std::vector< Argument > &args, const Internal::LoweredFunc::LinkageType linkage_type, const std::vector< IRMutator2 *> &custom_passes=std::vector< IRMutator2 *>())
 Given a vector of scheduled halide functions, create a Module that evaluates it. More...
 
EXPORT Stmt lower_main_stmt (const std::vector< Function > &output_funcs, const std::string &pipeline_name, const Target &t, const std::vector< IRMutator2 *> &custom_passes=std::vector< IRMutator2 *>())
 Given a halide function with a schedule, create a statement that evaluates it. More...
 
void lower_test ()
 
EXPORT llvm::Functiondefine_matlab_wrapper (llvm::Module *module, llvm::Function *pipeline_argv_wrapper, llvm::Function *metadata_getter)
 Add a mexFunction wrapper definition to the module, calling the function with the name pipeline_name. More...
 
Stmt inject_memoization (Stmt s, const std::map< std::string, Function > &env, const std::string &name, const std::vector< Function > &outputs)
 Transform pipeline calls for Funcs scheduled with memoize to do a lookup call to the runtime cache implementation, and if there is a miss, compute the results and call the runtime to store it back to the cache. More...
 
Stmt rewrite_memoized_allocations (Stmt s, const std::map< std::string, Function > &env)
 This should be called after Storage Flattening has added Allocation IR nodes. More...
 
EXPORT ModulusRemainder modulus_remainder (Expr e)
 For things like alignment analysis, often it's helpful to know if an integer expression is some multiple of a constant plus some other constant. More...
 
EXPORT ModulusRemainder modulus_remainder (Expr e, const Scope< ModulusRemainder > &scope)
 If we have alignment information about external variables, we can let the analysis know about that using this version of modulus_remainder: More...
 
EXPORT void modulus_remainder_test ()
 
EXPORT int gcd (int, int)
 The greatest common divisor of two integers. More...
 
EXPORT int lcm (int, int)
 The least common multiple of two integers. More...
 
EXPORT Monotonic is_monotonic (Expr e, const std::string &var)
 
EXPORT void is_monotonic_test ()
 
bool can_parallelize_rvar (const std::string &rvar, const std::string &func, const Definition &r)
 Returns whether or not Halide can prove that it is safe to parallelize an update definition across a specific variable. More...
 
void check_call_arg_types (const std::string &name, std::vector< Expr > *args, int dims)
 Validate arguments to a call to a func, image or imageparam. More...
 
bool has_likely_tag (Expr e)
 Return true if an expression uses a likely tag. More...
 
EXPORT Stmt partition_loops (Stmt s)
 Partitions loop bodies into a prologue, a steady state, and an epilogue. More...
 
Stmt inject_prefetch (Stmt s, const std::map< std::string, Function > &env)
 
Stmt reduce_prefetch_dimension (Stmt stmt, const Target &t)
 Reduce a multi-dimensional prefetch into a prefetch of lower dimension (max dimension of the prefetch is specified by target architecture). More...
 
std::string print_loop_nest (const std::vector< Function > &output_funcs)
 Emit some simple pseudocode that shows the structure of the loop nest specified by this pipeline's schedule, and the schedules of the functions it uses. More...
 
Stmt inject_profiling (Stmt, std::string)
 Take a statement representing a halide pipeline insert high-resolution timing into the generated code (via spawning a thread that acts as a sampling profiler); summaries of execution times and counts will be logged at the end. More...
 
Expr qualify (const std::string &prefix, Expr value)
 Prefix all variable names in the given expression with the prefix string. More...
 
Expr random_float (const std::vector< Expr > &)
 Return a random floating-point number between zero and one that varies deterministically based on the input expressions. More...
 
Expr random_int (const std::vector< Expr > &)
 Return a random unsigned integer between zero and 2^32-1 that varies deterministically based on the input expressions (which must be integers or unsigned integers). More...
 
Expr lower_random (Expr e, const std::vector< std::string > &free_vars, int tag)
 Convert calls to random() to IR generated by random_float and random_int. More...
 
std::vector< std::string > realization_order (const std::vector< Function > &output, const std::map< std::string, Function > &env)
 Given a bunch of functions that call each other, determine an order in which to do the scheduling. More...
 
EXPORT void split_predicate_test ()
 
bool is_func_trivial_to_inline (const Function &func)
 Return true if the cost of inlining a function is equivalent to the cost of calling the function directly. More...
 
Stmt remove_dead_allocations (Stmt s)
 Find Allocate/Free pairs that are never loaded from or stored to, and remove them from the Stmt. More...
 
Stmt remove_trivial_for_loops (Stmt s)
 Convert for loops of size 1 into LetStmt nodes, which allows for further simplification. More...
 
Stmt remove_undef (Stmt s)
 Removes stores that depend on undef values, and statements that only contain such stores. More...
 
Stmt schedule_functions (const std::vector< Function > &outputs, const std::vector< std::string > &order, const std::map< std::string, Function > &env, const Target &target, bool &any_memoized)
 Build loop nests and inject Function realizations at the appropriate places using the schedule. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &stream, const Scope< T > &s)
 
Stmt select_gpu_api (Stmt s, Target t)
 Replace for loops with GPU_Default device_api with an actual device API depending on what's enabled in the target. More...
 
EXPORT bool can_prove (Expr e)
 A common use of the simplifier is to prove boolean expressions are true at compile time. More...
 
EXPORT Stmt simplify_exprs (Stmt)
 Simplify expressions found in a statement, but don't simplify across different statements. More...
 
template<>
float mod_imp< float > (float a, float b)
 
template<>
double mod_imp< double > (double a, double b)
 
template<>
float div_imp< float > (float a, float b)
 
template<>
double div_imp< double > (double a, double b)
 
EXPORT void simplify_test ()
 
EXPORT void simplify_specializations (std::map< std::string, Function > &env)
 Try to simplify the RHS/LHS of a function's definition based on its specializations. More...
 
Stmt skip_stages (Stmt s, const std::vector< std::string > &order)
 Avoid computing certain stages if we can infer a runtime condition to check that tells us they won't be used. More...
 
Stmt sliding_window (Stmt s, const std::map< std::string, Function > &env)
 Perform sliding window optimizations on a halide statement. More...
 
EXPORT SolverResult solve_expression (Expr e, const std::string &variable, const Scope< Expr > &scope=Scope< Expr >::empty_scope())
 Attempts to collect all instances of a variable in an expression tree and place it as far to the left as possible, and as far up the tree as possible (i.e. More...
 
EXPORT Interval solve_for_outer_interval (Expr c, const std::string &variable)
 Find the smallest interval such that the condition is either true or false inside of it, but definitely false outside of it. More...
 
EXPORT Interval solve_for_inner_interval (Expr c, const std::string &variable)
 Find the largest interval such that the condition is definitely true inside of it, and might be true or false outside of it. More...
 
Expr and_condition_over_domain (Expr c, const Scope< Interval > &varying)
 Take a conditional that includes variables that vary over some domain, and convert it to a more conservative (less frequently true) condition that doesn't depend on those variables. More...
 
EXPORT void solve_test ()
 
Stmt split_tuples (Stmt s, const std::map< std::string, Function > &env)
 Rewrite all tuple-valued Realizations, Provide nodes, and Call nodes into several scalar-valued ones, so that later lowering passes only need to think about scalar-valued productions. More...
 
EXPORT void print_to_html (std::string filename, Stmt s)
 Dump an HTML-formatted print of a Stmt to filename. More...
 
EXPORT void print_to_html (std::string filename, const Module &m)
 Dump an HTML-formatted print of a Module to filename. More...
 
Stmt storage_flattening (Stmt s, const std::vector< Function > &outputs, const std::map< std::string, Function > &env, const Target &target)
 Take a statement with multi-dimensional Realize, Provide, and Call nodes, and turn it into a statement with single-dimensional Allocate, Store, and Load nodes respectively. More...
 
Stmt storage_folding (Stmt s, const std::map< std::string, Function > &env)
 Fold storage of functions if possible. More...
 
EXPORT Expr substitute (const std::string &name, const Expr &replacement, const Expr &expr)
 Substitute variables with the given name with the replacement expression within expr. More...
 
EXPORT Stmt substitute (const std::string &name, const Expr &replacement, const Stmt &stmt)
 Substitute variables with the given name with the replacement expression within stmt. More...
 
EXPORT void target_test ()
 
Stmt inject_tracing (Stmt, const std::string &pipeline_name, const std::map< std::string, Function > &env, const std::vector< Function > &outputs, const Target &Target)
 Take a statement representing a halide pipeline, inject calls to tracing functions at interesting points, such as allocations. More...
 
EXPORT Stmt trim_no_ops (Stmt s)
 Truncate loop bounds to the region over which they actually do something. More...
 
Stmt unify_duplicate_lets (Stmt s)
 Find let statements that all define the same value, and make later ones just reuse the symbol names of the earlier ones. More...
 
Stmt uniquify_variable_names (Stmt s)
 Modify a statement so that every internally-defined variable name is unique. More...
 
Stmt unpack_buffers (Stmt s)
 Creates let stmts for the various buffer components (e.g. More...
 
Stmt unroll_loops (Stmt)
 Take a statement with for loops marked for unrolling, and convert each into several copies of the innermost statement. More...
 
template<typename DstType , typename SrcType >
DstType reinterpret_bits (const SrcType &src)
 An aggressive form of reinterpret cast used for correct type-punning. More...
 
EXPORT std::string make_entity_name (void *stack_ptr, const std::string &type, char prefix)
 Make a unique name for an object based on the name of the stack variable passed in. More...
 
EXPORT std::string get_env_variable (char const *env_var_name)
 Get value of an environment variable. More...
 
EXPORT std::string running_program_name ()
 Get the name of the currently running executable. More...
 
EXPORT bool starts_with (const std::string &str, const std::string &prefix)
 Test if the first string starts with the second string. More...
 
EXPORT bool ends_with (const std::string &str, const std::string &suffix)
 Test if the first string ends with the second string. More...
 
EXPORT std::string replace_all (const std::string &str, const std::string &find, const std::string &replace)
 Replace all matches of the second string in the first string with the last string. More...
 
EXPORT std::vector< std::string > split_string (const std::string &source, const std::string &delim)
 Split the source string using 'delim' as the divider. More...
 
template<typename T , typename Fn >
fold_left (const std::vector< T > &vec, Fn f)
 Perform a left fold of a vector. More...
 
template<typename T , typename Fn >
fold_right (const std::vector< T > &vec, Fn f)
 Returns a right fold of a vector. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
NO_INLINE void collect_paired_args (std::vector< std::pair< T1, T2 >> &collected_args, const T3 &a1, const T4 &a2)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename ... Args>
NO_INLINE void collect_paired_args (std::vector< std::pair< T1, T2 >> &collected_args, const T3 &a1, const T4 &a2, Args &&... args)
 
EXPORT std::string extract_namespaces (const std::string &name, std::vector< std::string > &namespaces)
 Returns base name and fills in namespaces, outermost one first in vector. More...
 
EXPORT std::string file_make_temp (const std::string &prefix, const std::string &suffix)
 Create a unique file with a name of the form prefixXXXXXsuffix in an arbitrary (but writable) directory; this is typically /tmp, but the specific location is not guaranteed. More...
 
EXPORT std::string dir_make_temp ()
 Create a unique directory in an arbitrary (but writable) directory; this is typically somewhere inside /tmp, but the specific location is not guaranteed. More...
 
EXPORT bool file_exists (const std::string &name)
 Wrapper for access(). More...
 
EXPORT void assert_file_exists (const std::string &name)
 assert-fail if the file doesn't exist. More...
 
EXPORT void assert_no_file_exists (const std::string &name)
 assert-fail if the file DOES exist. More...
 
EXPORT void file_unlink (const std::string &name)
 Wrapper for unlink(). More...
 
EXPORT void ensure_no_file_exists (const std::string &name)
 Ensure that no file with this path exists. More...
 
EXPORT void dir_rmdir (const std::string &name)
 Wrapper for rmdir(). More...
 
EXPORT FileStat file_stat (const std::string &name)
 Wrapper for stat(). More...
 
Stmt find_linear_expressions (Stmt s)
 find_linear_expressions(Stmt s) identifies expressions that may be moved out of the generated fragment shader into a varying attribute. More...
 
Stmt setup_gpu_vertex_buffer (Stmt s)
 Compute a set of 2D mesh coordinates based on the behavior of varying attribute expressions contained within a GLSL scheduled for loop. More...
 
Stmt vectorize_loops (Stmt s, const Target &t)
 Take a statement with for loops marked for vectorization, and turn them into single statements that operate on vectors. More...
 
std::map< std::string, Functionwrap_func_calls (const std::map< std::string, Function > &env)
 Replace every call to wrapped Functions in the Functions' definitions with call to their wrapper functions. More...
 
void wrap_legacy_extern_stages (Module m)
 Add wrappers for any LoweredFuncs that need them to support backwards compatibility. More...
 
void add_legacy_wrapper (Module m, const LoweredFunc &fn)
 Add a wrapper for a LoweredFunc that accepts old buffers and upgrades them. More...
 
template<typename K , typename V >
get_element (const std::map< K, V > &m, const K &key)
 Return value of element within a map. More...
 
template<typename K , typename V >
V & get_element (std::map< K, V > &m, const K &key)
 Return value of element within a map. More...
 
std::map< std::string, Boxboxes_required (Expr e, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Call's to each function that occurs within a given statement or expression. More...
 
std::map< std::string, Boxboxes_required (Stmt s, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Call's to each function that occurs within a given statement or expression. More...
 
std::map< std::string, Boxboxes_provided (Expr e, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Provides's to each function that occurs within a given statement or expression. More...
 
std::map< std::string, Boxboxes_provided (Stmt s, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Provides's to each function that occurs within a given statement or expression. More...
 
std::map< std::string, Boxboxes_touched (Expr e, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Call's and 'Provides's to each function that occurs within a given statement or expression. More...
 
std::map< std::string, Boxboxes_touched (Stmt s, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Compute rectangular domains large enough to cover all the 'Call's and 'Provides's to each function that occurs within a given statement or expression. More...
 
Box box_required (Expr e, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Box box_required (Stmt s, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Box box_provided (Expr e, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Box box_provided (Stmt s, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Box box_touched (Expr e, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Box box_touched (Stmt s, std::string fn, const Scope< Interval > &scope=Scope< Interval >::empty_scope(), const FuncValueBounds &func_bounds=FuncValueBounds())
 Variants of the above that are only concerned with a single function. More...
 
Expr lower_euclidean_div (Expr a, Expr b)
 Given a Halide Euclidean division/mod operation, define it in terms of div_round_to_zero or mod_round_to_zero. More...
 
Expr lower_euclidean_mod (Expr a, Expr b)
 Given a Halide Euclidean division/mod operation, define it in terms of div_round_to_zero or mod_round_to_zero. More...
 
EXPORT Stmt eliminate_bool_vectors (Stmt s)
 Some targets treat vectors of bools as integers of the same type that the boolean operation is being used to operate on. More...
 
EXPORT Expr eliminate_bool_vectors (Expr s)
 Some targets treat vectors of bools as integers of the same type that the boolean operation is being used to operate on. More...
 
EXPORT Expr native_deinterleave (Expr x)
 Generate deinterleave or interleave operations, operating on groups of vectors at a time. More...
 
EXPORT Expr native_interleave (Expr x)
 Generate deinterleave or interleave operations, operating on groups of vectors at a time. More...
 
EXPORT bool is_native_deinterleave (Expr x)
 Generate deinterleave or interleave operations, operating on groups of vectors at a time. More...
 
EXPORT bool is_native_interleave (Expr x)
 Generate deinterleave or interleave operations, operating on groups of vectors at a time. More...
 
Stmt inline_function (Stmt s, Function f)
 Inline a single named function, which must be pure. More...
 
Expr inline_function (Expr e, Function f)
 Inline a single named function, which must be pure. More...
 
void inline_function (Function caller, Function f)
 Inline a single named function, which must be pure. More...
 
template<typename T >
EXPORT RefCountref_count (const T *t)
 Because in this header we don't yet know how client classes store their RefCount (and we don't want to depend on the declarations of the client classes), any class that you want to hold onto via one of these must provide implementations of ref_count and destroy, which we forward-declare here. More...
 
template<typename T >
EXPORT void destroy (const T *t)
 Because in this header we don't yet know how client classes store their RefCount (and we don't want to depend on the declarations of the client classes), any class that you want to hold onto via one of these must provide implementations of ref_count and destroy, which we forward-declare here. More...
 
EXPORT bool equal (const Expr &a, const Expr &b)
 Compare IR nodes for equality of value. More...
 
EXPORT bool equal (const Stmt &a, const Stmt &b)
 Compare IR nodes for equality of value. More...
 
EXPORT bool graph_equal (const Expr &a, const Expr &b)
 Compare IR nodes for equality of value. More...
 
EXPORT bool graph_equal (const Stmt &a, const Stmt &b)
 Compare IR nodes for equality of value. More...
 
EXPORT Expr make_const (Type t, int64_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
EXPORT Expr make_const (Type t, uint64_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
EXPORT Expr make_const (Type t, double val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, int32_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, uint32_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, int16_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, uint16_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, int8_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, uint8_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, bool val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, float val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
Expr make_const (Type t, float16_t val)
 Construct an immediate of the given type from any numeric C++ type. More...
 
EXPORT Expr halide_log (Expr a)
 Halide's vectorizable transcendentals. More...
 
EXPORT Expr halide_exp (Expr a)
 Halide's vectorizable transcendentals. More...
 
EXPORT Expr halide_erf (Expr a)
 Halide's vectorizable transcendentals. More...
 
EXPORT bool reduce_expr_modulo (Expr e, int modulus, int *remainder)
 Reduce an expression modulo some integer. More...
 
EXPORT bool reduce_expr_modulo (Expr e, int modulus, int *remainder, const Scope< ModulusRemainder > &scope)
 Reduce an expression modulo some integer. More...
 
EXPORT Stmt simplify (Stmt, bool simplify_lets=true, const Scope< Interval > &bounds=Scope< Interval >::empty_scope(), const Scope< ModulusRemainder > &alignment=Scope< ModulusRemainder >::empty_scope())
 Perform a a wide range of simplifications to expressions and statements, including constant folding, substituting in trivial values, arithmetic rearranging, etc. More...
 
EXPORT Expr simplify (Expr, bool simplify_lets=true, const Scope< Interval > &bounds=Scope< Interval >::empty_scope(), const Scope< ModulusRemainder > &alignment=Scope< ModulusRemainder >::empty_scope())
 Perform a a wide range of simplifications to expressions and statements, including constant folding, substituting in trivial values, arithmetic rearranging, etc. More...
 
template<typename T >
mod_imp (T a, T b)
 Implementations of division and mod that are specific to Halide. More...
 
template<typename T >
div_imp (T a, T b)
 Implementations of division and mod that are specific to Halide. More...
 
EXPORT Expr substitute (const std::map< std::string, Expr > &replacements, const Expr &expr)
 Substitute variables with names in the map. More...
 
EXPORT Stmt substitute (const std::map< std::string, Expr > &replacements, const Stmt &stmt)
 Substitute variables with names in the map. More...
 
EXPORT Expr substitute (const Expr &find, const Expr &replacement, const Expr &expr)
 Substitute expressions for other expressions. More...
 
EXPORT Stmt substitute (const Expr &find, const Expr &replacement, const Stmt &stmt)
 Substitute expressions for other expressions. More...
 
Expr graph_substitute (const std::string &name, const Expr &replacement, const Expr &expr)
 Substitutions where the IR may be a general graph (and not just a DAG). More...
 
Stmt graph_substitute (const std::string &name, const Expr &replacement, const Stmt &stmt)
 Substitutions where the IR may be a general graph (and not just a DAG). More...
 
Expr graph_substitute (const Expr &find, const Expr &replacement, const Expr &expr)
 Substitutions where the IR may be a general graph (and not just a DAG). More...
 
Stmt graph_substitute (const Expr &find, const Expr &replacement, const Stmt &stmt)
 Substitutions where the IR may be a general graph (and not just a DAG). More...
 
Expr substitute_in_all_lets (const Expr &expr)
 Substitute in all let Exprs in a piece of IR. More...
 
Stmt substitute_in_all_lets (const Stmt &stmt)
 Substitute in all let Exprs in a piece of IR. More...
 
EXPORT std::string unique_name (char prefix)
 Generate a unique name starting with the given prefix. More...
 
EXPORT std::string unique_name (const std::string &prefix)
 Generate a unique name starting with the given prefix. More...
 
bool add_would_overflow (int bits, int64_t a, int64_t b)
 Routines to test if math would overflow for signed integers with the given number of bits. More...
 
bool sub_would_overflow (int bits, int64_t a, int64_t b)
 Routines to test if math would overflow for signed integers with the given number of bits. More...
 
bool mul_would_overflow (int bits, int64_t a, int64_t b)
 Routines to test if math would overflow for signed integers with the given number of bits. More...
 

Variables

const int64_t unknown = std::numeric_limits<int64_t>::min()
 

Typedef Documentation

◆ DimBounds

typedef std::map<std::string, Interval> Halide::Internal::DimBounds

Definition at line 20 of file AutoScheduleUtils.h.

◆ FuncValueBounds

typedef std::map<std::pair<std::string, int>, Interval> Halide::Internal::FuncValueBounds

Definition at line 16 of file Bounds.h.

◆ add_const_if_T_is_const

template<typename T , typename T2 >
using Halide::Internal::add_const_if_T_is_const = typedef typename std::conditional<std::is_const<T>::value, const T2, T2>::type

Definition at line 80 of file Buffer.h.

◆ GeneratorParamImplBase

template<typename T >
using Halide::Internal::GeneratorParamImplBase = typedef typename select_type< cond<std::is_same<T, Target>::value, GeneratorParam_Target<T> >, cond<std::is_same<T, MachineParams>::value, GeneratorParam_MachineParams<T> >, cond<std::is_same<T, Type>::value, GeneratorParam_Type<T> >, cond<std::is_same<T, bool>::value, GeneratorParam_Bool<T> >, cond<std::is_arithmetic<T>::value, GeneratorParam_Arithmetic<T> >, cond<std::is_enum<T>::value, GeneratorParam_Enum<T> > >::type

Definition at line 765 of file Generator.h.

◆ GeneratorInputImplBase

template<typename T , typename TBase = typename std::remove_all_extents<T>::type>
using Halide::Internal::GeneratorInputImplBase = typedef typename select_type< cond<has_static_halide_type_method<TBase>::value, GeneratorInput_Buffer<T> >, cond<std::is_same<TBase, Func>::value, GeneratorInput_Func<T> >, cond<std::is_arithmetic<TBase>::value, GeneratorInput_Arithmetic<T> >, cond<std::is_scalar<TBase>::value, GeneratorInput_Scalar<T> > >::type

Definition at line 1661 of file Generator.h.

◆ GeneratorOutputImplBase

template<typename T , typename TBase = typename std::remove_all_extents<T>::type>
using Halide::Internal::GeneratorOutputImplBase = typedef typename select_type< cond<has_static_halide_type_method<TBase>::value, GeneratorOutput_Buffer<T> >, cond<std::is_same<TBase, Func>::value, GeneratorOutput_Func<T> >, cond<std::is_arithmetic<TBase>::value, GeneratorOutput_Arithmetic<T> > >::type

Definition at line 2185 of file Generator.h.

◆ GeneratorFactory

using Halide::Internal::GeneratorFactory = typedef std::function<std::unique_ptr<GeneratorBase>(const GeneratorContext&)>

Definition at line 2489 of file Generator.h.

◆ Region

typedef std::vector<Range> Halide::Internal::Region

A multi-dimensional box.

The outer product of the elements

Definition at line 394 of file IR.h.

◆ halide_task

typedef int(* Halide::Internal::halide_task) (void *user_context, int, uint8_t *)

Definition at line 123 of file JITModule.h.

◆ LLVMOStream

typedef llvm::raw_pwrite_stream Halide::Internal::LLVMOStream

Definition at line 27 of file LLVM_Output.h.

◆ make_integer_sequence

template<typename T , T N>
using Halide::Internal::make_integer_sequence = typedef typename make_integer_sequence_helper<T, 0, N>::type

Definition at line 314 of file Util.h.

◆ index_sequence

template<size_t... Ints>
using Halide::Internal::index_sequence = typedef integer_sequence<size_t, Ints...>

Definition at line 317 of file Util.h.

◆ make_index_sequence

template<size_t N>
using Halide::Internal::make_index_sequence = typedef make_integer_sequence<size_t, N>

Definition at line 320 of file Util.h.

Enumeration Type Documentation

◆ Direction

Enumerator
Upper 
Lower 

Definition at line 39 of file Bounds.h.

◆ IRNodeType

All our IR node types get unique IDs for the purposes of RTTI.

Enumerator
IntImm 
UIntImm 
FloatImm 
StringImm 
Cast 
Variable 
Add 
Sub 
Mul 
Div 
Mod 
Min 
Max 
EQ 
NE 
LT 
LE 
GT 
GE 
And 
Or 
Not 
Select 
Load 
Ramp 
Broadcast 
Call 
Let 
LetStmt 
AssertStmt 
ProducerConsumer 
For 
Store 
Provide 
Allocate 
Free 
Realize 
Block 
IfThenElse 
Evaluate 
Shuffle 
Prefetch 

Definition at line 25 of file Expr.h.

◆ ForType

An enum describing a type of loop traversal.

Used in schedules, and in the For loop IR node. GPUBlock and GPUThread are implicitly parallel

Enumerator
Serial 
Parallel 
Vectorized 
Unrolled 
GPUBlock 
GPUThread 

Definition at line 345 of file Expr.h.

◆ IOKind

Enumerator
Scalar 
Function 
Buffer 

Definition at line 986 of file Generator.h.

◆ Monotonic

Detect whether an expression is monotonic increasing in a variable, decreasing, or unknown.

Enumerator
Constant 
Increasing 
Decreasing 
Unknown 

Definition at line 18 of file Monotonic.h.

Function Documentation

◆ add_image_checks()

Stmt Halide::Internal::add_image_checks ( Stmt  s,
const std::vector< Function > &  outputs,
const Target t,
const std::vector< std::string > &  order,
const std::map< std::string, Function > &  env,
const FuncValueBounds fb 
)

Insert checks to make sure a statement doesn't read out of bounds on inputs or outputs, and that the inputs and outputs conform to the format required (e.g.

stride.0 must be 1).

◆ add_parameter_checks()

Stmt Halide::Internal::add_parameter_checks ( Stmt  s,
const Target t 
)

Insert checks to make sure that all referenced parameters meet their constraints.

◆ align_loads()

Stmt Halide::Internal::align_loads ( Stmt  s,
int  alignment 
)

Attempt to rewrite unaligned loads from buffers which are known to be aligned to instead load aligned vectors that cover the original load, and then slice the original load out of the aligned vectors.

◆ allocation_bounds_inference()

Stmt Halide::Internal::allocation_bounds_inference ( Stmt  s,
const std::map< std::string, Function > &  env,
const std::map< std::pair< std::string, int >, Interval > &  func_bounds 
)

Take a partially statement with Realize nodes in terms of variables, and define values for those variables.

◆ apply_split()

std::vector<ApplySplitResult> Halide::Internal::apply_split ( const Split split,
bool  is_update,
std::string  prefix,
std::map< std::string, Expr > &  dim_extent_alignment 
)

Given a Split schedule on a definition (init or update), return a list of of predicates on the definition, substitutions that needs to be applied to the definition (in ascending order of application), and let stmts which defined the values of variables referred by the predicates and substitutions (ordered from innermost to outermost let).

Referenced by Halide::Internal::ApplySplitResult::is_predicate().

◆ compute_loop_bounds_after_split()

std::vector<std::pair<std::string, Expr> > Halide::Internal::compute_loop_bounds_after_split ( const Split split,
std::string  prefix 
)

Compute the loop bounds of the new dimensions resulting from applying the split schedules using the loop bounds of the old dimensions.

Referenced by Halide::Internal::ApplySplitResult::is_predicate().

◆ get_ops_table()

const std::vector<AssociativePattern>& Halide::Internal::get_ops_table ( const std::vector< Expr > &  exprs)

◆ prove_associativity()

AssociativeOp Halide::Internal::prove_associativity ( const std::string &  f,
std::vector< Expr args,
std::vector< Expr exprs 
)

Given an update definition of a Func 'f', determine its equivalent associative binary/unary operator if there is any.

'is_associative' indicates if the operation was successfuly proven as associative.

Referenced by Halide::Internal::AssociativeOp::size().

◆ associativity_test()

EXPORT void Halide::Internal::associativity_test ( )

◆ generate_schedules()

EXPORT std::string Halide::Internal::generate_schedules ( const std::vector< Function > &  outputs,
const Target target,
const MachineParams arch_params 
)

Generate schedules for Funcs within a pipeline.

The Funcs should not already have specializations or schedules as the current auto-scheduler does not take into account user-defined schedules or specializations. This applies the schedules and returns a string representation of the schedules. The target architecture is specified by 'target'.

Referenced by Halide::MachineParams::MachineParams().

◆ get_extent()

Expr Halide::Internal::get_extent ( const Interval i)

Return the size of an interval.

Return an undefined expr if the interval is unbounded.

◆ box_size()

Expr Halide::Internal::box_size ( const Box b)

Return the size of an n-d box.

◆ disp_regions()

void Halide::Internal::disp_regions ( const std::map< std::string, Box > &  regions)

Helper function to print the bounds of a region.

◆ get_stage_definition()

Definition Halide::Internal::get_stage_definition ( const Function f,
int  stage_num 
)

Return the corresponding definition of a function given the stage.

◆ combine_load_costs()

void Halide::Internal::combine_load_costs ( std::map< std::string, Expr > &  result,
const std::map< std::string, Expr > &  partial 
)

Add partial load costs to the corresponding function in the result costs.

◆ get_stage_bounds() [1/2]

DimBounds Halide::Internal::get_stage_bounds ( Function  f,
int  stage_num,
const DimBounds pure_bounds 
)

Return the required bounds of an intermediate stage (f, stage_num) of function 'f' given the bounds of the pure dimensions.

◆ get_stage_bounds() [2/2]

std::vector<DimBounds> Halide::Internal::get_stage_bounds ( Function  f,
const DimBounds pure_bounds 
)

Return the required bounds for all the stages of the function 'f'.

Each entry in the returned vector corresponds to a stage.

◆ perform_inline()

Expr Halide::Internal::perform_inline ( Expr  e,
const std::map< std::string, Function > &  env,
const std::set< std::string > &  inlines = std::set< std::string >() 
)

Recursively inline all the functions in the set 'inlines' into the expression 'e' and return the resulting expression.

◆ get_parents()

std::set<std::string> Halide::Internal::get_parents ( Function  f,
int  stage 
)

Return all functions that are directly called by a function stage (f, stage).

◆ get_element() [1/2]

template<typename K , typename V >
V Halide::Internal::get_element ( const std::map< K, V > &  m,
const K &  key 
)

Return value of element within a map.

This will assert if the element is not in the map.

Definition at line 95 of file AutoScheduleUtils.h.

References internal_assert.

◆ get_element() [2/2]

template<typename K , typename V >
V& Halide::Internal::get_element ( std::map< K, V > &  m,
const K &  key 
)

Return value of element within a map.

This will assert if the element is not in the map.

Definition at line 102 of file AutoScheduleUtils.h.

References internal_assert.

◆ bounds_of_expr_in_scope()

Interval Halide::Internal::bounds_of_expr_in_scope ( Expr  expr,
const Scope< Interval > &  scope,
const FuncValueBounds func_bounds = FuncValueBounds(),
bool  const_bound = false 
)

Given an expression in some variables, and a map from those variables to their bounds (in the form of (minimum possible value, maximum possible value)), compute two expressions that give the minimum possible value and the maximum possible value of this expression.

Max or min may be undefined expressions if the value is not bounded above or below. If the expression is a vector, also takes the bounds across the vector lanes and returns a scalar result.

This is for tasks such as deducing the region of a buffer loaded by a chunk of code.

◆ find_constant_bound()

Expr Halide::Internal::find_constant_bound ( Expr  e,
Direction  d,
const Scope< Interval > &  scope = ScopeInterval >() 
)

◆ merge_boxes()

void Halide::Internal::merge_boxes ( Box a,
const Box b 
)

Expand box a to encompass box b.

◆ boxes_overlap()

bool Halide::Internal::boxes_overlap ( const Box a,
const Box b 
)

Test if box a could possibly overlap box b.

◆ box_union()

Box Halide::Internal::box_union ( const Box a,
const Box b 
)

The union of two boxes.

◆ box_intersection()

Box Halide::Internal::box_intersection ( const Box a,
const Box b 
)

The intersection of two boxes.

◆ box_contains()

bool Halide::Internal::box_contains ( const Box a,
const Box b 
)

Test if box a provably contains box b.

◆ boxes_required() [1/2]

std::map<std::string, Box> Halide::Internal::boxes_required ( Expr  e,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Call's to each function that occurs within a given statement or expression.

This is useful for figuring out what regions of things to evaluate.

◆ boxes_required() [2/2]

std::map<std::string, Box> Halide::Internal::boxes_required ( Stmt  s,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Call's to each function that occurs within a given statement or expression.

This is useful for figuring out what regions of things to evaluate.

◆ boxes_provided() [1/2]

std::map<std::string, Box> Halide::Internal::boxes_provided ( Expr  e,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Provides's to each function that occurs within a given statement or expression.

◆ boxes_provided() [2/2]

std::map<std::string, Box> Halide::Internal::boxes_provided ( Stmt  s,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Provides's to each function that occurs within a given statement or expression.

◆ boxes_touched() [1/2]

std::map<std::string, Box> Halide::Internal::boxes_touched ( Expr  e,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Call's and 'Provides's to each function that occurs within a given statement or expression.

◆ boxes_touched() [2/2]

std::map<std::string, Box> Halide::Internal::boxes_touched ( Stmt  s,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Compute rectangular domains large enough to cover all the 'Call's and 'Provides's to each function that occurs within a given statement or expression.

◆ box_required() [1/2]

Box Halide::Internal::box_required ( Expr  e,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ box_required() [2/2]

Box Halide::Internal::box_required ( Stmt  s,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ box_provided() [1/2]

Box Halide::Internal::box_provided ( Expr  e,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ box_provided() [2/2]

Box Halide::Internal::box_provided ( Stmt  s,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ box_touched() [1/2]

Box Halide::Internal::box_touched ( Expr  e,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ box_touched() [2/2]

Box Halide::Internal::box_touched ( Stmt  s,
std::string  fn,
const Scope< Interval > &  scope = ScopeInterval >::empty_scope(),
const FuncValueBounds func_bounds = FuncValueBounds() 
)

Variants of the above that are only concerned with a single function.

◆ compute_function_value_bounds()

FuncValueBounds Halide::Internal::compute_function_value_bounds ( const std::vector< std::string > &  order,
const std::map< std::string, Function > &  env 
)

Compute the maximum and minimum possible value for each function in an environment.

◆ bounds_test()

EXPORT void Halide::Internal::bounds_test ( )

◆ bounds_inference()

Stmt Halide::Internal::bounds_inference ( Stmt  ,
const std::vector< Function > &  outputs,
const std::vector< std::string > &  realization_order,
const std::map< std::string, Function > &  environment,
const std::map< std::pair< std::string, int >, Interval > &  func_bounds,
const Target target 
)

Take a partially lowered statement that includes symbolic representations of the bounds over which things should be realized, and inject expressions defining those bounds.

◆ buffer_accessor()

EXPORT Expr Halide::Internal::buffer_accessor ( const Buffer<> &  buf,
const std::vector< Expr > &  args 
)

◆ get_name_from_end_of_parameter_pack() [1/4]

template<typename T , typename = typename std::enable_if<!std::is_convertible<T, std::string>::value>::type>
std::string Halide::Internal::get_name_from_end_of_parameter_pack ( T &&  )

Definition at line 40 of file Buffer.h.

Referenced by get_name_from_end_of_parameter_pack().

◆ get_name_from_end_of_parameter_pack() [2/4]

std::string Halide::Internal::get_name_from_end_of_parameter_pack ( const std::string &  n)
inline

Definition at line 44 of file Buffer.h.

◆ get_name_from_end_of_parameter_pack() [3/4]

std::string Halide::Internal::get_name_from_end_of_parameter_pack ( )
inline

Definition at line 48 of file Buffer.h.

◆ get_name_from_end_of_parameter_pack() [4/4]

template<typename First , typename Second , typename ... Args>
std::string Halide::Internal::get_name_from_end_of_parameter_pack ( First  first,
Second  second,
Args &&...  rest 
)

Definition at line 55 of file Buffer.h.

References get_name_from_end_of_parameter_pack().

◆ get_shape_from_start_of_parameter_pack_helper() [1/3]

void Halide::Internal::get_shape_from_start_of_parameter_pack_helper ( std::vector< int > &  ,
const std::string &   
)
inline

◆ get_shape_from_start_of_parameter_pack_helper() [2/3]

void Halide::Internal::get_shape_from_start_of_parameter_pack_helper ( std::vector< int > &  )
inline

Definition at line 62 of file Buffer.h.

◆ get_shape_from_start_of_parameter_pack_helper() [3/3]

template<typename ... Args>
void Halide::Internal::get_shape_from_start_of_parameter_pack_helper ( std::vector< int > &  result,
int  x,
Args &&...  rest 
)

Definition at line 66 of file Buffer.h.

References get_shape_from_start_of_parameter_pack_helper().

◆ get_shape_from_start_of_parameter_pack()

template<typename ... Args>
std::vector<int> Halide::Internal::get_shape_from_start_of_parameter_pack ( Args &&...  args)

Definition at line 73 of file Buffer.h.

References get_shape_from_start_of_parameter_pack_helper().

◆ canonicalize_gpu_vars()

Stmt Halide::Internal::canonicalize_gpu_vars ( Stmt  s)

Canonicalize GPU var names into some pre-determined block/thread names (i.e.

__block_id_x, __thread_id_x, etc.). The x/y/z/w order is determined by the nesting order: innermost is assigned to x and so on.

◆ build_closure_type()

llvm::StructType* Halide::Internal::build_closure_type ( const Closure closure,
llvm::StructType *  buffer_t,
llvm::LLVMContext *  context 
)

The llvm type of a struct containing all of the externally referenced state of a Closure.

◆ pack_closure()

void Halide::Internal::pack_closure ( llvm::StructType *  type,
llvm::Value *  dst,
const Closure closure,
const Scope< llvm::Value *> &  src,
llvm::StructType *  buffer_t,
llvm::IRBuilder<> *  builder 
)

Emit code that builds a struct containing all the externally referenced state.

Requires you to pass it a type and struct to fill in, a scope to retrieve the llvm values from and a builder to place the packing code.

◆ unpack_closure()

void Halide::Internal::unpack_closure ( const Closure closure,
Scope< llvm::Value *> &  dst,
llvm::StructType *  type,
llvm::Value *  src,
llvm::IRBuilder<> *  builder 
)

Emit code that unpacks a struct containing all the externally referenced state into a symbol table.

Requires you to pass it a state struct type and value, a scope to fill, and a builder to place the unpacking code.

◆ llvm_type_of()

llvm::Type* Halide::Internal::llvm_type_of ( llvm::LLVMContext *  context,
Halide::Type  t 
)

Get the llvm type equivalent to a given halide type.

Referenced by Halide::Internal::CodeGen_LLVM::prepare_for_early_exit().

◆ function_takes_user_context()

bool Halide::Internal::function_takes_user_context ( const std::string &  name)

Which built-in functions require a user-context first argument?

◆ can_allocation_fit_on_stack()

bool Halide::Internal::can_allocation_fit_on_stack ( int64_t  size)

Given a size (in bytes), return True if the allocation size can fit on the stack; otherwise, return False.

This routine asserts if size is non-positive.

◆ lower_euclidean_div()

Expr Halide::Internal::lower_euclidean_div ( Expr  a,
Expr  b 
)

Given a Halide Euclidean division/mod operation, define it in terms of div_round_to_zero or mod_round_to_zero.

◆ lower_euclidean_mod()

Expr Halide::Internal::lower_euclidean_mod ( Expr  a,
Expr  b 
)

Given a Halide Euclidean division/mod operation, define it in terms of div_round_to_zero or mod_round_to_zero.

◆ unpredicate_loads_stores()

Stmt Halide::Internal::unpredicate_loads_stores ( Stmt  s)

Replace predicated loads/stores with unpredicated equivalents inside branches.

◆ get_target_options()

void Halide::Internal::get_target_options ( const llvm::Module &  module,
llvm::TargetOptions &  options,
std::string &  mcpu,
std::string &  mattrs 
)

Given an llvm::Module, set llvm:TargetOptions, cpu and attr information.

◆ clone_target_options()

void Halide::Internal::clone_target_options ( const llvm::Module &  from,
llvm::Module &  to 
)

Given two llvm::Modules, clone target options from one to the other.

◆ make_target_machine()

std::unique_ptr<llvm::TargetMachine> Halide::Internal::make_target_machine ( const llvm::Module &  module)

Given an llvm::Module, get or create an llvm:TargetMachine.

◆ set_function_attributes_for_target()

void Halide::Internal::set_function_attributes_for_target ( llvm::Function ,
Target   
)

Set the appropriate llvm Function attributes given a Target.

◆ cplusplus_function_mangled_name()

EXPORT std::string Halide::Internal::cplusplus_function_mangled_name ( const std::string &  name,
const std::vector< std::string > &  namespaces,
Type  return_type,
const std::vector< ExternFuncArgument > &  args,
const Target target 
)

Return the mangled C++ name for a function.

The target parameter is used to decide on the C++ ABI/mangling style to use.

◆ cplusplus_mangle_test()

EXPORT void Halide::Internal::cplusplus_mangle_test ( )

◆ common_subexpression_elimination() [1/2]

EXPORT Expr Halide::Internal::common_subexpression_elimination ( Expr  )

Replace each common sub-expression in the argument with a variable, and wrap the resulting expr in a let statement giving a value to that variable.

This is important to do within Halide (instead of punting to llvm), because exprs that come in from the front-end are small when considered as a graph, but combinatorially large when considered as a tree. For an example of a such a case, see test/code_explosion.cpp

◆ common_subexpression_elimination() [2/2]

EXPORT Stmt Halide::Internal::common_subexpression_elimination ( Stmt  )

Do common-subexpression-elimination on each expression in a statement.

Does not introduce let statements.

◆ cse_test()

EXPORT void Halide::Internal::cse_test ( )

◆ operator<<() [1/7]

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

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

◆ operator<<() [2/7]

EXPORT std::ostream& Halide::Internal::operator<< ( std::ostream &  ,
const LoweredFunc  
)

◆ debug_arguments()

void Halide::Internal::debug_arguments ( LoweredFunc func)

Injects debug prints in a LoweredFunc that describe the arguments.

Mutates the given func.

◆ debug_to_file()

Stmt Halide::Internal::debug_to_file ( Stmt  s,
const std::vector< Function > &  outputs,
const std::map< std::string, Function > &  env 
)

Takes a statement with Realize nodes still unlowered.

If the corresponding functions have a debug_file set, then inject code that will dump the contents of those functions to a file after the realization.

Referenced by Halide::Func::add_custom_lowering_pass().

◆ extract_odd_lanes()

EXPORT Expr Halide::Internal::extract_odd_lanes ( Expr  a)

Extract the odd-numbered lanes in a vector.

◆ extract_even_lanes()

EXPORT Expr Halide::Internal::extract_even_lanes ( Expr  a)

Extract the even-numbered lanes in a vector.

◆ extract_lane()

EXPORT Expr Halide::Internal::extract_lane ( Expr  vec,
int  lane 
)

Extract the nth lane of a vector.

◆ rewrite_interleavings()

Stmt Halide::Internal::rewrite_interleavings ( Stmt  s)

Look through a statement for expressions of the form select(ramp % 2 == 0, a, b) and replace them with calls to an interleave intrinsic.

◆ deinterleave_vector_test()

EXPORT void Halide::Internal::deinterleave_vector_test ( )

◆ make_device_interface_call()

Expr Halide::Internal::make_device_interface_call ( DeviceAPI  device_api)

Get an Expr which evaluates to the device interface for the given device api at runtime.

◆ inject_early_frees()

Stmt Halide::Internal::inject_early_frees ( Stmt  s)

Take a statement with allocations and inject markers (of the form of calls to "mark buffer dead") after the last use of each allocation.

Targets may use this to free buffers earlier than the close of their Allocate node.

◆ eliminate_bool_vectors() [1/2]

EXPORT Stmt Halide::Internal::eliminate_bool_vectors ( Stmt  s)

Some targets treat vectors of bools as integers of the same type that the boolean operation is being used to operate on.

For example, instead of select(i1x8, u16x8, u16x8), the target would prefer to see select(u16x8, u16x8, u16x8), where the first argument is a vector of integers representing a mask. This pass converts vectors of bools to vectors of integers to meet this requirement. This is done by injecting intrinsics to convert bools to architecture-specific masks, and using a select_mask instrinsic instead of a Select node. Because the masks are architecture specific, they may not be stored or loaded. On Stores, the masks are converted to UInt(8) with a value of 0 or 1, which is our canonical in-memory representation of a bool.

◆ eliminate_bool_vectors() [2/2]

EXPORT Expr Halide::Internal::eliminate_bool_vectors ( Expr  s)

Some targets treat vectors of bools as integers of the same type that the boolean operation is being used to operate on.

For example, instead of select(i1x8, u16x8, u16x8), the target would prefer to see select(u16x8, u16x8, u16x8), where the first argument is a vector of integers representing a mask. This pass converts vectors of bools to vectors of integers to meet this requirement. This is done by injecting intrinsics to convert bools to architecture-specific masks, and using a select_mask instrinsic instead of a Select node. Because the masks are architecture specific, they may not be stored or loaded. On Stores, the masks are converted to UInt(8) with a value of 0 or 1, which is our canonical in-memory representation of a bool.

◆ eliminated_bool_type()

EXPORT Type Halide::Internal::eliminated_bool_type ( Type  bool_type,
Type  other_type 
)
inline

If a type is a boolean vector, find the type that it has been changed to by eliminate_bool_vectors.

Definition at line 32 of file EliminateBoolVectors.h.

References Halide::Type::bits(), Halide::Type::Int, Halide::Type::is_vector(), Halide::Type::with_bits(), and Halide::Type::with_code().

◆ ref_count< IRNode >()

template<>
EXPORT RefCount& Halide::Internal::ref_count< IRNode > ( const IRNode n)
inline

Definition at line 102 of file Expr.h.

◆ destroy< IRNode >()

template<>
EXPORT void Halide::Internal::destroy< IRNode > ( const IRNode n)
inline

Definition at line 105 of file Expr.h.

◆ stmt_or_expr_uses_var()

template<typename StmtOrExpr >
bool Halide::Internal::stmt_or_expr_uses_var ( StmtOrExpr  e,
const std::string &  v 
)
inline

Test if a statement or expression references the given variable.

Definition at line 52 of file ExprUsesVar.h.

References Halide::Internal::Scope< T >::push(), and Halide::Internal::ExprUsesVars< T >::result.

Referenced by expr_uses_var(), and stmt_uses_var().

◆ stmt_or_expr_uses_vars()

template<typename StmtOrExpr , typename T >
bool Halide::Internal::stmt_or_expr_uses_vars ( StmtOrExpr  e,
const Scope< T > &  v,
const Scope< Expr > &  s = Scope<Expr>::empty_scope() 
)
inline

Test if a statement or expression references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument.

Definition at line 65 of file ExprUsesVar.h.

References Halide::Internal::ExprUsesVars< T >::result.

Referenced by expr_uses_vars(), and stmt_uses_vars().

◆ expr_uses_var()

bool Halide::Internal::expr_uses_var ( Expr  e,
const std::string &  v 
)
inline

Test if an expression references the given variable.

Definition at line 73 of file ExprUsesVar.h.

References stmt_or_expr_uses_var().

◆ stmt_uses_var()

bool Halide::Internal::stmt_uses_var ( Stmt  s,
const std::string &  v 
)
inline

Test if a statement references the given variable.

Definition at line 78 of file ExprUsesVar.h.

References stmt_or_expr_uses_var().

◆ expr_uses_vars()

template<typename T >
bool Halide::Internal::expr_uses_vars ( Expr  e,
const Scope< T > &  v,
const Scope< Expr > &  s = Scope<Expr>::empty_scope() 
)
inline

Test if an expression references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument.

Definition at line 87 of file ExprUsesVar.h.

References stmt_or_expr_uses_vars().

◆ stmt_uses_vars()

template<typename T >
bool Halide::Internal::stmt_uses_vars ( Stmt  e,
const Scope< T > &  v,
const Scope< Expr > &  s = Scope<Expr>::empty_scope() 
)
inline

Test if a statement references any of the variables in a scope, additionally considering variables bound to Expr's in the scope provided in the final argument.

Definition at line 97 of file ExprUsesVar.h.

References stmt_or_expr_uses_vars().

◆ find_direct_calls()

std::map<std::string, Function> Halide::Internal::find_direct_calls ( Function  f)

Construct a map from name to Function definition object for all Halide functions called directly in the definition of the Function f, including in update definitions, update index expressions, and RDom extents.

This map does not include the Function f, unless it is called recursively by itself.

◆ find_transitive_calls()

std::map<std::string, Function> Halide::Internal::find_transitive_calls ( Function  f)

Construct a map from name to Function definition object for all Halide functions called directly in the definition of the Function f, or indirectly in those functions' definitions, recursively.

This map always includes the Function f.

◆ populate_environment()

void Halide::Internal::populate_environment ( Function  f,
std::map< std::string, Function > &  env 
)

Find all Functions transitively referenced by f in any way and add them to the given map.

◆ check_types() [1/2]

template<typename Last >
void Halide::Internal::check_types ( const Tuple t,
int  idx 
)
inline

Definition at line 2064 of file Func.h.

References user_assert.

Referenced by Halide::evaluate(), and Halide::evaluate_may_gpu().

◆ check_types() [2/2]

template<typename First , typename Second , typename... Rest>
void Halide::Internal::check_types ( const Tuple t,
int  idx 
)
inline

Definition at line 2073 of file Func.h.

◆ assign_results() [1/2]

template<typename Last >
void Halide::Internal::assign_results ( Realization r,
int  idx,
Last  last 
)
inline

Definition at line 2079 of file Func.h.

Referenced by Halide::evaluate(), and Halide::evaluate_may_gpu().

◆ assign_results() [2/2]

template<typename First , typename Second , typename... Rest>
void Halide::Internal::assign_results ( Realization r,
int  idx,
First  first,
Second  second,
Rest &&...  rest 
)
inline

Definition at line 2085 of file Func.h.

◆ schedule_scalar()

◆ deep_copy()

std::pair<std::vector<Function>, std::map<std::string, Function> > Halide::Internal::deep_copy ( const std::vector< Function > &  outputs,
const std::map< std::string, Function > &  env 
)

◆ zero_gpu_loop_mins()

Stmt Halide::Internal::zero_gpu_loop_mins ( Stmt  s)

Rewrite all GPU loops to have a min of zero.

◆ fuse_gpu_thread_loops()

Stmt Halide::Internal::fuse_gpu_thread_loops ( Stmt  s)

Converts Halide's GPGPU IR to the OpenCL/CUDA/Metal model.

Within every loop over gpu block indices, fuse the inner loops over thread indices into a single loop (with predication to turn off threads). Also injects synchronization points as needed, and hoists allocations at the block level out into a single shared memory array.

◆ fuzz_float_stores()

Stmt Halide::Internal::fuzz_float_stores ( Stmt  s)

On every store of a floating point value, mask off the least-significant-bit of the mantissa.

We've found that whether or not this dramatically changes the output of a pipeline correlates very well with whether or not a pipeline will produce very different outputs on different architectures (e.g. with and without FMA). It's also a useful way to detect bad tests, such as those that expect exact floating point equality across platforms.

◆ generator_test()

EXPORT void Halide::Internal::generator_test ( )

◆ parameter_constraints()

EXPORT std::vector<Expr> Halide::Internal::parameter_constraints ( const Parameter p)

◆ enum_to_string()

template<typename T >
NO_INLINE std::string Halide::Internal::enum_to_string ( const std::map< std::string, T > &  enum_map,
const T &  t 
)

◆ enum_from_string()

template<typename T >
T Halide::Internal::enum_from_string ( const std::map< std::string, T > &  enum_map,
const std::string &  s 
)

Definition at line 301 of file Generator.h.

References EXPORT, get_halide_type_enum_map(), and user_assert.

◆ get_halide_type_enum_map()

EXPORT const std::map<std::string, Halide::Type>& Halide::Internal::get_halide_type_enum_map ( )

◆ halide_type_to_enum_string()

std::string Halide::Internal::halide_type_to_enum_string ( const Type t)
inline

◆ get_halide_looplevel_enum_map()

EXPORT const std::map<std::string, Halide::LoopLevel>& Halide::Internal::get_halide_looplevel_enum_map ( )

◆ halide_looplevel_to_enum_string()

std::string Halide::Internal::halide_looplevel_to_enum_string ( const LoopLevel loop_level)
inline

◆ halide_type_to_c_source()

EXPORT std::string Halide::Internal::halide_type_to_c_source ( const Type t)

◆ halide_type_to_c_type()

◆ generate_filter_main()

EXPORT int Halide::Internal::generate_filter_main ( int  argc,
char **  argv,
std::ostream &  cerr 
)

generate_filter_main() is a convenient wrapper for GeneratorRegistry::create() + compile_to_files(); it can be trivially wrapped by a "real" main() to produce a command-line utility for ahead-of-time filter compilation.

Referenced by halide_looplevel_to_enum_string().

◆ parse_scalar()

template<typename T >
T Halide::Internal::parse_scalar ( const std::string &  value)

Definition at line 2257 of file Generator.h.

References EXPORT, parse_halide_type_list(), and user_assert.

◆ parse_halide_type_list()

EXPORT std::vector<Type> Halide::Internal::parse_halide_type_list ( const std::string &  types)

Referenced by parse_scalar().

◆ inject_hexagon_rpc()

Stmt Halide::Internal::inject_hexagon_rpc ( Stmt  s,
const Target host_target,
Module module 
)

Pull loops marked with the Hexagon device API to a separate module, and call them through the Hexagon host runtime module.

◆ compile_module_to_hexagon_shared_object()

Buffer<uint8_t> Halide::Internal::compile_module_to_hexagon_shared_object ( const Module device_code)

◆ optimize_hexagon_shuffles()

EXPORT Stmt Halide::Internal::optimize_hexagon_shuffles ( Stmt  s,
int  lut_alignment 
)

Replace indirect and other loads with simple loads + vlut calls.

◆ vtmpy_generator()

EXPORT Stmt Halide::Internal::vtmpy_generator ( Stmt  s)

Generate vtmpy instruction if possible.

◆ optimize_hexagon_instructions()

EXPORT Stmt Halide::Internal::optimize_hexagon_instructions ( Stmt  s,
Target  t 
)

Hexagon deinterleaves when performing widening operations, and interleaves when performing narrowing operations.

This pass rewrites widenings/narrowings to be explicit in the IR, and attempts to simplify away most of the interleaving/deinterleaving.

◆ native_deinterleave()

EXPORT Expr Halide::Internal::native_deinterleave ( Expr  x)

Generate deinterleave or interleave operations, operating on groups of vectors at a time.

◆ native_interleave()

EXPORT Expr Halide::Internal::native_interleave ( Expr  x)

Generate deinterleave or interleave operations, operating on groups of vectors at a time.

◆ is_native_deinterleave()

EXPORT bool Halide::Internal::is_native_deinterleave ( Expr  x)

Generate deinterleave or interleave operations, operating on groups of vectors at a time.

◆ is_native_interleave()

EXPORT bool Halide::Internal::is_native_interleave ( Expr  x)

Generate deinterleave or interleave operations, operating on groups of vectors at a time.

◆ infer_arguments()

std::vector<InferredArgument> Halide::Internal::infer_arguments ( Stmt  body,
const std::vector< Function > &  outputs 
)

◆ call_extern_and_assert()

EXPORT Stmt Halide::Internal::call_extern_and_assert ( const std::string &  name,
const std::vector< Expr > &  args 
)

A helper function to call an extern function, and assert that it returns 0.

◆ inject_host_dev_buffer_copies()

EXPORT Stmt Halide::Internal::inject_host_dev_buffer_copies ( Stmt  s,
const Target t 
)

Inject calls to halide_device_malloc, halide_copy_to_device, and halide_copy_to_host as needed.

◆ inject_opengl_intrinsics()

Stmt Halide::Internal::inject_opengl_intrinsics ( Stmt  s)

Take a statement with for kernel for loops and turn loads and stores inside the loops into OpenGL texture load and store intrinsics.

Should only be run when the OpenGL target is active.

◆ inline_function() [1/3]

Stmt Halide::Internal::inline_function ( Stmt  s,
Function  f 
)

Inline a single named function, which must be pure.

For a pure function to be inlined, it must not have any specializations (i.e. it can only have one values definition).

◆ inline_function() [2/3]

Expr Halide::Internal::inline_function ( Expr  e,
Function  f 
)

Inline a single named function, which must be pure.

For a pure function to be inlined, it must not have any specializations (i.e. it can only have one values definition).

◆ inline_function() [3/3]

void Halide::Internal::inline_function ( Function  caller,
Function  f 
)

Inline a single named function, which must be pure.

For a pure function to be inlined, it must not have any specializations (i.e. it can only have one values definition).

◆ validate_schedule_inlined_function()

void Halide::Internal::validate_schedule_inlined_function ( Function  f)

Check if the schedule of an inlined function is legal, throwing an error if it is not.

◆ interval_test()

EXPORT void Halide::Internal::interval_test ( )

◆ ref_count()

template<typename T >
EXPORT RefCount& Halide::Internal::ref_count ( const T *  t)

Because in this header we don't yet know how client classes store their RefCount (and we don't want to depend on the declarations of the client classes), any class that you want to hold onto via one of these must provide implementations of ref_count and destroy, which we forward-declare here.

E.g. if you want to use IntrusivePtr<MyClass>, then you should define something like this in MyClass.cpp (assuming MyClass has a field: mutable RefCount ref_count):

template<> RefCount &ref_count<MyClass>(const MyClass *c) {return c->ref_count;} template<> void destroy<MyClass>(const MyClass *c) {delete c;}

Referenced by Halide::Internal::RefCount::is_zero().

◆ destroy()

template<typename T >
EXPORT void Halide::Internal::destroy ( const T *  t)

Because in this header we don't yet know how client classes store their RefCount (and we don't want to depend on the declarations of the client classes), any class that you want to hold onto via one of these must provide implementations of ref_count and destroy, which we forward-declare here.

E.g. if you want to use IntrusivePtr<MyClass>, then you should define something like this in MyClass.cpp (assuming MyClass has a field: mutable RefCount ref_count):

template<> RefCount &ref_count<MyClass>(const MyClass *c) {return c->ref_count;} template<> void destroy<MyClass>(const MyClass *c) {delete c;}

Referenced by Halide::Internal::RefCount::is_zero().

◆ equal() [1/2]

EXPORT bool Halide::Internal::equal ( const Expr a,
const Expr b 
)

Compare IR nodes for equality of value.

Traverses entire IR tree. For equality of reference, use Expr::same_as. If you're comparing non-CSE'd Exprs, use graph_equal, which is safe for nasty graphs of IR nodes.

Referenced by Halide::Internal::ExprWithCompareCache::ExprWithCompareCache(), Halide::Internal::AssociativePattern::operator==(), and Halide::Internal::AssociativeOp::Replacement::operator==().

◆ equal() [2/2]

EXPORT bool Halide::Internal::equal ( const Stmt a,
const Stmt b 
)

Compare IR nodes for equality of value.

Traverses entire IR tree. For equality of reference, use Expr::same_as. If you're comparing non-CSE'd Exprs, use graph_equal, which is safe for nasty graphs of IR nodes.

◆ graph_equal() [1/2]

EXPORT bool Halide::Internal::graph_equal ( const Expr a,
const Expr b 
)

Compare IR nodes for equality of value.

Traverses entire IR tree. For equality of reference, use Expr::same_as. If you're comparing non-CSE'd Exprs, use graph_equal, which is safe for nasty graphs of IR nodes.

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

◆ graph_equal() [2/2]

EXPORT bool Halide::Internal::graph_equal ( const Stmt a,
const Stmt b 
)

Compare IR nodes for equality of value.

Traverses entire IR tree. For equality of reference, use Expr::same_as. If you're comparing non-CSE'd Exprs, use graph_equal, which is safe for nasty graphs of IR nodes.

◆ ir_equality_test()

EXPORT void Halide::Internal::ir_equality_test ( )

◆ expr_match() [1/2]

EXPORT bool Halide::Internal::expr_match ( Expr  pattern,
Expr  expr,
std::vector< Expr > &  result 
)

Does the first expression have the same structure as the second? Variables in the first expression with the name * are interpreted as wildcards, and their matching equivalent in the second expression is placed in the vector give as the third argument.

Wildcards require the types to match. For the type bits and width, a 0 indicates "match anything". So an Int(8, 0) will match 8-bit integer vectors of any width (including scalars), and a UInt(0, 0) will match any unsigned integer type.

For example:

Expr x = Variable::make(Int(32), "*");
match(x + x, 3 + (2*k), result)

should return true, and set result[0] to 3 and result[1] to 2*k.

◆ expr_match() [2/2]

EXPORT bool Halide::Internal::expr_match ( Expr  pattern,
Expr  expr,
std::map< std::string, Expr > &  result 
)

Does the first expression have the same structure as the second? Variables are matched consistently.

The first time a variable is matched, it assumes the value of the matching part of the second expression. Subsequent matches must be equal to the first match.

For example:

Var x("x"), y("y");
match(x*(x + y), a*(a + b), result)

should return true, and set result["x"] = a, and result["y"] = b.

◆ expr_match_test()

EXPORT void Halide::Internal::expr_match_test ( )

◆ is_const() [1/2]

EXPORT 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.

Doesn't do any constant folding.

◆ is_const() [2/2]

EXPORT 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.

◆ as_const_int()

EXPORT const int64_t* Halide::Internal::as_const_int ( const Expr e)

If an expression is an IntImm or a Broadcast of an IntImm, return a pointer to its value.

Otherwise returns nullptr.

Referenced by Halide::cast(), Halide::fast_pow(), Halide::lerp(), Halide::pow(), and Halide::select().

◆ as_const_uint()

EXPORT const uint64_t* Halide::Internal::as_const_uint ( const Expr e)

If an expression is a UIntImm or a Broadcast of a UIntImm, return a pointer to its value.

Otherwise returns nullptr.

Referenced by Halide::cast().

◆ as_const_float()

EXPORT const double* Halide::Internal::as_const_float ( const Expr e)

If an expression is a FloatImm or a Broadcast of a FloatImm, return a pointer to its value.

Otherwise returns nullptr.

Referenced by Halide::cast(), and Halide::lerp().

◆ is_const_power_of_two_integer()

EXPORT bool Halide::Internal::is_const_power_of_two_integer ( const Expr e,
int *  bits 
)

Is the expression a constant integer power of two.

Also returns log base two of the expression if it is. Only returns true for integer types.

◆ is_positive_const()

EXPORT 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)

◆ is_negative_const()

EXPORT 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)

◆ is_negative_negatable_const()

EXPORT bool Halide::Internal::is_negative_negatable_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) and is its negative value representable.

(This excludes the most negative value of the Expr's type from inclusion. Intended to be used when the value will be negated as part of simplification.)

◆ is_undef()

EXPORT bool Halide::Internal::is_undef ( const Expr e)

Is the expression an undef.

◆ is_zero()

EXPORT bool Halide::Internal::is_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)

Referenced by Halide::operator%().

◆ is_one()

EXPORT bool Halide::Internal::is_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)

Referenced by Halide::Internal::Box::maybe_unused().

◆ is_two()

EXPORT bool Halide::Internal::is_two ( const Expr e)

Is the expression a const (as defined by is_const), and also equal to two (in all lanes, if a vector expression)

◆ is_no_op()

EXPORT 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)

◆ is_pure()

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.

◆ make_const() [1/12]

◆ make_const() [2/12]

EXPORT Expr Halide::Internal::make_const ( Type  t,
uint64_t  val 
)

Construct an immediate of the given type from any numeric C++ type.

◆ make_const() [3/12]

EXPORT Expr Halide::Internal::make_const ( Type  t,
double  val 
)

Construct an immediate of the given type from any numeric C++ type.

◆ make_const() [4/12]

Expr Halide::Internal::make_const ( Type  t,
int32_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 90 of file IROperator.h.

References make_const().

◆ make_const() [5/12]

Expr Halide::Internal::make_const ( Type  t,
uint32_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 91 of file IROperator.h.

References make_const().

◆ make_const() [6/12]

Expr Halide::Internal::make_const ( Type  t,
int16_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 92 of file IROperator.h.

References make_const().

◆ make_const() [7/12]

Expr Halide::Internal::make_const ( Type  t,
uint16_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 93 of file IROperator.h.

References make_const().

◆ make_const() [8/12]

Expr Halide::Internal::make_const ( Type  t,
int8_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 94 of file IROperator.h.

References make_const().

◆ make_const() [9/12]

Expr Halide::Internal::make_const ( Type  t,
uint8_t  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 95 of file IROperator.h.

References make_const().

◆ make_const() [10/12]

Expr Halide::Internal::make_const ( Type  t,
bool  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 96 of file IROperator.h.

References make_const().

◆ make_const() [11/12]

Expr Halide::Internal::make_const ( Type  t,
float  val 
)
inline

Construct an immediate of the given type from any numeric C++ type.

Definition at line 97 of file IROperator.h.

References make_const().

◆ make_const() [12/12]

Expr Halide::Internal::make_const ( Type  t,
float16_t  val 
)
inline

◆ check_representable()

◆ make_bool()

EXPORT Expr Halide::Internal::make_bool ( bool  val,
int  lanes = 1 
)

Construct a boolean constant from a C++ boolean value.

May also be a vector if width is given. It is not possible to coerce a C++ boolean to Expr because if we provide such a path then char objects can ambiguously be converted to Halide Expr or to std::string. The problem is that C++ does not have a real bool type - it is in fact close enough to char that C++ does not know how to distinguish them. make_bool is the explicit coercion.

Referenced by make_const().

◆ make_zero()

EXPORT Expr Halide::Internal::make_zero ( Type  t)

Construct the representation of zero in the given type.

Referenced by make_const(), Halide::operator &&(), and Halide::operator-().

◆ make_one()

EXPORT Expr Halide::Internal::make_one ( Type  t)

Construct the representation of one in the given type.

Referenced by make_const(), and Halide::operator||().

◆ make_two()

EXPORT Expr Halide::Internal::make_two ( Type  t)

Construct the representation of two in the given type.

Referenced by make_const().

◆ const_true()

EXPORT Expr Halide::Internal::const_true ( int  lanes = 1)

Construct the constant boolean true.

May also be a vector of trues, if a lanes argument is given.

Referenced by make_const().

◆ const_false()

EXPORT Expr Halide::Internal::const_false ( int  lanes = 1)

Construct the constant boolean false.

May also be a vector of falses, if a lanes argument is given.

Referenced by make_const().

◆ lossless_cast()

EXPORT Expr Halide::Internal::lossless_cast ( Type  t,
Expr  e 
)

Attempt to cast an expression to a smaller type while provably not losing information.

If it can't be done, return an undefined Expr.

Referenced by Halide::clamp(), and make_const().

◆ match_types()

EXPORT void Halide::Internal::match_types ( Expr a,
Expr b 
)

Coerce the two expressions to have the same type, using C-style casting rules.

For the purposes of casting, a boolean type is UInt(1). We use the following procedure:

If the types already match, do nothing.

Then, if one type is a vector and the other is a scalar, the scalar is broadcast to match the vector width, and we continue.

Then, if one type is floating-point and the other is not, the non-float is cast to the floating-point type, and we're done.

Then, if both types are unsigned ints, the one with fewer bits is cast to match the one with more bits and we're done.

Then, if both types are signed ints, the one with fewer bits is cast to match the one with more bits and we're done.

Finally, if one type is an unsigned int and the other type is a signed int, both are cast to a signed int with the greater of the two bit-widths. For example, matching an Int(8) with a UInt(16) results in an Int(16).

Referenced by Halide::absd(), Halide::div_round_to_zero(), make_const(), Halide::max(), Halide::min(), Halide::mod_round_to_zero(), Halide::operator &&(), Halide::operator!=(), Halide::operator%(), Halide::operator*(), Halide::operator+(), Halide::operator-(), Halide::operator/(), Halide::operator<(), Halide::operator<<(), Halide::operator<=(), Halide::operator==(), Halide::operator>(), Halide::operator>=(), Halide::operator>>(), and Halide::operator||().

◆ halide_log()

EXPORT Expr Halide::Internal::halide_log ( Expr  a)

Halide's vectorizable transcendentals.

Referenced by make_const().

◆ halide_exp()

EXPORT Expr Halide::Internal::halide_exp ( Expr  a)

Halide's vectorizable transcendentals.

Referenced by make_const().

◆ halide_erf()

EXPORT Expr Halide::Internal::halide_erf ( Expr  a)

Halide's vectorizable transcendentals.

Referenced by Halide::erf(), and make_const().

◆ raise_to_integer_power()

EXPORT 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.

Referenced by Halide::fast_pow(), make_const(), and Halide::pow().

◆ split_into_ands()

EXPORT void Halide::Internal::split_into_ands ( const Expr cond,
std::vector< Expr > &  result 
)

Split a boolean condition into vector of ANDs.

If 'cond' is undefined, return an empty vector.

Referenced by make_const().

◆ strided_ramp_base()

Expr Halide::Internal::strided_ramp_base ( Expr  e,
int  stride = 1 
)

If e is a ramp expression with stride, default 1, return the base, otherwise undefined.

◆ collect_print_args() [1/3]

NO_INLINE void Halide::Internal::collect_print_args ( std::vector< Expr > &  args)
inline

◆ collect_print_args() [2/3]

template<typename ... Args>
NO_INLINE void Halide::Internal::collect_print_args ( std::vector< Expr > &  args,
const char *  arg,
Args &&...  more_args 
)
inline

Definition at line 1730 of file IROperator.h.

References collect_print_args().

◆ collect_print_args() [3/3]

template<typename ... Args>
NO_INLINE void Halide::Internal::collect_print_args ( std::vector< Expr > &  args,
Expr  arg,
Args &&...  more_args 
)
inline

Definition at line 1736 of file IROperator.h.

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

◆ memoize_tag_helper()

EXPORT Expr Halide::Internal::memoize_tag_helper ( Expr  result,
const std::vector< Expr > &  cache_key_values 
)

◆ operator<<() [3/7]

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

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

◆ operator<<() [4/7]

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

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

◆ operator<<() [5/7]

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

Emit a halide for loop type (vectorized, serial, etc) in a human readable form.

◆ operator<<() [6/7]

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

Emit a halide name mangling value in a human readable format.

◆ lower_lerp()

Expr EXPORT Halide::Internal::lower_lerp ( Expr  zero_val,
Expr  one_val,
Expr  weight 
)

Build Halide IR that computes a lerp.

Use by codegen targets that don't have a native lerp.

◆ loop_invariant_code_motion()

Stmt Halide::Internal::loop_invariant_code_motion ( Stmt  )

Hoist loop-invariants out of inner loops.

This is especially important in cases where LLVM would not do it for us automatically. For example, it hoists loop invariants out of cuda kernels.

◆ iterator_to_pointer()

template<typename T >
auto Halide::Internal::iterator_to_pointer ( iter) -> decltype(&*std::declval<T>())

Definition at line 90 of file LLVM_Headers.h.

◆ get_triple_for_target()

llvm::Triple Halide::Internal::get_triple_for_target ( const Target target)

Return the llvm::Triple that corresponds to the given Halide Target.

◆ get_initial_module_for_target()

std::unique_ptr<llvm::Module> Halide::Internal::get_initial_module_for_target ( Target  ,
llvm::LLVMContext *  ,
bool  for_shared_jit_runtime = false,
bool  just_gpu = false 
)

Create an llvm module containing the support code for a given target.

◆ get_initial_module_for_ptx_device()

std::unique_ptr<llvm::Module> Halide::Internal::get_initial_module_for_ptx_device ( Target  ,
llvm::LLVMContext *  c 
)

Create an llvm module containing the support code for ptx device.

◆ add_bitcode_to_module()

void Halide::Internal::add_bitcode_to_module ( llvm::LLVMContext *  context,
llvm::Module &  module,
const std::vector< uint8_t > &  bitcode,
const std::string &  name 
)

Link a block of llvm bitcode into an llvm module.

◆ loop_carry()

Stmt Halide::Internal::loop_carry ( Stmt  ,
int  max_carried_values = 8 
)

Reuse loads done on previous loop iterations by stashing them in induction variables instead of redoing the load.

If the loads are predicated, the predicates need to match. Can be an optimization or pessimization depending on how good the L1 cache is on the architecture and how many memory issue slots there are. Currently only intended for Hexagon.

◆ lower()

EXPORT Module Halide::Internal::lower ( const std::vector< Function > &  output_funcs,
const std::string &  pipeline_name,
const Target t,
const std::vector< Argument > &  args,
const Internal::LoweredFunc::LinkageType  linkage_type,
const std::vector< IRMutator2 *> &  custom_passes = std::vector< IRMutator2 *>() 
)

Given a vector of scheduled halide functions, create a Module that evaluates it.

Automatically pulls in all the functions f depends on. Some stages of lowering may be target-specific. The Module may contain submodules for computation offloaded to another execution engine or API as well as buffers that are used in the passed in Stmt. Multiple LoweredFuncs are added to support legacy buffer_t calling convention.

◆ lower_main_stmt()

EXPORT Stmt Halide::Internal::lower_main_stmt ( const std::vector< Function > &  output_funcs,
const std::string &  pipeline_name,
const Target t,
const std::vector< IRMutator2 *> &  custom_passes = std::vector< IRMutator2 *>() 
)

Given a halide function with a schedule, create a statement that evaluates it.

Automatically pulls in all the functions f depends on. Some stages of lowering may be target-specific. Mostly used as a convenience function in tests that wish to assert some property of the lowered IR.

◆ lower_test()

void Halide::Internal::lower_test ( )

◆ define_matlab_wrapper()

EXPORT llvm::Function* Halide::Internal::define_matlab_wrapper ( llvm::Module *  module,
llvm::Function pipeline_argv_wrapper,
llvm::Function metadata_getter 
)

Add a mexFunction wrapper definition to the module, calling the function with the name pipeline_name.

Returns the mexFunction definition.

◆ inject_memoization()

Stmt Halide::Internal::inject_memoization ( Stmt  s,
const std::map< std::string, Function > &  env,
const std::string &  name,
const std::vector< Function > &  outputs 
)

Transform pipeline calls for Funcs scheduled with memoize to do a lookup call to the runtime cache implementation, and if there is a miss, compute the results and call the runtime to store it back to the cache.

Should leave non-memoized Funcs unchanged.

◆ rewrite_memoized_allocations()

Stmt Halide::Internal::rewrite_memoized_allocations ( Stmt  s,
const std::map< std::string, Function > &  env 
)

This should be called after Storage Flattening has added Allocation IR nodes.

It connects the memoization cache lookups to the Allocations so they point to the buffers from the memoization cache and those buffers are released when no longer used. Should not affect allocations for non-memoized Funcs.

◆ modulus_remainder() [1/2]

EXPORT ModulusRemainder Halide::Internal::modulus_remainder ( Expr  e)

For things like alignment analysis, often it's helpful to know if an integer expression is some multiple of a constant plus some other constant.

For example, it is straight-forward to deduce that ((10*x + 2)*(6*y - 3) - 1) is congruent to five modulo six.

We get the most information when the modulus is large. E.g. if something is congruent to 208 modulo 384, then we also know it's congruent to 0 mod 8, and we can possibly use it as an index for an aligned load. If all else fails, we can just say that an integer is congruent to zero modulo one.

◆ modulus_remainder() [2/2]

EXPORT ModulusRemainder Halide::Internal::modulus_remainder ( Expr  e,
const Scope< ModulusRemainder > &  scope 
)

If we have alignment information about external variables, we can let the analysis know about that using this version of modulus_remainder:

◆ reduce_expr_modulo() [1/2]

EXPORT bool Halide::Internal::reduce_expr_modulo ( Expr  e,
int  modulus,
int *  remainder 
)

Reduce an expression modulo some integer.

Returns true and assigns to remainder if an answer could be found.

◆ reduce_expr_modulo() [2/2]

EXPORT bool Halide::Internal::reduce_expr_modulo ( Expr  e,
int  modulus,
int *  remainder,
const Scope< ModulusRemainder > &  scope 
)

Reduce an expression modulo some integer.

Returns true and assigns to remainder if an answer could be found.

◆ modulus_remainder_test()

EXPORT void Halide::Internal::modulus_remainder_test ( )

◆ gcd()

EXPORT int Halide::Internal::gcd ( int  ,
int   
)

The greatest common divisor of two integers.

◆ lcm()

EXPORT int Halide::Internal::lcm ( int  ,
int   
)

The least common multiple of two integers.

◆ is_monotonic()

EXPORT Monotonic Halide::Internal::is_monotonic ( Expr  e,
const std::string &  var 
)

◆ is_monotonic_test()

EXPORT void Halide::Internal::is_monotonic_test ( )

◆ can_parallelize_rvar()

bool Halide::Internal::can_parallelize_rvar ( const std::string &  rvar,
const std::string &  func,
const Definition r 
)

Returns whether or not Halide can prove that it is safe to parallelize an update definition across a specific variable.

If this returns true, it's definitely safe. If this returns false, it may still be safe, but Halide couldn't prove it.

◆ check_call_arg_types()

void Halide::Internal::check_call_arg_types ( const std::string &  name,
std::vector< Expr > *  args,
int  dims 
)

Validate arguments to a call to a func, image or imageparam.

Referenced by Halide::Internal::Parameter::set_scalar().

◆ has_likely_tag()

bool Halide::Internal::has_likely_tag ( Expr  e)

Return true if an expression uses a likely tag.

◆ partition_loops()

EXPORT Stmt Halide::Internal::partition_loops ( Stmt  s)

Partitions loop bodies into a prologue, a steady state, and an epilogue.

Finds the steady state by hunting for use of clamped ramps, or the 'likely' intrinsic.

◆ inject_prefetch()

Stmt Halide::Internal::inject_prefetch ( Stmt  s,
const std::map< std::string, Function > &  env 
)

◆ reduce_prefetch_dimension()

Stmt Halide::Internal::reduce_prefetch_dimension ( Stmt  stmt,
const Target t 
)

Reduce a multi-dimensional prefetch into a prefetch of lower dimension (max dimension of the prefetch is specified by target architecture).

This keeps the 'max_dim' innermost dimensions and adds loops for the rest of the dimensions. If maximum prefetched-byte-size is specified (depending on the architecture), this also adds an outer loops that tile the prefetches.

◆ print_loop_nest()

std::string Halide::Internal::print_loop_nest ( const std::vector< Function > &  output_funcs)

Emit some simple pseudocode that shows the structure of the loop nest specified by this pipeline's schedule, and the schedules of the functions it uses.

Referenced by Halide::Func::Func().

◆ inject_profiling()

Stmt Halide::Internal::inject_profiling ( Stmt  ,
std::string   
)

Take a statement representing a halide pipeline insert high-resolution timing into the generated code (via spawning a thread that acts as a sampling profiler); summaries of execution times and counts will be logged at the end.

Should be done before storage flattening, but after all bounds inference.

◆ qualify()

Expr Halide::Internal::qualify ( const std::string &  prefix,
Expr  value 
)

Prefix all variable names in the given expression with the prefix string.

◆ random_float()

Expr Halide::Internal::random_float ( const std::vector< Expr > &  )

Return a random floating-point number between zero and one that varies deterministically based on the input expressions.

◆ random_int()

Expr Halide::Internal::random_int ( const std::vector< Expr > &  )

Return a random unsigned integer between zero and 2^32-1 that varies deterministically based on the input expressions (which must be integers or unsigned integers).

◆ lower_random()

Expr Halide::Internal::lower_random ( Expr  e,
const std::vector< std::string > &  free_vars,
int  tag 
)

Convert calls to random() to IR generated by random_float and random_int.

Tags all calls with the variables in free_vars, and the integer given as the last argument.

◆ realization_order()

std::vector<std::string> Halide::Internal::realization_order ( const std::vector< Function > &  output,
const std::map< std::string, Function > &  env 
)

Given a bunch of functions that call each other, determine an order in which to do the scheduling.

This in turn influences the order in which stages are computed when there's no strict dependency between them. Currently just some arbitrary depth-first traversal of the call graph.

◆ split_predicate_test()

EXPORT void Halide::Internal::split_predicate_test ( )

◆ is_func_trivial_to_inline()

bool Halide::Internal::is_func_trivial_to_inline ( const Function func)

Return true if the cost of inlining a function is equivalent to the cost of calling the function directly.

◆ remove_dead_allocations()

Stmt Halide::Internal::remove_dead_allocations ( Stmt  s)

Find Allocate/Free pairs that are never loaded from or stored to, and remove them from the Stmt.

This doesn't touch Realize/Call nodes and so must be called after storage_flattening.

◆ remove_trivial_for_loops()

Stmt Halide::Internal::remove_trivial_for_loops ( Stmt  s)

Convert for loops of size 1 into LetStmt nodes, which allows for further simplification.

Done during a late stage of lowering.

◆ remove_undef()

Stmt Halide::Internal::remove_undef ( Stmt  s)

Removes stores that depend on undef values, and statements that only contain such stores.

◆ schedule_functions()

Stmt Halide::Internal::schedule_functions ( const std::vector< Function > &  outputs,
const std::vector< std::string > &  order,
const std::map< std::string, Function > &  env,
const Target target,
bool &  any_memoized 
)

Build loop nests and inject Function realizations at the appropriate places using the schedule.

Returns a flag indicating whether memoization passes need to be run.

◆ operator<<() [7/7]

template<typename T >
std::ostream& Halide::Internal::operator<< ( std::ostream &  stream,
const Scope< T > &  s 
)

Definition at line 242 of file Scope.h.

References Halide::Internal::Scope< T >::const_iterator::name().

◆ select_gpu_api()

Stmt Halide::Internal::select_gpu_api ( Stmt  s,
Target  t 
)

Replace for loops with GPU_Default device_api with an actual device API depending on what's enabled in the target.

Choose the first of the following: opencl, cuda, openglcompute, opengl

◆ simplify() [1/2]

EXPORT Stmt Halide::Internal::simplify ( Stmt  ,
bool  simplify_lets = true,
const Scope< Interval > &  bounds = ScopeInterval >::empty_scope(),
const Scope< ModulusRemainder > &  alignment = ScopeModulusRemainder >::empty_scope() 
)

Perform a a wide range of simplifications to expressions and statements, including constant folding, substituting in trivial values, arithmetic rearranging, etc.

Simplifies across let statements, so must not be called on stmts with dangling or repeated variable names.

◆ simplify() [2/2]

EXPORT Expr Halide::Internal::simplify ( Expr  ,
bool  simplify_lets = true,
const Scope< Interval > &  bounds = ScopeInterval >::empty_scope(),
const Scope< ModulusRemainder > &  alignment = ScopeModulusRemainder >::empty_scope() 
)

Perform a a wide range of simplifications to expressions and statements, including constant folding, substituting in trivial values, arithmetic rearranging, etc.

Simplifies across let statements, so must not be called on stmts with dangling or repeated variable names.

◆ can_prove()

EXPORT bool Halide::Internal::can_prove ( Expr  e)

A common use of the simplifier is to prove boolean expressions are true at compile time.

Equivalent to is_one(simplify(e))

◆ simplify_exprs()

EXPORT Stmt Halide::Internal::simplify_exprs ( Stmt  )

Simplify expressions found in a statement, but don't simplify across different statements.

This is safe to perform at an earlier stage in lowering than full simplification of a stmt.

◆ mod_imp()

template<typename T >
T Halide::Internal::mod_imp ( a,
b 
)
inline

Implementations of division and mod that are specific to Halide.

Use these implementations; do not use native C division or mod to simplify Halide expressions. Halide division and modulo satisify the Euclidean definition of division for integers a and b:

/code (a/b)*b + ab = a 0 <= ab < |b| /endcode

Definition at line 54 of file Simplify.h.

References Halide::abs(), Halide::Runtime::Internal::b, and Halide::Type::is_int().

◆ div_imp()

template<typename T >
T Halide::Internal::div_imp ( a,
b 
)
inline

Implementations of division and mod that are specific to Halide.

Use these implementations; do not use native C division or mod to simplify Halide expressions. Halide division and modulo satisify the Euclidean definition of division for integers a and b:

/code (a/b)*b + ab = a 0 <= ab < |b| /endcode

Definition at line 66 of file Simplify.h.

References Halide::Runtime::Internal::b, Halide::Type::bits(), and Halide::Type::is_int().

◆ mod_imp< float >()

template<>
float Halide::Internal::mod_imp< float > ( float  a,
float  b 
)
inline

Definition at line 81 of file Simplify.h.

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

◆ mod_imp< double >()

template<>
double Halide::Internal::mod_imp< double > ( double  a,
double  b 
)
inline

Definition at line 86 of file Simplify.h.

References Halide::Runtime::Internal::b, and Halide::floor().

◆ div_imp< float >()

template<>
float Halide::Internal::div_imp< float > ( float  a,
float  b 
)
inline

Definition at line 91 of file Simplify.h.

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

◆ div_imp< double >()

template<>
double Halide::Internal::div_imp< double > ( double  a,
double  b 
)
inline

Definition at line 94 of file Simplify.h.

References Halide::Runtime::Internal::b, EXPORT, and simplify_test().

◆ simplify_test()

EXPORT void Halide::Internal::simplify_test ( )

Referenced by div_imp< double >().

◆ simplify_specializations()

EXPORT void Halide::Internal::simplify_specializations ( std::map< std::string, Function > &  env)

Try to simplify the RHS/LHS of a function's definition based on its specializations.

◆ skip_stages()

Stmt Halide::Internal::skip_stages ( Stmt  s,
const std::vector< std::string > &  order 
)

Avoid computing certain stages if we can infer a runtime condition to check that tells us they won't be used.

Does this by analyzing all reads of each buffer allocated, and inferring some condition that tells us if the reads occur. If the condition is non-trivial, inject ifs that guard the production.

◆ sliding_window()

Stmt Halide::Internal::sliding_window ( Stmt  s,
const std::map< std::string, Function > &  env 
)

Perform sliding window optimizations on a halide statement.

I.e. don't bother computing points in a function that have provably already been computed by a previous iteration.

◆ solve_expression()

EXPORT SolverResult Halide::Internal::solve_expression ( Expr  e,
const std::string &  variable,
const Scope< Expr > &  scope = ScopeExpr >::empty_scope() 
)

Attempts to collect all instances of a variable in an expression tree and place it as far to the left as possible, and as far up the tree as possible (i.e.

outside most parentheses). If the expression is an equality or comparison, this 'solves' the equation. Returns a pair of Expr and bool. The Expr is the mutated expression, and the bool indicates whether there is a single instance of the variable in the result. If it is false, the expression has only been partially solved, and there are still multiple instances of the variable.

◆ solve_for_outer_interval()

EXPORT Interval Halide::Internal::solve_for_outer_interval ( Expr  c,
const std::string &  variable 
)

Find the smallest interval such that the condition is either true or false inside of it, but definitely false outside of it.

Never returns undefined Exprs, instead it uses variables called "pos_inf" and "neg_inf" to represent positive and negative infinity.

◆ solve_for_inner_interval()

EXPORT Interval Halide::Internal::solve_for_inner_interval ( Expr  c,
const std::string &  variable 
)

Find the largest interval such that the condition is definitely true inside of it, and might be true or false outside of it.

◆ and_condition_over_domain()

Expr Halide::Internal::and_condition_over_domain ( Expr  c,
const Scope< Interval > &  varying 
)

Take a conditional that includes variables that vary over some domain, and convert it to a more conservative (less frequently true) condition that doesn't depend on those variables.

Formally, the output expr implies the input expr.

The condition may be a vector condition, in which case we also 'and' over the vector lanes, and return a scalar result.

◆ solve_test()

EXPORT void Halide::Internal::solve_test ( )

◆ split_tuples()

Stmt Halide::Internal::split_tuples ( Stmt  s,
const std::map< std::string, Function > &  env 
)

Rewrite all tuple-valued Realizations, Provide nodes, and Call nodes into several scalar-valued ones, so that later lowering passes only need to think about scalar-valued productions.

◆ print_to_html() [1/2]

EXPORT void Halide::Internal::print_to_html ( std::string  filename,
Stmt  s 
)

Dump an HTML-formatted print of a Stmt to filename.

◆ print_to_html() [2/2]

EXPORT void Halide::Internal::print_to_html ( std::string  filename,
const Module m 
)

Dump an HTML-formatted print of a Module to filename.

◆ storage_flattening()

Stmt Halide::Internal::storage_flattening ( Stmt  s,
const std::vector< Function > &  outputs,
const std::map< std::string, Function > &  env,
const Target target 
)

Take a statement with multi-dimensional Realize, Provide, and Call nodes, and turn it into a statement with single-dimensional Allocate, Store, and Load nodes respectively.

◆ storage_folding()

Stmt Halide::Internal::storage_folding ( Stmt  s,
const std::map< std::string, Function > &  env 
)

Fold storage of functions if possible.

This means reducing one of the dimensions module something for the purpose of storage, if we can prove that this is safe to do. E.g consider:

f(x) = ...
g(x) = f(x-1) + f(x)
f.store_root().compute_at(g, x);

We can store f as a circular buffer of size two, instead of allocating space for all of it.

◆ substitute() [1/6]

EXPORT Expr Halide::Internal::substitute ( const std::string &  name,
const Expr replacement,
const Expr expr 
)

Substitute variables with the given name with the replacement expression within expr.

This is a dangerous thing to do if variable names have not been uniquified. While it won't traverse inside let statements with the same name as the first argument, moving a piece of syntax around can change its meaning, because it can cross lets that redefine variable names that it includes references to.

Referenced by Halide::Internal::Function::operator ExternFuncArgument().

◆ substitute() [2/6]

EXPORT Stmt Halide::Internal::substitute ( const std::string &  name,
const Expr replacement,
const Stmt stmt 
)

Substitute variables with the given name with the replacement expression within stmt.

◆ substitute() [3/6]

EXPORT Expr Halide::Internal::substitute ( const std::map< std::string, Expr > &  replacements,
const Expr expr 
)

Substitute variables with names in the map.

◆ substitute() [4/6]

EXPORT Stmt Halide::Internal::substitute ( const std::map< std::string, Expr > &  replacements,
const Stmt stmt 
)

Substitute variables with names in the map.

◆ substitute() [5/6]

EXPORT Expr Halide::Internal::substitute ( const Expr find,
const Expr replacement,
const Expr expr 
)

Substitute expressions for other expressions.

◆ substitute() [6/6]

EXPORT Stmt Halide::Internal::substitute ( const Expr find,
const Expr replacement,
const Stmt stmt 
)

Substitute expressions for other expressions.

◆ graph_substitute() [1/4]

Expr Halide::Internal::graph_substitute ( const std::string &  name,
const Expr replacement,
const Expr expr 
)

Substitutions where the IR may be a general graph (and not just a DAG).

◆ graph_substitute() [2/4]

Stmt Halide::Internal::graph_substitute ( const std::string &  name,
const Expr replacement,
const Stmt stmt 
)

Substitutions where the IR may be a general graph (and not just a DAG).

◆ graph_substitute() [3/4]

Expr Halide::Internal::graph_substitute ( const Expr find,
const Expr replacement,
const Expr expr 
)

Substitutions where the IR may be a general graph (and not just a DAG).

◆ graph_substitute() [4/4]

Stmt Halide::Internal::graph_substitute ( const Expr find,
const Expr replacement,
const Stmt stmt 
)

Substitutions where the IR may be a general graph (and not just a DAG).

◆ substitute_in_all_lets() [1/2]

Expr Halide::Internal::substitute_in_all_lets ( const Expr expr)

Substitute in all let Exprs in a piece of IR.

Doesn't substitute in let stmts, as this may change the meaning of the IR (e.g. by moving a load after a store). Produces graphs of IR, so don't use non-graph-aware visitors or mutators on it until you've CSE'd the result.

◆ substitute_in_all_lets() [2/2]

Stmt Halide::Internal::substitute_in_all_lets ( const Stmt stmt)

Substitute in all let Exprs in a piece of IR.

Doesn't substitute in let stmts, as this may change the meaning of the IR (e.g. by moving a load after a store). Produces graphs of IR, so don't use non-graph-aware visitors or mutators on it until you've CSE'd the result.

◆ target_test()

EXPORT void Halide::Internal::target_test ( )

◆ inject_tracing()

Stmt Halide::Internal::inject_tracing ( Stmt  ,
const std::string &  pipeline_name,
const std::map< std::string, Function > &  env,
const std::vector< Function > &  outputs,
const Target Target 
)

Take a statement representing a halide pipeline, inject calls to tracing functions at interesting points, such as allocations.

Should be done before storage flattening, but after all bounds inference.

◆ trim_no_ops()

EXPORT Stmt Halide::Internal::trim_no_ops ( Stmt  s)

Truncate loop bounds to the region over which they actually do something.

For examples see test/correctness/trim_no_ops.cpp

◆ unify_duplicate_lets()

Stmt Halide::Internal::unify_duplicate_lets ( Stmt  s)

Find let statements that all define the same value, and make later ones just reuse the symbol names of the earlier ones.

◆ uniquify_variable_names()

Stmt Halide::Internal::uniquify_variable_names ( Stmt  s)

Modify a statement so that every internally-defined variable name is unique.

This lets later passes assume syntactic equivalence is semantic equivalence.

◆ unpack_buffers()

Stmt Halide::Internal::unpack_buffers ( Stmt  s)

Creates let stmts for the various buffer components (e.g.

foo.extent.0) in any referenced concrete buffers or buffer parameters. After this pass, the only undefined symbols should scalar parameters and the buffers themselves (e.g. foo.buffer).

◆ unroll_loops()

Stmt Halide::Internal::unroll_loops ( Stmt  )

Take a statement with for loops marked for unrolling, and convert each into several copies of the innermost statement.

I.e. unroll the loop.

◆ reinterpret_bits()

template<typename DstType , typename SrcType >
DstType Halide::Internal::reinterpret_bits ( const SrcType &  src)

An aggressive form of reinterpret cast used for correct type-punning.

Definition at line 55 of file Util.h.

References dst, ends_with(), EXPORT, get_env_variable(), make_entity_name(), memcpy(), replace_all(), running_program_name(), split_string(), starts_with(), and unique_name().

◆ make_entity_name()

EXPORT std::string Halide::Internal::make_entity_name ( void *  stack_ptr,
const std::string &  type,
char  prefix 
)

Make a unique name for an object based on the name of the stack variable passed in.

If introspection isn't working or there are no debug symbols, just uses unique_name with the given prefix.

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

◆ get_env_variable()

EXPORT std::string Halide::Internal::get_env_variable ( char const *  env_var_name)

Get value of an environment variable.

Returns its value is defined in the environment. If the var is not defined, an empty string is returned.

Referenced by reinterpret_bits().

◆ running_program_name()

EXPORT std::string Halide::Internal::running_program_name ( )

Get the name of the currently running executable.

Platform-specific. If program name cannot be retrieved, function returns an empty string.

Referenced by reinterpret_bits().

◆ unique_name() [1/2]

EXPORT std::string Halide::Internal::unique_name ( char  prefix)

Generate a unique name starting with the given prefix.

It's unique relative to all other strings returned by unique_name in this process.

The single-character version always appends a numeric suffix to the character.

The string version will either return the input as-is (with high probability on the first time it is called with that input), or replace any existing '$' characters with underscores, then add a '$' sign and a numeric suffix to it.

Note that unique_name('f') therefore differs from unique_name("f"). The former returns something like f123, and the latter returns either f or f$123.

Referenced by Halide::lambda(), and reinterpret_bits().

◆ unique_name() [2/2]

EXPORT std::string Halide::Internal::unique_name ( const std::string &  prefix)

Generate a unique name starting with the given prefix.

It's unique relative to all other strings returned by unique_name in this process.

The single-character version always appends a numeric suffix to the character.

The string version will either return the input as-is (with high probability on the first time it is called with that input), or replace any existing '$' characters with underscores, then add a '$' sign and a numeric suffix to it.

Note that unique_name('f') therefore differs from unique_name("f"). The former returns something like f123, and the latter returns either f or f$123.

◆ starts_with()

EXPORT bool Halide::Internal::starts_with ( const std::string &  str,
const std::string &  prefix 
)

Test if the first string starts with the second string.

Referenced by reinterpret_bits().

◆ ends_with()

EXPORT bool Halide::Internal::ends_with ( const std::string &  str,
const std::string &  suffix 
)

Test if the first string ends with the second string.

Referenced by reinterpret_bits().

◆ replace_all()

EXPORT std::string Halide::Internal::replace_all ( const std::string &  str,
const std::string &  find,
const std::string &  replace 
)

Replace all matches of the second string in the first string with the last string.

Referenced by reinterpret_bits().

◆ split_string()

EXPORT std::vector<std::string> Halide::Internal::split_string ( const std::string &  source,
const std::string &  delim 
)

Split the source string using 'delim' as the divider.

Referenced by reinterpret_bits().

◆ fold_left()

template<typename T , typename Fn >
T Halide::Internal::fold_left ( const std::vector< T > &  vec,
Fn  f 
)

Perform a left fold of a vector.

Returns a default-constructed vector element if the vector is empty. Similar to std::accumulate but with a less clunky syntax.

Definition at line 114 of file Util.h.

◆ fold_right()

template<typename T , typename Fn >
T Halide::Internal::fold_right ( const std::vector< T > &  vec,
Fn  f 
)

Returns a right fold of a vector.

Returns a default-constructed vector element if the vector is empty.

Definition at line 129 of file Util.h.

◆ collect_paired_args() [1/2]

template<typename T1 , typename T2 , typename T3 , typename T4 >
NO_INLINE void Halide::Internal::collect_paired_args ( std::vector< std::pair< T1, T2 >> &  collected_args,
const T3 &  a1,
const T4 &  a2 
)
inline

◆ collect_paired_args() [2/2]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename ... Args>
NO_INLINE void Halide::Internal::collect_paired_args ( std::vector< std::pair< T1, T2 >> &  collected_args,
const T3 &  a1,
const T4 &  a2,
Args &&...  args 
)
inline

Definition at line 148 of file Util.h.

References collect_paired_args().

◆ extract_namespaces()

EXPORT std::string Halide::Internal::extract_namespaces ( const std::string &  name,
std::vector< std::string > &  namespaces 
)

Returns base name and fills in namespaces, outermost one first in vector.

Referenced by halide_internal_handle_traits< T, true >::make_info().

◆ file_make_temp()

EXPORT std::string Halide::Internal::file_make_temp ( const std::string &  prefix,
const std::string &  suffix 
)

Create a unique file with a name of the form prefixXXXXXsuffix in an arbitrary (but writable) directory; this is typically /tmp, but the specific location is not guaranteed.

(Note that the exact form of the file name may vary; in particular, the suffix may be ignored on Windows.) The file is created (but not opened), thus this can be called from different threads (or processes, e.g. when building with parallel make) without risking collision. Note that if this file is used as a temporary file, the caller is responsibly for deleting it. Neither the prefix nor suffix may contain a directory separator.

◆ dir_make_temp()

EXPORT std::string Halide::Internal::dir_make_temp ( )

Create a unique directory in an arbitrary (but writable) directory; this is typically somewhere inside /tmp, but the specific location is not guaranteed.

The directory will be empty (i.e., this will never return /tmp itself, but rather a new directory inside /tmp). The caller is responsible for removing the directory after use.

◆ file_exists()

EXPORT bool Halide::Internal::file_exists ( const std::string &  name)

Wrapper for access().

Quietly ignores errors.

◆ assert_file_exists()

EXPORT void Halide::Internal::assert_file_exists ( const std::string &  name)

assert-fail if the file doesn't exist.

useful primarily for testing purposes.

◆ assert_no_file_exists()

EXPORT void Halide::Internal::assert_no_file_exists ( const std::string &  name)

assert-fail if the file DOES exist.

useful primarily for testing purposes.

◆ file_unlink()

EXPORT void Halide::Internal::file_unlink ( const std::string &  name)

Wrapper for unlink().

Asserts upon error.

Quietly ignores errors.

Referenced by Halide::Internal::TemporaryFile::~TemporaryFile().

◆ ensure_no_file_exists()

EXPORT void Halide::Internal::ensure_no_file_exists ( const std::string &  name)

Ensure that no file with this path exists.

If such a file exists and cannot be removed, assert-fail.

◆ dir_rmdir()

EXPORT void Halide::Internal::dir_rmdir ( const std::string &  name)

Wrapper for rmdir().

Asserts upon error.

◆ file_stat()

EXPORT FileStat Halide::Internal::file_stat ( const std::string &  name)

Wrapper for stat().

Asserts upon error.

◆ add_would_overflow()

bool Halide::Internal::add_would_overflow ( int  bits,
int64_t  a,
int64_t  b 
)

Routines to test if math would overflow for signed integers with the given number of bits.

Referenced by Halide::Internal::TemporaryFile::detach().

◆ sub_would_overflow()

bool Halide::Internal::sub_would_overflow ( int  bits,
int64_t  a,
int64_t  b 
)

Routines to test if math would overflow for signed integers with the given number of bits.

Referenced by Halide::Internal::TemporaryFile::detach().

◆ mul_would_overflow()

bool Halide::Internal::mul_would_overflow ( int  bits,
int64_t  a,
int64_t  b 
)

Routines to test if math would overflow for signed integers with the given number of bits.

Referenced by Halide::Internal::TemporaryFile::detach().

◆ find_linear_expressions()

Stmt Halide::Internal::find_linear_expressions ( Stmt  s)

find_linear_expressions(Stmt s) identifies expressions that may be moved out of the generated fragment shader into a varying attribute.

These expressions are tagged by wrapping them in a glsl_varying intrinsic

◆ setup_gpu_vertex_buffer()

Stmt Halide::Internal::setup_gpu_vertex_buffer ( Stmt  s)

Compute a set of 2D mesh coordinates based on the behavior of varying attribute expressions contained within a GLSL scheduled for loop.

This method is called during lowering to extract varying attribute expressions and generate code to evalue them at each mesh vertex location. The operation is performed on the host before the draw call to invoke the shader

◆ vectorize_loops()

Stmt Halide::Internal::vectorize_loops ( Stmt  s,
const Target t 
)

Take a statement with for loops marked for vectorization, and turn them into single statements that operate on vectors.

The loops in question must have constant extent.

◆ wrap_func_calls()

std::map<std::string, Function> Halide::Internal::wrap_func_calls ( const std::map< std::string, Function > &  env)

Replace every call to wrapped Functions in the Functions' definitions with call to their wrapper functions.

◆ wrap_legacy_extern_stages()

void Halide::Internal::wrap_legacy_extern_stages ( Module  m)

Add wrappers for any LoweredFuncs that need them to support backwards compatibility.

This currently wraps extern calls to stages that expect the old buffer_t type.

◆ add_legacy_wrapper()

void Halide::Internal::add_legacy_wrapper ( Module  m,
const LoweredFunc fn 
)

Add a wrapper for a LoweredFunc that accepts old buffers and upgrades them.

Variable Documentation

◆ unknown

const int64_t Halide::Internal::unknown = std::numeric_limits<int64_t>::min()

Definition at line 22 of file AutoScheduleUtils.h.