PandA-2024.02
|
Class managing ALAP and ASAP algorithms. More...
#include <ASLAP.hpp>
Public Types | |
enum | ALAP_method { ALAP_fast, ALAP_worst_case, ALAP_with_upper, ALAP_with_upper_minus_one, ALAP_with_partial_scheduling } |
Possible type of ALAP method currently implemented. More... | |
Public Member Functions | |
ASLAP (const HLS_managerConstRef hls_manager, const hlsRef HLS, const bool speculation, const CustomUnorderedSet< vertex > &operations, const ParameterConstRef parameters, unsigned int _ctrl_step_multiplier) | |
Constructor. More... | |
~ASLAP ()=default | |
Destructor. More... | |
void | print (std::ostream &os) const |
Function that prints the class ASLAP. More... | |
void | compute_ASAP (const ScheduleConstRef partial_schedule=ScheduleConstRef()) |
Function that computes the ASAP scheduling of the graph. More... | |
const ScheduleConstRef | CGetASAP () const |
Returns the ASAP vector of the vertices. More... | |
ScheduleRef | GetASAP () |
void | compute_ALAP (ALAP_method met, const ScheduleConstRef partial_schedule=ScheduleConstRef(), bool *feasible=nullptr, const ControlStep=ControlStep(0u)) |
Function that computes the ALAP scheduling of the graph. More... | |
const ScheduleConstRef | CGetALAP () const |
Returns the ALAP vector of the vertices. More... | |
const ScheduleRef | GetALAP () |
Return the ALAP (modifiable) More... | |
void | update_ALAP (const ControlStep maxc, bool *feasible=nullptr, const ScheduleConstRef partial_schedule=ScheduleConstRef()) |
Update the ALAP by using maxc as upper bound. More... | |
const OpGraphConstRef | CGetOpGraph () const |
Gets graph. More... | |
Private Member Functions | |
void | add_constraints_to_ALAP () |
Modify the ALAP scheduling taking into account also technology constraints. More... | |
void | add_constraints_to_ASAP () |
Modify the ASAP scheduling taking into account also technology constraints. More... | |
void | compute_ALAP_fast (bool *feasible=nullptr) |
Compute the standard ALAP scheduling with uncontrained resource. More... | |
void | compute_ALAP_LB () |
Compute the ALAP scheduling with uncontrained resources and with the minumum execution time. More... | |
void | compute_ALAP_worst_case () |
Compute ALAP using list based euristic to identify the total number of control steps. More... | |
ControlStep | get_min_csteps () const |
This method returns the minimum number of control steps to schedule the graph. More... | |
ControlStep | get_max_csteps () const |
This method returns the maximum number of control steps induced by the specification and by the technology constraints. More... | |
ControlStep | GetCycleLatency (const vertex operation, Allocation_MinMax minmax) const |
Return the number of cycles required to execute an operation. More... | |
Private Attributes | |
ScheduleRef | ASAP |
Array storing the ASAP values of the nodes in the graph. More... | |
ScheduleRef | ALAP |
Array storing the ALAP values of the nodes in the graph. More... | |
ControlStep | min_tot_csteps |
variable storing the minimum number of control steps required to schedule the graph. More... | |
ControlStep | max_tot_csteps |
variable storing the maximum number of control steps required to schedule the graph. More... | |
OpGraphConstRef | beh_graph |
the graph to be scheduled More... | |
std::deque< vertex > | levels |
constant variable storing the reference to the array of vertexes sorted by topological order associated with the SDG(it can be used also for SG). More... | |
bool | has_branching_blocks |
is true if the beh_graph has at least one branching block More... | |
const AllocationInformationConstRef | allocation_information |
The allocation data structure. More... | |
bool | speculation |
speculation More... | |
const double | clock_period |
The clock period. More... | |
int | debug_level |
debug level More... | |
unsigned int | ctrl_step_multiplier |
multiplier used to take into account chaining during asap/alap computation More... | |
const CustomUnorderedSet< vertex > & | operations |
relevant vertex for the aslap scheduling More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ASLAP &s) |
Friend definition of the << operator. More... | |
enum ASLAP::ALAP_method |
Possible type of ALAP method currently implemented.
Enumerator | |
---|---|
ALAP_fast | |
ALAP_worst_case | |
ALAP_with_upper | |
ALAP_with_upper_minus_one | |
ALAP_with_partial_scheduling |
ASLAP::ASLAP | ( | const HLS_managerConstRef | hls_manager, |
const hlsRef | HLS, | ||
const bool | speculation, | ||
const CustomUnorderedSet< vertex > & | operations, | ||
const ParameterConstRef | parameters, | ||
unsigned int | _ctrl_step_multiplier | ||
) |
Constructor.
hls_manager | is the HLS manager |
HLS | is the whole HLS data structure. |
speculation | tells if speculation could be performed |
beh_graph | is the graph on which asap and alap is computed. |
parameters | is the set of input parameters |
Definition at line 85 of file ASLAP.cpp.
References beh_graph, FunctionBehavior::FLSAODG, hls::functionId, GET_TYPE, has_branching_blocks, levels, FunctionBehavior::SG, speculation, TYPE_FOR, TYPE_IF, TYPE_SWITCH, and TYPE_WHILE.
Referenced by get_max_csteps().
|
default |
|
private |
Modify the ALAP scheduling taking into account also technology constraints.
ALL | is the allocation manager. |
ALAP_nip[i] contains the number of non immediate predecessor of node i with the same type of operation.
ALAP_p[i] contains the number of predecessor of node i with the same type of operation.
Definition at line 331 of file ASLAP.cpp.
References ALAP, allocation_information, beh_graph, OpGraph::CGetOpNodeInfo(), ctrl_step_multiplier, debug_level, DEBUG_LEVEL_VERY_PEDANTIC, Schedule::get_cstep(), GET_NAME, GetCycleLatency(), level, levels, max, max_tot_csteps, MIN, operations, PRINT_DBG_MEX, PRINT_DBG_STRING, R, vertex2obj< data_obj >::resize(), Schedule::set_execution(), STR, and lenet_tvm::target.
Referenced by update_ALAP().
|
private |
Modify the ASAP scheduling taking into account also technology constraints.
Currently this function does not correcty work when alternative paths are present.
ALL | is the allocation manager. |
ASAP_nip[i] contains the number of non immediate predecessor of node i with the same type of operation.
ASAP_p[i] contains the number of predecessor of node i with the same type of operation.
Definition at line 190 of file ASLAP.cpp.
References allocation_information, ASAP, beh_graph, OpGraph::CGetOpNodeInfo(), ctrl_step_multiplier, debug_level, DEBUG_LEVEL_VERY_PEDANTIC, Schedule::get_cstep(), GET_NAME, GetCycleLatency(), level, levels, max, MIN, min_tot_csteps, operations, PRINT_DBG_MEX, PRINT_DBG_STRING, vertex2obj< data_obj >::resize(), and Schedule::set_execution().
Referenced by compute_ASAP().
|
inline |
|
inline |
const OpGraphConstRef ASLAP::CGetOpGraph | ( | ) | const |
void ASLAP::compute_ALAP | ( | ALAP_method | met, |
const ScheduleConstRef | partial_schedule = ScheduleConstRef() , |
||
bool * | feasible = nullptr , |
||
const ControlStep | est_upper_bound = ControlStep(0u) |
||
) |
Function that computes the ALAP scheduling of the graph.
met | is the method adopted to compute the ALAP scheduling
|
partial_schedule | is a partial schedule that has to be considered |
feasible | is where feasibility of calculated ASAP & ALAP will be put; if used it must be setted initially to true |
est_upper_bound | is an upper estimation of the control steps (used by ). |
Definition at line 420 of file ASLAP.cpp.
References ALAP, ALAP_fast, ALAP_with_partial_scheduling, ALAP_with_upper, ALAP_with_upper_minus_one, ALAP_worst_case, Schedule::clear(), compute_ALAP_worst_case(), debug_level, DEBUG_LEVEL_VERY_PEDANTIC, max_tot_csteps, PRINT_DBG_MEX, Schedule::set_csteps(), THROW_ASSERT, THROW_ERROR, and update_ALAP().
Referenced by GetASAP().
|
private |
Compute the standard ALAP scheduling with uncontrained resource.
feasible | is where feasibility of calculated ASAP & ALAP will be put; if used it must be setted initially to true |
Definition at line 501 of file ASLAP.cpp.
References ALAP, ASAP, beh_graph, ctrl_step_multiplier, debug_level, DEBUG_LEVEL_PEDANTIC, from_strongtype_cast(), Schedule::get_cstep(), GET_NAME, GetCycleLatency(), Schedule::is_scheduled(), level, levels, max_tot_csteps, MIN, PRINT_DBG_MEX, vertex2obj< data_obj >::resize(), Schedule::set_execution(), STR, and lenet_tvm::target.
Referenced by update_ALAP().
|
private |
Compute the ALAP scheduling with uncontrained resources and with the minumum execution time.
Considering the minimum execution time is possible when it is already computed the max_tot_csteps. The standard ALAP algorithms should use the maximum execution time since it does not know the total number of control steps thus requiring a worst estimation of the ALAP time for each operation.
ALL | is the allocation manager. |
|
private |
Compute ALAP using list based euristic to identify the total number of control steps.
ALL | is the allocation manager. |
Definition at line 545 of file ASLAP.cpp.
References ALAP, allocation_information, beh_graph, ctrl_step_multiplier, Schedule::get_cstep(), GetCycleLatency(), AllocationInformation::initiation_time, level, levels, max, MAX, max_tot_csteps, operations, Schedule::set_execution(), and lenet_tvm::target.
Referenced by compute_ALAP().
void ASLAP::compute_ASAP | ( | const ScheduleConstRef | partial_schedule = ScheduleConstRef() | ) |
Function that computes the ASAP scheduling of the graph.
ALL | is the allocation manager. |
partial_schedule | is a partial schedule that has to be taken into account |
Definition at line 273 of file ASLAP.cpp.
References add_constraints_to_ASAP(), ASAP, beh_graph, Schedule::clear(), ctrl_step_multiplier, debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERBOSE, from_strongtype_cast(), Schedule::get_cstep(), GET_NAME, GetCycleLatency(), has_branching_blocks, Schedule::is_scheduled(), level, levels, MIN, min_tot_csteps, PRINT_DBG_MEX, vertex2obj< data_obj >::resize(), Schedule::set_csteps(), Schedule::set_execution(), STR, and WITH_CONSTRAINT.
|
inlineprivate |
This method returns the maximum number of control steps induced by the specification and by the technology constraints.
Definition at line 166 of file ASLAP.hpp.
References ASLAP(), GetCycleLatency(), max_tot_csteps, test_panda::parameters, and ~ASLAP().
|
inlineprivate |
This method returns the minimum number of control steps to schedule the graph.
Definition at line 156 of file ASLAP.hpp.
References min_tot_csteps.
|
inline |
Return the ALAP (modifiable)
Definition at line 277 of file ASLAP.hpp.
References ALAP, and update_ALAP().
|
inline |
Definition at line 240 of file ASLAP.hpp.
References ASAP, and compute_ALAP().
|
private |
Return the number of cycles required to execute an operation.
operation | is the operation |
minmax | specifies if the minimum or the maximum execution time must be returned |
Definition at line 601 of file ASLAP.cpp.
References allocation_information, beh_graph, clock_period, ctrl_step_multiplier, debug_level, DEBUG_LEVEL_PEDANTIC, AllocationInformation::execution_time, GET_NAME, PRINT_DBG_MEX, and STR.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), compute_ALAP_fast(), compute_ALAP_worst_case(), compute_ASAP(), and get_max_csteps().
void ASLAP::print | ( | std::ostream & | os | ) | const |
Function that prints the class ASLAP.
os | is the stream where the class has to be printed |
Definition at line 137 of file ASLAP.cpp.
References ALAP, ASAP, Schedule::num_scheduled(), and Schedule::print().
void ASLAP::update_ALAP | ( | const ControlStep | maxc, |
bool * | feasible = nullptr , |
||
const ScheduleConstRef | partial_schedule = ScheduleConstRef() |
||
) |
Update the ALAP by using maxc as upper bound.
This method modifies the maximum number of control steps and updates the ALAP scheduling if it possible.
maxc | is the maximum value of the control steps. |
feasible | is where feasibility of calculated ASAP & ALAP will be put; if used it must be setted initially to true |
partial_schedule | is a partial schedule that has to be taken into account |
Definition at line 475 of file ASLAP.cpp.
References add_constraints_to_ALAP(), ALAP, Schedule::clear(), compute_ALAP_fast(), debug_level, DEBUG_LEVEL_PEDANTIC, has_branching_blocks, level, levels, max_tot_csteps, PRINT_DBG_MEX, Schedule::set_execution(), and WITH_CONSTRAINT.
Referenced by compute_ALAP(), and GetALAP().
|
friend |
|
private |
Array storing the ALAP values of the nodes in the graph.
Definition at line 82 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), CGetALAP(), compute_ALAP(), compute_ALAP_fast(), compute_ALAP_worst_case(), GetALAP(), print(), and update_ALAP().
|
private |
The allocation data structure.
Definition at line 101 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), compute_ALAP_worst_case(), and GetCycleLatency().
|
private |
Array storing the ASAP values of the nodes in the graph.
Definition at line 79 of file ASLAP.hpp.
Referenced by add_constraints_to_ASAP(), CGetASAP(), compute_ALAP_fast(), compute_ASAP(), GetASAP(), and print().
|
private |
the graph to be scheduled
Definition at line 91 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), ASLAP(), CGetOpGraph(), compute_ALAP_fast(), compute_ALAP_worst_case(), compute_ASAP(), and GetCycleLatency().
|
private |
|
private |
multiplier used to take into account chaining during asap/alap computation
Definition at line 113 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), compute_ALAP_fast(), compute_ALAP_worst_case(), compute_ASAP(), and GetCycleLatency().
|
private |
debug level
Definition at line 110 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), compute_ALAP(), compute_ALAP_fast(), compute_ASAP(), GetCycleLatency(), and update_ALAP().
|
private |
is true if the beh_graph has at least one branching block
Definition at line 98 of file ASLAP.hpp.
Referenced by ASLAP(), compute_ASAP(), and update_ALAP().
|
private |
constant variable storing the reference to the array of vertexes sorted by topological order associated with the SDG(it can be used also for SG).
Definition at line 95 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), ASLAP(), compute_ALAP_fast(), compute_ALAP_worst_case(), compute_ASAP(), and update_ALAP().
|
private |
variable storing the maximum number of control steps required to schedule the graph.
Definition at line 88 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), compute_ALAP(), compute_ALAP_fast(), compute_ALAP_worst_case(), get_max_csteps(), and update_ALAP().
|
private |
variable storing the minimum number of control steps required to schedule the graph.
Definition at line 85 of file ASLAP.hpp.
Referenced by add_constraints_to_ASAP(), compute_ASAP(), and get_min_csteps().
|
private |
relevant vertex for the aslap scheduling
Definition at line 116 of file ASLAP.hpp.
Referenced by add_constraints_to_ALAP(), add_constraints_to_ASAP(), and compute_ALAP_worst_case().
|
private |