mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 17:11:01 +08:00
Remove interchange heuristic.
2009-08-11 Sebastian Pop <sebastian.pop@amd.com> * graphite-interchange.c (compute_subscript): Removed. (compute_array_size_cstr): Removed. (compute_array_size_poly): Removed. (compute_array_size): Removed. (gather_access_strides_poly): Removed. (gather_access_strides): Empty. From-SVN: r150691
This commit is contained in:
parent
25d7cc15a8
commit
312aea7f99
@ -1,3 +1,12 @@
|
||||
2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
|
||||
|
||||
* graphite-interchange.c (compute_subscript): Removed.
|
||||
(compute_array_size_cstr): Removed.
|
||||
(compute_array_size_poly): Removed.
|
||||
(compute_array_size): Removed.
|
||||
(gather_access_strides_poly): Removed.
|
||||
(gather_access_strides): Empty.
|
||||
|
||||
2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
|
||||
|
||||
* graphite-dependences.c (dependence_polyhedron_1): Replace
|
||||
|
@ -1,3 +1,12 @@
|
||||
2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
|
||||
|
||||
* graphite-interchange.c (compute_subscript): Removed.
|
||||
(compute_array_size_cstr): Removed.
|
||||
(compute_array_size_poly): Removed.
|
||||
(compute_array_size): Removed.
|
||||
(gather_access_strides_poly): Removed.
|
||||
(gather_access_strides): Empty.
|
||||
|
||||
2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
|
||||
|
||||
* graphite-dependences.c (dependence_polyhedron_1): Replace
|
||||
|
@ -53,239 +53,15 @@ along with GCC; see the file COPYING3. If not see
|
||||
#include "graphite.h"
|
||||
#include "graphite-poly.h"
|
||||
|
||||
/* Returns the subscript dimension defined by CSTR in PDR. */
|
||||
|
||||
static ppl_dimension_type
|
||||
compute_subscript (poly_dr_p pdr, ppl_const_Constraint_t cstr)
|
||||
{
|
||||
graphite_dim_t i;
|
||||
ppl_Linear_Expression_t expr;
|
||||
ppl_Coefficient_t coef;
|
||||
Value val;
|
||||
|
||||
value_init (val);
|
||||
ppl_new_Coefficient (&coef);
|
||||
|
||||
for (i = 0; i < pdr_nb_subscripts (pdr); i++)
|
||||
{
|
||||
ppl_dimension_type sub_dim = pdr_subscript_dim (pdr, i);
|
||||
|
||||
ppl_new_Linear_Expression_from_Constraint (&expr, cstr);
|
||||
ppl_Linear_Expression_coefficient (expr, sub_dim, coef);
|
||||
ppl_delete_Linear_Expression (expr);
|
||||
ppl_Coefficient_to_mpz_t (coef, val);
|
||||
|
||||
if (value_notzero_p (val))
|
||||
{
|
||||
gcc_assert (value_one_p (val)
|
||||
|| value_mone_p (val));
|
||||
|
||||
value_clear (val);
|
||||
ppl_delete_Coefficient (coef);
|
||||
return sub_dim;
|
||||
}
|
||||
}
|
||||
|
||||
gcc_unreachable ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
compute_array_size_cstr (ppl_dimension_type sub_dim, Value res,
|
||||
ppl_const_Constraint_t cstr)
|
||||
{
|
||||
ppl_Linear_Expression_t expr;
|
||||
ppl_Coefficient_t coef;
|
||||
Value val;
|
||||
|
||||
value_init (val);
|
||||
ppl_new_Coefficient (&coef);
|
||||
ppl_new_Linear_Expression_from_Constraint (&expr, cstr);
|
||||
ppl_Linear_Expression_coefficient (expr, sub_dim, coef);
|
||||
ppl_Coefficient_to_mpz_t (coef, val);
|
||||
|
||||
value_set_si (res, 0);
|
||||
|
||||
if (value_notzero_p (val))
|
||||
{
|
||||
gcc_assert (value_one_p (val) || value_mone_p (val));
|
||||
ppl_Linear_Expression_inhomogeneous_term (expr, coef);
|
||||
ppl_Coefficient_to_mpz_t (coef, res);
|
||||
value_absolute (res, res);
|
||||
}
|
||||
|
||||
value_clear (val);
|
||||
ppl_delete_Coefficient (coef);
|
||||
ppl_delete_Linear_Expression (expr);
|
||||
}
|
||||
|
||||
/* Returns in ARRAY_SIZE the size in bytes of the array PDR for the
|
||||
subscript at dimension SUB_DIM. */
|
||||
|
||||
static void
|
||||
compute_array_size_poly (poly_dr_p pdr, ppl_dimension_type sub_dim, Value array_size,
|
||||
ppl_const_Polyhedron_t ph)
|
||||
{
|
||||
ppl_const_Constraint_System_t pcs;
|
||||
ppl_Constraint_System_const_iterator_t cit, cend;
|
||||
ppl_const_Constraint_t cstr;
|
||||
Value val;
|
||||
Value res;
|
||||
|
||||
if (sub_dim >= pdr_subscript_dim (pdr, pdr_nb_subscripts (pdr)))
|
||||
{
|
||||
value_set_si (array_size, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
value_init (val);
|
||||
value_init (res);
|
||||
|
||||
value_set_si (res, 0);
|
||||
|
||||
ppl_Polyhedron_get_constraints (ph, &pcs);
|
||||
ppl_new_Constraint_System_const_iterator (&cit);
|
||||
ppl_new_Constraint_System_const_iterator (&cend);
|
||||
|
||||
for (ppl_Constraint_System_begin (pcs, cit),
|
||||
ppl_Constraint_System_end (pcs, cend);
|
||||
!ppl_Constraint_System_const_iterator_equal_test (cit, cend);
|
||||
ppl_Constraint_System_const_iterator_increment (cit))
|
||||
{
|
||||
ppl_Constraint_System_const_iterator_dereference (cit, &cstr);
|
||||
|
||||
if (ppl_Constraint_type (cstr) == PPL_CONSTRAINT_TYPE_EQUAL)
|
||||
continue;
|
||||
|
||||
compute_array_size_cstr (sub_dim, val, cstr);
|
||||
value_max (res, res, val);
|
||||
}
|
||||
|
||||
compute_array_size_poly (pdr, sub_dim + 1, val, ph);
|
||||
value_multiply (array_size, res, val);
|
||||
|
||||
value_clear (res);
|
||||
value_clear (val);
|
||||
}
|
||||
|
||||
/* Initializes ARRAY_SIZE, the size in bytes of the array for the
|
||||
subscript at dimension SUB_DIM in PDR. */
|
||||
|
||||
static void
|
||||
compute_array_size (poly_dr_p pdr, ppl_dimension_type sub_dim, Value array_size)
|
||||
{
|
||||
ppl_Pointset_Powerset_C_Polyhedron_t data_container = PDR_ACCESSES (pdr);
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
|
||||
Value val;
|
||||
|
||||
value_set_si (array_size, 1);
|
||||
if (sub_dim >= pdr_subscript_dim (pdr, pdr_nb_subscripts (pdr)))
|
||||
return;
|
||||
|
||||
value_init (val);
|
||||
ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it);
|
||||
ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end);
|
||||
|
||||
for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (data_container, it),
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_end (data_container, end);
|
||||
!ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end);
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it))
|
||||
{
|
||||
ppl_const_Polyhedron_t ph;
|
||||
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph);
|
||||
compute_array_size_poly (pdr, sub_dim, val, ph);
|
||||
value_max (array_size, array_size, val);
|
||||
}
|
||||
|
||||
value_clear (val);
|
||||
ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it);
|
||||
ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
|
||||
}
|
||||
|
||||
/* Computes ACCESS_STRIDES, the sum of all the strides of PDR at
|
||||
LOOP_DEPTH. */
|
||||
|
||||
static void
|
||||
gather_access_strides_poly (poly_dr_p pdr, ppl_const_Polyhedron_t ph,
|
||||
ppl_dimension_type loop_dim, Value res)
|
||||
gather_access_strides (poly_dr_p pdr ATTRIBUTE_UNUSED,
|
||||
graphite_dim_t loop_depth ATTRIBUTE_UNUSED,
|
||||
Value access_strides ATTRIBUTE_UNUSED)
|
||||
{
|
||||
ppl_const_Constraint_System_t pcs;
|
||||
ppl_Constraint_System_const_iterator_t cit, cend;
|
||||
ppl_const_Constraint_t cstr;
|
||||
ppl_Linear_Expression_t expr;
|
||||
ppl_Coefficient_t coef;
|
||||
Value stride;
|
||||
Value array_size;
|
||||
|
||||
value_init (array_size);
|
||||
value_init (stride);
|
||||
ppl_new_Coefficient (&coef);
|
||||
value_set_si (res, 0);
|
||||
|
||||
ppl_Polyhedron_get_constraints (ph, &pcs);
|
||||
ppl_new_Constraint_System_const_iterator (&cit);
|
||||
ppl_new_Constraint_System_const_iterator (&cend);
|
||||
|
||||
for (ppl_Constraint_System_begin (pcs, cit),
|
||||
ppl_Constraint_System_end (pcs, cend);
|
||||
!ppl_Constraint_System_const_iterator_equal_test (cit, cend);
|
||||
ppl_Constraint_System_const_iterator_increment (cit))
|
||||
{
|
||||
ppl_Constraint_System_const_iterator_dereference (cit, &cstr);
|
||||
ppl_new_Linear_Expression_from_Constraint (&expr, cstr);
|
||||
ppl_Linear_Expression_coefficient (expr, loop_dim, coef);
|
||||
ppl_delete_Linear_Expression (expr);
|
||||
ppl_Coefficient_to_mpz_t (coef, stride);
|
||||
|
||||
if (value_zero_p (stride))
|
||||
continue;
|
||||
|
||||
value_absolute (stride, stride);
|
||||
compute_array_size (pdr, compute_subscript (pdr, cstr), array_size);
|
||||
value_multiply (stride, stride, array_size);
|
||||
value_addto (res, res, stride);
|
||||
}
|
||||
|
||||
value_clear (array_size);
|
||||
value_clear (stride);
|
||||
ppl_delete_Coefficient (coef);
|
||||
ppl_delete_Constraint_System_const_iterator (cit);
|
||||
ppl_delete_Constraint_System_const_iterator (cend);
|
||||
}
|
||||
|
||||
/* Computes ACCESS_STRIDES, the sum of all the strides of PDR at
|
||||
LOOP_DEPTH. */
|
||||
|
||||
static void
|
||||
gather_access_strides (poly_dr_p pdr, graphite_dim_t loop_depth,
|
||||
Value access_strides)
|
||||
{
|
||||
ppl_dimension_type loop_dim = pdr_iterator_dim (pdr, loop_depth);
|
||||
|
||||
ppl_Pointset_Powerset_C_Polyhedron_t accesses = PDR_ACCESSES (pdr);
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
|
||||
Value res;
|
||||
|
||||
value_init (res);
|
||||
ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it);
|
||||
ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end);
|
||||
|
||||
for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (accesses, it),
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_end (accesses, end);
|
||||
!ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end);
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it))
|
||||
{
|
||||
ppl_const_Polyhedron_t ph;
|
||||
|
||||
ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph);
|
||||
gather_access_strides_poly (pdr, ph, loop_dim, res);
|
||||
value_addto (access_strides, access_strides, res);
|
||||
}
|
||||
|
||||
value_clear (res);
|
||||
ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it);
|
||||
ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
|
||||
/* Empty for now. */
|
||||
}
|
||||
|
||||
/* Returns true when it is profitable to interchange loop at depth1
|
||||
|
Loading…
x
Reference in New Issue
Block a user