PandA-2024.02
schedule.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
45 #ifndef SCHEDULE_HPP
46 #define SCHEDULE_HPP
47 
49 #include "graph.hpp"
50 
52 #include <iosfwd>
53 
55 #include "refcount.hpp"
56 #include "strong_typedef.hpp"
57 
59 REF_FORWARD_DECL(behavioral_manager);
60 UINT_STRONG_TYPEDEF(ControlStep);
62 #ifdef NDEBUG
63 #define ControlStep(value) value
64 #endif
67 class HLS_manager;
68 class OpVertexSet;
77 
78 #include "custom_map.hpp"
79 #include "custom_set.hpp"
80 #include "graph.hpp"
81 #include "hash_helper.hpp"
82 #include <iosfwd>
83 
89 struct AbsControlStep : std::pair<unsigned int, ControlStep>
90 {
91  public:
93  static const ControlStep UNKNOWN;
94 
99 
105  AbsControlStep(const unsigned int basic_block_index, const ControlStep control_step);
106 
112  bool operator<(const AbsControlStep& other) const;
113 };
114 
118 class Schedule
119 {
120  private:
121  friend class parametric_list_based;
122  friend class AllocationInformation;
123 
126 
129 
132 
135 
137  const unsigned int function_index;
138 
140  ControlStep tot_csteps;
141 
145 
148 
151 
155 
159 
163 
167 
169  std::map<vertex, double> op_slack;
170 
173 
176 
178  const int debug_level;
179 
186  double GetReadyTime(const unsigned int tree_node_index, const unsigned int basic_block_index) const;
187 
193  double GetBBEndingTime(const unsigned int basic_block_index) const;
194 
195  public:
199  Schedule(const HLS_managerConstRef hls_manager, const unsigned int function_index, const OpGraphConstRef op_graph,
200  const ParameterConstRef parameters);
201 
205  ~Schedule();
206 
210  void Initialize();
211 
216  ControlStep get_csteps() const
217  {
218  return tot_csteps;
219  }
220 
225  void set_csteps(ControlStep cs)
226  {
227  tot_csteps = cs;
228  }
229 
233  void print(fu_bindingRef Rfu = fu_bindingRef()) const;
234 
239  void WriteDot(const std::string& file_name, OpGraphConstRef sub_op_graph = OpGraphConstRef(),
240  OpVertexSet* opSet = nullptr) const;
241 
246  {
247  spec = spec_map;
248  }
249 
254  {
255  return spec;
256  }
257 
263  void set_execution(const vertex& op, ControlStep c_step);
264 
270  void set_execution_end(const vertex& op, ControlStep c_step_end);
271 
275  bool is_scheduled(const vertex& op) const;
276 
280  bool is_scheduled(const unsigned int statement_index) const;
281 
287  AbsControlStep get_cstep(const vertex& op) const;
288 
294  AbsControlStep get_cstep(const unsigned int index) const;
295 
301  AbsControlStep get_cstep_end(const vertex& op) const;
302 
308  AbsControlStep get_cstep_end(const unsigned int statement_index) const;
309 
313  double GetEndingTime(const unsigned int operation) const;
314 
318  double GetStartingTime(const unsigned int operation) const;
319 
325  double get_fo_correction(unsigned int first_operation, unsigned int second_operation) const;
326 
330  unsigned int num_scheduled() const;
331 
335  void clear();
336 
340  void set_slack(vertex op, double v_slack)
341  {
342  op_slack[op] = v_slack;
343  }
344 
345  double get_slack(vertex op) const
346  {
347  if(op_slack.find(op) != op_slack.end())
348  {
349  return op_slack.find(op)->second;
350  }
351  else
352  {
353  return 0.0;
354  }
355  }
356 
362  void UpdateTime(const unsigned int operation_index, bool update_cs = true);
363 
370  FunctionFrontendFlowStep_Movable CanBeMoved(const unsigned int statement_index,
371  const unsigned int basic_block) const;
372 
379  bool EvaluateCondsMerging(const unsigned statement_index, const unsigned int first_condition,
380  const unsigned second_condition, unsigned int function_decl_nid) const;
381 
388  bool EvaluateMultiWayIfsMerging(const unsigned int first_statement_index, const unsigned int second_statement_index,
389  unsigned int function_decl_nid) const;
390 
394  const std::string PrintTimingInformation(const unsigned int statement_index) const;
395 
400  CustomSet<unsigned int> ComputeCriticalPath(const StateInfoConstRef state_info) const;
401 
407  void AddConnectionTimes(unsigned int first_operation, unsigned int second_operation, const double value);
408 };
412 #endif
AbsControlStep()
Empty constructor.
Definition: schedule.cpp:90
OpGraphConstRef op_graph
The operation graph (for scheduling purpose) (cannot be const because of = operator) ...
Definition: schedule.hpp:172
CustomUnorderedMapUnstable< unsigned int, ControlStep > op_ending_cycle
map between the operation index and the clock cycle on which the operations ends its execution ...
Definition: schedule.hpp:150
ControlStep get_csteps() const
This method returns the number of control steps.
Definition: schedule.hpp:216
refcount< fu_binding > fu_bindingRef
RefCount type definition of the fu_binding class structure.
Definition: fu_binding.hpp:402
UINT_STRONG_TYPEDEF(ControlStep)
std::map< vertex, double > op_slack
slack map
Definition: schedule.hpp:169
Class managing the schedule of the operations.
Definition: schedule.hpp:118
This class manages the tree structures extracted from the raw file.
CustomMap< unsigned int, double > starting_times
The absolute starting time of each operation as computed by the scheduling Key is the index of the gi...
Definition: schedule.hpp:154
void set_csteps(ControlStep cs)
This method sets the number of control steps.
Definition: schedule.hpp:225
Class specification of the graph structures.
tree_managerRef TM
The tree manager.
Definition: schedule.hpp:128
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
ControlStep tot_csteps
total number of control steps
Definition: schedule.hpp:140
static const ControlStep UNKNOWN
Constant used to specify unknown control step.
Definition: schedule.hpp:93
refcount< const OpGraph > OpGraphConstRef
Definition: op_graph.hpp:923
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapUnstable
Definition: custom_map.hpp:156
CustomUnorderedMap< vertex, bool > spec
Map for speculation property of each operation vertex.
Definition: schedule.hpp:166
redefinition of map to manage ordered/unordered structures
AllocationInformationConstRef allocation_information
The allocation information.
Definition: schedule.hpp:134
Absolute Control step First field is the basic block Second field is the relative control step...
Definition: schedule.hpp:89
A set of operation vertices.
Definition: op_graph.hpp:654
CONSTREF_FORWARD_DECL(AllocationInformation)
graph include
REF_FORWARD_DECL(behavioral_manager)
CustomUnorderedMap< vertex, bool > get_spec() const
Returns the speculation map.
Definition: schedule.hpp:253
CustomMap< ControlStep, CustomSet< unsigned int > > starting_cycles_to_ops
The reverse of op_starting_cycle.
Definition: schedule.hpp:147
const ParameterConstRef parameters
The set of input parameters.
Definition: schedule.hpp:175
void Initialize() override
Initialize all the data structure.
This class specifies the characteristic of a particular operation working on a given functional unit...
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
void set_slack(vertex op, double v_slack)
set the slack associated with the vertex with respect to the clock period
Definition: schedule.hpp:340
tree_manipulationConstRef tree_man
The tree manipulation.
Definition: schedule.hpp:131
void print(int x)
CustomMap< std::pair< unsigned int, unsigned int >, double > connection_times
Connection times The key is an operation graph edge.
Definition: schedule.hpp:162
#define index(x, y)
Definition: Keccak.c:74
redefinition of set to manage ordered/unordered structures
This class macros for the definition of strong typedef.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
const unsigned int function_index
The index of the function.
Definition: schedule.hpp:137
double get_slack(vertex op) const
Definition: schedule.hpp:345
Class managing list based scheduling algorithms.
Template definition of refcount.
bool operator<(const AbsControlStep &other) const
Compare two scheduling step.
Definition: schedule.cpp:101
FunctionFrontendFlowStep_Movable
Enum class used to specify if a statement can be moved.
void set_spec(const CustomUnorderedMap< vertex, bool > &spec_map)
Sets the speculation map.
Definition: schedule.hpp:245
const int debug_level
The debug level.
Definition: schedule.hpp:178
Structure holding information about a node into graph.
CustomMap< unsigned int, double > ending_times
The absolute ending time of each operation as computed by the scheduling Key is the index of the gimp...
Definition: schedule.hpp:158
This file collects some hash functors.
const Wrefcount< const HLS_manager > hls_manager
The HLS manager.
Definition: schedule.hpp:125
Class managing the functional-unit binding.
Definition: fu_binding.hpp:90
Class used to describe a particular graph with operations as nodes.
Definition: op_graph.hpp:783
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
CustomUnorderedMapUnstable< unsigned int, ControlStep > op_starting_cycle
map between the operation index and the clock cycle on which the operation starts its execution NOTE:...
Definition: schedule.hpp:144

Generated on Mon Feb 12 2024 13:02:54 for PandA-2024.02 by doxygen 1.8.13