This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [graphite] Add -fgraphite-identity
- From: Jack Howarth <howarth at bromo dot msbb dot uc dot edu>
- To: Tobias Grosser <grosser at fim dot uni-passau dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Sebastian Pop <sebpop at gmail dot com>
- Date: Thu, 23 Oct 2008 12:35:19 -0400
- Subject: Re: [graphite] Add -fgraphite-identity
- References: <1223663206.1370.63.camel@localhost> <1224774591.1256.11.camel@localhost>
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