graphite-dependences.c (pddr_original_scattering): New.

2009-08-28  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-dependences.c (pddr_original_scattering): New.
	(graphite_legal_transform_dr): Call pddr_original_scattering.
	(dot_deps_1): New.
	(dot_deps): New.
	* graphite-dependences.h (dot_deps): Declared.
	* graphite-poly.c (new_poly_dr): Initialize PDR_ID.
	(print_pdr): Print PDR_ID.
	* graphite-poly.h (struct poly_dr): Add field id.
	(PDR_ID): New.
	(pbb_index): New.
	* graphite-scop-detection.c (dot_all_scops_1): Cleanup comment.

From-SVN: r151183
This commit is contained in:
Sebastian Pop 2009-08-28 20:31:28 +00:00 committed by Sebastian Pop
parent f8e0bb8b37
commit afae02072c
7 changed files with 128 additions and 22 deletions

View File

@ -1,3 +1,17 @@
2009-08-28 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (pddr_original_scattering): New.
(graphite_legal_transform_dr): Call pddr_original_scattering.
(dot_deps_1): New.
(dot_deps): New.
* graphite-dependences.h (dot_deps): Declared.
* graphite-poly.c (new_poly_dr): Initialize PDR_ID.
(print_pdr): Print PDR_ID.
* graphite-poly.h (struct poly_dr): Add field id.
(PDR_ID): New.
(pbb_index): New.
* graphite-scop-detection.c (dot_all_scops_1): Cleanup comment.
2009-08-28 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (graphite_carried_dependence_level_k): Do

View File

@ -1,3 +1,17 @@
2009-08-25 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (pddr_original_scattering): New.
(graphite_legal_transform_dr): Call pddr_original_scattering.
(dot_deps_1): New.
(dot_deps): New.
* graphite-dependences.h (dot_deps): Declared.
* graphite-poly.c (new_poly_dr): Initialize PDR_ID.
(print_pdr): Print PDR_ID.
* graphite-poly.h (struct poly_dr): Add field id.
(PDR_ID): New.
(pbb_index): New.
* graphite-scop-detection.c (dot_all_scops_1): Cleanup comment.
2009-08-22 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (graphite_carried_dependence_level_k): Do

View File

@ -494,6 +494,30 @@ dependence_polyhedron (poly_bb_p pbb1, poly_bb_p pbb2,
return res;
}
/* Returns the PDDR corresponding to the original schedule, or NULL if
the dependence relation is empty. */
static poly_ddr_p
pddr_original_scattering (poly_bb_p pbb1, poly_bb_p pbb2,
poly_dr_p pdr1, poly_dr_p pdr2)
{
poly_ddr_p pddr;
ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1);
ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2);
ppl_Polyhedron_t so1 = PBB_ORIGINAL_SCATTERING (pbb1);
ppl_Polyhedron_t so2 = PBB_ORIGINAL_SCATTERING (pbb2);
if (PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2))
return NULL;
pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
true, true);
if (pddr_is_empty (pddr))
return NULL;
return pddr;
}
/* Returns true when the PBB_TRANSFORMED_SCATTERING functions of PBB1
and PBB2 respect the data dependences of PBB_ORIGINAL_SCATTERING
functions. */
@ -509,20 +533,11 @@ graphite_legal_transform_dr (poly_bb_p pbb1, poly_bb_p pbb2,
ppl_dimension_type pdim;
bool is_empty_p;
poly_ddr_p pddr;
ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1);
ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2);
ppl_Polyhedron_t so1 = PBB_ORIGINAL_SCATTERING (pbb1);
ppl_Polyhedron_t so2 = PBB_ORIGINAL_SCATTERING (pbb2);
graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1;
graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1;
if (sdim1 != sdim2)
return true;
pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
true, true);
if (pddr_is_empty (pddr))
pddr = pddr_original_scattering (pbb1, pbb2, pdr1, pdr2);
if (!pddr)
return true;
po = PDDR_DDP (pddr);
@ -679,8 +694,6 @@ graphite_carried_dependence_level_k (poly_dr_p pdr1, poly_dr_p pdr2,
ppl_Polyhedron_t so2 = PBB_TRANSFORMED_SCATTERING (pbb2);
ppl_Pointset_Powerset_C_Polyhedron_t po;
ppl_Pointset_Powerset_C_Polyhedron_t eqpp;
graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1;
graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1;
graphite_dim_t tdim1 = pbb_nb_scattering_transform (pbb1);
graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1);
ppl_dimension_type dim;
@ -691,7 +704,7 @@ graphite_carried_dependence_level_k (poly_dr_p pdr1, poly_dr_p pdr2,
|| !poly_drs_may_alias_p (pdr1, pdr2))
return false;
if (sdim1 != sdim2)
if (PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2))
return true;
pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
@ -733,4 +746,50 @@ dependency_between_pbbs_p (poly_bb_p pbb1, poly_bb_p pbb2, int level)
return false;
}
/* Pretty print to FILE all the data dependences of SCoP in DOT
format. */
static void
dot_deps_1 (FILE *file, scop_p scop)
{
int i, j, k, l;
poly_bb_p pbb1, pbb2;
poly_dr_p pdr1, pdr2;
fputs ("digraph all {\n", file);
for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++)
for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++)
if (pddr_original_scattering (pbb1, pbb2, pdr1, pdr2))
fprintf (file, "S%d_D%d -> S%d_D%d\n",
pbb_index (pbb1), PDR_ID (pdr1),
pbb_index (pbb2), PDR_ID (pdr2));
fputs ("}\n\n", file);
}
/* Display all the data dependences in SCoP using dotty. */
void
dot_deps (scop_p scop)
{
/* When debugging, enable the following code. This cannot be used
in production compilers because it calls "system". */
#if 1
int x;
FILE *stream = fopen ("/tmp/scopdeps.dot", "w");
gcc_assert (stream);
dot_deps_1 (stream, scop);
fclose (stream);
x = system ("dotty /tmp/scopdeps.dot");
#else
dot_deps_1 (stderr, scop);
#endif
}
#endif

View File

@ -50,5 +50,6 @@ typedef struct poly_ddr
extern int eq_poly_ddr_p (const void *, const void *);
extern hashval_t hash_poly_ddr_p (const void *);
extern void free_poly_ddr (void *);
extern void dot_deps (scop_p);
#endif

View File

@ -273,7 +273,9 @@ new_poly_dr (poly_bb_p pbb,
enum POLY_DR_TYPE type, void *cdr, int nb_subscripts)
{
poly_dr_p pdr = XNEW (struct poly_dr);
static int id = 0;
PDR_ID (pdr) = id++;
PDR_PBB (pdr) = pbb;
PDR_ACCESSES (pdr) = accesses;
PDR_TYPE (pdr) = type;
@ -361,7 +363,7 @@ print_pdr_access_layout (FILE *file, poly_dr_p pdr)
void
print_pdr (FILE *file, poly_dr_p pdr)
{
fprintf (file, "pdr (");
fprintf (file, "pdr_%d (", PDR_ID (pdr));
switch (PDR_TYPE (pdr))
{

View File

@ -53,6 +53,9 @@ enum POLY_DR_TYPE
struct poly_dr
{
/* An identifier for this PDR. */
int id;
/* A pointer to compiler's data reference description. */
void *compiler_dr;
@ -130,9 +133,10 @@ struct poly_dr
ppl_Pointset_Powerset_C_Polyhedron_t accesses;
/* The number of subscripts. */
graphite_dim_t nb_subscripts;
graphite_dim_t nb_subscripts;
};
#define PDR_ID(PDR) (PDR->id)
#define PDR_CDR(PDR) (PDR->compiler_dr)
#define PDR_PBB(PDR) (PDR->pbb)
#define PDR_TYPE(PDR) (PDR->type)
@ -304,9 +308,18 @@ extern bool scop_do_interchange (scop_p);
extern bool scop_do_strip_mine (scop_p);
extern void pbb_number_of_iterations (poly_bb_p, graphite_dim_t, Value);
/* The index of the PBB. */
static inline int
pbb_index (poly_bb_p pbb)
{
return GBB_BB (PBB_BLACK_BOX (pbb))->index;
}
/* The scop that contains the PDR. */
static inline scop_p pdr_scop (poly_dr_p pdr)
static inline scop_p
pdr_scop (poly_dr_p pdr)
{
return PBB_SCOP (PDR_PBB (pdr));
}

View File

@ -1445,12 +1445,15 @@ build_scops (VEC (scop_p, heap) **scops)
VEC_length (scop_p, *scops));
}
/* Pretty print all SCoPs in DOT format and mark them with different colors.
If there are not enough colors, paint later SCoPs gray.
/* Pretty print to FILE all the SCoPs in DOT format and mark them with
different colors. If there are not enough colors, paint the
remaining SCoPs in gray.
Special nodes:
- "*" after the node number: entry of a SCoP,
- "#" after the node number: exit of a SCoP,
- "()" entry or exit not part of SCoP. */
- "*" after the node number denotes the entry of a SCoP,
- "#" after the node number denotes the exit of a SCoP,
- "()" around the node number denotes the entry or the
exit nodes of the SCOP. These are not part of SCoP. */
static void
dot_all_scops_1 (FILE *file, VEC (scop_p, heap) *scops)