PandA-2024.02
omp_functions.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) 2015-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  */
41 #include "omp_functions.hpp"
43 
45 #include "function_behavior.hpp"
46 
48 #include "hls_manager.hpp"
49 
51 #include "behavioral_helper.hpp"
52 
54 #include "dbgPrintHelper.hpp"
55 
56 OmpFunctions::OmpFunctions(const HLS_managerConstRef _HLSMgr) : HLSMgr(_HLSMgr), locks_allocation(0)
57 {
58 }
59 
60 std::ostream& operator<<(std::ostream& os, const OmpFunctions* omp_functions)
61 {
62  const auto HLSMgr = omp_functions->HLSMgr;
63  os << "Function where locks will be allocated:" << std::endl;
64  os << std::string(indentation + 2, ' ')
65  << HLSMgr->CGetFunctionBehavior(omp_functions->locks_allocation)->CGetBehavioralHelper()->get_function_name()
66  << std::endl;
67  os << std::string(indentation, ' ') << "Functions which wrap omp for loops:" << std::endl;
68  for(const auto omp_for_wrapper : omp_functions->omp_for_wrappers)
69  {
70  os << std::string(indentation + 2, ' ')
71  << HLSMgr->CGetFunctionBehavior(omp_for_wrapper)->CGetBehavioralHelper()->get_function_name() << std::endl;
72  }
73  os << std::string(indentation, ' ') << "Functions that are kernel:" << std::endl;
74  for(const auto kernel_functions : omp_functions->kernel_functions)
75  {
76  os << std::string(indentation + 2, ' ')
77  << HLSMgr->CGetFunctionBehavior(kernel_functions)->CGetBehavioralHelper()->get_function_name() << std::endl;
78  }
79  os << std::string(indentation, ' ') << "Functions that are atomic:" << std::endl;
80  for(const auto atomic_functions : omp_functions->atomic_functions)
81  {
82  os << std::string(indentation + 2, ' ')
83  << HLSMgr->CGetFunctionBehavior(atomic_functions)->CGetBehavioralHelper()->get_function_name() << std::endl;
84  }
85  os << std::string(indentation, ' ') << "Functions that are inside the kernel:" << std::endl;
86  for(const auto parallelized_functions : omp_functions->parallelized_functions)
87  {
88  os << std::string(indentation + 2, ' ')
89  << HLSMgr->CGetFunctionBehavior(parallelized_functions)->CGetBehavioralHelper()->get_function_name()
90  << std::endl;
91  }
92  os << std::string(indentation, ' ') << "Functions that are top of the parallel:" << std::endl;
93  for(const auto hierarchical_functions : omp_functions->hierarchical_functions)
94  {
95  os << std::string(indentation + 2, ' ')
96  << HLSMgr->CGetFunctionBehavior(hierarchical_functions)->CGetBehavioralHelper()->get_function_name()
97  << std::endl;
98  }
99  os << std::string(indentation, ' ')
100  << "Functions which have to be created in multiple parallel instances:" << std::endl;
101  for(const auto parallelized_function : omp_functions->parallelized_functions)
102  {
103  os << std::string(indentation + 2, ' ')
104  << HLSMgr->CGetFunctionBehavior(parallelized_function)->CGetBehavioralHelper()->get_function_name()
105  << std::endl;
106  }
107  os << std::string(indentation, ' ') << "Functions which lock/unlock mutexes:" << std::endl;
108  for(const auto locking_function : omp_functions->locking_functions)
109  {
110  os << std::string(indentation + 2, ' ')
111  << HLSMgr->CGetFunctionBehavior(locking_function)->CGetBehavioralHelper()->get_function_name() << std::endl;
112  }
113  os << std::string(indentation, ' ')
114  << "Functions which propagate accesses to mutexes (in mutual exclusions):" << std::endl;
115  for(const auto locks_merge_communication : omp_functions->locks_merge_communication)
116  {
117  os << std::string(indentation + 2, ' ')
118  << HLSMgr->CGetFunctionBehavior(locks_merge_communication)->CGetBehavioralHelper()->get_function_name()
119  << std::endl;
120  }
121  os << std::string(indentation, ' ') << "Functions which propagate accesses to mutexes (in parallel):" << std::endl;
122  for(const auto locks_parallel_communication : omp_functions->locks_parallel_comunication)
123  {
124  os << std::string(indentation + 2, ' ')
125  << HLSMgr->CGetFunctionBehavior(locks_parallel_communication)->CGetBehavioralHelper()->get_function_name()
126  << std::endl;
127  }
128  return os;
129 }
Data structure representing the entire HLS information.
File containing functions and utilities to support the printing of debug messagges.
friend std::ostream & operator<<(std::ostream &os, const OmpFunctions *omp_function)
Friend definition of the << operator.
CustomSet< unsigned int > hierarchical_functions
The set of functions which have to be parallelized.
CustomSet< unsigned int > kernel_functions
The set of functions which have to be parallelized.
OmpFunctions(const HLS_managerConstRef HLSMgr)
Constructor.
CustomSet< unsigned int > parallelized_functions
The set of functions which have to be parallelized.
unsigned int locks_allocation
The function where locks have to be instantiated.
CustomSet< unsigned int > locking_functions
The set of functions which lock/unlock mutexes.
const HLS_managerConstRef HLSMgr
The HLS manager.
CustomSet< unsigned int > locks_merge_communication
The set of functions propagating accesses to locks in mutual exclusions.
CustomSet< unsigned int > atomic_functions
The set of functions which have to be parallelized.
size_t indentation
The current indentation for debug messages.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
CustomSet< unsigned int > locks_parallel_comunication
The set of functions propagating accesses to locks in parallel.
CustomSet< unsigned int > omp_for_wrappers
The set of openmp for wrappers.
Datastructure to describe functions allocation in high-level synthesis.
A brief description of the C++ Header File.

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