Halide
Halide::Internal::Definition Class Reference

A Function definition which can either represent a init or an update definition. More...

#include <Definition.h>

Public Member Functions

 Definition (const IntrusivePtr< DefinitionContents > &)
 Construct a Definition from an existing DefinitionContents pointer. More...
 
 Definition (const std::vector< Expr > &args, const std::vector< Expr > &values, const ReductionDomain &rdom, bool is_init)
 Construct a Definition with the supplied args, values, and reduction domain. More...
 
 Definition ()
 Construct an undefined Definition object. More...
 
Definition get_copy () const
 Return a copy of this Definition. More...
 
bool same_as (const Definition &other) const
 Equality of identity. More...
 
bool defined () const
 Definition objects are nullable. More...
 
bool is_init () const
 Is this an init definition; otherwise it's an update definition. More...
 
void accept (IRVisitor *) const
 Pass an IRVisitor through to all Exprs referenced in the definition. More...
 
void mutate (IRMutator *)
 Pass an IRMutator through to all Exprs referenced in the definition. More...
 
const std::vector< Expr > & args () const
 Get the default (no-specialization) arguments (left-hand-side) of the definition. More...
 
std::vector< Expr > & args ()
 
const std::vector< Expr > & values () const
 Get the default (no-specialization) right-hand-side of the definition. More...
 
std::vector< Expr > & values ()
 
const Exprpredicate () const
 Get the predicate on the definition. More...
 
Exprpredicate ()
 
std::vector< Exprsplit_predicate () const
 Split predicate into vector of ANDs. More...
 
const StageScheduleschedule () const
 Get the default (no-specialization) stage-specific schedule associated with this definition. More...
 
StageScheduleschedule ()
 
const std::vector< Specialization > & specializations () const
 You may create several specialized versions of a func with different stage-specific schedules. More...
 
std::vector< Specialization > & specializations ()
 
const Specializationadd_specialization (Expr condition)
 
std::string source_location () const
 Attempt to get the source file and line where this definition was made using DWARF introspection. More...
 

Detailed Description

A Function definition which can either represent a init or an update definition.

A function may have different definitions due to specialization, which are stored in 'specializations' (Not possible from the front-end, but some scheduling directives may potentially cause this divergence to occur). Although init definition may have multiple values (RHS) per specialization, it must have the same LHS (i.e. same pure dimension variables). The update definition, on the other hand, may have different LHS/RHS per specialization. Note that, while the Expr in LHS/RHS may be different across specializations, they must have the same number of dimensions and the same pure dimensions.

Definition at line 38 of file Definition.h.

Constructor & Destructor Documentation

◆ Definition() [1/3]

Halide::Internal::Definition::Definition ( const IntrusivePtr< DefinitionContents > &  )
explicit

Construct a Definition from an existing DefinitionContents pointer.

Must be non-null

◆ Definition() [2/3]

Halide::Internal::Definition::Definition ( const std::vector< Expr > &  args,
const std::vector< Expr > &  values,
const ReductionDomain rdom,
bool  is_init 
)

Construct a Definition with the supplied args, values, and reduction domain.

◆ Definition() [3/3]

Halide::Internal::Definition::Definition ( )

Construct an undefined Definition object.

Member Function Documentation

◆ get_copy()

Definition Halide::Internal::Definition::get_copy ( ) const

Return a copy of this Definition.

◆ same_as()

bool Halide::Internal::Definition::same_as ( const Definition other) const
inline

Equality of identity.

Definition at line 57 of file Definition.h.

References Halide::Internal::IntrusivePtr< T >::same_as().

◆ defined()

bool Halide::Internal::Definition::defined ( ) const

Definition objects are nullable.

Does this definition exist?

Referenced by Halide::Stage::Stage().

◆ is_init()

bool Halide::Internal::Definition::is_init ( ) const

Is this an init definition; otherwise it's an update definition.

◆ accept()

void Halide::Internal::Definition::accept ( IRVisitor ) const

Pass an IRVisitor through to all Exprs referenced in the definition.

◆ mutate()

void Halide::Internal::Definition::mutate ( IRMutator )

Pass an IRMutator through to all Exprs referenced in the definition.

◆ args() [1/2]

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

Get the default (no-specialization) arguments (left-hand-side) of the definition.

Referenced by Halide::Stage::Stage().

◆ args() [2/2]

std::vector<Expr>& Halide::Internal::Definition::args ( )

◆ values() [1/2]

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

Get the default (no-specialization) right-hand-side of the definition.

◆ values() [2/2]

std::vector<Expr>& Halide::Internal::Definition::values ( )

◆ predicate() [1/2]

const Expr& Halide::Internal::Definition::predicate ( ) const

Get the predicate on the definition.

◆ predicate() [2/2]

Expr& Halide::Internal::Definition::predicate ( )

◆ split_predicate()

std::vector<Expr> Halide::Internal::Definition::split_predicate ( ) const

Split predicate into vector of ANDs.

If there is no predicate (i.e. this definition is always valid), this returns an empty vector.

◆ schedule() [1/2]

const StageSchedule& Halide::Internal::Definition::schedule ( ) const

Get the default (no-specialization) stage-specific schedule associated with this definition.

Referenced by Halide::Stage::get_schedule().

◆ schedule() [2/2]

StageSchedule& Halide::Internal::Definition::schedule ( )

◆ specializations() [1/2]

const std::vector<Specialization>& Halide::Internal::Definition::specializations ( ) const

You may create several specialized versions of a func with different stage-specific schedules.

They trigger when the condition is true. See Func::specialize

◆ specializations() [2/2]

std::vector<Specialization>& Halide::Internal::Definition::specializations ( )

◆ add_specialization()

const Specialization& Halide::Internal::Definition::add_specialization ( Expr  condition)

◆ source_location()

std::string Halide::Internal::Definition::source_location ( ) const

Attempt to get the source file and line where this definition was made using DWARF introspection.

Returns an empty string if no debug symbols were found or the debug symbols were not understood. Works on OS X and Linux only.


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