PandA-2024.02
priority.cpp
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  */
46 #include "priority.hpp"
47 #include "ASLAP.hpp"
48 
49 #include "op_graph.hpp"
50 
51 #include "schedule.hpp"
52 
54 {
55  const ScheduleConstRef asap = aslap->CGetASAP();
56  const ScheduleConstRef alap = aslap->CGetALAP();
57 
58  const OpGraphConstRef data = aslap->CGetOpGraph();
59  VertexIterator vIt, vEnd;
60  for(boost::tie(vIt, vEnd) = boost::vertices(*data); vIt != vEnd; vIt++)
61  {
62  if(!asap->is_scheduled(*vIt))
63  {
64  continue;
65  }
66  operator[](*vIt) = from_strongtype_cast<int>(
67  -alap->get_cstep(*vIt).second +
68  asap->get_cstep(*vIt).second);
69  }
70 }
71 
73  unsigned int _ctrl_step_multiplier)
74  : ready_nodes(_ready_nodes), ctrl_step_multiplier(_ctrl_step_multiplier)
75 {
76  const ScheduleConstRef asap = aslap->CGetASAP();
77  const ScheduleConstRef alap = aslap->CGetALAP();
78 
79  const OpGraphConstRef data = aslap->CGetOpGraph();
80  VertexIterator vIt, vEnd;
81  for(boost::tie(vIt, vEnd) = boost::vertices(*data); vIt != vEnd; vIt++)
82  {
83  if(!asap->is_scheduled(*vIt))
84  {
85  continue;
86  }
87  operator[](*vIt) = from_strongtype_cast<int>(
88  -alap->get_cstep(*vIt).second +
89  asap->get_cstep(*vIt).second);
90  }
91 }
92 
94 {
95  auto it_end = ready_nodes.end();
96  auto it = ready_nodes.begin();
97  if(it != it_end)
98  {
99  while(it != it_end)
100  {
101  operator[](*it) = operator[](*it) + static_cast<int>(ctrl_step_multiplier);
102  it++;
103  }
104  return true;
105  }
106  else
107  {
108  return false;
109  }
110 }
111 
113 {
114  auto it_end = priority_value.end();
115  for(auto it = priority_value.begin(); it != it_end; ++it)
116  {
117  operator[](it->first) = it->second;
118  }
119 }
virtual int & operator[](const vertex &_a)
return the priority associated with the vertex.
Definition: priority.hpp:88
const OpVertexSet & ready_nodes
set of ready vertices.
Definition: priority.hpp:141
Dest from_strongtype_cast(Source source)
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapUnstable
Definition: custom_map.hpp:156
A set of operation vertices.
Definition: op_graph.hpp:654
priority_fixed(const CustomUnorderedMapUnstable< vertex, int > &priority_value)
Constructor.
Definition: priority.cpp:112
bool update() override
This specialization does update the priorities at the end of the control step only of ready nodes...
Definition: priority.cpp:93
This package is used to drive the list based algorithm with different type of priority schemes...
Class specifying ALAP and ASAP algorithms.
unsigned int ctrl_step_multiplier
multiplier used to take into account chaining during asap/alap computation
Definition: priority.hpp:143
Data structure used to store the schedule of the operations.
priority_static_mobility(const ASLAPRef &aslap)
Constructor.
Definition: priority.cpp:53
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Definition: graph.hpp:1307
priority_dynamic_mobility(const ASLAPRef &aslap, const OpVertexSet &_ready_nodes, unsigned int _ctrl_step_multiplier)
Constructor.
Definition: priority.cpp:72
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94

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