Halide 22.0.0 Halide compiler and libraries

Classes | Public Member Functions | List of all members
Halide::Internal::ReductionDomain Class Reference

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

`#include <Reduction.h>`

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

## Public Member Functions
| ReductionDomain ()
| Construct a new nullptr reduction domain. More...
| 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. More...
| ReductionDomain (const std::vector< ReductionVariable > &domain, const Expr &predicate, bool frozen)
| Construct a reduction domain from deserialization. More...
ReductionDomain | deep_copy () const
| Return a deep copy of this ReductionDomain. More...
bool | defined () const
| Is this handle non-nullptr. More...
bool | same_as (const ReductionDomain &other) const
| Tests for equality of reference. More...
const std::vector< ReductionVariable > & | domain () const
| Immutable access to the reduction variables. More...
void | where (Expr predicate)
| Add predicate to the reduction domain. More...
Expr | predicate () const
| Return the predicate defined on this reduction domain. More...
void | set_predicate (const Expr &)
| Set the predicate, replacing any previously set predicate. More...
std::vector< Expr > | split_predicate () const
| Split predicate into vector of ANDs. More...
void | freeze ()
| Mark RDom as frozen, which means it cannot accept new predicates. More...
bool | frozen () const
| Check if a RDom has been frozen. More...
void | accept (IRVisitor *) const
| Pass an IRVisitor through to all Exprs referenced in the ReductionDomain. More...
void | mutate (IRMutator *)
| Pass an IRMutator through to all Exprs referenced in the ReductionDomain. More...

## Detailed Description

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

Definition at line 38 of file Reduction.h.

## Constructor & Destructor Documentation

## ◆ ReductionDomain() [1/3]

Halide::Internal::ReductionDomain::ReductionDomain | ( |  | ) |
| inline

Construct a new nullptr reduction domain.

Definition at line 52 of file Reduction.h.

## ◆ ReductionDomain() [2/3]

Halide::Internal::ReductionDomain::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() [3/3]

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

Construct a reduction domain from deserialization.

## Member Function Documentation

## ◆ deep_copy()

ReductionDomain Halide::Internal::ReductionDomain::deep_copy | ( |  | ) | const

Return a deep copy of this ReductionDomain.

## ◆ defined()

bool Halide::Internal::ReductionDomain::defined | ( |  | ) | const
| inline

Is this handle non-nullptr.

Definition at line 69 of file Reduction.h.

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

Referenced by Halide::RDom::defined().

## ◆ same_as()

bool Halide::Internal::ReductionDomain::same_as | ( | const ReductionDomain & | other | ) | const
| inline

Tests for equality of reference.

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

Definition at line 76 of file Reduction.h.

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

Referenced by Halide::RDom::same_as().

## ◆ domain()

const std::vector< ReductionVariable > & Halide::Internal::ReductionDomain::domain | ( |  | ) | const

Immutable access to the reduction variables.

## ◆ where()

void Halide::Internal::ReductionDomain::where | ( | Expr | predicate | ) |

Add predicate to the reduction domain.

See RDom::where for more details.

## ◆ predicate()

Expr Halide::Internal::ReductionDomain::predicate | ( |  | ) | const

Return the predicate defined on this reduction domain.

## ◆ set_predicate()

void Halide::Internal::ReductionDomain::set_predicate | ( | const Expr & |  | ) |

Set the predicate, replacing any previously set predicate.

## ◆ split_predicate()

std::vector< Expr > Halide::Internal::ReductionDomain::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.

## ◆ freeze()

void Halide::Internal::ReductionDomain::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.

## ◆ frozen()

bool Halide::Internal::ReductionDomain::frozen | ( |  | ) | const

Check if a RDom has been frozen.

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

## ◆ accept()

void Halide::Internal::ReductionDomain::accept | ( | IRVisitor * |  | ) | const

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

## ◆ mutate()

void Halide::Internal::ReductionDomain::mutate | ( | IRMutator * |  | ) |

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

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

- src/Reduction.h