Internal::ReductionDomain#

class ReductionDomain#

A reference-counted handle on a reduction domain, which is just a vector of ReductionVariable.

Public Functions

inline ReductionDomain()#

Construct a new nullptr reduction domain.

ReductionDomain(const std::vector<ReductionVariable> &domain)#

Construct a reduction domain that spans the outer product of all values of the given ReductionVariable in scanline order, with the start of the vector being innermost, and the end of the vector being outermost.

ReductionDomain(const std::vector<ReductionVariable> &domain, const Expr &predicate, bool frozen)#

Construct a reduction domain from deserialization.

ReductionDomain deep_copy() const#

Return a deep copy of this ReductionDomain.

inline bool defined() const#

Is this handle non-nullptr.

inline bool same_as(const ReductionDomain &other) const#

Tests for equality of reference.

Only one reduction domain is allowed per reduction function, and this is used to verify that

const std::vector<ReductionVariable> &domain() const#

Immutable access to the reduction variables.

void where(Expr predicate)#

Add predicate to the reduction domain.

See RDom::where for more details.

Expr predicate() const#

Return the predicate defined on this reduction domain.

void set_predicate(const Expr&)#

Set the predicate, replacing any previously set predicate.

std::vector<Expr> split_predicate() const#

Split predicate into vector of ANDs.

If there is no predicate (i.e. all iteration domain in this reduction domain is valid), this returns an empty vector.

void freeze()#

Mark RDom as frozen, which means it cannot accept new predicates.

An RDom is frozen once it is used in a Func’s update definition.

bool frozen() const#

Check if a RDom has been frozen.

If so, it is an error to add new predicates.

void accept(IRVisitor*) const#

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

void mutate(IRMutator*)#

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

struct Compare#

This lets you use a ReductionDomain as a key in a map of the form map<ReductionDomain, Foo, ReductionDomain::Compare>.