* [graphite] Add -fgraphite-identity / Solution two
[not found] <1223663206.1370.63.camel@localhost>
@ 2008-10-11 2:48 ` Tobias Grosser
[not found] ` <48EFC9C7.6020504@inria.fr>
2008-10-23 17:10 ` [graphite] Add -fgraphite-identity Tobias Grosser
2 siblings, 0 replies; 11+ messages in thread
From: Tobias Grosser @ 2008-10-11 2:48 UTC (permalink / raw)
To: GCC; +Cc: GCC Patches, Sebastian Pop
[-- Attachment #1: Type: text/plain, Size: 820 bytes --]
Hi,
I would like to add a new command line parameter for graphite. It will
allow us to test graphite without any transformation like loop blocking,
but only using a simple GIMPLE->GRAPHITE->GIMPLE identity
transformation.
Buy adding this command line option, we do not change the behavior of
any other part of graphite or gcc, but gain the possibility to debug,
test and check the performance of the graphite front/backend without the
noise of additional transformations.
Also we can check the backend for every possible SCoP and not only for
SCoPs, that we can transform using loop blocking.
This should make debugging of the current bug reports easier and allows
us to set up nightly tests testing the complete front and backend.
This patch implements solution two of the recent discussion at gcc@.
See you
Tobi
[-- Attachment #2: graphite-Insert_flag_identity-2008-10.10.patch --]
[-- Type: text/x-patch, Size: 4275 bytes --]
2008-10-10 Tobias Grosser <grosser@fim.uni-passau.de>
* doc/invoke.texi: Add -fgraphite-identity.
* graphite.c (graphite_apply_transformations): Check for
-fgraphite-identity.
* toplev.c: (process_options): Add flag_graphite_identity.
* tree-ssa-loop.c: Add flag_graphite_identity.
diff --git a/gcc/common.opt b/gcc/common.opt
index 6f09dfd..4e68067 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -567,6 +567,10 @@ floop-block
Common Report Var(flag_loop_block) Optimization
Enable Loop Blocking transformation
+fgraphite-identity
+Common Report Var(flag_graphite_identity) Optimization
+Enable Graphite Identity transformation
+
fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 755c422..4fcf975 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -340,7 +340,7 @@ Objective-C and Objective-C++ Dialects}.
-fira-coalesce -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
--floop-block -floop-interchange -floop-strip-mine @gol
+-floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
-fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
@@ -6116,6 +6116,13 @@ because the innermost loop will iterate over a smaller amount of data
that can be kept in the caches. This optimization applies to all the
languages supported by GCC and is not limited to Fortran.
+@item -fgraphite-identity
+@opindex fgraphite-identity
+Enable the identity transformation for graphite. For every SCoP we generate
+the polyhedral representation and transform it back to gimple. Using
+-fgraphite-identity we can check the costs or benefits of the
+GIMPLE -> GRAPHITE -> GIMPLE transformation.
+
@item -fcheck-data-deps
@opindex fcheck-data-deps
Compare the results of several data dependence analyzers. This option
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a615e2c..ab386d7 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -4912,17 +4912,13 @@ graphite_apply_transformations (scop_p scop)
if (flag_loop_block)
transform_done = graphite_trans_scop_block (scop);
-#if 0 && ENABLE_CHECKING
- /* When the compiler is configured with ENABLE_CHECKING, always
- generate code, even if we did not apply any transformation. This
- provides better code coverage of the backend code generator.
-
- This also allows to check the performance for an identity
- transform: GIMPLE -> GRAPHITE -> GIMPLE; and the output of CLooG
- is never an identity: if CLooG optimizations are not disabled,
- the CLooG output is always optimized in control flow. */
- transform_done = true;
-#endif
+ /* Generate code, even if we did not apply any real transformation.
+ This also allows to check the performance for the identity
+ transformation: GIMPLE -> GRAPHITE -> GIMPLE
+ Keep in mind, that CLooG optimizes in control, so the loop structure
+ may change, even if we only use -fgraphite-identity. */
+ if (flag_graphite_identity)
+ transform_done = true;
return transform_done;
}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 24e4df7..42ad2a4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1707,7 +1707,8 @@ process_options (void)
if (flag_graphite
|| flag_loop_block
|| flag_loop_interchange
- || flag_loop_strip_mine)
+ || flag_loop_strip_mine
+ || flag_graphite_identity)
sorry ("Graphite loop optimizations cannot be used");
#endif
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 51fc07c..2ea58f6 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -305,7 +305,8 @@ gate_graphite_transforms (void)
{
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
- if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine)
+ if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine
+ || flag_graphite_identity)
flag_graphite = 1;
return flag_graphite != 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Cleanup of command line parameters [PATCH]
[not found] ` <84fc9c000810111419h3f231334m7806ac7cea9c5bec@mail.gmail.com>
@ 2008-10-12 4:06 ` Tobias Grosser
2008-10-12 12:44 ` Tobias Burnus
2008-10-12 4:20 ` Tobias Grosser
1 sibling, 1 reply; 11+ messages in thread
From: Tobias Grosser @ 2008-10-12 4:06 UTC (permalink / raw)
To: Richard Guenther; +Cc: Sebastian Pop, Albert Cohen, GCC, GCC Patches
On Sat, 2008-10-11 at 23:19 +0200, Richard Guenther wrote:
> On Sat, Oct 11, 2008 at 11:13 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> > On Sat, Oct 11, 2008 at 6:46 AM, Richard Guenther
> > <richard.guenther@gmail.com> wrote:
> >> Note that we cannot really remove switches from the user, but we have to at
> >> least keep them as no-op for backward compatibility. Which is why I would
> >> like you to think twice at least as to what options you want to add for 4.4.
> >> As a rule of thumb, do not add (or at least document) options that are not
> >> useful for users of GCC but only developers of GCC. Maybe you can add a
> >> glob for debugging options with -fdebug-graphite-XXX instead?
> >>
> >
> > We can enable the -fgraphite-* flags only when ENABLE_CHECKING is defined,
> > such that these are disabled in the released compilers.
>
> I think that you can keep them enabled without ENABLE_CHECKING. But I suggest
> to remove user-level documentation of them (documentation in common.opt comments
> should be enough).
Hi,
another patch. It contains:
- Removal of documentation outside of common.opts for (-fgraphite,
-floop-block, -floop-interchange, -floop-strip-mine)
This means doc/invoke.texi.
(Proposed by Richi)
- Removal of flag "-floop-strip-mine", as it never will improve
performance and so there will be no use for it.
(Proposed by Harsha)
- Rename of -floop-block to -fgraphite-block and -floop-interchange to
-fgraphite-interchange.
(Proposed by Albert)
- Add of -fgraphite-identity.
(Proposed by Tobias (me), solution 2 selected by Harsha y Sebastian)
- Add warning as -fgraphite-interchange is not yet implemented.
(Tobias (me))
So the graphite command line flags are not available any more in the
user documentation, but can be used to test/debug the graphite code.
What flags exist?
-fgraphite: Graphite without code generation.
Useful for frontend testing.
-fgraphite-identity: The identity transformation.
Useful for backend testing without
transformation.
-fgraphite-block: Loop blocking.
Useful for checking available performance
improvements with loop blocking
-fgraphite-interchange: Loop interchange (unimplemented).
Useful for checking available performance
improvements with loop interchange.
Later I would like to be -fgraphite the automatic optimizer.
See you
Tobi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Cleanup of command line parameters [PATCH]
[not found] ` <84fc9c000810111419h3f231334m7806ac7cea9c5bec@mail.gmail.com>
2008-10-12 4:06 ` [graphite] Cleanup of command line parameters [PATCH] Tobias Grosser
@ 2008-10-12 4:20 ` Tobias Grosser
1 sibling, 0 replies; 11+ messages in thread
From: Tobias Grosser @ 2008-10-12 4:20 UTC (permalink / raw)
To: Richard Guenther; +Cc: Sebastian Pop, Albert Cohen, GCC, GCC Patches
[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]
On Sat, 2008-10-11 at 23:19 +0200, Richard Guenther wrote:
> On Sat, Oct 11, 2008 at 11:13 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> > On Sat, Oct 11, 2008 at 6:46 AM, Richard Guenther
> > <richard.guenther@gmail.com> wrote:
> >> Note that we cannot really remove switches from the user, but we have to at
> >> least keep them as no-op for backward compatibility. Which is why I would
> >> like you to think twice at least as to what options you want to add for 4.4.
> >> As a rule of thumb, do not add (or at least document) options that are not
> >> useful for users of GCC but only developers of GCC. Maybe you can add a
> >> glob for debugging options with -fdebug-graphite-XXX instead?
> >>
> >
> > We can enable the -fgraphite-* flags only when ENABLE_CHECKING is defined,
> > such that these are disabled in the released compilers.
>
> I think that you can keep them enabled without ENABLE_CHECKING. But I suggest
> to remove user-level documentation of them (documentation in common.opt comments
> should be enough).
Hi,
another patch. It contains:
- Removal of documentation outside of common.opts for (-fgraphite,
-floop-block, -floop-interchange, -floop-strip-mine)
This means doc/invoke.texi.
(Proposed by Richi)
- Removal of flag "-floop-strip-mine", as it never will improve
performance and so there will be no use for it.
(Proposed by Harsha)
- Rename of -floop-block to -fgraphite-block and -floop-interchange to
-fgraphite-interchange.
(Proposed by Albert)
- Add of -fgraphite-identity.
(Proposed by Tobias (me), solution 2 selected by Harsha y Sebastian)
- Add warning as -fgraphite-interchange is not yet implemented.
(Tobias (me))
So the graphite command line flags are not available any more in the
user documentation, but can be used to test/debug the graphite code.
What flags exist?
-fgraphite: Graphite without code generation.
Useful for frontend testing.
-fgraphite-identity: The identity transformation.
Useful for backend testing without
transformation.
-fgraphite-block: Loop blocking.
Useful for checking available performance
improvements with loop blocking
-fgraphite-interchange: Loop interchange (unimplemented).
Useful for checking available performance
improvements with loop interchange.
Later I would like to be -fgraphite the automatic optimizer.
See you
Tobi
[-- Attachment #2: graphite-command_line_cleanup-2008-10-11.patch --]
[-- Type: text/x-patch, Size: 11605 bytes --]
2008-09-11 Tobias Grosser <grosser@fim.uni-passau.de>
* common.opt: Remove floop-strip-mine. Rename floop-block to
fgraphite-block, floop-interchange to fgraphite-interchange.
Add fgraphite-identity.
* doc/invoke.texi: Remove documentation for fgraphite*
* graphite.c: (graphite_apply_transformations): Add support for
fgraphite-identity.
* toplev.c (process_options): Rename flags. Add flage_graphite_identity.
Add "fgraphite-interchange is unimplemented" message.
* tree-ssa-loop.c (gate_graphite_transforms): Update flags.
* testsuite/gcc.dg/graphite/block-0.c: Update flags.
* testsuite/gcc.dg/graphite/block-1.c: Update flags.
* testsuite/gcc.dg/graphite/scop-16.c: Update flags.
* testsuite/gcc.dg/graphite/scop-17.c: Update flags.
* testsuite/gcc.dg/graphite/scop-18.c: Update flags.
* testsuite/gfortran.dg/graphite/block-1.f90: Update flags.
* testsuite/gfortran.dg/graphite/block-2.f: Update flags.
* testsuite/gfortran.dg/graphite/block-3.f90: Update flags.
* testsuite/gfortran.dg/graphite/block-4.f90: Update flags.
diff --git a/gcc/common.opt b/gcc/common.opt
index 6f09dfd..e5f26ae 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -555,17 +555,17 @@ fgraphite
Common Report Var(flag_graphite)
Enable in and out of Graphite representation
-floop-strip-mine
-Common Report Var(flag_loop_strip_mine) Optimization
-Enable Loop Strip Mining transformation
+fgraphite-interchange
+Common Report Var(flag_graphite_interchange) Optimization
+Enable Graphite Loop Interchange transformation
-floop-interchange
-Common Report Var(flag_loop_interchange) Optimization
-Enable Loop Interchange transformation
+fgraphite-block
+Common Report Var(flag_graphite_block) Optimization
+Enable Graphite Loop Blocking transformation
-floop-block
-Common Report Var(flag_loop_block) Optimization
-Enable Loop Blocking transformation
+fgraphite-identity
+Common Report Var(flag_graphite_identity) Optimization
+Enable Graphite Identity transformation
fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 755c422..7420b8f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -340,7 +340,6 @@ Objective-C and Objective-C++ Dialects}.
-fira-coalesce -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
--floop-block -floop-interchange -floop-strip-mine @gol
-fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
@@ -6041,81 +6040,6 @@ at @option{-O} and higher.
Perform linear loop transformations on tree. This flag can improve cache
performance and allow further loop optimizations to take place.
-@item -floop-interchange
-Perform loop interchange transformations on loops. Interchanging two
-nested loops switches the inner and outer loops. For example, given a
-loop like:
-@smallexample
-DO J = 1, M
- DO I = 1, N
- A(J, I) = A(J, I) * C
- ENDDO
-ENDDO
-@end smallexample
-loop interchange will transform the loop as if the user had written:
-@smallexample
-DO I = 1, N
- DO J = 1, M
- A(J, I) = A(J, I) * C
- ENDDO
-ENDDO
-@end smallexample
-which can be beneficial when @code{N} is larger than the caches,
-because in Fortran, the elements of an array are stored in memory
-contiguously by column, and the original loop iterates over rows,
-potentially creating at each access a cache miss. This optimization
-applies to all the languages supported by GCC and is not limited to
-Fortran.
-
-@item -floop-strip-mine
-Perform loop strip mining transformations on loops. Strip mining
-splits a loop into two nested loops. The outer loop has strides
-equal to the strip size and the inner loop has strides of the
-original loop within a strip. For example, given a loop like:
-@smallexample
-DO I = 1, N
- A(I) = A(I) + C
-ENDDO
-@end smallexample
-loop strip mining will transform the loop as if the user had written:
-@smallexample
-DO II = 1, N, 4
- DO I = II, min (II + 3, N)
- A(I) = A(I) + C
- ENDDO
-ENDDO
-@end smallexample
-This optimization applies to all the languages supported by GCC and is
-not limited to Fortran.
-
-@item -floop-block
-Perform loop blocking transformations on loops. Blocking strip mines
-each loop in the loop nest such that the memory accesses of the
-element loops fit inside caches. For example, given a loop like:
-@smallexample
-DO I = 1, N
- DO J = 1, M
- A(J, I) = B(I) + C(J)
- ENDDO
-ENDDO
-@end smallexample
-loop blocking will transform the loop as if the user had written:
-@smallexample
-DO II = 1, N, 64
- DO JJ = 1, M, 64
- DO I = II, min (II + 63, N)
- DO J = JJ, min (JJ + 63, M)
- A(J, I) = B(I) + C(J)
- ENDDO
- ENDDO
- ENDDO
-ENDDO
-@end smallexample
-which can be beneficial when @code{M} is larger than the caches,
-because the innermost loop will iterate over a smaller amount of data
-that can be kept in the caches. This optimization applies to all the
-languages supported by GCC and is not limited to Fortran.
-
@item -fcheck-data-deps
@opindex fcheck-data-deps
Compare the results of several data dependence analyzers. This option
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a615e2c..322db17 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -4909,20 +4909,16 @@ graphite_apply_transformations (scop_p scop)
graphite_sort_gbbs (scop);
scop_remove_ignoreable_gbbs (scop);
- if (flag_loop_block)
+ if (flag_graphite_block)
transform_done = graphite_trans_scop_block (scop);
-#if 0 && ENABLE_CHECKING
- /* When the compiler is configured with ENABLE_CHECKING, always
- generate code, even if we did not apply any transformation. This
- provides better code coverage of the backend code generator.
-
- This also allows to check the performance for an identity
- transform: GIMPLE -> GRAPHITE -> GIMPLE; and the output of CLooG
- is never an identity: if CLooG optimizations are not disabled,
- the CLooG output is always optimized in control flow. */
- transform_done = true;
-#endif
+ /* Generate code, even if we did not apply any real transformation.
+ This also allows to check the performance for the identity
+ transformation: GIMPLE -> GRAPHITE -> GIMPLE
+ Keep in mind, that CLooG optimizes in control, so the loop structure
+ may change, even if we only use -fgraphite-identity. */
+ if (flag_graphite_identity)
+ transform_done = true;
return transform_done;
}
diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c
index f277f05..d3aac6b 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-0.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O -fgraphite-block -fdump-tree-graphite-all" } */
#define N 1000
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index 039b974..2305722 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" } */
#define MAX 8192
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-16.c b/gcc/testsuite/gcc.dg/graphite/scop-16.c
index 42f7b6a..03e6a58 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-16.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-16.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" } */
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-17.c b/gcc/testsuite/gcc.dg/graphite/scop-17.c
index 4c1b0ca..04da58c 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-17.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-17.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" } */
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-18.c b/gcc/testsuite/gcc.dg/graphite/scop-18.c
index fe2d5f4..b4286c8 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-18.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-18.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" } */
#define N 24
#define M 1000
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-1.f90 b/gcc/testsuite/gfortran.dg/graphite/block-1.f90
index 124f06d..5740f12 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-1.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-1.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
+! { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-2.f b/gcc/testsuite/gfortran.dg/graphite/block-2.f
index af966ec..5bfbca2 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-2.f
+++ b/gcc/testsuite/gfortran.dg/graphite/block-2.f
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
+! { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" }
SUBROUTINE MATRIX_MUL_UNROLLED (A, B, C, L, M, N)
DIMENSION A(L,M), B(M,N), C(L,N)
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-3.f90 b/gcc/testsuite/gfortran.dg/graphite/block-3.f90
index c7809d3..6117a99 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-3.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
+! { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-4.f90 b/gcc/testsuite/gfortran.dg/graphite/block-4.f90
index 586a777..bb20688 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-4.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-4.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
+! { dg-options "-O2 -fgraphite-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 24e4df7..365270c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1705,12 +1705,15 @@ process_options (void)
#ifndef HAVE_cloog
if (flag_graphite
- || flag_loop_block
- || flag_loop_interchange
- || flag_loop_strip_mine)
+ || flag_graphite_block
+ || flag_graphite_interchange
+ || flag_graphite_identity)
sorry ("Graphite loop optimizations cannot be used");
#endif
+ if (flag_graphite_interchange)
+ sorry ("Flag not yet implemented");
+
/* Unrolling all loops implies that standard loop unrolling must also
be done. */
if (flag_unroll_all_loops)
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 51fc07c..b372164 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -305,7 +305,8 @@ gate_graphite_transforms (void)
{
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
- if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine)
+ if (flag_graphite_block || flag_graphite_interchange
+ || flag_graphite_identity)
flag_graphite = 1;
return flag_graphite != 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Cleanup of command line parameters [PATCH]
2008-10-12 4:06 ` [graphite] Cleanup of command line parameters [PATCH] Tobias Grosser
@ 2008-10-12 12:44 ` Tobias Burnus
2008-10-12 14:25 ` Tobias Grosser
0 siblings, 1 reply; 11+ messages in thread
From: Tobias Burnus @ 2008-10-12 12:44 UTC (permalink / raw)
To: Tobias Grosser
Cc: Richard Guenther, Sebastian Pop, Albert Cohen, GCC, GCC Patches
Hi,
Tobias Grosser wrote:
> another patch. It contains:
>
> - Removal of documentation outside of common.opts for (-fgraphite,
> -floop-block, -floop-interchange, -floop-strip-mine)
> This means doc/invoke.texi.
> (Proposed by Richi)
While I agree that -fgraphite does not make sense as user option, I'm
not sure about -floop-block and -floop-interchange. I could imagine that
some users would like to play with this option (though I have no real
opinion about this).
> - Removal of flag "-floop-strip-mine", as it never will improve
> performance and so there will be no use for it.
> (Proposed by Harsha)
I might have misunderstood Harsha, but I think he said that it only does
not improve the performance if used by itself, i.e. combined with other
options it is/might be profitable. Thus one may leave it in as
undocumented option. (I have no opinion about this and I did no tests, I
only wanted to stress the "by itself".)
In any case, those changes should also be documented at
http://gcc.gnu.org/gcc-4.4/changes.html, which currently lists all options.
Tobias B
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Cleanup of command line parameters [PATCH]
2008-10-12 12:44 ` Tobias Burnus
@ 2008-10-12 14:25 ` Tobias Grosser
0 siblings, 0 replies; 11+ messages in thread
From: Tobias Grosser @ 2008-10-12 14:25 UTC (permalink / raw)
To: Tobias Burnus
Cc: Richard Guenther, Sebastian Pop, Albert Cohen, GCC, GCC Patches
Hi,
On Sun, 2008-10-12 at 13:19 +0200, Tobias Burnus wrote:
> Hi,
>
> Tobias Grosser wrote:
> > another patch. It contains:
> >
> > - Removal of documentation outside of common.opts for (-fgraphite,
> > -floop-block, -floop-interchange, -floop-strip-mine)
> > This means doc/invoke.texi.
> > (Proposed by Richi)
>
> While I agree that -fgraphite does not make sense as user option, I'm
> not sure about -floop-block and -floop-interchange. I could imagine that
> some users would like to play with this option (though I have no real
> opinion about this).
The problem I see is, that these options are for me like intermediate
demonstration options, as graphite should get an automatic optimizer. So
I am not sure what to do. I see these options:
1. Keep them until we have these optimizer:
Here we have the problem what to do after that. We could simply ignore
them or we make them like hints to allow the optimizer trying specific
transformations. But I think, it may not even be possible to try to
disable specific optimizations in all cases while using the polytop
model.
So we may have options just used in one or two releases.
2. Keep them like the -fgraphite options hidden, but allow interested
user to try graphite. So we get interested testers, but do not have to
keep these - maybe later misleading - options forever.
>
> > - Removal of flag "-floop-strip-mine", as it never will improve
> > performance and so there will be no use for it.
> > (Proposed by Harsha)
>
> I might have misunderstood Harsha, but I think he said that it only does
> not improve the performance if used by itself, i.e. combined with other
> options it is/might be profitable. Thus one may leave it in as
> undocumented option. (I have no opinion about this and I did no tests, I
> only wanted to stress the "by itself".)
No I am quite sure, we do not need this flag. Yes you are right strip
mining can help combined with loop interchange to improve performance.
But this is -floop-block and already available.
>
> In any case, those changes should also be documented at
> http://gcc.gnu.org/gcc-4.4/changes.html, which currently lists all options.
>
> Tobias B
Thanks for your comments and please correct me, if I said something
wrong/could say something better. I am quite new to the gcc development
so every hint is appreciated.
see you
Tobias
^ permalink raw reply [flat|nested] 11+ messages in thread
* [graphite] Add -fgraphite-identity
[not found] <1223663206.1370.63.camel@localhost>
2008-10-11 2:48 ` [graphite] Add -fgraphite-identity / Solution two Tobias Grosser
[not found] ` <48EFC9C7.6020504@inria.fr>
@ 2008-10-23 17:10 ` Tobias Grosser
2008-10-23 18:30 ` Sebastian Pop
2008-10-23 20:10 ` Jack Howarth
2 siblings, 2 replies; 11+ messages in thread
From: Tobias Grosser @ 2008-10-23 17:10 UTC (permalink / raw)
To: GCC Patches; +Cc: Sebastian Pop
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
Hi,
after testing "-fgraphite-identity" in the graphite branch for a week, I
would like to add it to trunk.
This patch contains only the addition of "-fgraphite-identity".
What is "-fgraphite-identity"?
"-fgraphite-identity" allows us to test graphite without any
optimizations enabled. So we can just check the GIMPLE->GRAPHITE->GIMPLE
identity transformation.
Benefits:
- Easier debugging/testing of front and backend, without any
optimizations changing the test results.
- The backend can be exposed to more code, so we more test cases
for the backend.
Because of this, we will use it in the planned nightly tests.
See you
Tobi
[-- Attachment #2: graphite-Insert_flag_identity-2008-10.10.patch --]
[-- Type: text/x-patch, Size: 4275 bytes --]
2008-10-10 Tobias Grosser <grosser@fim.uni-passau.de>
* doc/invoke.texi: Add -fgraphite-identity.
* graphite.c (graphite_apply_transformations): Check for
-fgraphite-identity.
* toplev.c: (process_options): Add flag_graphite_identity.
* tree-ssa-loop.c: Add flag_graphite_identity.
diff --git a/gcc/common.opt b/gcc/common.opt
index 6f09dfd..4e68067 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -567,6 +567,10 @@ floop-block
Common Report Var(flag_loop_block) Optimization
Enable Loop Blocking transformation
+fgraphite-identity
+Common Report Var(flag_graphite_identity) Optimization
+Enable Graphite Identity transformation
+
fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 755c422..4fcf975 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -340,7 +340,7 @@ Objective-C and Objective-C++ Dialects}.
-fira-coalesce -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
--floop-block -floop-interchange -floop-strip-mine @gol
+-floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
-fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
@@ -6116,6 +6116,13 @@ because the innermost loop will iterate over a smaller amount of data
that can be kept in the caches. This optimization applies to all the
languages supported by GCC and is not limited to Fortran.
+@item -fgraphite-identity
+@opindex fgraphite-identity
+Enable the identity transformation for graphite. For every SCoP we generate
+the polyhedral representation and transform it back to gimple. Using
+-fgraphite-identity we can check the costs or benefits of the
+GIMPLE -> GRAPHITE -> GIMPLE transformation.
+
@item -fcheck-data-deps
@opindex fcheck-data-deps
Compare the results of several data dependence analyzers. This option
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a615e2c..ab386d7 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -4912,17 +4912,13 @@ graphite_apply_transformations (scop_p scop)
if (flag_loop_block)
transform_done = graphite_trans_scop_block (scop);
-#if 0 && ENABLE_CHECKING
- /* When the compiler is configured with ENABLE_CHECKING, always
- generate code, even if we did not apply any transformation. This
- provides better code coverage of the backend code generator.
-
- This also allows to check the performance for an identity
- transform: GIMPLE -> GRAPHITE -> GIMPLE; and the output of CLooG
- is never an identity: if CLooG optimizations are not disabled,
- the CLooG output is always optimized in control flow. */
- transform_done = true;
-#endif
+ /* Generate code, even if we did not apply any real transformation.
+ This also allows to check the performance for the identity
+ transformation: GIMPLE -> GRAPHITE -> GIMPLE
+ Keep in mind, that CLooG optimizes in control, so the loop structure
+ may change, even if we only use -fgraphite-identity. */
+ if (flag_graphite_identity)
+ transform_done = true;
return transform_done;
}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 24e4df7..42ad2a4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1707,7 +1707,8 @@ process_options (void)
if (flag_graphite
|| flag_loop_block
|| flag_loop_interchange
- || flag_loop_strip_mine)
+ || flag_loop_strip_mine
+ || flag_graphite_identity)
sorry ("Graphite loop optimizations cannot be used");
#endif
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 51fc07c..2ea58f6 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -305,7 +305,8 @@ gate_graphite_transforms (void)
{
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
- if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine)
+ if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine
+ || flag_graphite_identity)
flag_graphite = 1;
return flag_graphite != 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Add -fgraphite-identity
2008-10-23 17:10 ` [graphite] Add -fgraphite-identity Tobias Grosser
@ 2008-10-23 18:30 ` Sebastian Pop
2008-10-23 19:31 ` Andreas Schwab
2008-10-23 20:49 ` Jack Howarth
2008-10-23 20:10 ` Jack Howarth
1 sibling, 2 replies; 11+ messages in thread
From: Sebastian Pop @ 2008-10-23 18:30 UTC (permalink / raw)
To: Tobias Grosser; +Cc: GCC Patches
> * doc/invoke.texi: Add -fgraphite-identity.
> +Enable the identity transformation for graphite. For every SCoP we generate
> +the polyhedral representation and transform it back to gimple. Using
> +-fgraphite-identity we can check the costs or benefits of the
> +GIMPLE -> GRAPHITE -> GIMPLE transformation.
Please remove this from the patch that you propose for mainline. Also
please correct in the graphite branch the documentation formatting:
"dot space space".
> + /* Generate code, even if we did not apply any real transformation.
s/Generate code, even/Generate code even/
s/did not apply/did not applied/
> + Keep in mind, that CLooG optimizes in control, so the loop structure
s/Keep in mind, that/Keep in mind that/
The patch looks good. Please apply after these corrections.
Thanks,
Sebastian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Add -fgraphite-identity
2008-10-23 18:30 ` Sebastian Pop
@ 2008-10-23 19:31 ` Andreas Schwab
2008-10-23 20:49 ` Jack Howarth
1 sibling, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2008-10-23 19:31 UTC (permalink / raw)
To: Sebastian Pop; +Cc: Tobias Grosser, GCC Patches
"Sebastian Pop" <sebpop@gmail.com> writes:
> s/did not apply/did not applied/
The original looks correct.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Add -fgraphite-identity
2008-10-23 17:10 ` [graphite] Add -fgraphite-identity Tobias Grosser
2008-10-23 18:30 ` Sebastian Pop
@ 2008-10-23 20:10 ` Jack Howarth
1 sibling, 0 replies; 11+ messages in thread
From: Jack Howarth @ 2008-10-23 20:10 UTC (permalink / raw)
To: Tobias Grosser; +Cc: GCC Patches, Sebastian Pop
On Thu, Oct 23, 2008 at 01:09:51PM -0200, Tobias Grosser wrote:
> Hi,
>
> after testing "-fgraphite-identity" in the graphite branch for a week, I
> would like to add it to trunk.
>
> This patch contains only the addition of "-fgraphite-identity".
>
> What is "-fgraphite-identity"?
> "-fgraphite-identity" allows us to test graphite without any
> optimizations enabled. So we can just check the GIMPLE->GRAPHITE->GIMPLE
> identity transformation.
>
> Benefits:
> - Easier debugging/testing of front and backend, without any
> optimizations changing the test results.
> - The backend can be exposed to more code, so we more test cases
> for the backend.
>
> Because of this, we will use it in the planned nightly tests.
>
> See you
> Tobi
>
>
> 2008-10-10 Tobias Grosser <grosser@fim.uni-passau.de>
>
> * doc/invoke.texi: Add -fgraphite-identity.
> * graphite.c (graphite_apply_transformations): Check for
> -fgraphite-identity.
> * toplev.c: (process_options): Add flag_graphite_identity.
> * tree-ssa-loop.c: Add flag_graphite_identity.
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 6f09dfd..4e68067 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -567,6 +567,10 @@ floop-block
> Common Report Var(flag_loop_block) Optimization
> Enable Loop Blocking transformation
>
> +fgraphite-identity
> +Common Report Var(flag_graphite_identity) Optimization
> +Enable Graphite Identity transformation
> +
> fguess-branch-probability
> Common Report Var(flag_guess_branch_prob) Optimization
> Enable guessing of branch probabilities
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 755c422..4fcf975 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -340,7 +340,7 @@ Objective-C and Objective-C++ Dialects}.
> -fira-coalesce -fno-ira-share-save-slots @gol
> -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
> -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
> --floop-block -floop-interchange -floop-strip-mine @gol
> +-floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
> -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
> -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
> -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
> @@ -6116,6 +6116,13 @@ because the innermost loop will iterate over a smaller amount of data
> that can be kept in the caches. This optimization applies to all the
> languages supported by GCC and is not limited to Fortran.
>
> +@item -fgraphite-identity
> +@opindex fgraphite-identity
> +Enable the identity transformation for graphite. For every SCoP we generate
> +the polyhedral representation and transform it back to gimple. Using
> +-fgraphite-identity we can check the costs or benefits of the
> +GIMPLE -> GRAPHITE -> GIMPLE transformation.
> +
> @item -fcheck-data-deps
> @opindex fcheck-data-deps
> Compare the results of several data dependence analyzers. This option
> diff --git a/gcc/graphite.c b/gcc/graphite.c
> index a615e2c..ab386d7 100644
> --- a/gcc/graphite.c
> +++ b/gcc/graphite.c
> @@ -4912,17 +4912,13 @@ graphite_apply_transformations (scop_p scop)
> if (flag_loop_block)
> transform_done = graphite_trans_scop_block (scop);
>
> -#if 0 && ENABLE_CHECKING
> - /* When the compiler is configured with ENABLE_CHECKING, always
> - generate code, even if we did not apply any transformation. This
> - provides better code coverage of the backend code generator.
> -
> - This also allows to check the performance for an identity
> - transform: GIMPLE -> GRAPHITE -> GIMPLE; and the output of CLooG
> - is never an identity: if CLooG optimizations are not disabled,
> - the CLooG output is always optimized in control flow. */
> - transform_done = true;
> -#endif
> + /* Generate code, even if we did not apply any real transformation.
> + This also allows to check the performance for the identity
> + transformation: GIMPLE -> GRAPHITE -> GIMPLE
> + Keep in mind, that CLooG optimizes in control, so the loop structure
> + may change, even if we only use -fgraphite-identity. */
> + if (flag_graphite_identity)
> + transform_done = true;
>
> return transform_done;
> }
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 24e4df7..42ad2a4 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -1707,7 +1707,8 @@ process_options (void)
> if (flag_graphite
> || flag_loop_block
> || flag_loop_interchange
> - || flag_loop_strip_mine)
> + || flag_loop_strip_mine
> + || flag_graphite_identity)
> sorry ("Graphite loop optimizations cannot be used");
> #endif
>
> diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
> index 51fc07c..2ea58f6 100644
> --- a/gcc/tree-ssa-loop.c
> +++ b/gcc/tree-ssa-loop.c
> @@ -305,7 +305,8 @@ gate_graphite_transforms (void)
> {
> /* Enable -fgraphite pass if any one of the graphite optimization flags
> is turned on. */
> - if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine)
> + if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine
> + || flag_graphite_identity)
> flag_graphite = 1;
>
> return flag_graphite != 0;
Tobias,
The -fgraphite-identity option does generate code though from the
GIMPLE->GRAPHITE->GIMPLE transformations, right? Also, I thought it was
said that these transformations might improve the ability of GIMPLE to
optimize loops. Is that a correct assumption?
Jack
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Add -fgraphite-identity
2008-10-23 18:30 ` Sebastian Pop
2008-10-23 19:31 ` Andreas Schwab
@ 2008-10-23 20:49 ` Jack Howarth
2008-10-23 20:52 ` Sebastian Pop
1 sibling, 1 reply; 11+ messages in thread
From: Jack Howarth @ 2008-10-23 20:49 UTC (permalink / raw)
To: Sebastian Pop; +Cc: Tobias Grosser, GCC Patches
On Thu, Oct 23, 2008 at 10:56:11AM -0500, Sebastian Pop wrote:
> > * doc/invoke.texi: Add -fgraphite-identity.
> > +Enable the identity transformation for graphite. For every SCoP we generate
> > +the polyhedral representation and transform it back to gimple. Using
> > +-fgraphite-identity we can check the costs or benefits of the
> > +GIMPLE -> GRAPHITE -> GIMPLE transformation.
>
> Please remove this from the patch that you propose for mainline. Also
> please correct in the graphite branch the documentation formatting:
> "dot space space".
>
> > + /* Generate code, even if we did not apply any real transformation.
>
> s/Generate code, even/Generate code even/
> s/did not apply/did not applied/
>
> > + Keep in mind, that CLooG optimizes in control, so the loop structure
>
> s/Keep in mind, that/Keep in mind that/
>
>
> The patch looks good. Please apply after these corrections.
>
> Thanks,
> Sebastian
Sebastian,
Do you plan on moving the fix...
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00902.html
into gcc trunk soon? Can that be applied by itself to trunk?
I ask because I ran into a bunch of these irreducible errors
while compiling pymol with -fgraphite.
Jack
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [graphite] Add -fgraphite-identity
2008-10-23 20:49 ` Jack Howarth
@ 2008-10-23 20:52 ` Sebastian Pop
0 siblings, 0 replies; 11+ messages in thread
From: Sebastian Pop @ 2008-10-23 20:52 UTC (permalink / raw)
To: Jack Howarth; +Cc: Tobias Grosser, GCC Patches
On Thu, Oct 23, 2008 at 11:42 AM, Jack Howarth
<howarth@bromo.msbb.uc.edu> wrote:
> Do you plan on moving the fix...
>
> http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00902.html
>
> into gcc trunk soon? Can that be applied by itself to trunk?
I did not had time to look over this problem yet, though I will give
it a try by end of today. The patch at that link is not correct, and
it produces other problems, so I reverted it from the graphite branch.
The fix should be to set the irreducible loop flags in the block_split
function.
Sebastian
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-10-23 17:10 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1223663206.1370.63.camel@localhost>
2008-10-11 2:48 ` [graphite] Add -fgraphite-identity / Solution two Tobias Grosser
[not found] ` <48EFC9C7.6020504@inria.fr>
[not found] ` <84fc9c000810110446h24576e7dq95b7aa1a85dabc99@mail.gmail.com>
[not found] ` <cb9d34b20810111413x5f0d2e8aj1dac49a45d27f260@mail.gmail.com>
[not found] ` <84fc9c000810111419h3f231334m7806ac7cea9c5bec@mail.gmail.com>
2008-10-12 4:06 ` [graphite] Cleanup of command line parameters [PATCH] Tobias Grosser
2008-10-12 12:44 ` Tobias Burnus
2008-10-12 14:25 ` Tobias Grosser
2008-10-12 4:20 ` Tobias Grosser
2008-10-23 17:10 ` [graphite] Add -fgraphite-identity Tobias Grosser
2008-10-23 18:30 ` Sebastian Pop
2008-10-23 19:31 ` Andreas Schwab
2008-10-23 20:49 ` Jack Howarth
2008-10-23 20:52 ` Sebastian Pop
2008-10-23 20:10 ` Jack Howarth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).