tvm
Public Member Functions | Protected Member Functions | List of all members
tvm::tir::usmp::algo::GreedyBase Class Referenceabstract

This is the base class for Greedy Algorithms where the sorting is specialized in the extended classes based on the greedy criteria. More...

#include <greedy.h>

Collaboration diagram for tvm::tir::usmp::algo::GreedyBase:

Public Member Functions

 GreedyBase ()
 
virtual Map< BufferInfo, PoolAllocationPlanMemory (const Array< BufferInfo > &buffer_info_arr)=0
 This function should be implemented by the extended classes to sort the BufferInfo objects based on a criteria and then calling PostSortAllocation. More...
 

Protected Member Functions

size_t round_up_to_byte_alignment (const size_t &non_aligned_byte_offset, const int &byte_alignment)
 Rounds up the offset to satisfy the alignement requirement. More...
 
bool IsValidPlacement (const PoolInfo &candidate_pool, const size_t &next_offset, const size_t &size_bytes)
 A helper function check whether a offset is valid given the constraints. More...
 
PoolInfo SelectPlacementPool (const BufferInfo &buf_info, const std::unordered_map< PoolInfo, size_t, ObjectPtrHash, ObjectPtrEqual > &pool_offsets)
 Selects a pool for placement in the given set of ordered pool candidates. More...
 
Map< BufferInfo, PoolAllocationPostSortAllocation (const std::vector< BufferInfo > &buffer_info_vec)
 This is the base allocation function that works on sorted BufferInfo objects based on the greedy heuristic. The sorting algorithm has to be called before calling this. More...
 

Detailed Description

This is the base class for Greedy Algorithms where the sorting is specialized in the extended classes based on the greedy criteria.

Constructor & Destructor Documentation

◆ GreedyBase()

tvm::tir::usmp::algo::GreedyBase::GreedyBase ( )
inline

Member Function Documentation

◆ IsValidPlacement()

bool tvm::tir::usmp::algo::GreedyBase::IsValidPlacement ( const PoolInfo candidate_pool,
const size_t &  next_offset,
const size_t &  size_bytes 
)
protected

A helper function check whether a offset is valid given the constraints.

◆ PlanMemory()

virtual Map<BufferInfo, PoolAllocation> tvm::tir::usmp::algo::GreedyBase::PlanMemory ( const Array< BufferInfo > &  buffer_info_arr)
pure virtual

This function should be implemented by the extended classes to sort the BufferInfo objects based on a criteria and then calling PostSortAllocation.

◆ PostSortAllocation()

Map<BufferInfo, PoolAllocation> tvm::tir::usmp::algo::GreedyBase::PostSortAllocation ( const std::vector< BufferInfo > &  buffer_info_vec)
protected

This is the base allocation function that works on sorted BufferInfo objects based on the greedy heuristic. The sorting algorithm has to be called before calling this.

◆ round_up_to_byte_alignment()

size_t tvm::tir::usmp::algo::GreedyBase::round_up_to_byte_alignment ( const size_t &  non_aligned_byte_offset,
const int &  byte_alignment 
)
protected

Rounds up the offset to satisfy the alignement requirement.

◆ SelectPlacementPool()

PoolInfo tvm::tir::usmp::algo::GreedyBase::SelectPlacementPool ( const BufferInfo buf_info,
const std::unordered_map< PoolInfo, size_t, ObjectPtrHash, ObjectPtrEqual > &  pool_offsets 
)
protected

Selects a pool for placement in the given set of ordered pool candidates.


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