[Bug c/39500] New: autopar fails to parallel

2009-03-18 Thread nemokingdom at gmail dot com
autopar fails auto-parallelization with the code below:

int X[1000];

int main(void)
{
  int i;

  for (i = 0; i < 100; i++)
  X[i] = X[i+100];

  return 0;
}


-- 
   Summary: autopar fails to parallel
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nemokingdom at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39500



[Bug c/39500] autopar fails to parallel

2009-03-18 Thread nemokingdom at gmail dot com


--- Comment #1 from nemokingdom at gmail dot com  2009-03-19 01:27 ---
(In reply to comment #0)
> autopar fails auto-parallelization with the code below:
> 
> int X[1000];
> 
> int main(void)
> {
>   int i;
> 
>   for (i = 0; i < 100; i++)
>   X[i] = X[i+100];
> 
>   return 0;
> }
> 
This bug basically about x1 and y1 not allowed to be in between zero and niter
- 1. This seems to be an typical off by one error.

x1 and y1 not allowed to be in between zero and niter - 1. This seems to
be an typical off by one error.

Index: tree-data-ref.c
===
--- tree-data-ref.c (revision 144721)
+++ tree-data-ref.c (working copy)
@@ -2292,7 +2292,7 @@

  /* If the overlap occurs outside of the bounds of the
 loop, there is no dependence.  */
- if (x1 > niter || y1 > niter)
+ if (x1 >= niter || y1 >= niter)
{
  *overlaps_a = conflict_fn_no_dependence ();
  *overlaps_b = conflict_fn_no_dependence ();


-- 

nemokingdom at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39500



[Bug c/39500] autopar fails to parallel

2009-03-18 Thread nemokingdom at gmail dot com


--- Comment #4 from nemokingdom at gmail dot com  2009-03-19 02:46 ---
(In reply to comment #3)
> I will take care of this one.
> 
I add test case for this situation.

Index: testsuite/gcc.dg/autopar/pr39500-1.c
===
--- testsuite/gcc.dg/autopar/pr39500-1.c(revision 0)
+++ testsuite/gcc.dg/autopar/pr39500-1.c(revision 0)
@@ -0,0 +1,29 @@
+/* pr39500: autopar fails to parallel */
+/* origin: nemoking...@gmail.com(LiFeng)*/
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details
-fdump-tree-final_cleanup" } */
+
+void abort (void);
+
+int main(void)
+{
+  int i;
+  int x[100];
+
+  for (i = 0; i < 100; i++)
+  x[i] = x[i+100];
+
+  for (i = 0; i < 100; i++)
+{
+  if (x[i] != x[i+100])
+   abort ();
+}
+
+  return 0;
+}
+
+/* Check that the first loop in parloop got parallelized.  */
+
+/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1
"parloops" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
Index: testsuite/gcc.dg/autopar/pr39500-2.c
===
--- testsuite/gcc.dg/autopar/pr39500-2.c(revision 0)
+++ testsuite/gcc.dg/autopar/pr39500-2.c(revision 0)
@@ -0,0 +1,21 @@
+/* pr39500: autopar fails to parallel */
+/* origin: nemoking...@gmail.com(LiFeng)*/
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details
-fdump-tree-final_cleanup" } */
+
+int main(void)
+{
+  int i;
+  int x[100];
+
+  for (i = 0; i < 101; i++)
+  x[i] = x[i+100];
+
+  return 0;
+}
+
+/* Check that the first loop in parloop got parallelized.  */
+
+/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0
"parloops" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
Index: tree-data-ref.c
===
--- tree-data-ref.c (revision 144648)
+++ tree-data-ref.c (working copy)
@@ -2302,7 +2302,7 @@

  /* If the overlap occurs outside of the bounds of the
 loop, there is no dependence.  */
- if (x1 > niter || y1 > niter)
+ if (x1 >= niter || y1 >= niter)
{
  *overlaps_a = conflict_fn_no_dependence ();
  *overlaps_b = conflict_fn_no_dependence ();


-- 

nemokingdom at gmail dot com changed:

   What|Removed |Added

  Component|middle-end  |c


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39500



[Bug middle-end/39575] New: after build_sese_loop_nests, loops still unordered

2009-03-29 Thread nemokingdom at gmail dot com
in build_sese_loop_nests, the loops in sese->loop_nest can be:
loop3 loop2 loop1(test case: gcc.dg/graphite/block-3.c), after 
the algorithms(sort the loops) there,
it will still unordered as loop2 loop1 loop3.

I'm not sure if this is the bug. but if this bug is confirmed, 
I will take care of this.


-- 
   Summary: after build_sese_loop_nests, loops still unordered
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nemokingdom at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39575



[Bug middle-end/39568] [graphite] Remove GBB_LOOPS

2009-03-30 Thread nemokingdom at gmail dot com


--- Comment #2 from nemokingdom at gmail dot com  2009-03-30 11:30 ---
I test with bootstrap enabled and success.
Here is the patch:

Index: sese.h
===
--- sese.h  (revision 145190)
+++ sese.h  (working copy)
@@ -341,54 +341,6 @@
  CASE_LABEL_EXPR.  */
   VEC (gimple, heap) *conditions;
   VEC (gimple, heap) *condition_cases;
-
-  /* LOOPS contains for every column in the graphite domain the corresponding
- gimple loop.  If there exists no corresponding gimple loop LOOPS contains
- NULL. 
-  
- Example:
-
- Original code:
-
- for (i = 0; i <= 20; i++) 
-   for (j = 5; j <= 10; j++)
- A
-
- Original domain:
-
- |  i >= 0
- |  i <= 20
- |  j >= 0
- |  j <= 10
-
- This is a two dimensional domain with "Loop i" represented in
- dimension 0, and "Loop j" represented in dimension 1.  Original
- loops vector:
-
- | 0 1 
- | Loop iLoop j
-
- After some changes (Exchange i and j, strip-mine i), the domain
- is:
-
- |  i >= 0
- |  i <= 20
- |  j >= 0
- |  j <= 10
- |  ii <= i
- |  ii + 1 >= i 
- |  ii <= 2k
- |  ii >= 2k 
-
- Iterator vector:
- | 012 3
- | Loop j   NULL Loop iNULL
-
- Means the original loop i is now on dimension 2 of the domain and
- loop j in the original loop nest is now on dimension 0.
- Dimensions 1 and 3 represent the newly created loops.  */
-  VEC (loop_p, heap) *loops;
-
   VEC (data_reference_p, heap) *data_refs;
   htab_t cloog_iv_types;
 } *gimple_bb_p;
@@ -397,10 +349,9 @@
 #define GBB_DATA_REFS(GBB) GBB->data_refs
 #define GBB_CONDITIONS(GBB) GBB->conditions
 #define GBB_CONDITION_CASES(GBB) GBB->condition_cases
-#define GBB_LOOPS(GBB) (GBB->loops)
 #define GBB_CLOOG_IV_TYPES(GBB) GBB->cloog_iv_types

-/* Return the loop that contains the basic block GBB.  */
+/* Return the innermost loop that contains the basic block GBB.  */

 static inline struct loop *
 gbb_loop (struct gimple_bb *gbb)
@@ -412,24 +363,26 @@
If there is no corresponding gimple loop, we return NULL.  */

 static inline loop_p
-gbb_loop_at_index (gimple_bb_p gbb, int index)
+gbb_loop_at_index (gimple_bb_p gbb, sese region, int index)
 {
-  return VEC_index (loop_p, GBB_LOOPS (gbb), index);
-}
+  loop_p loop = gbb_loop (gbb);
+  int depth = sese_loop_depth (region, loop);

-/* Returns the index of LOOP in the loop nest around GBB.  */
+  while (--depth > index)
+{
+  loop = loop_outer (loop);
+}

+  gcc_assert (sese_contains_loop (region, loop));
+
+  return loop;
+}
+
+/* Returns the index of LOOP in the region, 0 based index */
 static inline int
-gbb_loop_index (gimple_bb_p gbb, loop_p loop)
+gbb_loop_index (sese region, loop_p loop)
 {
-  int i;
-  loop_p l;
-
-  for (i = 0; VEC_iterate (loop_p, GBB_LOOPS (gbb), i, l); i++)
-if (loop == l)
-  return i;
-
-  gcc_unreachable();
+  return sese_loop_depth (region, loop) - 1;
 }

 /* The number of common loops in REGION for GBB1 and GBB2.  */
Index: graphite-clast-to-gimple.c
===
--- graphite-clast-to-gimple.c  (revision 145190)
+++ graphite-clast-to-gimple.c  (working copy)
@@ -316,6 +316,7 @@
   int index = 0;
   CloogStatement *cs = user_stmt->statement;
   poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+  sese region = SCOP_REGION (PBB_SCOP (pbb));

   for (t = user_stmt->substitutions; t; t = t->next) 
 {
@@ -327,8 +328,8 @@
   if (expr->type == expr_term
  && !term->var)
{
- loop_p loop = gbb_loop_at_index (PBB_BLACK_BOX (pbb), index);
- tree oldiv = oldiv_for_loop (SCOP_REGION (PBB_SCOP (pbb)), loop);
+ loop_p loop = gbb_loop_at_index (PBB_BLACK_BOX (pbb), region, index);
+ tree oldiv = oldiv_for_loop (region, loop);
  tree type = oldiv ? TREE_TYPE (oldiv) : integer_type_node;
  tree value = gmp_cst_to_tree (type, term->val);
  loop_iv_stack_insert_constant (stack, index, value);
@@ -507,7 +508,8 @@
free (*slot);

   new_name = loop_iv_stack_get_iv 
-   (ivstack, gbb_loop_index (PBB_BLACK_BOX (pbb), iv->loop));
+   (ivstack, gbb_loop_index (region, iv->loop));
+  
   *slot = new_rename_map_elt (old_name, new_name);
 }
 }
@@ -685,6 +687,7 @@
 {
   gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
   struct clast_stmt *t;
+  sese region = SCOP_REGION (PBB_SCOP (pbb));
   int index = 0;

   for (t = user_stmt->substitutions; t; t = t->next, index++)
@@ -703,8 +706,8 @@

   if (!*slot)
{
- loop_p loop = gbb_loop_at_index (PBB_BLACK_BOX (pbb), index);
- tree oldiv = oldiv_for_loop (SCOP_REGION (PBB_SCOP (pbb)), loop);
+ loop_p loop = gbb_loop_at_index (

[Bug middle-end/42298] New: GCC fails validity in mdbx in polyhedral benchmark.

2009-12-04 Thread nemokingdom at gmail dot com
t= 0.00 Tolerance=0.100E-11
> Value=0.100E-13 Target= 0.00 Tolerance=0.100E-11
= Value=100 Target=100
> Value=0.2897000 Target=0.2897000 Tolerance=0.500E-03
> Value=-3.341300 Target=-3.341300 Tolerance=0.100E-02
> Value=-3.051700 Target=-3.051700 Tolerance=0.500E-03
> Value= 1.100700 Target= 1.100700 Tolerance=0.100E-02
> Value=0.500E-13 Target= 0.00 Tolerance=0.100E-11
> Value=-.100E-13 Target= 0.00 Tolerance=0.100E-11
> Value=-.300E-13 Target= 0.00 Tolerance=0.100E-11

mdbx FAILED1 fails and   39 passes

 Error executing R/mdbx/ - End of Instruction Stream


-- 
       Summary: GCC fails validity in mdbx in polyhedral benchmark.
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nemokingdom at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42298



[Bug middle-end/42298] GCC fails validity in mdbx in polyhedral benchmark.

2009-12-04 Thread nemokingdom at gmail dot com


--- Comment #1 from nemokingdom at gmail dot com  2009-12-05 07:04 ---
The polyhedral benchmark is available in:
http://www.polyhedron.com/web_images/documents/pb05.zip

> One fail (of 40 checkings) in mdbx in polyhedral benchmark with option -O2
> -fno-loop-block -fno-loop-strip-mine.
> 
> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tr...@155007 
> 
>   $ ../configure --prefix=/home/li/source/gcc.trunk/install 
> --disable-bootstrap
> --enable-languages=c,fortran,c++ --with-cloog=/usr/lib/cloog-0.15.7
> --with-ppl=/usr/lib/ppl-0.10.2
> 
> ## - ##
> ## Platform. ##
> ## - ##
> 
> hostname = laptop
> uname -m = i686
> uname -r = 2.6.27-7-generic
> uname -s = Linux
> 
> 
> 
> Date & Time :  5 Dec 2009 14:42:10
> Test Name   : airgraphite
> Compile Command : /home/li/source/gcc.trunk/install/bin/gfortran -O2
> -fno-loop-block -fno-loop-strip-mine %n.f90 -o %n
> Benchmarks  : -ac -aermod -air -capacita -channel -doduc -fatigue -gas_dyn
> -induct -linpk mdbx -nf -protein -rnflow -test_fpu -tfft
> Maximum Times   :  200.0
> Target Error %  :  0.100
> Minimum Repeats : 2
> Maximum Repeats : 2
> 
>Benchmark   Compile  Executable   Ave Run  Number   Estim
> Name(secs) (bytes)(secs) Repeats   Err %
>-   ---  --   --- ---  --
>  -ac  0.00   0 -1.00  0.
>  -aermod  0.00   0 -1.00  0.
> -air  0.00   0 -1.00  0.
>-capacita  0.00   0 -1.00  0.
> -channel  0.00   0 -1.00  0.
>   -doduc  0.00   0 -1.00  0.
> -fatigue  0.00   0 -1.00  0.
> -gas_dyn  0.00   0 -1.00  0.
>  -induct  0.00   0 -1.00  0.
>   -linpk  0.00   0 -1.00  0.
> mdbx  4.13   40691 18.09   2  1.5863
>  -nf  0.00   0 -1.00   2  1.5863
> -protein  0.00   0 -1.00   2  1.5863
>  -rnflow  0.00   0 -1.00   2  1.5863
>-test_fpu  0.00   0 -1.00   2  1.5863
>-tfft  0.00   0 -1.00   2  1.5863
> 
> Geometric Mean Execution Time =  Infinity  seconds
> 
> 
> Polyhedron Benchmark Validator
> Copyright (C) Polyhedron Software Ltd - 2004 - All rights reserved
> 
> Test File: airgraphite.run
> Instruction File : air_valid.in
> 
> = Value=1000 Target=1000
> > Value=0.2804000 Target=0.270 Tolerance=0.100E-01
> FAIL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > Value=-3.328200 Target=-3.32 Tolerance=0.200E-01
> > Value=-3.047800 Target=-3.045000 Tolerance=0.500E-02
> > Value= 17.45580 Target= 17.1 Tolerance= 1.00
> > Value=-.400E-13 Target= 0.00 Tolerance=0.100E-11
> > Value=-.200E-13 Target= 0.00 Tolerance=0.100E-11
> > Value=-.200E-13 Target= 0.00 Tolerance=0.100E-11
> = Value=100 Target=100
> > Value=0.2962000 Target=0.2962000 Tolerance=0.200E-03
> > Value=-3.344000 Target=-3.344000 Tolerance=0.200E-03
> > Value=-3.047800 Target=-3.047800 Tolerance=0.500E-03
> > Value= 1.001200 Target= 1.001200 Tolerance=0.200E-03
> > Value=0.100E-13 Target= 0.00 Tolerance=0.100E-11
> > Value=-.700E-14 Target= 0.00 Tolerance=0.100E-11
> > Value=0.100E-13 Target= 0.00 Tolerance=0.100E-11
> = Value=100 Target=100
> > Value=0.2962000 Target=0.2962000 Tolerance=0.200E-03
> > Value=-3.344000 Target=-3.344000 Tolerance=0.200E-03
> > Value=-3.047800 Target=-3.047800 Tolerance=0.500E-03
> > Value= 1.001200 Target= 1.001200 Tolerance=0.200E-03
> > Value=-.200E-13 Target= 0.00 Tolerance=0.100E-11
> > Value=0.600E

[Bug middle-end/42298] [4.5 Regression] GCC fails validity in mdbx in polyhedral benchmark.

2009-12-07 Thread nemokingdom at gmail dot com


--- Comment #3 from nemokingdom at gmail dot com  2009-12-07 13:01 ---
Subject: Re:  [4.5 Regression] GCC fails validity in 
mdbx in polyhedral benchmark.

Hi Rguenth,
On Mon, Dec 7, 2009 at 7:14 PM, rguenth at gcc dot gnu dot org
 wrote:
>
>
> --- Comment #2 from rguenth at gcc dot gnu dot org  2009-12-07 11:14 
> ---
> Huh?  Does plain -O2 work?  Do I understand correctly that -O2 -fno-loop-block
> -fno-loop-strip-mine miscompiles?

Em, this benchmark can be compiled, but failed at validity of the benchmark
testing (passed 39 of 40). So I think this caused a runtime error.

-O2 also has this fail. I disable Graphite by -fno-loop-strip-mine
-fno-loop-block.
So I think it's not related to Graphite.

>
> Sebastian, how can disabling graphite options but not enabling graphite
> miscompile anything??  P1, please fix / comment.
>
>
> --
>
> rguenth at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> 
>                 CC|                            |spop at gcc dot gnu dot org
>           Keywords|                            |wrong-code
>           Priority|P3                          |P1
>            Summary|GCC fails validity in mdbx  |[4.5 Regression] GCC fails
>                   |in polyhedral benchmark.    |validity in mdbx in
>                   |                            |polyhedral benchmark.
>   Target Milestone|---                         |4.5.0
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42298
>
> --- You are receiving this mail because: ---
> You reported the bug, or are watching the reporter.
>

Li


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42298