PandA-2024.02
BB_based_stg.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  */
43 #ifndef BB_BASED_STG_HPP
44 #define BB_BASED_STG_HPP
45 
46 #include "STG_creator.hpp"
47 
49 
50 class BB_based_stg : public STG_creator
51 {
52  protected:
54  ComputeHLSRelationships(const DesignFlowStep::RelationshipType relationship_type) const override;
55 
56  public:
61  BB_based_stg(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId,
62  const DesignFlowManagerConstRef design_flow_manager);
63 
69 
73  void Initialize() override;
74 
75  private:
81  void optimize_cycles(vertex bbEndingCycle, CustomUnorderedMap<vertex, vertex>& first_state,
83  std::map<vertex, std::list<vertex>>& global_starting_ops,
84  std::map<vertex, std::list<vertex>>& global_ending_ops,
85  std::map<vertex, std::list<vertex>>& global_executing_ops,
86  std::map<vertex, std::list<vertex>>& global_onfly_ops);
87 
96  bool can_be_moved(std::list<vertex>& lastStateEndingOp, std::list<vertex>& lastStateConditionalOpList,
97  vertex firstStateNextBb, std::map<vertex, std::list<vertex>>& global_starting_ops,
98  std::map<vertex, std::list<vertex>>& global_executing_ops);
99 
115  std::map<vertex, std::list<vertex>>& global_starting_ops,
116  std::map<vertex, std::list<vertex>>& global_executing_ops);
117 
121  bool is_instantaneous_operation(vertex operation);
122 
127  bool res_const_operation(vertex& operation, std::list<vertex>& lastStateExecutingOpList, vertex lastSt);
128 
136  void compute_use_def(const std::list<vertex>& opEndingList, const std::list<vertex>& opRuningList,
137  const std::list<vertex>& ignoreList, CustomOrderedSet<unsigned int>& useSet,
138  CustomOrderedSet<unsigned int>& defSet, const OpGraphConstRef data);
139 
145  void move_without_duplication(const vertex stateToMove, const vertex secondLastState, const vertex destinationState,
146  const std::map<vertex, std::list<vertex>>& global_starting_ops,
147  const std::map<vertex, std::list<vertex>>& global_executing_ops,
148  const std::map<vertex, std::list<vertex>>& global_ending_ops,
149  const CustomOrderedSet<unsigned int>& defSet,
150  const CustomOrderedSet<unsigned int>& useSet);
151 
159  void move_with_duplication(const vertex stateToMove, const vertex secondLastState, const vertex stateToClone,
160  const std::map<vertex, std::list<vertex>>& global_starting_ops,
161  const std::map<vertex, std::list<vertex>>& global_executing_ops,
162  const std::map<vertex, std::list<vertex>>& global_ending_ops,
163  const CustomOrderedSet<unsigned int>& defSet,
164  const CustomOrderedSet<unsigned int>& useSet);
180  void compute_EPP_edge_increments(const std::map<vertex, std::list<vertex>>& starting_ops) const;
181 };
182 #endif
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Definition: hls_step.hpp:205
void move_without_duplication(const vertex stateToMove, const vertex secondLastState, const vertex destinationState, const std::map< vertex, std::list< vertex >> &global_starting_ops, const std::map< vertex, std::list< vertex >> &global_executing_ops, const std::map< vertex, std::list< vertex >> &global_ending_ops, const CustomOrderedSet< unsigned int > &defSet, const CustomOrderedSet< unsigned int > &useSet)
Copies all the operations of the state to move in the following.
Generic class managing all the stg creation algorithms.
Definition: STG_creator.hpp:55
void move_with_duplication(const vertex stateToMove, const vertex secondLastState, const vertex stateToClone, const std::map< vertex, std::list< vertex >> &global_starting_ops, const std::map< vertex, std::list< vertex >> &global_executing_ops, const std::map< vertex, std::list< vertex >> &global_ending_ops, const CustomOrderedSet< unsigned int > &defSet, const CustomOrderedSet< unsigned int > &useSet)
Duplicates the first state of the destination bb and copies all the operations of the state to move i...
RelationshipType
The relationship type.
DesignFlowStep_Status InternalExec() override
Execute the step.
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > ComputeHLSRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
bool is_instantaneous_operation(vertex operation)
returns true if the operation takes no time
This class specifies the characteristic of a particular operation working on a given functional unit...
unsigned map[NUM_VERTICES]
Definition: bfs.c:12
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
Base class for all the STG creation algorithms.
vertex check_data_dependency(vertex operation, vertex state, std::map< vertex, std::list< vertex >> &global_starting_ops, std::map< vertex, std::list< vertex >> &global_executing_ops)
This method takes as parameters an operation and a state of the STG graph, and returns the operation ...
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
DesignFlowStep_Status
The status of a step.
bool can_be_moved(std::list< vertex > &lastStateEndingOp, std::list< vertex > &lastStateConditionalOpList, vertex firstStateNextBb, std::map< vertex, std::list< vertex >> &global_starting_ops, std::map< vertex, std::list< vertex >> &global_executing_ops)
Returns true if all the operations in the list can be moved to the state specified.
bool res_const_operation(vertex &operation, std::list< vertex > &lastStateExecutingOpList, vertex lastSt)
returns true if the number of fu available prevents us from moving that operation in the next state ...
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
void optimize_cycles(vertex bbEndingCycle, CustomUnorderedMap< vertex, vertex > &first_state, CustomUnorderedMap< vertex, vertex > &last_state, std::map< vertex, std::list< vertex >> &global_starting_ops, std::map< vertex, std::list< vertex >> &global_ending_ops, std::map< vertex, std::list< vertex >> &global_executing_ops, std::map< vertex, std::list< vertex >> &global_onfly_ops)
Given two bb linked by a forwarding edge, this method tries to move overlap the execution of the last...
BB_based_stg(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
void compute_EPP_edge_increments(const std::map< vertex, std::list< vertex >> &starting_ops) const
If hardware discrepancy analysis is activated, use this function to compute the edge increments for t...
CONSTREF_FORWARD_DECL(OpGraph)
void compute_use_def(const std::list< vertex > &opEndingList, const std::list< vertex > &opRuningList, const std::list< vertex > &ignoreList, CustomOrderedSet< unsigned int > &useSet, CustomOrderedSet< unsigned int > &defSet, const OpGraphConstRef data)
computes the variables used and defined in the by the given list of operations, and saves them in the...
Class used to describe a particular graph with operations as nodes.
Definition: op_graph.hpp:783

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