Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Public Attributes | List of all members
Halide::Internal::RegionCosts Struct Reference

Auto scheduling component which is used to assign costs for computing a region of a function or one of its stages. More...

`#include <RegionCosts.h>`

## Public Member Functions
Cost | stage_region_cost (const std::string &func, int stage, const DimBounds &bounds, const std::set< std::string > &inlines=std::set< std::string >())
| Return the cost of producing a region (specified by 'bounds') of a function stage (specified by 'func' and 'stage'). More...
Cost | stage_region_cost (const std::string &func, int stage, const Box &region, const std::set< std::string > &inlines=std::set< std::string >())
| Return the cost of producing a region of a function stage (specified by 'func' and 'stage'). More...
Cost | region_cost (const std::string &func, const Box &region, const std::set< std::string > &inlines=std::set< std::string >())
| Return the cost of producing a region of function 'func'. More...
Cost | region_cost (const std::map< std::string, Box > &regions, const std::set< std::string > &inlines=std::set< std::string >())
| Same as region_cost above but this computes the total cost of many function regions. More...
Cost | get_func_stage_cost (const Function &f, int stage, const std::set< std::string > &inlines=std::set< std::string >()) const
| Compute the cost of producing a single value by one stage of 'f'. More...
std::vector< Cost > | get_func_cost (const Function &f, const std::set< std::string > &inlines=std::set< std::string >())
| Compute the cost of producing a single value by all stages of 'f'. More...
std::map< std::string, Expr > | stage_detailed_load_costs (const std::string &func, int stage, DimBounds &bounds, const std::set< std::string > &inlines=std::set< std::string >())
| Computes the memory costs of computing a region (specified by 'bounds') of a function stage (specified by 'func' and 'stage'). More...
std::map< std::string, Expr > | stage_detailed_load_costs (const std::string &func, int stage, const std::set< std::string > &inlines=std::set< std::string >())
| Return a map containing the costs incurred to access each of the functions required to produce a single value of a function stage. More...
std::map< std::string, Expr > | detailed_load_costs (const std::string &func, const Box &region, const std::set< std::string > &inlines=std::set< std::string >())
| Same as stage_detailed_load_costs above but this computes the cost of a region of 'func'. More...
std::map< std::string, Expr > | detailed_load_costs (const std::map< std::string, Box > &regions, const std::set< std::string > &inlines=std::set< std::string >())
| Same as detailed_load_costs above but this computes the cost of many function regions and aggregates them. More...
Expr | region_size (const std::string &func, const Box &region)
| Return the size of the region of 'func' in bytes. More...
Expr | region_footprint (const std::map< std::string, Box > &regions, const std::set< std::string > &inlined=std::set< std::string >())
| Return the size of the peak amount of memory allocated in bytes. More...
Expr | input_region_size (const std::string &input, const Box &region)
| Return the size of the input region in bytes. More...
Expr | input_region_size (const std::map< std::string, Box > &input_regions)
| Return the total size of the many input regions in bytes. More...
void | disp_func_costs ()
| Display the cost of each function in the pipeline. More...
| RegionCosts (const std::map< std::string, Function > &env, const std::vector< std::string > &order)
| Construct a region cost object for the pipeline. More...

## Public Attributes
std::map< std::string, Function > | env
| An environment map which contains all functions in the pipeline. More...
std::vector< std::string > | order
| Realization order of functions in the pipeline. More...
std::map< std::string, std::vector< Cost > > | func_cost
| A map containing the cost of computing a value in each stage of a function. More...
std::map< std::string, Type > | inputs
| A map containing the types of all image inputs in the pipeline. More...
Scope< Interval > | input_estimates
| A scope containing the estimated min/extent values of ImageParams in the pipeline. More...

## Detailed Description

Auto scheduling component which is used to assign costs for computing a region of a function or one of its stages.

Definition at line 48 of file RegionCosts.h.

## Constructor & Destructor Documentation

## ◆ RegionCosts()

Halide::Internal::RegionCosts::RegionCosts | ( | const std::map< std::string, Function > & | env,
|  | const std::vector< std::string > & | order
| ) |  |

Construct a region cost object for the pipeline.

'env' is a map of all functions in the pipeline. 'order' is the realization order of functions in the pipeline. The first function to be realized comes first.

## Member Function Documentation

## ◆ stage_region_cost() [1/2]

Cost Halide::Internal::RegionCosts::stage_region_cost | ( | const std::string & | func,
|  | int | stage,
|  | const DimBounds & | bounds,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Return the cost of producing a region (specified by 'bounds') of a function stage (specified by 'func' and 'stage').

'inlines' specifies names of all the inlined functions.

## ◆ stage_region_cost() [2/2]

Cost Halide::Internal::RegionCosts::stage_region_cost | ( | const std::string & | func,
|  | int | stage,
|  | const Box & | region,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Return the cost of producing a region of a function stage (specified by 'func' and 'stage').

'inlines' specifies names of all the inlined functions.

## ◆ region_cost() [1/2]

Cost Halide::Internal::RegionCosts::region_cost | ( | const std::string & | func,
|  | const Box & | region,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Return the cost of producing a region of function 'func'.

This adds up the costs of all stages of 'func' required to produce the region. 'inlines' specifies names of all the inlined functions.

## ◆ region_cost() [2/2]

Cost Halide::Internal::RegionCosts::region_cost | ( | const std::map< std::string, Box > & | regions,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Same as region_cost above but this computes the total cost of many function regions.

## ◆ get_func_stage_cost()

Cost Halide::Internal::RegionCosts::get_func_stage_cost | ( | const Function & | f,
|  | int | stage,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  | const

Compute the cost of producing a single value by one stage of 'f'.

'inlines' specifies names of all the inlined functions.

## ◆ get_func_cost()

std::vector< Cost > Halide::Internal::RegionCosts::get_func_cost | ( | const Function & | f,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Compute the cost of producing a single value by all stages of 'f'.

'inlines' specifies names of all the inlined functions. This returns a vector of costs. Each entry in the vector corresponds to a stage in 'f'.

## ◆ stage_detailed_load_costs() [1/2]

std::map< std::string, Expr > Halide::Internal::RegionCosts::stage_detailed_load_costs | ( | const std::string & | func,
|  | int | stage,
|  | DimBounds & | bounds,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Computes the memory costs of computing a region (specified by 'bounds') of a function stage (specified by 'func' and 'stage').

This returns a map containing the costs incurred to access each of the functions required to produce 'func'.

## ◆ stage_detailed_load_costs() [2/2]

std::map< std::string, Expr > Halide::Internal::RegionCosts::stage_detailed_load_costs | ( | const std::string & | func,
|  | int | stage,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Return a map containing the costs incurred to access each of the functions required to produce a single value of a function stage.

## ◆ detailed_load_costs() [1/2]

std::map< std::string, Expr > Halide::Internal::RegionCosts::detailed_load_costs | ( | const std::string & | func,
|  | const Box & | region,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Same as stage_detailed_load_costs above but this computes the cost of a region of 'func'.

## ◆ detailed_load_costs() [2/2]

std::map< std::string, Expr > Halide::Internal::RegionCosts::detailed_load_costs | ( | const std::map< std::string, Box > & | regions,
|  | const std::set< std::string > & | inlines = `std::set< std::string >()`
| ) |  |

Same as detailed_load_costs above but this computes the cost of many function regions and aggregates them.

## ◆ region_size()

Expr Halide::Internal::RegionCosts::region_size | ( | const std::string & | func,
|  | const Box & | region
| ) |  |

Return the size of the region of 'func' in bytes.

## ◆ region_footprint()

Expr Halide::Internal::RegionCosts::region_footprint | ( | const std::map< std::string, Box > & | regions,
|  | const std::set< std::string > & | inlined = `std::set< std::string >()`
| ) |  |

Return the size of the peak amount of memory allocated in bytes.

This takes the realization (topological) order of the function regions and the early free mechanism into account while computing the peak footprint.

## ◆ input_region_size() [1/2]

Expr Halide::Internal::RegionCosts::input_region_size | ( | const std::string & | input,
|  | const Box & | region
| ) |  |

Return the size of the input region in bytes.

## ◆ input_region_size() [2/2]

Expr Halide::Internal::RegionCosts::input_region_size | ( | const std::map< std::string, Box > & | input_regions | ) |

Return the total size of the many input regions in bytes.

## ◆ disp_func_costs()

void Halide::Internal::RegionCosts::disp_func_costs | ( |  | ) |

Display the cost of each function in the pipeline.

## Member Data Documentation

## ◆ env

std::map<std::string, Function> Halide::Internal::RegionCosts::env

An environment map which contains all functions in the pipeline.

Definition at line 50 of file RegionCosts.h.

## ◆ order

std::vector<std::string> Halide::Internal::RegionCosts::order

Realization order of functions in the pipeline.

The first function to be realized comes first.

Definition at line 53 of file RegionCosts.h.

## ◆ func_cost

std::map<std::string, std::vector<Cost> > Halide::Internal::RegionCosts::func_cost

A map containing the cost of computing a value in each stage of a function.

The number of entries in the vector is equal to the number of stages in the function.

Definition at line 57 of file RegionCosts.h.

## ◆ inputs

std::map<std::string, Type> Halide::Internal::RegionCosts::inputs

A map containing the types of all image inputs in the pipeline.

Definition at line 59 of file RegionCosts.h.

## ◆ input_estimates

Scope<Interval> Halide::Internal::RegionCosts::input_estimates

A scope containing the estimated min/extent values of ImageParams in the pipeline.

Definition at line 62 of file RegionCosts.h.

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

- src/RegionCosts.h