54 #include <boost/range/adaptor/reversed.hpp> 74 const DesignFlowManagerConstRef _design_flow_manager)
84 auto omp_functions = GetPointer<OmpFunctions>(
HLSMgr->Rfuns);
85 const auto TM =
HLSMgr->get_tree_manager();
87 const auto call_graph_manager =
HLSMgr->CGetCallGraphManager();
88 auto root_functions = call_graph_manager->GetRootFunctions();
91 const auto top_rtldesign_function =
92 HLSMgr->get_tree_manager()->GetFunction(
parameters->getOption<std::string>(OPT_top_design_name));
93 if(top_rtldesign_function && root_functions.count(top_rtldesign_function->index))
95 root_functions.clear();
96 root_functions.insert(top_rtldesign_function->index);
100 for(
const auto f_id : root_functions)
102 for(
const auto reached_f_id : call_graph_manager->GetReachedFunctionsFrom(f_id))
104 vertex_subset.insert(call_graph_manager->GetVertex(reached_f_id));
107 const auto call_graph = call_graph_manager->CGetCallSubGraph(vertex_subset);
108 std::list<vertex> sorted_functions;
109 call_graph->TopologicalSort(sorted_functions);
112 for(
const auto function : sorted_functions)
114 bool function_classification_found =
false;
115 const auto function_id = call_graph_manager->get_function(
function);
116 std::cout << cycleInd <<
" " 117 <<
HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name() << std::endl;
118 if(
HLSMgr->CGetFunctionBehavior(function_id)
119 ->CGetBehavioralHelper()
123 "---Found omp for wrapper " +
124 HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name());
125 omp_functions->omp_for_wrappers.insert(function_id);
130 for(boost::tie(ie, ie_end) = boost::in_edges(
function, *call_graph);
131 ie != ie_end && !function_classification_found; ie++)
133 const auto source = boost::source(*ie, *call_graph);
134 const auto source_id = call_graph_manager->get_function(source);
135 if(omp_functions->omp_for_wrappers.find(source_id) != omp_functions->omp_for_wrappers.end())
138 "---Found kernel function: " +
139 HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name());
140 omp_functions->kernel_functions.insert(function_id);
141 function_classification_found =
true;
145 for(boost::tie(ie, ie_end) = boost::in_edges(
function, *call_graph);
146 ie != ie_end && !function_classification_found; ie++)
148 const auto source = boost::source(*ie, *call_graph);
149 const auto source_id = call_graph_manager->get_function(source);
150 if(omp_functions->kernel_functions.find(source_id) != omp_functions->kernel_functions.end() or
151 omp_functions->parallelized_functions.find(source_id) != omp_functions->parallelized_functions.end())
153 if(
HLSMgr->CGetFunctionBehavior(function_id)
154 ->CGetBehavioralHelper()
155 ->IsOmpFunctionAtomic())
159 "---Found atomic function: " +
160 HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name());
161 omp_functions->atomic_functions.insert(function_id);
167 "---Found function to be parallelized: " +
168 HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name());
169 omp_functions->parallelized_functions.insert(function_id);
174 cycleInd = cycleInd + 1;
178 for(
const auto function : boost::adaptors::reverse(sorted_functions))
180 const auto function_id = call_graph_manager->get_function(
function);
181 std::cout << cycleInd <<
" " 182 <<
HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name() << std::endl;
184 for(boost::tie(ie, ie_end) = boost::out_edges(
function, *call_graph); ie != ie_end; ie++)
187 const auto target_id = call_graph_manager->get_function(
target);
188 if(omp_functions->omp_for_wrappers.find(target_id) != omp_functions->omp_for_wrappers.end() or
189 omp_functions->hierarchical_functions.find(target_id) != omp_functions->hierarchical_functions.end())
192 "---Found hierarchical function: " +
193 HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper()->get_function_name());
194 omp_functions->hierarchical_functions.insert(function_id);
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
boost::graph_traits< graph >::out_edge_iterator OutEdgeIterator
out_edge_iterator definition.
virtual void Initialize()
Initialize the step (i.e., like a constructor, but executed just before exec.
File containing functions and utilities to support the printing of debug messagges.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
boost::graph_traits< graph >::in_edge_iterator InEdgeIterator
in_edge_iterator definition.
~OmpFunctionAllocationCS() override
Destructor.
refcount< functions > functionsRef
refcount definition of the class
DesignFlowStep_Status Exec() override
Execute the step.
DesignFlowStep_Status Exec() override
Execute the step.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
OmpFunctionAllocationCS(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
this class is used to manage the command-line or XML options.
int debug_level
The debug level.
Datastructure to describe functions allocation in high-level synthesis.
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.