Commit 247fd30e by Sebastian Pop Committed by Sebastian Pop

Add a stride parameter to scop_do_strip_mine.

2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter
	for the stride.
	(lst_do_strip_mine): Same.
	(scop_do_strip_mine): Same.
	* graphite-poly.c (apply_poly_transforms): Update call to
	scop_do_strip_mine.
	* graphite-poly.h (scop_do_strip_mine): Update declaration.

From-SVN: r167345
parent a2254c5d
2010-12-01 Sebastian Pop <sebastian.pop@amd.com>
* graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter
for the stride.
(lst_do_strip_mine): Same.
(scop_do_strip_mine): Same.
* graphite-poly.c (apply_poly_transforms): Update call to
scop_do_strip_mine.
* graphite-poly.h (scop_do_strip_mine): Update declaration.
2010-12-01 Jan Hubicka <jh@suse.cz> 2010-12-01 Jan Hubicka <jh@suse.cz>
* tree.c (build_common_builtin_nodes): Do not initialize * tree.c (build_common_builtin_nodes): Do not initialize
2010-10-20 Sebastian Pop <sebastian.pop@amd.com>
* graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter
for the stride.
(lst_do_strip_mine): Same.
(scop_do_strip_mine): Same.
* graphite-poly.c (apply_poly_transforms): Update call to
scop_do_strip_mine.
* graphite-poly.h (scop_do_strip_mine): Update declaration.
2010-09-24 Sebastian Pop <sebastian.pop@amd.com> 2010-09-24 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/45758 PR middle-end/45758
......
...@@ -193,15 +193,14 @@ lst_strip_mine_profitable_p (lst_p lst, int stride) ...@@ -193,15 +193,14 @@ lst_strip_mine_profitable_p (lst_p lst, int stride)
return res; return res;
} }
/* Strip-mines all the loops of LST that are considered profitable to /* Strip-mines all the loops of LST with STRIDE. Return true if it
strip-mine. Return true if it did strip-mined some loops. */ did strip-mined some loops. */
static bool static bool
lst_do_strip_mine_loop (lst_p lst, int depth) lst_do_strip_mine_loop (lst_p lst, int depth, int stride)
{ {
int i; int i;
lst_p l; lst_p l;
int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
poly_bb_p pbb; poly_bb_p pbb;
if (!lst) if (!lst)
...@@ -212,7 +211,7 @@ lst_do_strip_mine_loop (lst_p lst, int depth) ...@@ -212,7 +211,7 @@ lst_do_strip_mine_loop (lst_p lst, int depth)
bool res = false; bool res = false;
FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine_loop (l, depth); res |= lst_do_strip_mine_loop (l, depth, stride);
return res; return res;
} }
...@@ -222,30 +221,45 @@ lst_do_strip_mine_loop (lst_p lst, int depth) ...@@ -222,30 +221,45 @@ lst_do_strip_mine_loop (lst_p lst, int depth)
stride); stride);
} }
/* Strip-mines all the loops of LST that are considered profitable to /* Strip-mines all the loops of LST with STRIDE. When STRIDE is zero,
strip-mine. Return true if it did strip-mined some loops. */ read the stride from the PARAM_LOOP_BLOCK_TILE_SIZE. Return true
if it did strip-mined some loops.
Strip mining transforms a loop
| for (i = 0; i < N; i++)
| S (i);
into the following loop nest:
| for (k = 0; k < N; k += STRIDE)
| for (j = 0; j < STRIDE; j++)
| S (i = k + j);
*/
static bool static bool
lst_do_strip_mine (lst_p lst) lst_do_strip_mine (lst_p lst, int stride)
{ {
int i; int i;
lst_p l; lst_p l;
bool res = false; bool res = false;
int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
int depth; int depth;
if (!stride)
stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE);
if (!lst if (!lst
|| !LST_LOOP_P (lst)) || !LST_LOOP_P (lst))
return false; return false;
FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine (l); res |= lst_do_strip_mine (l, stride);
depth = lst_depth (lst); depth = lst_depth (lst);
if (depth >= 0 if (depth >= 0
&& lst_strip_mine_profitable_p (lst, stride)) && lst_strip_mine_profitable_p (lst, stride))
{ {
res |= lst_do_strip_mine_loop (lst, lst_depth (lst)); res |= lst_do_strip_mine_loop (lst, lst_depth (lst), stride);
lst_add_loop_under_loop (lst); lst_add_loop_under_loop (lst);
} }
...@@ -256,9 +270,9 @@ lst_do_strip_mine (lst_p lst) ...@@ -256,9 +270,9 @@ lst_do_strip_mine (lst_p lst)
have been strip-mined. */ have been strip-mined. */
bool bool
scop_do_strip_mine (scop_p scop) scop_do_strip_mine (scop_p scop, int stride)
{ {
return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop)); return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), stride);
} }
/* Loop blocks all the loops in SCOP. Returns true when we manage to /* Loop blocks all the loops in SCOP. Returns true when we manage to
...@@ -272,7 +286,7 @@ scop_do_block (scop_p scop) ...@@ -272,7 +286,7 @@ scop_do_block (scop_p scop)
store_scattering (scop); store_scattering (scop);
strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop)); strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), 0);
interchanged = scop_do_interchange (scop); interchanged = scop_do_interchange (scop);
/* If we don't interchange loops, the strip mine alone will not be /* If we don't interchange loops, the strip mine alone will not be
......
...@@ -776,7 +776,7 @@ apply_poly_transforms (scop_p scop) ...@@ -776,7 +776,7 @@ apply_poly_transforms (scop_p scop)
else else
{ {
if (flag_loop_strip_mine) if (flag_loop_strip_mine)
transform_done |= scop_do_strip_mine (scop); transform_done |= scop_do_strip_mine (scop, 0);
if (flag_loop_interchange) if (flag_loop_interchange)
transform_done |= scop_do_interchange (scop); transform_done |= scop_do_interchange (scop);
......
...@@ -412,7 +412,7 @@ extern void print_iteration_domains (FILE *, scop_p, int); ...@@ -412,7 +412,7 @@ extern void print_iteration_domains (FILE *, scop_p, int);
extern void debug_iteration_domain (poly_bb_p, int); extern void debug_iteration_domain (poly_bb_p, int);
extern void debug_iteration_domains (scop_p, int); extern void debug_iteration_domains (scop_p, int);
extern bool scop_do_interchange (scop_p); extern bool scop_do_interchange (scop_p);
extern bool scop_do_strip_mine (scop_p); extern bool scop_do_strip_mine (scop_p, int);
extern bool scop_do_block (scop_p); extern bool scop_do_block (scop_p);
extern bool flatten_all_loops (scop_p); extern bool flatten_all_loops (scop_p);
extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t); extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment