diff --git a/include/pass_mpi_collective.hpp b/include/pass_mpi_collective.hpp index b26df08071ce5b3ede9ed9327ff5beb056283780..4bb63dbea14e8c3e0cb8a751c03bbc83679ac3aa 100644 --- a/include/pass_mpi_collective.hpp +++ b/include/pass_mpi_collective.hpp @@ -98,10 +98,13 @@ public: bool __is_pd_set_mpi_coll_rank(function *fun, basic_block bb, int rank , int mpi_code, bitmap pds); - bitmap_head get_set_mpi_coll_rank(function *fun, int rank, int mpi_code); + bitmap get_set_mpi_coll_rank(function *fun, int rank, int mpi_code); //post-dom set frontier - bitmap_head get_frontier_from_pds(function *fun, bitmap pds); + bitmap get_frontier_from_pds(function *fun, bitmap pds); + + //err warning + void raise_warning_if_mpi_very_wrong(function *fun); void better_rank_collective(function *fun); int __better_rank_collective(basic_block bb, diff --git a/src/pass_mpi_collective.cpp b/src/pass_mpi_collective.cpp index b781025fa71c2aaa96dc24bed9e9955444a7b8cd..f5f1f340413087b0f94e643d317e8cb373b1768a 100644 --- a/src/pass_mpi_collective.cpp +++ b/src/pass_mpi_collective.cpp @@ -84,12 +84,15 @@ unsigned int pass_mpi_collective::execute(function *fun) rank_collective(fun); //better_rank_collective(fun); - bitmap_head pdbitmap = get_set_mpi_coll_rank(fun, 2, MPI_BARRIER); + //bitmap_head pdbitmap = get_set_mpi_coll_rank(fun, 2, MPI_BARRIER); - debug_bitmap(&pdbitmap); + //debug_bitmap(&pdbitmap); - bitmap_head pdf = get_frontier_from_pds(fun, &pdbitmap); - debug_bitmap(&pdf); + //bitmap_head pdf = get_frontier_from_pds(fun, &pdbitmap); + //debug_bitmap(&pdf); + + printf("[][][][][][][][][][]\n"); + raise_warning_if_mpi_very_wrong(fun); cfgviz_dump(fun, "_split"); @@ -717,20 +720,21 @@ bool pass_mpi_collective::__is_pd_set_mpi_coll_rank(function *fun return is_pd_by_set; } -bitmap_head pass_mpi_collective::get_set_mpi_coll_rank(function *fun +bitmap pass_mpi_collective::get_set_mpi_coll_rank(function *fun , int rank , int mpi_code) { - bitmap_head set_post_dommed; - bitmap_initialize(&set_post_dommed, &bitmap_default_obstack); + bitmap set_post_dommed; + set_post_dommed = new bitmap_head(); + bitmap_initialize(set_post_dommed, &bitmap_default_obstack); __is_pd_set_mpi_coll_rank(fun, ENTRY_BLOCK_PTR_FOR_FN(fun) - , rank, mpi_code, &set_post_dommed); + , rank, mpi_code, set_post_dommed); return set_post_dommed; } -bitmap_head pass_mpi_collective::get_frontier_from_pds(function *fun +bitmap pass_mpi_collective::get_frontier_from_pds(function *fun , bitmap pds) { //we check each bb, if a bb is in the postdom set, we check its @@ -740,8 +744,9 @@ bitmap_head pass_mpi_collective::get_frontier_from_pds(function *fun edge e; edge_iterator ei; - bitmap_head pdf; - bitmap_initialize(&pdf, &bitmap_default_obstack); + bitmap pdf; + pdf = new bitmap_head(); + bitmap_initialize(pdf, &bitmap_default_obstack); FOR_ALL_BB_FN(bb, fun) { @@ -753,29 +758,35 @@ bitmap_head pass_mpi_collective::get_frontier_from_pds(function *fun printf("\tchecking out my parent %i\n", e->src->index); if (!bitmap_bit_p(pds, e->src->index)) { - bitmap_set_bit(&pdf, e->src->index); + bitmap_set_bit(pdf, e->src->index); } } } } return pdf; } -/* + void pass_mpi_collective::raise_warning_if_mpi_very_wrong(function *fun) { for (int mpi_code = 0; mpi_code < LAST_AND_UNUSED_MPI_COLLECTIVE_CODE; ++mpi_code) { - unsigned int i; - bitmap_head pdf; - do + bitmap pds; + bitmap pdf; + + for (int i = 0 ; i < collective_max_rank[mpi_code] ; i++) { - pdf = get_set_mpi_coll_rank(fun, i, mpi_code) - if bit - while () + + printf("%i and %i\n", i, mpi_code); + pds = get_set_mpi_coll_rank(fun, i, mpi_code); + pdf = get_frontier_from_pds(fun, pds); + + debug_bitmap(pds); + debug_bitmap(pdf); + } } } -*/ + //============================ GRAPHVIZ ===================================== /* Build a filename (as a string) based on function name */