On Sat, 2008-10-11 at 23:19 +0200, Richard Guenther wrote: > On Sat, Oct 11, 2008 at 11:13 PM, Sebastian Pop <[EMAIL PROTECTED]> wrote: > > On Sat, Oct 11, 2008 at 6:46 AM, Richard Guenther > > <[EMAIL PROTECTED]> 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
2008-09-11 Tobias Grosser <[EMAIL PROTECTED]> * 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 [EMAIL PROTECTED] @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. [EMAIL PROTECTED] -floop-interchange -Perform loop interchange transformations on loops. Interchanging two -nested loops switches the inner and outer loops. For example, given a -loop like: [EMAIL PROTECTED] -DO J = 1, M - DO I = 1, N - A(J, I) = A(J, I) * C - ENDDO -ENDDO [EMAIL PROTECTED] smallexample -loop interchange will transform the loop as if the user had written: [EMAIL PROTECTED] -DO I = 1, N - DO J = 1, M - A(J, I) = A(J, I) * C - ENDDO -ENDDO [EMAIL PROTECTED] 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. - [EMAIL PROTECTED] -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: [EMAIL PROTECTED] -DO I = 1, N - A(I) = A(I) + C -ENDDO [EMAIL PROTECTED] smallexample -loop strip mining will transform the loop as if the user had written: [EMAIL PROTECTED] -DO II = 1, N, 4 - DO I = II, min (II + 3, N) - A(I) = A(I) + C - ENDDO -ENDDO [EMAIL PROTECTED] smallexample -This optimization applies to all the languages supported by GCC and is -not limited to Fortran. - [EMAIL PROTECTED] -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: [EMAIL PROTECTED] -DO I = 1, N - DO J = 1, M - A(J, I) = B(I) + C(J) - ENDDO -ENDDO [EMAIL PROTECTED] smallexample -loop blocking will transform the loop as if the user had written: [EMAIL PROTECTED] -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 [EMAIL PROTECTED] 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;