Skip to content
Extraits de code Groupes Projets
Valider aba047ca rédigé par Thomas DILASSER's avatar Thomas DILASSER
Parcourir les fichiers

functional detector

parent d1b54191
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #1160 en échec
......@@ -226,25 +226,104 @@ void bitmap_mpi_iterated_pdf_union(function * fun)
}
}
//bitmap_set_pdf_intersect(ipdf_set, pfrontiers, &mpi_ipdf, fun);
bitmap_print( stdout, &ipdf_set, "iterated PDF: ", "\n\n" ) ;
bitmap_and_into(&ipdf_set, &mpi_set);
bitmap_print( stdout, &ipdf_set, "MPI iterated PDF: ", "\n\n" ) ;
bitmap_and(&mpi_ipdf, &mpi_set,&ipdf_set);
bitmap_print( stdout, &mpi_ipdf, "MPI iterated PDF: ", "\n\n" ) ;
bitmap_print( stdout, &mpi_set, "MPI set: ", "\n\n" ) ;
bitmap_head test;
bitmap_initialize( &test, &bitmap_default_obstack);
if(bitmap_intersect_p(&ipdf_set, &mpi_set)){
printf("! WARNING ! \n");
}else
{
printf("No potential deadlock detected\n");
}
free_dominance_info(fun, CDI_POST_DOMINATORS);
}
void detect_potential_deadlock(function * fun)
{
printf("\n------------------\n");
printf("---MPI Analysis---\n");
printf("------------------\n\n");
//init
calculate_dominance_info(CDI_POST_DOMINATORS);
bitmap_head *pfrontiers;
basic_block bb;
pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
FOR_ALL_BB_FN (bb, cfun)
{
bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack);
}
bitmap_head node_set ;
bitmap_initialize( &node_set, &bitmap_default_obstack);
FOR_ALL_BB_FN (bb, cfun)
{
bitmap_set_bit( &node_set, bb->index ) ;
}
bitmap_head pdf_set;
bitmap_initialize (&pdf_set, &bitmap_default_obstack);
bitmap_post_dominance_frontiers (pfrontiers, fun);
bitmap_set_pdf_union(node_set, pfrontiers, &pdf_set, fun);
bitmap_head ipdf_set;
bitmap_initialize (&ipdf_set, &bitmap_default_obstack);
iterated_post_dominance(pdf_set, pfrontiers, &ipdf_set, fun);
bitmap_head mpi_set, mpi_ipdf;
bitmap_initialize( &mpi_set, &bitmap_default_obstack);
bitmap_initialize( &mpi_ipdf, &bitmap_default_obstack);
FOR_ALL_BB_FN (bb, cfun)
{
if (bb->aux !=NULL && *((int *)bb->aux)>=0)
{
bitmap_set_bit( &mpi_set, bb->index ) ;
}
}
bitmap_and(&mpi_ipdf, &mpi_set,&ipdf_set);
bitmap_head test;
bitmap_initialize( &test, &bitmap_default_obstack);
if(bitmap_intersect_p(&ipdf_set, &mpi_set)){
printf("! WARNING ! \n");
bitmap_print( stdout, &ipdf_set, "Potential problems blocks : ", "\n\n" ) ;
}else
{
printf("No potential deadlock detected\n");
}
issue_warnings(ipdf_set,fun);
free_dominance_info(fun, CDI_POST_DOMINATORS);
}
//void bitmap_set_pdf_intersect(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun)
//{
// basic_block bb;
//
// /* Create the union of each PDF */
// FOR_ALL_BB_FN( bb, fun )
// {
// if ( bitmap_bit_p( &node_set, bb->index ) && bb->aux !=NULL && *((int *)bb->aux)>=0)
// {
// bitmap_ior_into( pdf_set, &node_set ) ;
// }
// }
//
//
//}
void issue_warnings (bitmap_head ipdf_set, function * fun)
{
basic_block bb;
gimple_stmt_iterator gsi;
gimple *stmt;
printf("\n----------- WHICH LINES ---------\n\n");
FOR_EACH_BB_FN( bb, fun )
{
if(bitmap_bit_p(&ipdf_set, bb->index))
{
gsi = gsi_start_bb(bb);
stmt = gsi_stmt(gsi);
printf("/!\\ /!\\ /!\\ Basic Block %d (line %d) might cause an issue\n", bb->index, gimple_lineno(stmt));
}
}
printf("\n");
}
......@@ -8,4 +8,6 @@ void iterated_post_dominance(bitmap_head pdf_node_set, bitmap_head *pdf, bitmap_
void bitmap_iterated_pdf_union(function * fun);
void bitmap_mpi_iterated_pdf_union(function * fun);
void bitmap_set_pdf_intersect(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun);
void detect_potential_deadlock(function * fun);
void issue_warnings (bitmap_head ipdf_set, function * fun);
#endif
......@@ -109,17 +109,18 @@ class split_count_pass : public gimple_opt_pass
//writing corresponding MPI Call in corresponding basic block
edit_all_aux_value(fun,(int*)NULL);
write_mpi_code(fun);
print_bb_aux(fun);
//print_bb_aux(fun);
/* Skip system header functions */
if ( !in_system_header_at( fun->function_start_locus ) )
cfgviz_dump( fun, function_name(fun), 1 ) ;
//edit_all_aux_value(fun,(int*)LAST_AND_UNUSED_MPI_COLLECTIVE_CODE);
//write_mpi_code(fun);
bitmap_pdf(fun);
bitmap_pdf_union(fun);
bitmap_iterated_pdf_union(fun);
bitmap_mpi_iterated_pdf_union(fun);
//bitmap_pdf(fun);
//bitmap_pdf_union(fun);
//bitmap_iterated_pdf_union(fun);
//bitmap_mpi_iterated_pdf_union(fun);
detect_potential_deadlock(fun);
return 0;
}
};
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter