Halide
Halide::Internal::Call Struct Reference

A function call. More...

#include <IR.h>

Inherits Halide::Internal::ExprNode< Call >.

Public Types

enum  CallType {
  Image, Extern, ExternCPlusPlus, PureExtern,
  Halide, Intrinsic, PureIntrinsic
}
 
enum  IntrinsicOp {
  abs, absd, add_image_checks_marker, alloca,
  bitwise_and, bitwise_not, bitwise_or, bitwise_xor,
  bool_to_mask, bundle, call_cached_indirect_function, cast_mask,
  concat_bits, count_leading_zeros, count_trailing_zeros, debug_to_file,
  declare_box_touched, div_round_to_zero, dynamic_shuffle, extract_bits,
  extract_mask_element, get_user_context, gpu_thread_barrier, halving_add,
  halving_sub, hvx_gather, hvx_scatter, hvx_scatter_acc,
  hvx_scatter_release, if_then_else, if_then_else_mask, image_load,
  image_store, lerp, likely, likely_if_innermost,
  load_typed_struct_member, make_struct, memoize_expr, mod_round_to_zero,
  mul_shift_right, mux, popcount, prefetch,
  promise_clamped, random, register_destructor, require,
  require_mask, return_second, rewrite_buffer, round,
  rounding_halving_add, rounding_mul_shift_right, rounding_shift_left, rounding_shift_right,
  saturating_add, saturating_sub, saturating_cast, scatter_gather,
  select_mask, shift_left, shift_right, signed_integer_overflow,
  size_of_halide_buffer_t, sorted_avg, strict_float, stringify,
  undef, unreachable, unsafe_promise_clamped, widen_right_add,
  widen_right_mul, widen_right_sub, widening_add, widening_mul,
  widening_shift_left, widening_shift_right, widening_sub, IntrinsicOpCount
}
 

Public Member Functions

bool is_pure () const
 Check if a call node is pure within a pipeline, meaning that the same args always give the same result, and the calls can be reordered, duplicated, unified, etc without changing the meaning of anything. More...
 
bool is_intrinsic () const
 
bool is_intrinsic (IntrinsicOp op) const
 
bool is_intrinsic (std::initializer_list< IntrinsicOp > intrinsics) const
 
bool is_tag () const
 
bool is_extern () const
 
- Public Member Functions inherited from Halide::Internal::ExprNode< Call >
void accept (IRVisitor *v) const override
 We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors. More...
 
Expr mutate_expr (IRMutator *v) const override
 
 ExprNode ()
 
 ~ExprNode () override=default
 
- Public Member Functions inherited from Halide::Internal::BaseExprNode
 BaseExprNode (IRNodeType t)
 
- Public Member Functions inherited from Halide::Internal::IRNode
 IRNode (IRNodeType t)
 
virtual ~IRNode ()=default
 

Static Public Member Functions

static const char * get_intrinsic_name (IntrinsicOp op)
 
static Expr make (Type type, IntrinsicOp op, const std::vector< Expr > &args, CallType call_type, FunctionPtr func=FunctionPtr(), int value_index=0, const Buffer<> &image=Buffer<>(), Parameter param=Parameter())
 
static Expr make (Type type, const std::string &name, const std::vector< Expr > &args, CallType call_type, FunctionPtr func=FunctionPtr(), int value_index=0, Buffer<> image=Buffer<>(), Parameter param=Parameter())
 
static Expr make (const Function &func, const std::vector< Expr > &args, int idx=0)
 Convenience constructor for calls to other halide functions. More...
 
static Expr make (const Buffer<> &image, const std::vector< Expr > &args)
 Convenience constructor for loads from concrete images. More...
 
static Expr make (const Parameter &param, const std::vector< Expr > &args)
 Convenience constructor for loads from images parameters. More...
 
static const Callas_intrinsic (const Expr &e, std::initializer_list< IntrinsicOp > intrinsics)
 Returns a pointer to a call node if the expression is a call to one of the requested intrinsics. More...
 
static const Callas_tag (const Expr &e)
 

Public Attributes

const typedef char *const ConstString
 
std::string name
 
std::vector< Exprargs
 
CallType call_type
 
FunctionPtr func
 
int value_index
 
Buffer image
 
Parameter param
 
- Public Attributes inherited from Halide::Internal::BaseExprNode
Type type
 
- Public Attributes inherited from Halide::Internal::IRNode
RefCount ref_count
 These classes are all managed with intrusive reference counting, so we also track a reference count. More...
 
IRNodeType node_type
 Each IR node subclass has a unique identifier. More...
 

Static Public Attributes

static HALIDE_EXPORT ConstString buffer_get_dimensions
 
static HALIDE_EXPORT ConstString buffer_get_min
 
static HALIDE_EXPORT ConstString buffer_get_extent
 
static HALIDE_EXPORT ConstString buffer_get_stride
 
static HALIDE_EXPORT ConstString buffer_get_max
 
static HALIDE_EXPORT ConstString buffer_get_host
 
static HALIDE_EXPORT ConstString buffer_get_device
 
static HALIDE_EXPORT ConstString buffer_get_device_interface
 
static HALIDE_EXPORT ConstString buffer_get_shape
 
static HALIDE_EXPORT ConstString buffer_get_host_dirty
 
static HALIDE_EXPORT ConstString buffer_get_device_dirty
 
static HALIDE_EXPORT ConstString buffer_get_type
 
static HALIDE_EXPORT ConstString buffer_set_host_dirty
 
static HALIDE_EXPORT ConstString buffer_set_device_dirty
 
static HALIDE_EXPORT ConstString buffer_is_bounds_query
 
static HALIDE_EXPORT ConstString buffer_init
 
static HALIDE_EXPORT ConstString buffer_init_from_buffer
 
static HALIDE_EXPORT ConstString buffer_crop
 
static HALIDE_EXPORT ConstString buffer_set_bounds
 
static HALIDE_EXPORT ConstString trace
 
static const IRNodeType _node_type = IRNodeType::Call
 

Detailed Description

A function call.

This can represent a call to some extern function (like sin), but it's also our multi-dimensional version of a Load, so it can be a load from an input image, or a call to another halide function. These two types of call nodes don't survive all the way down to code generation - the lowering process converts them to Load nodes.

Definition at line 482 of file IR.h.

Member Enumeration Documentation

◆ CallType

Enumerator
Image 

A load from an input image.

Extern 

A call to an external C-ABI function, possibly with side-effects.

ExternCPlusPlus 

A call to an external C-ABI function, possibly with side-effects.

PureExtern 

A call to a guaranteed-side-effect-free external function.

Halide 

A call to a Func.

Intrinsic 

A possibly-side-effecty compiler intrinsic, which has special handling during codegen.

PureIntrinsic 

A side-effect-free version of the above.

Definition at line 485 of file IR.h.

◆ IntrinsicOp

Enumerator
abs 
absd 
add_image_checks_marker 
alloca 
bitwise_and 
bitwise_not 
bitwise_or 
bitwise_xor 
bool_to_mask 
bundle 
call_cached_indirect_function 
cast_mask 
concat_bits 
count_leading_zeros 
count_trailing_zeros 
debug_to_file 
declare_box_touched 
div_round_to_zero 
dynamic_shuffle 
extract_bits 
extract_mask_element 
get_user_context 
gpu_thread_barrier 
halving_add 
halving_sub 
hvx_gather 
hvx_scatter 
hvx_scatter_acc 
hvx_scatter_release 
if_then_else 
if_then_else_mask 
image_load 
image_store 
lerp 
likely 
likely_if_innermost 
load_typed_struct_member 
make_struct 
memoize_expr 
mod_round_to_zero 
mul_shift_right 
mux 
popcount 
prefetch 
promise_clamped 
random 
register_destructor 
require 
require_mask 
return_second 
rewrite_buffer 
round 
rounding_halving_add 
rounding_mul_shift_right 
rounding_shift_left 
rounding_shift_right 
saturating_add 
saturating_sub 
saturating_cast 
scatter_gather 
select_mask 
shift_left 
shift_right 
signed_integer_overflow 
size_of_halide_buffer_t 
sorted_avg 
strict_float 
stringify 
undef 
unreachable 
unsafe_promise_clamped 
widen_right_add 
widen_right_mul 
widen_right_sub 
widening_add 
widening_mul 
widening_shift_left 
widening_shift_right 
widening_sub 
IntrinsicOpCount 

Definition at line 510 of file IR.h.

Member Function Documentation

◆ get_intrinsic_name()

static const char* Halide::Internal::Call::get_intrinsic_name ( IntrinsicOp  op)
static

Referenced by is_intrinsic().

◆ make() [1/5]

static Expr Halide::Internal::Call::make ( Type  type,
IntrinsicOp  op,
const std::vector< Expr > &  args,
CallType  call_type,
FunctionPtr  func = FunctionPtr(),
int  value_index = 0,
const Buffer<> &  image = Buffer<>(),
Parameter  param = Parameter() 
)
static

Referenced by make().

◆ make() [2/5]

static Expr Halide::Internal::Call::make ( Type  type,
const std::string &  name,
const std::vector< Expr > &  args,
CallType  call_type,
FunctionPtr  func = FunctionPtr(),
int  value_index = 0,
Buffer<>  image = Buffer<>(),
Parameter  param = Parameter() 
)
static

◆ make() [3/5]

static Expr Halide::Internal::Call::make ( const Function func,
const std::vector< Expr > &  args,
int  idx = 0 
)
static

Convenience constructor for calls to other halide functions.

◆ make() [4/5]

static Expr Halide::Internal::Call::make ( const Buffer<> &  image,
const std::vector< Expr > &  args 
)
inlinestatic

Convenience constructor for loads from concrete images.

Definition at line 669 of file IR.h.

References args, Image, image, make(), Halide::Buffer< T, Dims >::name(), and Halide::Buffer< T, Dims >::type().

◆ make() [5/5]

static Expr Halide::Internal::Call::make ( const Parameter param,
const std::vector< Expr > &  args 
)
inlinestatic

Convenience constructor for loads from images parameters.

Definition at line 674 of file IR.h.

References args, Image, make(), Halide::Internal::Parameter::name(), param, and Halide::Internal::Parameter::type().

◆ is_pure()

bool Halide::Internal::Call::is_pure ( ) const
inline

Check if a call node is pure within a pipeline, meaning that the same args always give the same result, and the calls can be reordered, duplicated, unified, etc without changing the meaning of anything.

Not transitive - doesn't guarantee the args themselves are pure. An example of a pure Call node is sqrt. If in doubt, don't mark a Call node as pure.

Definition at line 684 of file IR.h.

References call_type, Image, PureExtern, and PureIntrinsic.

◆ is_intrinsic() [1/3]

bool Halide::Internal::Call::is_intrinsic ( ) const
inline

◆ is_intrinsic() [2/3]

bool Halide::Internal::Call::is_intrinsic ( IntrinsicOp  op) const
inline

Definition at line 695 of file IR.h.

References get_intrinsic_name(), and is_intrinsic().

◆ is_intrinsic() [3/3]

bool Halide::Internal::Call::is_intrinsic ( std::initializer_list< IntrinsicOp intrinsics) const
inline

Definition at line 699 of file IR.h.

References is_intrinsic().

◆ is_tag()

bool Halide::Internal::Call::is_tag ( ) const
inline

Definition at line 708 of file IR.h.

References is_intrinsic(), likely, likely_if_innermost, and strict_float.

◆ as_intrinsic()

static const Call* Halide::Internal::Call::as_intrinsic ( const Expr e,
std::initializer_list< IntrinsicOp intrinsics 
)
inlinestatic

Returns a pointer to a call node if the expression is a call to one of the requested intrinsics.

Definition at line 714 of file IR.h.

References Halide::Internal::IRHandle::as().

Referenced by as_tag().

◆ as_tag()

static const Call* Halide::Internal::Call::as_tag ( const Expr e)
inlinestatic

Definition at line 725 of file IR.h.

References as_intrinsic(), likely, likely_if_innermost, and strict_float.

◆ is_extern()

bool Halide::Internal::Call::is_extern ( ) const
inline

Definition at line 729 of file IR.h.

References call_type, Extern, ExternCPlusPlus, and PureExtern.

Member Data Documentation

◆ ConstString

const typedef char* const Halide::Internal::Call::ConstString

Definition at line 501 of file IR.h.

◆ name

std::string Halide::Internal::Call::name

Definition at line 483 of file IR.h.

◆ args

std::vector<Expr> Halide::Internal::Call::args

Definition at line 484 of file IR.h.

Referenced by make().

◆ call_type

CallType Halide::Internal::Call::call_type

Definition at line 493 of file IR.h.

Referenced by Halide::SimdOpCheckTest::check_one(), is_extern(), is_intrinsic(), and is_pure().

◆ buffer_get_dimensions

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_dimensions
static

Definition at line 620 of file IR.h.

◆ buffer_get_min

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_min
static

Definition at line 621 of file IR.h.

◆ buffer_get_extent

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_extent
static

Definition at line 622 of file IR.h.

◆ buffer_get_stride

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_stride
static

Definition at line 623 of file IR.h.

◆ buffer_get_max

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_max
static

Definition at line 624 of file IR.h.

◆ buffer_get_host

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_host
static

Definition at line 625 of file IR.h.

◆ buffer_get_device

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_device
static

Definition at line 626 of file IR.h.

◆ buffer_get_device_interface

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_device_interface
static

Definition at line 627 of file IR.h.

◆ buffer_get_shape

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_shape
static

Definition at line 628 of file IR.h.

◆ buffer_get_host_dirty

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_host_dirty
static

Definition at line 629 of file IR.h.

◆ buffer_get_device_dirty

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_device_dirty
static

Definition at line 630 of file IR.h.

◆ buffer_get_type

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_get_type
static

Definition at line 631 of file IR.h.

◆ buffer_set_host_dirty

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_set_host_dirty
static

Definition at line 632 of file IR.h.

◆ buffer_set_device_dirty

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_set_device_dirty
static

Definition at line 633 of file IR.h.

◆ buffer_is_bounds_query

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_is_bounds_query
static

Definition at line 634 of file IR.h.

◆ buffer_init

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_init
static

Definition at line 635 of file IR.h.

◆ buffer_init_from_buffer

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_init_from_buffer
static

Definition at line 636 of file IR.h.

◆ buffer_crop

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_crop
static

Definition at line 637 of file IR.h.

◆ buffer_set_bounds

HALIDE_EXPORT ConstString Halide::Internal::Call::buffer_set_bounds
static

Definition at line 638 of file IR.h.

◆ trace

HALIDE_EXPORT ConstString Halide::Internal::Call::trace
static

Definition at line 639 of file IR.h.

◆ func

FunctionPtr Halide::Internal::Call::func

Definition at line 643 of file IR.h.

Referenced by Halide::SimdOpCheckTest::check_one().

◆ value_index

int Halide::Internal::Call::value_index

Definition at line 647 of file IR.h.

◆ image

Buffer Halide::Internal::Call::image

Definition at line 651 of file IR.h.

Referenced by make().

◆ param

Parameter Halide::Internal::Call::param

Definition at line 655 of file IR.h.

Referenced by make().

◆ _node_type

const IRNodeType Halide::Internal::Call::_node_type = IRNodeType::Call
static

Definition at line 735 of file IR.h.

Referenced by Halide::Internal::IRMatcher::Overflow::match().


The documentation for this struct was generated from the following file: