PIPS
|
#include <stdint.h>
#include <stdlib.h>
#include <ctype.h>
#include "genC.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "properties.h"
#include "freia.h"
#include "hwac.h"
#include "freia_sigmac.h"
Go to the source code of this file.
Macros | |
#define | SIGMAC_INSTANTIATE(a, b) " agent " a " = new " b ";\n" |
#define | SIGMAC_CONNECT(a, b) " connect (" a ", " b ");\n" |
#define | REPLICATION_AGENT "rep" |
#define | SIGMAC_HELPER "freia_mppa_launch" |
#define | N_PREDEFINED_CONTROLLERS 5 |
#define | MAIN_PATH "cd .. && ./main" |
Functions | |
static void | sigmac_name_instances (dag dg, hash_table htid) |
Populates the hash table htid: one dagvtx is linked to an unique id depending on its freia_api_t. More... | |
static string | sc_vtx_tostring (const dagvtx v, const hash_table htid) |
Generate a unique string per dagvtx consisting in. More... | |
static bool | is_param_dynamic (expression arg) |
Determine if an argument contains references to other variables (dirty hack based on isalpha) More... | |
static bool | has_vtx_dynamic_params (dagvtx v) |
Determine if a dagvtx has at least one dynamic parameter. More... | |
static list | sc_get_params_values (dagvtx vtx, hash_table hparams, int *nparams) |
Returns a list of values of one dagvtx misc input parameters. More... | |
static bool | sc_print_kernel (string_buffer sb_par, dagvtx v) |
Print the value of a morphological kernel extracted from a dagvtx. More... | |
static bool | sc_kernel_compute_loop (string_buffer sb_morpho, const dagvtx vtx, string kname) |
Print a kernel customized inner loop from a morphological kernel. More... | |
static void | sc_kernel_specific_agent (string_buffer sb_morpho, hash_table hparams, const dag dg) |
static void | sigmac_params_decl (string_buffer sb_par, dag dg, hash_table hparams, int *pnparams) |
Generates the constant parameters declaration. More... | |
static void | sc_inst (string_buffer sb, const dagvtx v, const hash_table htid, const hash_table hparams, string miscparams, bool is_dynamic) |
Generate the instanciation of an agent in the forme "agent instname = new agentname (parameters)". More... | |
static int | sc_get_port_id (dagvtx current_vtx, dagvtx succ, dag dg) |
Helper function determine the input port of the succ dagvtx to be connected to the output port of current_vtx dagvtx succ must be in dagvtx_succs(current_vtx) More... | |
static void | sc_delimiter (string_buffer sb, const string title) |
Generate a 3 lines commented code delimiter with a centered title. More... | |
Variables | |
static int | n_dags = 0 |
#define MAIN_PATH "cd .. && ./main" |
#define N_PREDEFINED_CONTROLLERS 5 |
#define REPLICATION_AGENT "rep" |
Definition at line 53 of file freia_sigmac.c.
#define SIGMAC_CONNECT | ( | a, | |
b | |||
) | " connect (" a ", " b ");\n" |
Definition at line 52 of file freia_sigmac.c.
#define SIGMAC_HELPER "freia_mppa_launch" |
#define SIGMAC_INSTANTIATE | ( | a, | |
b | |||
) | " agent " a " = new " b ";\n" |
Definition at line 51 of file freia_sigmac.c.
Determine if a dagvtx has at least one dynamic parameter.
Definition at line 113 of file freia_sigmac.c.
References dagvtx_optype(), f(), FOREACH, freia_get_vertex_params(), get_freia_api_vtx(), is_param_dynamic(), and spoc_type_thr.
Referenced by sc_delimiter(), and sigmac_params_decl().
|
static |
Determine if an argument contains references to other variables (dirty hack based on isalpha)
Definition at line 101 of file freia_sigmac.c.
References expression_to_string().
Referenced by has_vtx_dynamic_params(), and sc_delimiter().
|
static |
Generate a 3 lines commented code delimiter with a centered title.
); int a = (columns - l - 2) / 2; for (i = 0; i < a; i++) sb_cat(sb, "#"); if (!(l % 2)) sb_cat(sb, " ", title, " #"); else sb_cat(sb, " ", title, " "); for (i = 0; i < a; i++) sb_cat(sb, "#"); sb_cat(sb, "
); for (i = 0; i < columns; i++) sb_cat(sb, "#"); sb_cat(sb, "
If vtx is compound, returns the id of correspondant connected component. Else returns -1.
Main loop looping over the list of vertices of the given dag
call this helper for dag d ??? currently non constant parameters are NOT handled at all.
we generate an application subgraph with 4 pipes for every independant dag
Generate a root subgraph (equivalent of the main function) which initialize the image data and calls the application subgraphs
two i/o pipes for each predefined controller and four for each dag (2 for images i/o, 2 for parameters i/o)
we only need one instance of the following agents because several commands can be sent throughout the same pipe
Definition at line 351 of file freia_sigmac.c.
References _intFMT, freia_api_t::arg_misc_in, cat, CONS, dag_dot_dump_prefix(), dag_dump(), dag_fix_image_reuse(), dag_inputs, dag_no_image_operation(), dag_outputs, dag_split_on_scalars(), dag_statements(), dag_vertex_preds(), dag_vertices, dagvtx_image(), dagvtx_is_measurement_p(), dagvtx_nb_dump(), dagvtx_number(), dagvtx_operation(), dagvtx_opid(), dagvtx_optype(), dagvtx_statement(), dagvtx_succs, dg, entity_to_expression(), entity_undefined_p, expression_domain, expression_to_string(), f(), FOREACH, fprintf(), free(), freia_allocate_new_images_if_needed(), freia_create_helper_function(), freia_dag_optimize(), freia_get_vertex_params(), freia_insert_added_stats(), freia_migrate_statements(), freia_ok(), freia_sigmac_compile_calls(), FREIA_SIGMAC_SC_INCLUDES, gen_free_list(), gen_full_copy_list(), gen_in_list_p(), gen_length(), gen_make_list(), gen_nconc(), gen_nreverse(), gen_nth(), gen_position(), get_bool_property(), get_freia_api_vtx(), get_int_property(), has_vtx_dynamic_params(), HASH_FOREACH, hash_pointer, hash_put(), hash_table_free(), hash_table_make(), HELPER, helper_file_name(), hwac_replace_statement(), i2a(), init, input(), sigmac_hw_t::inst_prefix, int, int_to_expression(), is_param_dynamic(), LIST, local_name_to_top_level_entity(), MAIN_PATH, make_call(), sigmac_hw_t::mergeable, module, n_dags, N_PREDEFINED_CONTROLLERS, NIL, out, PARAM_T, pips_assert, pips_debug, PIXEL_T, REPLICATION_AGENT, safe_fopen(), same_string_p, sb_cat, sb_prf, sc_get_params_values(), sc_get_port_id(), sc_inst(), sc_kernel_specific_agent(), sc_vtx_tostring(), set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, set_size(), set_union(), freia_api_t::sigmac, SIGMAC_CONNECT, SIGMAC_HELPER, SIGMAC_INSTANTIATE, sigmac_name_instances(), sigmac_params_decl(), spoc_type_thr, strdup(), string_buffer_empty_p(), string_buffer_free(), string_buffer_make(), string_buffer_reset(), string_buffer_to_file(), string_buffer_to_string(), string_buffer_to_string_reverse(), and strupper().
|
static |
Returns a list of values of one dagvtx misc input parameters.
Definition at line 130 of file freia_sigmac.c.
References call_arguments, dagvtx_content, dagvtx_opid(), freia_extract_params(), freia_statement_to_call(), pstatement_statement, and vtxcontent_source.
Referenced by sc_delimiter(), and sigmac_params_decl().
Helper function determine the input port of the succ dagvtx to be connected to the output port of current_vtx dagvtx succ must be in dagvtx_succs(current_vtx)
Definition at line 344 of file freia_sigmac.c.
References dag_vertex_preds(), dg, and gen_position().
Referenced by sc_delimiter().
|
static |
Generate the instanciation of an agent in the forme "agent instname = new agentname (parameters)".
Definition at line 281 of file freia_sigmac.c.
References dagvtx_optype(), f(), FOREACH, freia_convolution_p(), freia_get_vertex_params(), get_bool_property(), get_freia_api_vtx(), hash_get(), n_dags, same_string_p, sb_cat, sb_prf, sc_vtx_tostring(), SIGMAC_INSTANTIATE, spoc_type_poc, string_buffer_free(), string_buffer_make(), string_buffer_reset(), and string_buffer_to_string().
Referenced by sc_delimiter().
|
static |
Print a kernel customized inner loop from a morphological kernel.
Definition at line 157 of file freia_sigmac.c.
References cat, dagvtx_optype(), freia_extract_kernel_vtx(), i2a(), intptr_t, n_dags, PIXEL_T, sb_prf, spoc_type_poc, and strdup().
Referenced by sc_kernel_specific_agent().
|
static |
Definition at line 187 of file freia_sigmac.c.
References CONS, dag_vertices, dagvtx_optype(), dg, EXPRESSION, FOREACH, freia_get_vertex_params(), gen_in_list_p(), gen_nth(), hash_get(), lparams, NIL, sc_kernel_compute_loop(), and spoc_type_poc.
Referenced by sc_delimiter().
|
static |
Print the value of a morphological kernel extracted from a dagvtx.
Definition at line 143 of file freia_sigmac.c.
References freia_extract_kernel_vtx(), intptr_t, sb_cat, and sb_prf.
Referenced by sigmac_params_decl().
|
static |
Generate a unique string per dagvtx consisting in.
Definition at line 92 of file freia_sigmac.c.
References cat, get_freia_api_vtx(), hash_get(), i2a(), sigmac_hw_t::inst_prefix, freia_api_t::sigmac, and strdup().
Referenced by sc_delimiter(), and sc_inst().
|
static |
Populates the hash table htid: one dagvtx is linked to an unique id depending on its freia_api_t.
Definition at line 61 of file freia_sigmac.c.
References dag_vertices, dg, f(), FOREACH, get_freia_api_vtx(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_free(), hash_table_make(), and hash_update().
Referenced by sc_delimiter().
|
static |
Generates the constant parameters declaration.
Definition at line 211 of file freia_sigmac.c.
References CONS, dag_inputs, dag_vertices, dagvtx_is_measurement_p(), dagvtx_optype(), dg, EXPRESSION, expression_to_string(), f(), FOREACH, freia_convolution_p(), freia_get_vertex_params(), gen_in_list_p(), gen_length(), gen_nth(), get_freia_api_vtx(), has_vtx_dynamic_params(), hash_get(), lparams, NIL, PIXEL_T, sb_cat, sb_prf, sc_get_params_values(), sc_print_kernel(), and spoc_type_poc.
Referenced by sc_delimiter().
|
static |
Definition at line 56 of file freia_sigmac.c.
Referenced by freia_compile(), mppa_dag_maybe_split_instrs_cmd(), mppa_dag_split(), sc_delimiter(), sc_inst(), and sc_kernel_compute_loop().