Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 546752 | Differences between
and this patch

Collapse All | Expand All

(-)gcc-5.2.0.orig/gcc/graphite-dependences.c (-2 / +2 lines)
Lines 110-122 Link Here
110
  return isl_map_intersect_domain (map, s);
110
  return isl_map_intersect_domain (map, s);
111
}
111
}
112
112
113
/* Constrain pdr->accesses with pdr->extent and pbb->domain.  */
113
/* Constrain pdr->accesses with pdr->subscript_sizes and pbb->domain.  */
114
114
115
static isl_map *
115
static isl_map *
116
add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb)
116
add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb)
117
{
117
{
118
  isl_map *x = isl_map_intersect_range (isl_map_copy (pdr->accesses),
118
  isl_map *x = isl_map_intersect_range (isl_map_copy (pdr->accesses),
119
					isl_set_copy (pdr->extent));
119
					isl_set_copy (pdr->subscript_sizes));
120
  x = constrain_domain (x, isl_set_copy (pbb->domain));
120
  x = constrain_domain (x, isl_set_copy (pbb->domain));
121
  return x;
121
  return x;
122
}
122
}
(-)gcc-5.2.0.orig/gcc/graphite-interchange.c (-26 / +29 lines)
Lines 101-137 Link Here
101
static isl_constraint *
101
static isl_constraint *
102
build_linearized_memory_access (isl_map *map, poly_dr_p pdr)
102
build_linearized_memory_access (isl_map *map, poly_dr_p pdr)
103
{
103
{
104
  isl_constraint *res;
105
  isl_local_space *ls = isl_local_space_from_space (isl_map_get_space (map));
104
  isl_local_space *ls = isl_local_space_from_space (isl_map_get_space (map));
106
  unsigned offset, nsubs;
105
  isl_constraint *res = isl_equality_alloc (ls);
107
  int i;
106
  isl_val *size = isl_val_int_from_ui (isl_map_get_ctx (map), 1);
108
  isl_ctx *ctx;
109
107
110
  isl_val *size, *subsize, *size1;
108
  unsigned nsubs = isl_set_dim (pdr->subscript_sizes, isl_dim_set);
111
112
  res = isl_equality_alloc (ls);
113
  ctx = isl_local_space_get_ctx (ls);
114
  size = isl_val_int_from_ui (ctx, 1);
115
116
  nsubs = isl_set_dim (pdr->extent, isl_dim_set);
117
  /* -1 for the already included L dimension.  */
109
  /* -1 for the already included L dimension.  */
118
  offset = isl_map_dim (map, isl_dim_out) - 1 - nsubs;
110
  unsigned offset = isl_map_dim (map, isl_dim_out) - 1 - nsubs;
119
  res = isl_constraint_set_coefficient_si (res, isl_dim_out, offset + nsubs, -1);
111
  res = isl_constraint_set_coefficient_si (res, isl_dim_out, offset + nsubs, -1);
120
  /* Go through all subscripts from last to first.  First dimension
112
  /* Go through all subscripts from last to first.  The dimension "i=0"
121
     is the alias set, ignore it.  */
113
     is the alias set, ignore it.  */
122
  for (i = nsubs - 1; i >= 1; i--)
114
  for (int i = nsubs - 1; i >= 1; i--)
123
    {
115
    {
124
      isl_space *dc;
116
      isl_aff *extract_dim;
125
      isl_aff *aff;
117
      res = isl_constraint_set_coefficient_val (res, isl_dim_out, offset + i,
126
118
						isl_val_copy (size));
127
      size1 = isl_val_copy (size);
119
      isl_space *dc = isl_set_get_space (pdr->subscript_sizes);
128
      res = isl_constraint_set_coefficient_val (res, isl_dim_out, offset + i, size);
120
      extract_dim = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
129
      dc = isl_set_get_space (pdr->extent);
121
      extract_dim = isl_aff_set_coefficient_si (extract_dim, isl_dim_in, i, 1);
130
      aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
122
      isl_val *max = isl_set_max_val (pdr->subscript_sizes, extract_dim);
131
      aff = isl_aff_set_coefficient_si (aff, isl_dim_in, i, 1);
123
      isl_aff_free (extract_dim);
132
      subsize = isl_set_max_val (pdr->extent, aff);
124
133
      isl_aff_free (aff);
125
      /* The result is NULL in case of an error, the optimal value in case there
134
      size = isl_val_mul (size1, subsize);
126
	 is one, negative infinity or infinity if the problem is unbounded and
127
	 NaN if the problem is empty.  */
128
      gcc_assert (max);
129
130
      /* When one of the dimensions cannot be computed, we cannot build the size
131
	 of the array for any outer dimensions.  */
132
      if (!isl_val_is_int (max))
133
	{
134
	  isl_val_free (max);
135
	  break;
136
	}
137
      size = isl_val_mul (size, max);
135
    }
138
    }
136
139
137
  isl_val_free (size);
140
  isl_val_free (size);
Lines 198-204 Link Here
198
201
199
  /* pdr->accesses:    [P1..nb_param,I1..nb_domain]->[a,S1..nb_subscript]
202
  /* pdr->accesses:    [P1..nb_param,I1..nb_domain]->[a,S1..nb_subscript]
200
          ??? [P] not used for PDRs?
203
          ??? [P] not used for PDRs?
201
     pdr->extent:      [a,S1..nb_subscript]
204
     pdr->subscript_sizes:      [a,S1..nb_subscript]
202
     pbb->domain:      [P1..nb_param,I1..nb_domain]
205
     pbb->domain:      [P1..nb_param,I1..nb_domain]
203
     pbb->transformed: [P1..nb_param,I1..nb_domain]->[T1..Tnb_sctr]
206
     pbb->transformed: [P1..nb_param,I1..nb_domain]->[T1..Tnb_sctr]
204
          [T] includes local vars (currently unused)
207
          [T] includes local vars (currently unused)
(-)gcc-5.2.0.orig/gcc/graphite-poly.c (-3 / +3 lines)
Lines 294-300 Link Here
294
void
294
void
295
new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
295
new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
296
	     enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts,
296
	     enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts,
297
	     isl_map *acc, isl_set *extent)
297
	     isl_map *acc, isl_set *subscript_sizes)
298
{
298
{
299
  static int id = 0;
299
  static int id = 0;
300
  poly_dr_p pdr = XNEW (struct poly_dr);
300
  poly_dr_p pdr = XNEW (struct poly_dr);
Lines 304-310 Link Here
304
  PDR_NB_REFS (pdr) = 1;
304
  PDR_NB_REFS (pdr) = 1;
305
  PDR_PBB (pdr) = pbb;
305
  PDR_PBB (pdr) = pbb;
306
  pdr->accesses = acc;
306
  pdr->accesses = acc;
307
  pdr->extent = extent;
307
  pdr->subscript_sizes = subscript_sizes;
308
  PDR_TYPE (pdr) = type;
308
  PDR_TYPE (pdr) = type;
309
  PDR_CDR (pdr) = cdr;
309
  PDR_CDR (pdr) = cdr;
310
  PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts;
310
  PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts;
Lines 317-323 Link Here
317
free_poly_dr (poly_dr_p pdr)
317
free_poly_dr (poly_dr_p pdr)
318
{
318
{
319
  isl_map_free (pdr->accesses);
319
  isl_map_free (pdr->accesses);
320
  isl_set_free (pdr->extent);
320
  isl_set_free (pdr->subscript_sizes);
321
  XDELETE (pdr);
321
  XDELETE (pdr);
322
}
322
}
323
323
(-)gcc-5.2.0.orig/gcc/graphite-poly.h (-1 / +1 lines)
Lines 175-181 Link Here
175
175
176
     In the example, the vector "R C O I L P" is "7 7 3 2 0 1".  */
176
     In the example, the vector "R C O I L P" is "7 7 3 2 0 1".  */
177
  isl_map *accesses;
177
  isl_map *accesses;
178
  isl_set *extent;
178
  isl_set *subscript_sizes;
179
179
180
  /* Data reference's base object set number, we must assure 2 pdrs are in the
180
  /* Data reference's base object set number, we must assure 2 pdrs are in the
181
     same base object set before dependency checking.  */
181
     same base object set before dependency checking.  */
(-)gcc-5.2.0.orig/gcc/graphite-scop-detection.c (-6 / +16 lines)
Lines 314-320 Link Here
314
			     gimple stmt)
314
			     gimple stmt)
315
{
315
{
316
  data_reference_p dr;
316
  data_reference_p dr;
317
  unsigned i;
318
  int j;
317
  int j;
319
  bool res = true;
318
  bool res = true;
320
  vec<data_reference_p> drs = vNULL;
319
  vec<data_reference_p> drs = vNULL;
Lines 327-344 Link Here
327
					     stmt, &drs);
326
					     stmt, &drs);
328
327
329
      FOR_EACH_VEC_ELT (drs, j, dr)
328
      FOR_EACH_VEC_ELT (drs, j, dr)
330
	for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
329
	{
331
	  if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i)))
330
	  int nb_subscripts = DR_NUM_DIMENSIONS (dr);
331
	  tree ref = DR_REF (dr);
332
333
	  for (int i = nb_subscripts - 1; i >= 0; i--)
332
	    {
334
	    {
333
	      res = false;
335
	      if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
334
	      goto done;
336
		  || (TREE_CODE (ref) != ARRAY_REF
337
		      && TREE_CODE (ref) != MEM_REF
338
		      && TREE_CODE (ref) != COMPONENT_REF))
339
		{
340
		  free_data_refs (drs);
341
		  return false;
342
		}
343
344
	      ref = TREE_OPERAND (ref, 0);
335
	    }
345
	    }
346
	}
336
347
337
      free_data_refs (drs);
348
      free_data_refs (drs);
338
      drs.create (0);
349
      drs.create (0);
339
    }
350
    }
340
351
341
 done:
342
  free_data_refs (drs);
352
  free_data_refs (drs);
343
  return res;
353
  return res;
344
}
354
}
(-)gcc-5.2.0.orig/gcc/graphite-scop-detection.h (-1 / +1 lines)
Lines 23-29 Link Here
23
#define GCC_GRAPHITE_SCOP_DETECTION_H
23
#define GCC_GRAPHITE_SCOP_DETECTION_H
24
24
25
extern void build_scops (vec<scop_p> *);
25
extern void build_scops (vec<scop_p> *);
26
extern void dot_all_scops (vec<scop_p> );
26
extern void dot_all_scops (vec<scop_p>);
27
extern void dot_scop (scop_p);
27
extern void dot_scop (scop_p);
28
28
29
#endif /* GCC_GRAPHITE_SCOP_DETECTION_H */
29
#endif /* GCC_GRAPHITE_SCOP_DETECTION_H */
(-)gcc-5.2.0.orig/gcc/graphite-sese-to-poly.c (-28 / +26 lines)
Lines 537-542 Link Here
537
	      (isl_local_space_from_space (isl_map_get_space (pbb->schedule)));
537
	      (isl_local_space_from_space (isl_map_get_space (pbb->schedule)));
538
538
539
	  val = isl_aff_get_coefficient_val (static_sched, isl_dim_in, i / 2);
539
	  val = isl_aff_get_coefficient_val (static_sched, isl_dim_in, i / 2);
540
	  gcc_assert (val && isl_val_is_int (val));
540
541
541
	  val = isl_val_neg (val);
542
	  val = isl_val_neg (val);
542
	  c = isl_constraint_set_constant_val (c, val);
543
	  c = isl_constraint_set_constant_val (c, val);
Lines 759-772 Link Here
759
760
760
/* Compute pwaff mod 2^width.  */
761
/* Compute pwaff mod 2^width.  */
761
762
762
extern isl_ctx *the_isl_ctx;
763
764
static isl_pw_aff *
763
static isl_pw_aff *
765
wrap (isl_pw_aff *pwaff, unsigned width)
764
wrap (isl_pw_aff *pwaff, unsigned width)
766
{
765
{
767
  isl_val *mod;
766
  isl_val *mod;
768
767
769
  mod = isl_val_int_from_ui(the_isl_ctx, width);
768
  mod = isl_val_int_from_ui (isl_pw_aff_get_ctx (pwaff), width);
770
  mod = isl_val_2exp (mod);
769
  mod = isl_val_2exp (mod);
771
  pwaff = isl_pw_aff_mod_val (pwaff, mod);
770
  pwaff = isl_pw_aff_mod_val (pwaff, mod);
772
771
Lines 1045-1051 Link Here
1045
	  (isl_local_space_from_space (isl_space_copy (space)));
1044
	  (isl_local_space_from_space (isl_space_copy (space)));
1046
      c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
1045
      c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
1047
      tree_int_to_gmp (nb_iters, g);
1046
      tree_int_to_gmp (nb_iters, g);
1048
      v = isl_val_int_from_gmp (the_isl_ctx, g);
1047
      v = isl_val_int_from_gmp (scop->ctx, g);
1049
      c = isl_constraint_set_constant_val (c, v);
1048
      c = isl_constraint_set_constant_val (c, v);
1050
      inner = isl_set_add_constraint (inner, c);
1049
      inner = isl_set_add_constraint (inner, c);
1051
    }
1050
    }
Lines 1100-1106 Link Here
1100
	  c = isl_inequality_alloc
1099
	  c = isl_inequality_alloc
1101
	      (isl_local_space_from_space (isl_space_copy (space)));
1100
	      (isl_local_space_from_space (isl_space_copy (space)));
1102
	  c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
1101
	  c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
1103
	  v = isl_val_int_from_gmp (the_isl_ctx, g);
1102
	  v = isl_val_int_from_gmp (scop->ctx, g);
1104
	  mpz_clear (g);
1103
	  mpz_clear (g);
1105
	  c = isl_constraint_set_constant_val (c, v);
1104
	  c = isl_constraint_set_constant_val (c, v);
1106
	  inner = isl_set_add_constraint (inner, c);
1105
	  inner = isl_set_add_constraint (inner, c);
Lines 1364-1370 Link Here
1364
      c = isl_inequality_alloc (isl_local_space_from_space (space));
1363
      c = isl_inequality_alloc (isl_local_space_from_space (space));
1365
      mpz_init (g);
1364
      mpz_init (g);
1366
      tree_int_to_gmp (lb, g);
1365
      tree_int_to_gmp (lb, g);
1367
      v = isl_val_int_from_gmp (the_isl_ctx, g);
1366
      v = isl_val_int_from_gmp (scop->ctx, g);
1368
      v = isl_val_neg (v);
1367
      v = isl_val_neg (v);
1369
      mpz_clear (g);
1368
      mpz_clear (g);
1370
      c = isl_constraint_set_constant_val (c, v);
1369
      c = isl_constraint_set_constant_val (c, v);
Lines 1384-1390 Link Here
1384
1383
1385
      mpz_init (g);
1384
      mpz_init (g);
1386
      tree_int_to_gmp (ub, g);
1385
      tree_int_to_gmp (ub, g);
1387
      v = isl_val_int_from_gmp (the_isl_ctx, g);
1386
      v = isl_val_int_from_gmp (scop->ctx, g);
1388
      mpz_clear (g);
1387
      mpz_clear (g);
1389
      c = isl_constraint_set_constant_val (c, v);
1388
      c = isl_constraint_set_constant_val (c, v);
1390
      c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1);
1389
      c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1);
Lines 1520-1539 Link Here
1520
   domain.  */
1519
   domain.  */
1521
1520
1522
static isl_set *
1521
static isl_set *
1523
pdr_add_data_dimensions (isl_set *extent, scop_p scop, data_reference_p dr)
1522
pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
1523
			 data_reference_p dr)
1524
{
1524
{
1525
  tree ref = DR_REF (dr);
1525
  tree ref = DR_REF (dr);
1526
  int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
1527
1526
1528
  for (i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0))
1527
  int nb_subscripts = DR_NUM_DIMENSIONS (dr);
1528
  for (int i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0))
1529
    {
1529
    {
1530
      tree low, high;
1531
1532
      if (TREE_CODE (ref) != ARRAY_REF)
1530
      if (TREE_CODE (ref) != ARRAY_REF)
1533
	break;
1531
	return subscript_sizes;
1534
1532
1535
      low = array_ref_low_bound (ref);
1533
      tree low = array_ref_low_bound (ref);
1536
      high = array_ref_up_bound (ref);
1534
      tree high = array_ref_up_bound (ref);
1537
1535
1538
      /* XXX The PPL code dealt separately with
1536
      /* XXX The PPL code dealt separately with
1539
         subscript - low >= 0 and high - subscript >= 0 in case one of
1537
         subscript - low >= 0 and high - subscript >= 0 in case one of
Lines 1551-1560 Link Here
1551
	  isl_aff *aff;
1549
	  isl_aff *aff;
1552
	  isl_set *univ, *lbs, *ubs;
1550
	  isl_set *univ, *lbs, *ubs;
1553
	  isl_pw_aff *index;
1551
	  isl_pw_aff *index;
1554
	  isl_space *space;
1555
	  isl_set *valid;
1552
	  isl_set *valid;
1556
	  isl_pw_aff *lb = extract_affine_int (low, isl_set_get_space (extent));
1553
	  isl_space *space = isl_set_get_space (subscript_sizes);
1557
	  isl_pw_aff *ub = extract_affine_int (high, isl_set_get_space (extent));
1554
	  isl_pw_aff *lb = extract_affine_int (low, isl_space_copy (space));
1555
	  isl_pw_aff *ub = extract_affine_int (high, isl_space_copy (space));
1558
1556
1559
	  /* high >= 0 */
1557
	  /* high >= 0 */
1560
	  valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (ub));
1558
	  valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (ub));
Lines 1562-1586 Link Here
1562
				       isl_set_dim (valid, isl_dim_set));
1560
				       isl_set_dim (valid, isl_dim_set));
1563
	  scop->context = isl_set_intersect (scop->context, valid);
1561
	  scop->context = isl_set_intersect (scop->context, valid);
1564
1562
1565
	  space = isl_set_get_space (extent);
1566
	  aff = isl_aff_zero_on_domain (isl_local_space_from_space (space));
1563
	  aff = isl_aff_zero_on_domain (isl_local_space_from_space (space));
1567
	  aff = isl_aff_add_coefficient_si (aff, isl_dim_in, i + 1, 1);
1564
	  aff = isl_aff_add_coefficient_si (aff, isl_dim_in, i + 1, 1);
1568
	  univ = isl_set_universe (isl_space_domain (isl_aff_get_space (aff)));
1565
	  univ = isl_set_universe (isl_space_domain (isl_aff_get_space (aff)));
1569
	  index = isl_pw_aff_alloc (univ, aff);
1566
	  index = isl_pw_aff_alloc (univ, aff);
1570
1567
1571
	  id = isl_set_get_tuple_id (extent);
1568
	  id = isl_set_get_tuple_id (subscript_sizes);
1572
	  lb = isl_pw_aff_set_tuple_id (lb, isl_dim_in, isl_id_copy (id));
1569
	  lb = isl_pw_aff_set_tuple_id (lb, isl_dim_in, isl_id_copy (id));
1573
	  ub = isl_pw_aff_set_tuple_id (ub, isl_dim_in, id);
1570
	  ub = isl_pw_aff_set_tuple_id (ub, isl_dim_in, id);
1574
1571
1575
	  /* low <= sub_i <= high */
1572
	  /* low <= sub_i <= high */
1576
	  lbs = isl_pw_aff_ge_set (isl_pw_aff_copy (index), lb);
1573
	  lbs = isl_pw_aff_ge_set (isl_pw_aff_copy (index), lb);
1577
	  ubs = isl_pw_aff_le_set (index, ub);
1574
	  ubs = isl_pw_aff_le_set (index, ub);
1578
	  extent = isl_set_intersect (extent, lbs);
1575
	  subscript_sizes = isl_set_intersect (subscript_sizes, lbs);
1579
	  extent = isl_set_intersect (extent, ubs);
1576
	  subscript_sizes = isl_set_intersect (subscript_sizes, ubs);
1580
	}
1577
	}
1581
    }
1578
    }
1582
1579
1583
  return extent;
1580
  return subscript_sizes;
1584
}
1581
}
1585
1582
1586
/* Build data accesses for DR in PBB.  */
1583
/* Build data accesses for DR in PBB.  */
Lines 1590-1596 Link Here
1590
{
1587
{
1591
  int dr_base_object_set;
1588
  int dr_base_object_set;
1592
  isl_map *acc;
1589
  isl_map *acc;
1593
  isl_set *extent;
1590
  isl_set *subscript_sizes;
1594
  scop_p scop = PBB_SCOP (pbb);
1591
  scop_p scop = PBB_SCOP (pbb);
1595
1592
1596
  {
1593
  {
Lines 1617-1625 Link Here
1617
      alias_set_num = *(bap->alias_set);
1614
      alias_set_num = *(bap->alias_set);
1618
1615
1619
    space = isl_space_set_tuple_id (space, isl_dim_set, id);
1616
    space = isl_space_set_tuple_id (space, isl_dim_set, id);
1620
    extent = isl_set_nat_universe (space);
1617
    subscript_sizes = isl_set_nat_universe (space);
1621
    extent = isl_set_fix_si (extent, isl_dim_set, 0, alias_set_num);
1618
    subscript_sizes = isl_set_fix_si (subscript_sizes, isl_dim_set, 0,
1622
    extent = pdr_add_data_dimensions (extent, scop, dr);
1619
				      alias_set_num);
1620
    subscript_sizes = pdr_add_data_dimensions (subscript_sizes, scop, dr);
1623
  }
1621
  }
1624
1622
1625
  gcc_assert (dr->aux);
1623
  gcc_assert (dr->aux);
Lines 1627-1633 Link Here
1627
1625
1628
  new_poly_dr (pbb, dr_base_object_set,
1626
  new_poly_dr (pbb, dr_base_object_set,
1629
	       DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
1627
	       DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
1630
	       dr, DR_NUM_DIMENSIONS (dr), acc, extent);
1628
	       dr, DR_NUM_DIMENSIONS (dr), acc, subscript_sizes);
1631
}
1629
}
1632
1630
1633
/* Write to FILE the alias graph of data references in DIMACS format.  */
1631
/* Write to FILE the alias graph of data references in DIMACS format.  */

Return to bug 546752