Halide
Halide::Internal::Dimension Class Reference

#include <Dimension.h>

Public Member Functions

Expr min () const
 Get an expression representing the minimum coordinates of this image parameter in the given dimension. More...
 
Expr extent () const
 Get an expression representing the extent of this image parameter in the given dimension. More...
 
Expr max () const
 Get an expression representing the maximum coordinates of this image parameter in the given dimension. More...
 
Expr stride () const
 Get an expression representing the stride of this image in the given dimension. More...
 
Dimension set_min (Expr min)
 Set the min in a given dimension to equal the given expression. More...
 
Dimension set_extent (Expr extent)
 Set the extent in a given dimension to equal the given expression. More...
 
Dimension set_stride (Expr stride)
 Set the stride in a given dimension to equal the given value. More...
 
Dimension set_bounds (Expr min, Expr extent)
 Set the min and extent in one call. More...
 
Dimension set_estimate (Expr min, Expr extent)
 Set the min and extent estimates in one call. More...
 
Dimension set_bounds_estimate (Expr min, Expr extent)
 
Expr min_estimate () const
 
Expr extent_estimate () const
 
Dimension dim (int i)
 Get a different dimension of the same buffer. More...
 
const Dimension dim (int i) const
 

Detailed Description

Definition at line 16 of file Dimension.h.

Member Function Documentation

◆ min()

Expr Halide::Internal::Dimension::min ( ) const

Get an expression representing the minimum coordinates of this image parameter in the given dimension.

Referenced by set_bounds_estimate().

◆ extent()

Expr Halide::Internal::Dimension::extent ( ) const

Get an expression representing the extent of this image parameter in the given dimension.

Referenced by set_bounds_estimate().

◆ max()

Expr Halide::Internal::Dimension::max ( ) const

Get an expression representing the maximum coordinates of this image parameter in the given dimension.

◆ stride()

Expr Halide::Internal::Dimension::stride ( ) const

Get an expression representing the stride of this image in the given dimension.

◆ set_min()

Dimension Halide::Internal::Dimension::set_min ( Expr  min)

Set the min in a given dimension to equal the given expression.

Setting the mins to zero may simplify some addressing math.

◆ set_extent()

Dimension Halide::Internal::Dimension::set_extent ( Expr  extent)

Set the extent in a given dimension to equal the given expression.

Images passed in that fail this check will generate a runtime error. Returns a reference to the ImageParam so that these calls may be chained.

This may help the compiler generate better code. E.g:

im.dim(0).set_extent(100);

tells the compiler that dimension zero must be of extent 100, which may result in simplification of boundary checks. The value can be an arbitrary expression:

im.dim(0).set_extent(im.dim(1).extent());

declares that im is a square image (of unknown size), whereas:

im.dim(0).set_extent((im.dim(0).extent()/32)*32);

tells the compiler that the extent is a multiple of 32.

◆ set_stride()

Dimension Halide::Internal::Dimension::set_stride ( Expr  stride)

Set the stride in a given dimension to equal the given value.

This is particularly helpful to set when vectorizing. Known strides for the vectorized dimension generate better code.

◆ set_bounds()

Dimension Halide::Internal::Dimension::set_bounds ( Expr  min,
Expr  extent 
)

Set the min and extent in one call.

◆ set_estimate()

Dimension Halide::Internal::Dimension::set_estimate ( Expr  min,
Expr  extent 
)

Set the min and extent estimates in one call.

These values are only used by the auto-scheduler and/or the RunGen tool/

Referenced by set_bounds_estimate().

◆ set_bounds_estimate()

Dimension Halide::Internal::Dimension::set_bounds_estimate ( Expr  min,
Expr  extent 
)
inline

Definition at line 76 of file Dimension.h.

References extent(), min(), and set_estimate().

◆ min_estimate()

Expr Halide::Internal::Dimension::min_estimate ( ) const

◆ extent_estimate()

Expr Halide::Internal::Dimension::extent_estimate ( ) const

◆ dim() [1/2]

Dimension Halide::Internal::Dimension::dim ( int  i)

Get a different dimension of the same buffer.

◆ dim() [2/2]

const Dimension Halide::Internal::Dimension::dim ( int  i) const

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