Internal::FunctionPtr#

struct FunctionPtr#

A possibly-weak pointer to a Halide function.

Take care to follow the rules mentioned above. Preserves weakness/strength on copy.

Note that Function objects are always strong pointers to Halide functions.

Public Functions

inline FunctionGroup *group() const#

Get a pointer to the group this Function belongs to.

FunctionContents *get() const#

Get the opaque FunctionContents object this pointer refers to.

Wrap it in a Function to do anything interesting with it.

inline void weaken()#

Convert from a strong reference to a weak reference.

Does nothing if the pointer is undefined, or if the reference is already weak.

inline void strengthen()#

Convert from a weak reference to a strong reference.

Does nothing if the pointer is undefined, or if the reference is already strong.

inline bool defined() const#

Check if the reference is defined.

inline bool same_as(const FunctionPtr &other) const#

Check if two FunctionPtrs refer to the same Function, resolving through global-wrapper links (so a following pointer to a Func and a direct pointer to its wrapper are “the same”).

inline bool operator<(const FunctionPtr &other) const#

Pointer comparison, for using FunctionPtrs as keys in maps and sets.

Orders by the resolved Func (following global-wrapper links), matching same_as.

Public Members

IntrusivePtr<FunctionGroup> strong#

A strong and weak pointer to the group.

Only one of these should be non-zero.

int idx = 0#

The index of the function within the group.

bool follow_global_wrappers = false#

Whether get() follows global-wrapper links (created by Func::in()).

Set on Call nodes so that a call to a Func resolves to that Func’s global wrapper, as if every caller had been rewritten; left false on Func handles (so they still refer to the Func itself) and on a wrapper’s own call to the Func it wraps. See FunctionContents::global_wrapper.