PIPS
hardware_accelerator.c File Reference
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "misc.h"
#include "ri-util.h"
#include "effects-util.h"
#include "callgraph.h"
#include "resources.h"
#include "pipsdbm.h"
#include "control.h"
#include "effects-generic.h"
#include "freia.h"
#include "hwac.h"
+ Include dependency graph for hardware_accelerator.c:

Go to the source code of this file.

Functions

static string commenter (__attribute__((unused)) entity e)
 
static bool freia_compiler (const string module, const string hardware)
 compile FREIA calls for some target. More...
 
bool freia_spoc_compiler (const string module)
 Warning! Do not modify this file that is automatically generated! More...
 
bool freia_terapix_compiler (const string module)
 
bool freia_aipo_compiler (const string module)
 
bool freia_opencl_compiler (const string module)
 
bool freia_sigmac_compiler (const string module)
 
bool freia_mppa_compiler (const string module)
 

Function Documentation

◆ commenter()

static string commenter ( __attribute__((unused)) entity  e)
static

Definition at line 52 of file hardware_accelerator.c.

53 {
54  return strdup(" hardware accelerator generated variable");
55  //return string_undefined; // no comment?
56 }
char * strdup()

References strdup().

Referenced by freia_compiler(), and push_generated_variable_commenter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freia_aipo_compiler()

bool freia_aipo_compiler ( const string  module)
Parameters
moduleodule

Definition at line 134 of file hardware_accelerator.c.

135 {
136  return freia_compiler(module, "aipo");
137 }
static bool freia_compiler(const string module, const string hardware)
compile FREIA calls for some target.
static char * module
Definition: pips.c:74

References freia_compiler(), and module.

+ Here is the call graph for this function:

◆ freia_compiler()

static bool freia_compiler ( const string  module,
const string  hardware 
)
static

compile FREIA calls for some target.

Definition at line 62 of file hardware_accelerator.c.

63 {
64  debug_on("PIPS_HWAC_DEBUG_LEVEL");
65  pips_debug(1, "considering module %s for hardware %s\n", module, hardware);
66 
67  // this will be usefull
69  (statement) db_get_memory_resource(DBR_CODE, module, true);
72  // should be pure?
74  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module, false));
75  // useless... but...
77  db_get_memory_resource(DBR_PROPER_EFFECTS, module, false));
79 
80  pips_debug(1, "considering module %s\n", module);
81 
82  // accelerated code generation
83  string freia_file = freia_compile(module, mod_stat, hardware);
84 
85  // some code cleanup
87 
88  // put updated code and accelerated helpers
90 
91  // update callees
92  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module,
93  (void*) compute_callees(mod_stat));
94 
95  // other possibly generated resources
96  // Argh, as soon as it is put, it is obsolete. Indeed, the code is updated,
97  // and the file depends on the code and resources derived from the code.
98  if (freia_spoc_p(hardware))
99  DB_PUT_NEW_FILE_RESOURCE(DBR_SPOC_FILE, module, freia_file);
100  else if (freia_terapix_p(hardware))
101  DB_PUT_NEW_FILE_RESOURCE(DBR_TERAPIX_FILE, module, freia_file);
102  else if (freia_opencl_p(hardware))
103  DB_PUT_NEW_FILE_RESOURCE(DBR_OPENCL_FILE, module, freia_file);
104  else if (freia_sigmac_p(hardware))
105  DB_PUT_NEW_FILE_RESOURCE(DBR_SIGMAC_FILE, module, freia_file);
106  else if (freia_mppa_p(hardware))
107  DB_PUT_NEW_FILE_RESOURCE(DBR_MPPA_FILE, module, freia_file);
108  // else no helper file for AIPO target, which is just a code transformation
109 
110  // release resources
111  // ??? free statement_effects? MEMORY LEAK...
112  // but some statements contents where freed
113  // there may be some sharing between * effects & statements?
119 
120  debug_off();
121  return true;
122 }
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
string freia_compile(string module, statement mod_stat, string target)
freia_compile: compile freia module & statement for target
Definition: freia.c:785
#define freia_opencl_p(s)
Definition: freia.h:61
#define freia_sigmac_p(s)
Definition: freia.h:62
#define freia_mppa_p(s)
Definition: freia.h:63
#define freia_spoc_p(s)
Definition: freia.h:59
#define freia_terapix_p(s)
Definition: freia.h:60
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)
Put a new file resource into the current workspace database.
void pop_generated_variable_commenter(void)
Definition: statement.c:2623
void push_generated_variable_commenter(string(*)(entity))
Definition: statement.c:2616
static string commenter(__attribute__((unused)) entity e)
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define debug_off()
Definition: misc-local.h:160
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479

References clean_up_sequences(), commenter(), compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, DB_PUT_NEW_FILE_RESOURCE, debug_off, debug_on, freia_compile(), freia_mppa_p, freia_opencl_p, freia_sigmac_p, freia_spoc_p, freia_terapix_p, mod_stat, module, module_name_to_entity(), pips_debug, pop_generated_variable_commenter(), push_generated_variable_commenter(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), and set_proper_rw_effects().

Referenced by freia_aipo_compiler(), freia_mppa_compiler(), freia_opencl_compiler(), freia_sigmac_compiler(), freia_spoc_compiler(), and freia_terapix_compiler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freia_mppa_compiler()

bool freia_mppa_compiler ( const string  module)
Parameters
moduleodule

Definition at line 149 of file hardware_accelerator.c.

149  {
150  return freia_compiler(module, "mppa");
151 }

References freia_compiler(), and module.

+ Here is the call graph for this function:

◆ freia_opencl_compiler()

bool freia_opencl_compiler ( const string  module)
Parameters
moduleodule

Definition at line 139 of file hardware_accelerator.c.

140 {
141  return freia_compiler(module, "opencl");
142 }

References freia_compiler(), and module.

+ Here is the call graph for this function:

◆ freia_sigmac_compiler()

bool freia_sigmac_compiler ( const string  module)
Parameters
moduleodule

Definition at line 144 of file hardware_accelerator.c.

145 {
146  return freia_compiler(module, "sigmac");
147 }

References freia_compiler(), and module.

+ Here is the call graph for this function:

◆ freia_spoc_compiler()

bool freia_spoc_compiler ( const  string)

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/hwac/hwac-local.h instead, to add your own modifications. header file built by cproto hwac-local.h cproto-generated files hardware_accelerator.c

Parameters
moduleodule

Definition at line 124 of file hardware_accelerator.c.

125 {
126  return freia_compiler(module, "spoc");
127 }

References freia_compiler(), and module.

+ Here is the call graph for this function:

◆ freia_terapix_compiler()

bool freia_terapix_compiler ( const string  module)
Parameters
moduleodule

Definition at line 129 of file hardware_accelerator.c.

130 {
131  return freia_compiler(module, "terapix");
132 }

References freia_compiler(), and module.

+ Here is the call graph for this function: