Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
C
COAV2023
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Anzo
COAV2023
Validations
c7e5eb85
Valider
c7e5eb85
rédigé
1 year ago
par
Nicolas MARIE
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
change dominance system to add dominance infos to graphs
parent
2d9239c5
Aucune branche associée trouvée
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
Makefile
+9
-3
9 ajouts, 3 suppressions
Makefile
include/pass_mpi_collective.hpp
+16
-3
16 ajouts, 3 suppressions
include/pass_mpi_collective.hpp
src/pass_mpi_collective.cpp
+80
-34
80 ajouts, 34 suppressions
src/pass_mpi_collective.cpp
avec
105 ajouts
et
40 suppressions
Makefile
+
9
−
3
Voir le fichier @
c7e5eb85
...
...
@@ -40,7 +40,8 @@ OBJS=$(addprefix $(OBJD)/, $(SRCS:cpp=o))
all
:
$(
MAKE
)
plugin
$(
MAKE
)
test
$(
MAKE
)
dots
.PHONY
:
plugin
plugin
:
mkdir
-p
$(
OBJD
)
...
...
@@ -54,6 +55,11 @@ test:
$(
MAKE
)
$(
TESTD
)
/test2
$(
MAKE
)
$(
TESTD
)
/test3
.PHONY
:
dots
dots
:
touch
$(
DOTD
)
/lock.dot
$(
MAKE
)
$(
shell find
$(
DOTD
)
-name
"*.dot"
|
sed
's/\.dot/\.svg/'
)
$(TESTD)/%
:
$(TESTSRCD)/%.c
$(
CC
)
$(
TEST_FLAGS
)
$(
PLUGIN_FLAGS
)
$^
-o
$@
...
...
@@ -65,8 +71,8 @@ $(LIBD)/libplugin.so: $(OBJD)/plugin.o $(OBJD)/pass_mpi_collective.o
# removing test scince plugin was rebuild
rm
-rf
$(
TESTD
)
%.
pn
g
:
%.dot
dot
-T
pn
g
$<
-o
$@
%.
sv
g
:
%.dot
dot
-T
sv
g
$<
-o
$@
.PHONY
:
clean
clean
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
include/pass_mpi_collective.hpp
+
16
−
3
Voir le fichier @
c7e5eb85
...
...
@@ -2,6 +2,8 @@
#include
<gcc-plugin.h>
// declare opt_pass
#include
<tree-pass.h>
// vector
#include
<vector>
/* Enum to represent the collective operations */
#define DEFMPICOLLECTIVES(CODE, NAME) CODE,
...
...
@@ -20,6 +22,15 @@ const char *const mpi_collective_name[] =
};
#undef DEFMPICOLLECTIVES
struct
bb_data
{
mpi_collective_code
mpi_code
;
std
::
vector
<
basic_block
>
dom
;
std
::
vector
<
basic_block
>
post_dom
;
std
::
vector
<
basic_block
>
dom_front
;
std
::
vector
<
basic_block
>
post_dom_front
;
};
class
pass_mpi_collective
:
public
opt_pass
{
...
...
@@ -42,11 +53,13 @@ public:
void
split_blocks
(
function
*
fun
);
// gestions des aux
void
label_bb
(
function
*
fun
);
void
clean_bb
(
function
*
fun
);
void
alloc_bb_aux
(
function
*
fun
);
void
label_collec
(
function
*
fun
);
void
free_bb_aux
(
function
*
fun
);
// calculate dominances
void
dominance
(
function
*
fun
);
void
label_dom
(
function
*
fun
);
void
free_dom_data
();
private:
// MPI function / collectives detections
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/pass_mpi_collective.cpp
+
80
−
34
Voir le fichier @
c7e5eb85
...
...
@@ -10,6 +10,8 @@
#include
<gimple-iterator.h>
// basename
#include
<filesystem>
// vector
#include
<vector>
// our pass
#include
"pass_mpi_collective.hpp"
...
...
@@ -54,9 +56,13 @@ unsigned int pass_mpi_collective::execute(function *fun)
printf
(
"
\t
--------------------------[split]---------------------------
\n
"
);
print_tree
(
fun
);
label_bb
(
fun
);
alloc_bb_aux
(
fun
);
label_collec
(
fun
);
label_dom
(
fun
);
cfgviz_dump
(
fun
,
"_split"
);
clean_bb
(
fun
);
free_dom_data
();
free_bb_aux
(
fun
);
return
0
;
}
...
...
@@ -175,78 +181,99 @@ void pass_mpi_collective::split_blocks(function *fun)
}
}
// gestions des aux
void
pass_mpi_collective
::
alloc_bb_aux
(
function
*
fun
)
{
basic_block
bb
;
FOR_ALL_BB_FN
(
bb
,
fun
)
{
bb
->
aux
=
(
bb_data
*
)
new
bb_data
();
}
}
void
pass_mpi_collective
::
label_bb
(
function
*
fun
)
// gestions des aux
void
pass_mpi_collective
::
label_collec
(
function
*
fun
)
{
basic_block
bb
;
gimple_stmt_iterator
gsi
;
gimple
*
stmt
;
mpi_collective_code
mpi_code
;
FOR_
EACH
_BB_FN
(
bb
,
fun
)
FOR_
ALL
_BB_FN
(
bb
,
fun
)
{
((
bb_data
*
)
bb
->
aux
)
->
mpi_code
=
LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
;
for
(
gsi
=
gsi_start_bb
(
bb
);
!
gsi_end_p
(
gsi
);
gsi_next
(
&
gsi
))
{
stmt
=
gsi_stmt
(
gsi
);
int
mpi_code
=
is_mpi_collec
(
stmt
);
if
(
mpi_code
!=
LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
)
{
bb
->
aux
=
(
void
*
)
(
new
int
(
mpi_code
));
}
mpi_code
=
is_mpi_collec
(
stmt
);
((
bb_data
*
)
bb
->
aux
)
->
mpi_code
=
mpi_code
;
}
}
}
void
pass_mpi_collective
::
clean_bb
(
function
*
fun
)
void
pass_mpi_collective
::
free_bb_aux
(
function
*
fun
)
{
basic_block
bb
;
FOR_ALL_BB_FN
(
bb
,
fun
)
{
if
(
bb
->
aux
!=
NULL
)
{
delete
(
int
*
)
bb
->
aux
;
delete
(
bb_data
*
)
bb
->
aux
;
bb
->
aux
=
NULL
;
}
}
}
// calculate dominance
void
pass_mpi_collective
::
dominance
(
function
*
fun
)
void
pass_mpi_collective
::
label_dom
(
function
*
fun
)
{
basic_block
bb
;
auto_vec
<
basic_block
>
dom
inated
;
auto_vec
<
basic_block
>
post_dom
inated
;
auto_vec
<
basic_block
>
dom
_gccvec
;
auto_vec
<
basic_block
>
post_dom
_gccvec
;
size_t
size_dom
;
size_t
size_post_dom
;
calculate_dominance_info
(
CDI_POST_DOMINATORS
);
calculate_dominance_info
(
CDI_DOMINATORS
);
calculate_dominance_info
(
CDI_POST_DOMINATORS
);
FOR_ALL_BB_FN
(
bb
,
fun
)
{
dominated
=
get_all_dominated_blocks
(
CDI_DOMINATORS
,
bb
);
size_dom
=
dominated
.
length
();
bb_data
*
data
=
((
bb_data
*
)
bb
->
aux
);
dom_gccvec
=
get_all_dominated_blocks
(
CDI_DOMINATORS
,
bb
);
size_dom
=
dom_gccvec
.
length
();
for
(
size_t
i
=
0
;
i
<
size_dom
;
++
i
)
{
if
(
dom
inated
[
i
]
->
index
!=
bb
->
index
)
if
(
dom
_gccvec
[
i
]
->
index
!=
bb
->
index
)
{
printf
(
"%d domine %d
\n
"
,
bb
->
index
,
dominated
[
i
]
->
index
);
data
->
dom
.
push_back
(
dom_gccvec
[
i
]);
}
}
post_dominated
=
get_all_dominated_blocks
(
CDI_POST_DOMINATORS
,
bb
);
size_post_dom
=
post_dominated
.
length
();
//for (basic_block bb2 : *dom)
//{
// printf("%d dom %d\n", bb->index, bb2->index);
//}
//((bb_data *) bb->aux)->dom = dominated;
post_dom_gccvec
=
get_all_dominated_blocks
(
CDI_POST_DOMINATORS
,
bb
);
size_post_dom
=
post_dom_gccvec
.
length
();
for
(
size_t
i
=
0
;
i
<
size_post_dom
;
++
i
)
{
if
(
post_dom
inated
[
i
]
->
index
!=
bb
->
index
)
if
(
post_dom
_gccvec
[
i
]
->
index
!=
bb
->
index
)
{
printf
(
"%d post domine %d
\n
"
,
bb
->
index
,
post_dominated
[
i
]
->
index
);
data
->
post_dom
.
push_back
(
post_dom_gccvec
[
i
]);
}
}
//for (basic_block bb2 : *post_dom)
//{
// printf("%d post dom %d\n", bb->index, bb2->index);
//}
//((bb_data *) bb->aux)->post_dom = post_dominated;
}
}
void
pass_mpi_collective
::
free_dom_data
()
{
free_dominance_info
(
CDI_DOMINATORS
);
free_dominance_info
(
CDI_POST_DOMINATORS
);
}
...
...
@@ -280,23 +307,42 @@ char *pass_mpi_collective::cfgviz_generate_filename(function *fun,
void
pass_mpi_collective
::
cfgviz_internal_dump
(
function
*
fun
,
FILE
*
out
)
{
basic_block
bb
;
mpi_collective_code
code
;
edge_iterator
eit
;
edge
e
;
fprintf
(
out
,
"Digraph G{
\n
"
);
FOR_ALL_BB_FN
(
bb
,
fun
)
{
code
=
LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
;
if
(
bb
->
aux
!=
NULL
)
bb_data
*
data
=
((
bb_data
*
)
bb
->
aux
);
fprintf
(
out
,
"%d [label=
\"
BB %d"
,
bb
->
index
,
bb
->
index
);
if
(
data
->
mpi_code
!=
LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
)
{
fprintf
(
out
,
"|%s"
,
mpi_collective_name
[
data
->
mpi_code
]);
}
if
(
!
data
->
dom
.
empty
())
{
fprintf
(
out
,
"|dom("
);
for
(
basic_block
bb2
:
data
->
dom
)
{
fprintf
(
out
,
"%d,"
,
bb2
->
index
);
}
fprintf
(
out
,
")"
);
}
if
(
!
data
->
post_dom
.
empty
())
{
code
=
*
((
mpi_collective_code
*
)
bb
->
aux
);
fprintf
(
out
,
"|post_dom("
);
for
(
basic_block
bb2
:
data
->
post_dom
)
{
fprintf
(
out
,
"%d,"
,
bb2
->
index
);
}
fprintf
(
out
,
")"
);
}
fprintf
(
out
,
"%d [label=
\"
BB %d %s
\"
shape=ellipse]
\n
"
,
bb
->
index
,
bb
->
index
,
(
code
==
LAST_AND_UNUSED_MPI_COLLECTIVE_CODE
?
""
:
mpi_collective_name
[
code
]));
fprintf
(
out
,
"
\"
shape=ellipse]
\n
"
);
FOR_EACH_EDGE
(
e
,
eit
,
bb
->
succs
)
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter