00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00318 #ifndef parallel_INCLUDED
00319 #define parallel_INCLUDED "parallel.h"
00320
00321 #ifndef pu_info_INCLUDED
00322 #include <sys/types.h>
00323 #endif
00324 #ifndef pu_info_INCLUDED
00325 #include "pu_info.h"
00326 #endif
00327 #ifndef sxlist_INCLUDED
00328 #include "sxlist.h"
00329 #endif
00330 #ifndef sdlist_INCLUDED
00331 #include "sdlist.h"
00332 #endif
00333 #ifndef snl_INCLUDED
00334 #include "snl.h"
00335 #endif
00336
00337 enum INTERCHANGE_TYPE {INT_NONE, INT_PERMUTABLE, INT_INVARIANT, INT_GENERAL};
00338
00339 enum PAR_DIR_TYPE {PD_NONE, PD_PREFER_CONCURRENT, PD_NO_CONCURRENT};
00340
00341 class PARALLEL_INFO {
00342 double _cost;
00343 INT _work_estimate;
00344 INT _nloops;
00345 INT _permutation[SNL_MAX_LOOPS];
00346 INTERCHANGE_TYPE _int_type;
00347 INT _sd_split_depth;
00348 INT _split_depth;
00349 INT _parallel_depth;
00350 INT _is_doacross;
00351 INT _doacross_tile_size;
00352 INT _sync_distances[2];
00353 INT _doacross_overhead;
00354 double _reduction_cycles;
00355 double _loop_cycles;
00356 double _parallel_cycles;
00357 double _machine_cycles;
00358 double _cache_cycles_per_iter;
00359 double _cache_cycles;
00360 BOOL _preferred_concurrent;
00361 WN* _wn_outer;
00362
00363 public:
00364 PARALLEL_INFO(INT nloops);
00365 PARALLEL_INFO(WN* wn_outer, INT permutation[], INT nloops,
00366 INT parallel_depth, INTERCHANGE_TYPE int_type, SNL_DEP_MATRIX** sdm_array,
00367 BOOL sdm_scl[], SX_INFO* sx_info, SD_INFO* sd_info, INT sd_split_depth,
00368 double machine_cycles, double work_estimate);
00369 PARALLEL_INFO(WN* wn_outer, INT permutation[], INT nloops,
00370 INT parallel_depth, INTERCHANGE_TYPE int_type, SNL_DEP_MATRIX** sdm_array,
00371 BOOL sdm_scl[], SX_INFO* sx_info, SD_INFO* sd_info, INT sd_split_depth,
00372 double machine_cycles, double work_estimate, BOOL dummy);
00373 ~PARALLEL_INFO() {}
00374 double Cost() {return _cost;}
00375 INT Work_Estimate() {return _work_estimate;}
00376 INT Parallel_Depth() {return _parallel_depth;}
00377 INT Parallel_Loop() { return _permutation[_parallel_depth - Do_Loop_Depth(_wn_outer)]; }
00378 INT* Permutation() {return _permutation;}
00379 INT Permutation(INT i) {return _permutation[i];}
00380 INT Nloops() {return _nloops;}
00381 INTERCHANGE_TYPE Int_Type() {return _int_type;}
00382 INT Sd_Split_Depth() {return _sd_split_depth;}
00383 INT Split_Depth() {return _split_depth;}
00384 INT Is_Doacross() {return _is_doacross;}
00385 INT Doacross_Tile_Size() {return _doacross_tile_size;}
00386 INT* Sync_Distances() {return _sync_distances;}
00387 INT Doacross_Overhead() {return _doacross_overhead;}
00388 void Set_Preferred(void) { _preferred_concurrent = TRUE; }
00389 void Print(FILE *f);
00390 double Reduction_Cost(void) { return _reduction_cycles; }
00391 double Parallel_Overhead_Cost(void) { return _parallel_cycles; }
00392 double Loop_Cost(void) { return _loop_cycles; }
00393 double Machine_Cost(void) { return _machine_cycles; }
00394 double Cache_Cost(void) { return _cache_cycles; }
00395 };
00396
00397 extern WN* Minimal_Kernel(WN* wn_outer, INT nloops);
00398 extern BOOL General_Permutation(WN* wn_outer, INT permutation[], INT nloops);
00399 extern BOOL Invariant_Permutation(WN* wn_outer, INT permutation[], INT nloops);
00400 extern BOOL Fully_Permutable_Permutation(WN* wn_outer, INT nloops);
00401 extern SNL_DEP_MATRIX** Inv_Dep_Info(WN* wn_outer, INT nloops,
00402 BOOL check_privates = FALSE, BOOL definitely = FALSE);
00403 extern BOOL SNL_Legal_Perm_Deps(SNL_DEP_MATRIX* sdm_body, INT permutation[],
00404 INT nloops);
00405 extern void Mark_Auto_Parallelizable_Loops(WN* func_nd);
00406 extern BOOL Outermore_Parallel_Construct(WN* wn_loop, BOOL check_suggested);
00407 extern BOOL Innermore_Parallel_Loop(WN* wn_loop, BOOL check_suggested);
00408 extern void Auto_Parallelization(PU_Info* current_pu, WN* func_nd);
00409 extern BOOL Is_Privatizable_With_Context(WN* loop, WN* wn, BOOL defnitely);
00410 extern double Compute_Work_Estimate(double machine, double cache);
00411 extern BOOL Cannot_Concurrentize(WN* wn_loop);
00412 extern void Mark_Critical_Section_Loops(WN* func_nd);
00413 extern void Mark_Threadprivate_Loops(WN* func_nd);
00414 extern BOOL Outermore_Parallel_Construct_Or_Lego_Loop(WN* wn_loop);
00415 extern BOOL Innermore_Parallel_Or_Lego_Loop(WN* wn_loop);
00416 extern void IPA_LNO_Evaluate_Call_Infos(WN* func_nd);
00417 extern void IPA_LNO_Unevaluate_Call_Infos(WN* func_nd);
00418
00419 #ifdef KEY
00420 extern INT Last_Apo_Loop_Id;
00421 #endif
00422
00423 #endif