From 46cdd0c8cd8cb595fd3bac820d05e06072e858ed Mon Sep 17 00:00:00 2001 From: Mircea Namolaru Date: Mon, 17 Nov 2014 23:59:07 +0100 Subject: [PATCH] Support for unroll and jam optimization. From-SVN: r217682 --- gcc/ChangeLog | 8 ++++++++ gcc/doc/invoke.texi | 18 +++++++++++++++++- gcc/graphite-optimize-isl.c | 19 ++++++++++++------- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d936a923fe0..a04b10a3575 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-11-17 Mircea Namolaru + + * doc/invoke.texi (floop-unroll-and-jam): Document + (loop-unroll-jam-size): Likewise. + (loop-unroll-jam-depth): Likewise. + * graphite-optimize-isl.c (getPrevectorMap_full): Modify comment. + (getScheduleForBandList): Replaced unsafe union_map reuse. + 2014-11-17 Andrew Pinski * config/aarch64/thunderx.md: Remove copyright which should not diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 9846a73079d..89edddb4712 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -391,7 +391,8 @@ Objective-C and Objective-C++ Dialects}. -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol -fivopts -fkeep-inline-functions -fkeep-static-consts -flive-range-shrinkage @gol --floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol +-floop-block -floop-interchange -floop-strip-mine @gol +-floop-unroll-and-jam -floop-nest-optimize @gol -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol -flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol @@ -8352,6 +8353,13 @@ optimizer based on the Pluto optimization algorithms. It calculates a loop structure optimized for data-locality and parallelism. This option is experimental. +@item -floop-unroll-and-jam +@opindex floop-unroll-and-jam +Enable unroll and jam for the ISL based loop nest optimizer. The unroll +factor can be changed using the @option{loop-unroll-jam-size} parameter. +The unrolled dimension (counting from the most inner one) can be changed +using the @option{loop-unroll-jam-depth} parameter. . + @item -floop-parallelize-all @opindex floop-parallelize-all Use the Graphite data dependence analysis to identify loops that can @@ -10469,6 +10477,14 @@ loop in the loop nest by a given number of iterations. The strip length can be changed using the @option{loop-block-tile-size} parameter. The default value is 51 iterations. +@item loop-unroll-jam-size +Specify the unroll factor for the @option{-floop-unroll-and-jam}. The +default value is 4. + +@item loop-unroll-jam-depth +Specify the dimension to be unrolled (counting from the most inner loop) +for the @option{-floop-unroll-and-jam}. The default value is 2. + @item ipa-cp-value-list-size IPA-CP attempts to track all possible values and types passed to a function's parameter in order to propagate them and perform devirtualization. diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c index cbab8202244..195101a3572 100644 --- a/gcc/graphite-optimize-isl.c +++ b/gcc/graphite-optimize-isl.c @@ -320,7 +320,7 @@ getPrevectorMap (isl_ctx *ctx, int DimToVectorize, ip >= 0 The image of this map is the separation class. The range of this map includes - all the i that are multiple of 4 in the domain beside the greater one. + all the i multiple of 4 in the domain such as i + 3 is in the domain too. */ static isl_map * @@ -486,20 +486,25 @@ getScheduleForBandList (isl_band_list *BandList, isl_union_map **map_sepcl) } } } - Schedule = isl_union_map_union (Schedule, PartialSchedule); + Schedule = isl_union_map_union (Schedule, + isl_union_map_copy(PartialSchedule)); isl_band_free (Band); isl_space_free (Space); if (!flag_loop_unroll_jam) - continue; + { + isl_union_map_free (PartialSchedule); + continue; + } if (PartialSchedule_f) - *map_sepcl = isl_union_map_union (*map_sepcl, - PartialSchedule_f); + { + *map_sepcl = isl_union_map_union (*map_sepcl, PartialSchedule_f); + isl_union_map_free (PartialSchedule); + } else - *map_sepcl = isl_union_map_union (*map_sepcl, - isl_union_map_copy (PartialSchedule)); + *map_sepcl = isl_union_map_union (*map_sepcl, PartialSchedule); } return Schedule; -- 2.30.2