Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
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.
 
 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 (bool is_init, const Expr &predicate, const std::vector< Expr > &args, const std::vector< Expr > &values, const StageSchedule &schedule, const std::vector< Specialization > &specializations)
 Construct a Definition with deserialized data.
 
 Definition ()
 Construct an undefined Definition object.
 
Definition get_copy () const
 Return a copy of this Definition.
 
bool same_as (const Definition &other) const
 Equality of identity.
 
bool defined () const
 Definition objects are nullable.
 
bool is_init () const
 Is this an init definition; otherwise it's an update definition.
 
void accept (IRVisitor *) const
 Pass an IRVisitor through to all Exprs referenced in the definition.
 
void mutate (IRMutator *)
 Pass an IRMutator through to all Exprs referenced in the definition.
 
const std::vector< Expr > & args () const
 Get the default (no-specialization) arguments (left-hand-side) of the definition.
 
std::vector< Expr > & args ()
 
const std::vector< Expr > & values () const
 Get the default (no-specialization) right-hand-side of the definition.
 
std::vector< Expr > & values ()
 
const Exprpredicate () const
 Get the predicate on the definition.
 
Exprpredicate ()
 
std::vector< Exprsplit_predicate () const
 Split predicate into vector of ANDs.
 
const StageScheduleschedule () const
 Get the default (no-specialization) stage-specific schedule associated with this definition.
 
StageScheduleschedule ()
 
const std::vector< Specialization > & specializations () const
 You may create several specialized versions of a func with different stage-specific schedules.
 
std::vector< Specialization > & specializations ()
 
const Specializationadd_specialization (Expr condition)
 

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/4]

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

Construct a Definition from an existing DefinitionContents pointer.

Must be non-null

◆ Definition() [2/4]

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/4]

Halide::Internal::Definition::Definition ( bool is_init,
const Expr & predicate,
const std::vector< Expr > & args,
const std::vector< Expr > & values,
const StageSchedule & schedule,
const std::vector< Specialization > & specializations )

Construct a Definition with deserialized data.

◆ Definition() [4/4]

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

Warning: Any Vars in the Exprs are not qualified with the Func name, so the Exprs may contain names which collide with names provided by unique_name.

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.

Warning: Any Vars in the Exprs are not qualified with the Func name, so the Exprs may contain names which collide with names provided by unique_name.

◆ 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::SimdOpCheckTest::check_one(), and 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)

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