PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "dg.h"
#include "graph.h"
#include "matrice.h"
#include "tiling.h"
#include "database.h"
#include "text.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "resources.h"
#include "pipsdbm.h"
#include "movements.h"
#include "rice.h"
#include "constants.h"
#include "ricedg.h"
#include "wp65.h"
Go to the source code of this file.
Typedefs | |
typedef dg_arc_label | arc_label |
Code Generation for Distributed Memory Machines. More... | |
typedef dg_vertex_label | vertex_label |
Functions | |
static void | add_range_in_list (range r) |
static void | implied_do_ranges (statement s) |
static void | update_loop_nest_dim (loop l) |
static void | compute_loop_nest_dim (statement l) |
static void | reduce_loop_bound (loop l) |
Function used during code generation for non-perfectly nested loops. More... | |
static void | reduce_loop_bound_for_st (statement stmp) |
bool | list_of_calls_p (list lsb) |
instruction_to_wp65_code.c More... | |
entity | ith_index_of_ref (reference r, int level) |
loop | ith_loop_in_loop_nest (statement s1, int level) |
void | instruction_to_wp65_code (entity module, list l, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map) |
void | call_to_wp65_code (statement s, entity compute_module, entity memory_module, entity bank_id, entity proc_id, statement computational, statement emulator, statement_mapping fetch_map, statement_mapping store_map, hash_table v_to_esv) |
expression | ref_in_implied_do (expression exp) |
This function extracts from an implied_do expression the reference having to be computed or printed. More... | |
reference | translate_IO_ref (call c, hash_table v_to_esv, bool loop_or_call_print) |
This function translates a reference in I/O statement into its corresponding emulated shared memory reference. More... | |
statement | generate_io_wp65_code (statement s1, statement body, hash_table v_to_esv, bool loop_or_call_print) |
bool | io_loop_nest_p (statement st) |
Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call an io. More... | |
void | loop_nest_movement_generation (entity module, statement loop_nest, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat, bool fully_parallel, Psysteme sc_tile, Pbase initial_basis, Pbase local_basis, Pbase local_basis2, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_tile_basis2, Pbase loop_body_indices, list lpv, list *lb, list *blb, list *sb, list *bsb, int first_parallel_level, int last_parallel_level, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud) |
void | loop_nest_to_wp65_code (entity module, statement loop_nest, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat) |
void | make_all_movement_blocks (entity initial_module, entity compute_module, entity memory_module, entity v, list map, hash_table llv_to_lcr, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, int pn, int bn, int ls, Psysteme iteration_domain, Pbase initial_basis, Pbase local_basis, entity proc_id, Pbase bank_indices, Pbase loop_body_indices, list *pmb, list *pbmb, tag use_def, int first_parallel_level, int last_parallel_level) |
generates all data movements related to entity v, loads or stores depending on use_def More... | |
void | search_parallel_loops (statement mod_stat, statement loop_statement, graph dg, loop_carried_dep) |
bool | full_parallel_loop_nest_p (statement mod_stat, statement loop_stmt, int nest_dim, graph dg, bool *loop_carried_dep) |
Variables | |
static list | implied_do_range_list =NIL |
static int | loop_nest_dim =0 |
static list | loops_of_nest =NIL |
typedef dg_arc_label arc_label |
Code Generation for Distributed Memory Machines.
Higher level functions
PUMA, ESPRIT contract 2701
Francois Irigoin, Corinne Ancourt 1991
Definition at line 46 of file instruction_to_wp65_code.c.
typedef dg_vertex_label vertex_label |
Definition at line 47 of file instruction_to_wp65_code.c.
|
static |
Definition at line 74 of file instruction_to_wp65_code.c.
References CONS, gen_nconc(), implied_do_range_list, NIL, and RANGE.
Referenced by implied_do_ranges().
void call_to_wp65_code | ( | statement | s, |
entity | compute_module, | ||
entity | memory_module, | ||
entity | bank_id, | ||
entity | proc_id, | ||
statement | computational, | ||
statement | emulator, | ||
statement_mapping | fetch_map, | ||
statement_mapping | store_map, | ||
hash_table | v_to_esv | ||
) |
To deal with implied_do and I/Os
communications for variables having to be loaded in local memories for assignments
communications for variables having to be stored in global memory for assignments
compute_module | ompute_module |
memory_module | emory_module |
bank_id | ank_id |
proc_id | roc_id |
computational | omputational |
emulator | mulator |
fetch_map | etch_map |
store_map | tore_map |
v_to_esv | _to_esv |
Definition at line 267 of file instruction_to_wp65_code.c.
References call_function, CONS, copy_statement(), entity_local_name(), fprintf(), gen_nconc(), generate_io_wp65_code(), GET_STATEMENT_MAPPING, HASH_UNDEFINED_VALUE, ifdebug, include_constant_symbolic_communication(), instruction_block, instruction_call, NIL, reference_list_print(), STATEMENT, statement_instruction, and statement_number.
Referenced by instruction_to_wp65_code().
|
static |
Definition at line 96 of file instruction_to_wp65_code.c.
References gen_recurse, gen_true(), loop_domain, loop_nest_dim, and update_loop_nest_dim().
Referenced by loop_nest_to_wp65_code().
bool full_parallel_loop_nest_p | ( | statement | mod_stat, |
statement | loop_stmt, | ||
int | nest_dim, | ||
graph | dg, | ||
bool * | loop_carried_dep | ||
) |
mod_stat | od_stat |
loop_stmt | oop_stmt |
nest_dim | est_dim |
dg | g |
loop_carried_dep | oop_carried_dep |
Definition at line 1119 of file instruction_to_wp65_code.c.
References dg, mod_stat, and search_parallel_loops().
Referenced by loop_nest_to_wp65_code().
statement generate_io_wp65_code | ( | statement | s1, |
statement | body, | ||
hash_table | v_to_esv, | ||
bool | loop_or_call_print | ||
) |
we know that it is a loop nest containing a PRINT function The loop body contains block statement in case of CONTINUE loop nest style
loop nest belonging IO statement
implied_do case
s1 | 1 |
body | ody |
v_to_esv | _to_esv |
loop_or_call_print | oop_or_call_print |
Definition at line 406 of file instruction_to_wp65_code.c.
References CAR, copy_expression(), DIMENSION, dimension_lower, dimension_upper, ENDP, entity_type, gen_length(), gen_nreverse(), gen_nthcdr(), hash_get(), implied_do_range_list, implied_do_ranges(), instruction_block, instruction_block_p, instruction_call, int_to_expression(), ith_loop_in_loop_nest(), loop_range, make_range(), NIL, pl, POP, RANGE, range_lower, range_upper, reference_variable, s1, STATEMENT, statement_instruction, statement_ordering, STATEMENT_ORDERING_UNDEFINED, translate_IO_ref(), type_variable, and variable_dimensions.
Referenced by call_to_wp65_code(), and loop_nest_to_wp65_code().
|
static |
Definition at line 81 of file instruction_to_wp65_code.c.
References add_range_in_list(), gen_recurse, gen_true(), and range_domain.
Referenced by generate_io_wp65_code().
void instruction_to_wp65_code | ( | entity | module, |
list | l, | ||
graph | dg, | ||
int | pn, | ||
int | bn, | ||
int | ls, | ||
int | pd, | ||
entity | proc_id, | ||
entity | proc_id_mm, | ||
Pbase | bank_indices, | ||
hash_table | v_to_esv, | ||
hash_table | v_to_nlv, | ||
entity | compute_module, | ||
statement | computational, | ||
entity | memory_module, | ||
statement | emulator, | ||
statement_mapping | fetch_map, | ||
statement_mapping | store_map | ||
) |
cms
FI: the semantics has been changed: the next two get_xxx() cannot/should not return something undefined.
if ((cme = get_current_module_entity()) == entity_undefined)
FI: already done somewhere else
set_current_module_entity(local_name_to_top_level_entity(module_local_name(module)));
if ((cms = get_current_module_statement()) == statement_undefined)
FI: shouldn't the current statement be retrieved at the same time as the current module?
reset_current_module_entity();
module | odule |
dg | g |
pn | n |
bn | n |
ls | s |
pd | d |
proc_id | roc_id |
proc_id_mm | roc_id_mm |
bank_indices | ank_indices |
v_to_esv | _to_esv |
v_to_nlv | _to_nlv |
compute_module | ompute_module |
computational | omputational |
memory_module | emory_module |
emulator | mulator |
fetch_map | etch_map |
store_map | tore_map |
Definition at line 175 of file instruction_to_wp65_code.c.
References call_to_wp65_code(), CAR, db_get_memory_resource(), debug_off, debug_on, dg, fprintf(), get_current_module_statement(), ifdebug, instruction_block, instruction_tag, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, loop_nest_to_wp65_code(), MAPL, mod_stat, module, module_local_name(), pips_internal_error, reset_current_module_statement(), return_statement_p(), s1, set_current_module_statement(), STATEMENT, statement_instruction, and Svecteur::var.
Referenced by module_to_wp65_modules().
Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call an io.
st | t |
Definition at line 467 of file instruction_to_wp65_code.c.
References call_function, CAR, entity_local_name(), instruction_block, instruction_block_p, instruction_call, STATEMENT, and statement_instruction.
Referenced by loop_nest_to_wp65_code().
level | evel |
Definition at line 146 of file instruction_to_wp65_code.c.
References entity_undefined, EXPRESSION, expression_syntax, gen_nth(), level, reference_indices, reference_variable, syntax_reference, and syntax_reference_p.
s1 | 1 |
level | evel |
Definition at line 158 of file instruction_to_wp65_code.c.
References CAR, instruction_block, instruction_block_p, instruction_loop, level, loop1, loop_body, s1, STATEMENT, and statement_instruction.
Referenced by generate_io_wp65_code().
lsb | sb |
Definition at line 136 of file instruction_to_wp65_code.c.
References CAR, CDR, NIL, pl, STATEMENT, and statement_call_p().
Referenced by concat_data_list(), and loop_nest_to_wp65_code().
void loop_nest_movement_generation | ( | entity | module, |
statement | loop_nest, | ||
int | pn, | ||
int | bn, | ||
int | ls, | ||
int | pd, | ||
entity | proc_id, | ||
entity | proc_id_mm, | ||
Pbase | bank_indices, | ||
hash_table | v_to_esv, | ||
hash_table | v_to_nlv, | ||
entity | compute_module, | ||
statement | computational, | ||
entity | memory_module, | ||
statement | emulator, | ||
statement_mapping | fetch_map, | ||
statement_mapping | store_map, | ||
statement | mod_stat, | ||
bool | fully_parallel, | ||
Psysteme | sc_tile, | ||
Pbase | initial_basis, | ||
Pbase | local_basis, | ||
Pbase | local_basis2, | ||
Pbase | tile_basis_in_tile_basis, | ||
Pbase | tile_basis_in_tile_basis2, | ||
Pbase | loop_body_indices, | ||
list | lpv, | ||
list * | lb, | ||
list * | blb, | ||
list * | sb, | ||
list * | bsb, | ||
int | first_parallel_level, | ||
int | last_parallel_level, | ||
hash_table | llv_to_lcr, | ||
hash_table | r_to_llv, | ||
hash_table | v_to_lllv, | ||
hash_table | r_to_ud | ||
) |
the list of data having to be store into the global memory is the concatenation of store_map sets of the internal loops
update of variable names according to the module of appartenance
module | odule |
loop_nest | oop_nest |
pn | n |
bn | n |
ls | s |
pd | d |
proc_id | roc_id |
proc_id_mm | roc_id_mm |
bank_indices | ank_indices |
v_to_esv | _to_esv |
v_to_nlv | _to_nlv |
compute_module | ompute_module |
computational | omputational |
memory_module | emory_module |
emulator | mulator |
fetch_map | etch_map |
store_map | tore_map |
mod_stat | od_stat |
fully_parallel | ully_parallel |
sc_tile | c_tile |
initial_basis | nitial_basis |
local_basis | ocal_basis |
local_basis2 | ocal_basis2 |
tile_basis_in_tile_basis | ile_basis_in_tile_basis |
tile_basis_in_tile_basis2 | ile_basis_in_tile_basis2 |
loop_body_indices | oop_body_indices |
lpv | pv |
lb | b |
blb | lb |
sb | b |
bsb | sb |
first_parallel_level | irst_parallel_level |
last_parallel_level | ast_parallel_level |
llv_to_lcr | lv_to_lcr |
r_to_llv | _to_llv |
v_to_lllv | _to_lllv |
r_to_ud | _to_ud |
Definition at line 483 of file instruction_to_wp65_code.c.
References CAR, concat_data_list(), debug_off, debug_on, entity_is_argument_p(), entity_local_name(), is_action_read, is_action_write, make_all_movement_blocks(), MAPL, mod_stat, module, NIL, pips_assert, REFERENCE, reference_scalar_p(), reference_variable, and sc_variables_rename().
Referenced by loop_nest_to_wp65_code().
void loop_nest_to_wp65_code | ( | entity | module, |
statement | loop_nest, | ||
graph | dg, | ||
int | pn, | ||
int | bn, | ||
int | ls, | ||
int | pd, | ||
entity | proc_id, | ||
entity | proc_id_mm, | ||
Pbase | bank_indices, | ||
hash_table | v_to_esv, | ||
hash_table | v_to_nlv, | ||
entity | compute_module, | ||
statement | computational, | ||
entity | memory_module, | ||
statement | emulator, | ||
statement_mapping | fetch_map, | ||
statement_mapping | store_map, | ||
statement | mod_stat | ||
) |
load block
bank load block
store block
bank store block
compute block
list of local variables to list of conflicting references
inverse table: list of local variables to use for a given reference
variable to list of list of local variables: the main list is an image of connected components of the dependence graph filtered for a given variable, v; the low-level list is a function of the number of pipeline stages
reference to use-def usage ; use and def are encoded as action_is_read and action_is_write
pipelining offset; no pipelining is implemented yet
private variables for the loop nest
local variables
pour eviter tous les problemes de tiling sur les nids de boucles internes a des nids de boucles mal imbriques on execute les boucles internes en sequentiel. Il faudrait autrement s'assurer que l'on a les meme indices de boucles en interne pour le tiling et que les bornes sont identiques (meme restrictions que pour du loop fusion)
creation of new indices
a modifie pour tenir compte des dimensions reelles des domaines
normalement full_initila_basis == initial_basis2
a modifie pour tenir compte des dimensions reelles des domaines
put together the different pieces of code as two lists of statements
add the scanning over the tiles around them to build a proper stmt
update computational and emulator with cs and ems
module | odule |
loop_nest | oop_nest |
dg | g |
pn | n |
bn | n |
ls | s |
pd | d |
proc_id | roc_id |
proc_id_mm | roc_id_mm |
bank_indices | ank_indices |
v_to_esv | _to_esv |
v_to_nlv | _to_nlv |
compute_module | ompute_module |
computational | omputational |
memory_module | emory_module |
emulator | mulator |
fetch_map | etch_map |
store_map | tore_map |
mod_stat | od_stat |
Definition at line 579 of file instruction_to_wp65_code.c.
References assert, base_dup(), base_fprint(), BASE_NULLE, base_reversal(), CAR, compute_loop_nest_dim(), CONS, continue_statement_p(), create_tile_basis(), debug(), debug_off, debug_on, dg, entity_local_name(), find_iteration_domain(), fprint_wp65_hash_tables(), fprintf(), full_parallel_loop_nest_p(), gen_map(), gen_nconc(), generate_io_wp65_code(), hash_pointer, hash_table_free(), hash_table_make(), ifdebug, include_constant_symbolic_communication(), insert_run_time_communications(), instruction_block, instruction_loop, instruction_to_statement(), int_to_expression(), io_loop_nest_p(), is_execution_parallel, list_of_calls_p(), loop_bounds_to_tile_bounds(), loop_locals, loop_nest_dim, loop_nest_movement_generation(), loop_nest_to_local_variables(), loop_nest_to_tile(), loop_to_statement, make_block_statement(), make_compute_block(), make_execution(), make_loop(), make_loop_label(), make_range(), make_scanning_over_one_tile(), make_scanning_over_tiles(), MAP, MAPL, mod_stat, module, NIL, perfectly_nested_loop_to_body(), reduce_loop_bound_for_st(), REFERENCE, reference_list_print(), reference_scalar_defined_p(), reference_scalar_p(), sc_fprint(), sc_new(), sc_variables_rename(), STATEMENT, statement_instruction, statement_undefined, Svecteur::succ, UU, VALUE_ZERO, Svecteur::var, vect_add(), vect_chg_coeff(), vect_dup(), vect_fprint(), vect_size(), VECTEUR_NUL, and wp65_debug_print_text().
Referenced by instruction_to_wp65_code().
void make_all_movement_blocks | ( | entity | initial_module, |
entity | compute_module, | ||
entity | memory_module, | ||
entity | v, | ||
list | map, | ||
hash_table | llv_to_lcr, | ||
hash_table | v_to_lllv, | ||
hash_table | r_to_ud, | ||
hash_table | v_to_esv, | ||
int | pn, | ||
int | bn, | ||
int | ls, | ||
Psysteme | iteration_domain, | ||
Pbase | initial_basis, | ||
Pbase | local_basis, | ||
entity | proc_id, | ||
Pbase | bank_indices, | ||
Pbase | loop_body_indices, | ||
list * | pmb, | ||
list * | pbmb, | ||
tag | use_def, | ||
int | first_parallel_level, | ||
int | last_parallel_level | ||
) |
generates all data movements related to entity v, loads or stores depending on use_def
FI: depending on the pipeline stage, a specific lv should be chosen; by default, let's take the first one
statement for one movement block
statement for one bank movement block
initial_module | nitial_module |
compute_module | ompute_module |
memory_module | emory_module |
map | ap |
llv_to_lcr | lv_to_lcr |
v_to_lllv | _to_lllv |
r_to_ud | _to_ud |
v_to_esv | _to_esv |
pn | n |
bn | n |
ls | s |
iteration_domain | teration_domain |
initial_basis | nitial_basis |
local_basis | ocal_basis |
proc_id | roc_id |
bank_indices | ank_indices |
loop_body_indices | oop_body_indices |
pmb | mb |
pbmb | movement blocks |
use_def | bank movement blocks |
first_parallel_level | irst_parallel_level |
last_parallel_level | ast_parallel_level |
Definition at line 972 of file instruction_to_wp65_code.c.
References CAR, CONS, debug(), ENDP, ENTITY, gen_nconc(), hash_get(), ifdebug, intptr_t, is_action_read, is_action_write, LIST, make_load_blocks(), make_store_blocks(), NIL, pips_debug, pips_internal_error, POP, REFERENCE, reference_in_list_p(), STATEMENT, and wp65_debug_print_text().
Referenced by loop_nest_movement_generation().
|
static |
Function used during code generation for non-perfectly nested loops.
The loops of inner nests are executed sequentially. No tiling is applied on these inner loops. Thus, the new loop bounds do not change, except that there are shift -1 to deal with Fortran declarations.
Definition at line 109 of file instruction_to_wp65_code.c.
References fprintf(), loop_range, make_vecteur_expression(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_lower, range_upper, TCST, VALUE_MONE, vect_add_elem(), and VECTEUR_NUL.
Referenced by reduce_loop_bound_for_st().
|
static |
Definition at line 130 of file instruction_to_wp65_code.c.
References gen_recurse, gen_true(), loop_domain, and reduce_loop_bound().
Referenced by loop_nest_to_wp65_code().
expression ref_in_implied_do | ( | expression | exp | ) |
This function extracts from an implied_do expression the reference having to be computed or printed.
exp | xp |
Definition at line 328 of file instruction_to_wp65_code.c.
References call_arguments, call_function, CAR, entity_local_name(), exp, EXPRESSION, expression_syntax, gen_last(), syntax_call, and syntax_call_p.
Referenced by translate_IO_ref().
void search_parallel_loops | ( | statement | mod_stat, |
statement | loop_statement, | ||
graph | dg, | ||
loop_carried_dep | |||
) |
Definition at line 1068 of file instruction_to_wp65_code.c.
References CAR, CDR, cone_levels, cone_undefined, CONFLICT, conflict_cone, CONS, dg, dg_arc_label_conflicts, ENDP, FindMaximumCommonLevel(), gen_nconc(), graph_vertices, ignore_this_conflict(), INT, level, load_statement_enclosing_loops(), loops_mapping_of_statement(), MAPL, mod_stat, NIL, pl, region, region_of_loop(), reset_enclosing_loops_map(), s1, set_belong_p(), set_enclosing_loops_map(), SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().
Referenced by full_parallel_loop_nest_p().
reference translate_IO_ref | ( | call | c, |
hash_table | v_to_esv, | ||
bool | loop_or_call_print | ||
) |
This function translates a reference in I/O statement into its corresponding emulated shared memory reference.
scan the argument list till IOLIST' arguments
implied-do case: the array reference is the first argument in the last argument list of the implied do call
v_to_esv | _to_esv |
loop_or_call_print | oop_or_call_print |
Definition at line 346 of file instruction_to_wp65_code.c.
References call_arguments, call_function, CAR, CDR, ENDP, entity_local_name(), exp, EXPRESSION, expression_syntax, expression_to_string(), gen_full_copy_list(), hash_get(), is_syntax_reference, make_reference(), make_syntax(), NIL, pips_assert, pips_user_error, ref_in_implied_do(), reference_indices, reference_undefined, reference_variable, same_string_p, syntax_call, syntax_call_p, syntax_reference, and syntax_reference_p.
Referenced by generate_io_wp65_code().
|
static |
Definition at line 87 of file instruction_to_wp65_code.c.
References CONS, loop_nest_dim, loop_to_statement, loops_of_nest, and STATEMENT.
Referenced by compute_loop_nest_dim().
Definition at line 69 of file instruction_to_wp65_code.c.
Referenced by add_range_in_list(), and generate_io_wp65_code().
|
static |
Definition at line 70 of file instruction_to_wp65_code.c.
Referenced by compute_loop_nest_dim(), loop_nest_to_wp65_code(), and update_loop_nest_dim().
Definition at line 71 of file instruction_to_wp65_code.c.
Referenced by update_loop_nest_dim().