Commit Graph

282 Commits

Author SHA1 Message Date
Johannes Doerfert a99130f042 [Refactor][NfC] Simplify and clean the handling of (new) access relations
This patch does not change the semantic on it's own. However, the
  dependence analysis as well as dce will now use the newest available
  access relation for each memory access, thus if at some point the json
  importer or any other pass will run before those two and set a new
  access relation the behaviour will be different. In general it is
  unclear if the dependence analysis and dce should be run on the old or
  new access functions anyway. If we need to access the original access
  function from the outside later, we can expose the getter again.

Differential Revision: http://reviews.llvm.org/D5707

llvm-svn: 219612
2014-10-13 12:58:03 +00:00
Johannes Doerfert 731685e6bc Allow the VectorBlockGenerator to use the IslExprBuilder.
This also enables the VectorBlockGenerator to build load store
  accesses according to the newAccessRelation of a MemoryAccess.

llvm-svn: 219321
2014-10-08 17:25:30 +00:00
Johannes Doerfert 4c7ce479ea [Refactor] Rename MemoryAccess::Type as it clashes with llvm::Type
llvm-svn: 219294
2014-10-08 10:11:33 +00:00
Johannes Doerfert 2ef33e9f16 Allow multidimensional accesses in the IslExprBuilder.
This resolved the issues with delinearized accesses that might alias,
  thus delinearization doesn't deactivate runtime alias checks anymore.

Differential Revision: http://reviews.llvm.org/D5614

llvm-svn: 219078
2014-10-05 11:33:59 +00:00
Johannes Doerfert 1a28a8938e Introduce the ScopArrayInfo class.
This class allows to store information about the arrays in the SCoP.
  For each base pointer in the SCoP one object is created storing the
  type and dimension sizes of the array. The objects can be obtained via
  the SCoP, a MemoryAccess or the isl_id associated with the output
  dimension of a MemoryAccess (the description of what is accessed).

  So far we use the information in the IslExprBuilder to create the
  right base type before indexing into the base array. This fixes the
  bug http://llvm.org/bugs/show_bug.cgi?id=21113 (both test cases are
  included). On top of that we can now build runtime alias checks for
  delinearized arrays as the dimension sizes are also part of the
  ScopArrayInfo objects.

Differential Revision: http://reviews.llvm.org/D5613

llvm-svn: 219077
2014-10-05 11:32:18 +00:00
Johannes Doerfert 12b355a2ce [Refactor] Generalize parallel code generation
+ Generalized function names and comments
    + Removed OpenMP (omp) from the names and comments
    + Use common names (non OpenMP specific) for runtime library call creation
      methodes
  + Commented the parallel code generator and all its member functions
  + Refactored some values and methodes

Differential Revision: http://reviews.llvm.org/D4990

llvm-svn: 219003
2014-10-03 19:10:13 +00:00
Johannes Doerfert 51d1c74d78 [Refactor] Rename LoopAnnotator to ScopAnnotator
The LoopAnnotator doesn't annotate only loops any more, thus it is
  called ScopAnnotator from now on.

  This also removes unnecessary polly:: namespace tags.

llvm-svn: 218878
2014-10-02 15:32:17 +00:00
Johannes Doerfert ecdf263c07 Allow to annotate alias scopes in the new SCoP.
The command line flag -polly-annotate-alias-scopes controls whether or not
  Polly annotates alias scopes in the new SCoP (default ON). This can improve
  later optimizations as the new SCoP is basically an alias free environment for
  them.

llvm-svn: 218877
2014-10-02 15:31:24 +00:00
Johannes Doerfert c7b719fc03 Annotate LLVM-IR for all parallel loops
This change allows to annotate all parallel loops with loop id metadata.
  Furthermore, it will annotate memory instructions with
  llvm.mem.parallel_loop_access metadata for all surrounding parallel loops.
  This is especially usefull if an external paralleliser is used.

  This also removes the PollyLoopInfo class and comments the
  LoopAnnotator.

  A test case for multiple parallel loops is attached.

llvm-svn: 218793
2014-10-01 20:10:44 +00:00
Johannes Doerfert 9143d67aba [RTC] Bail if too many parameters are involved in a RTC access.
If too many parameters are involved in accesses used to create RTCs
  we might end up with enormous compile times and RTC expressions.
  The reason is that the lexmin/lexmax is dependent on all these
  parameters and isl might need to create a case for every "ordering"
  of them (e.g., p0 <= p1 <= p2, p1 <= p0 <= p2, ...).

  The exact number of parameters allowed in accesses is defined by the
  command line option -polly-rtc-max-parameters=XXX and set by default
  to 8.

  Differential Revision: http://reviews.llvm.org/D5500

llvm-svn: 218566
2014-09-27 11:02:39 +00:00
Johannes Doerfert b164c795b7 [RTC] Runtime Alias Checks for the ISL backend
This change will build all alias groups (minimal/maximal accesses
  to possible aliasing base pointers) we have to check before
  we can assume an alias free environment. It will also use these
  to create Runtime Alias Checks (RTC) in the ISL code generation
  backend, thus allow us to optimize SCoPs despite possibly aliasing
  pointers when this backend is used.

  This feature will be enabled for the isl code generator, e.g.,
  --polly-code-generator=isl, but disabled for:
    - The cloog code generator (still the default).
    - The case delinearization is enabled.
    - The case non-affine accesses are allowed.

llvm-svn: 218046
2014-09-18 11:17:17 +00:00
Johannes Doerfert dcb5f1dcf6 Allow the IslExprBuilder to build address of expressions
llvm-svn: 218045
2014-09-18 11:14:30 +00:00
Johannes Doerfert 377a620f98 Compute and print the minimal loop carried dependency distance
During the IslAst parallelism check also compute the minimal dependency
  distance and store it in the IstAst for node.

Reviewer: sebpop

Differential Revision: http://reviews.llvm.org/D4987

llvm-svn: 217729
2014-09-13 17:34:11 +00:00
Tobias Grosser 230acc4445 Delinearize _all_ accesses to a multi-dimensional array
Even though we previously correctly detected the multi-dimensional access
pattern for accesses with a certain base address, we only delinearized
non-affine accesses to this address. Affine accesses have not been touched and
remained as single dimensional accesses. The result was an inconsistent
description of accesses to the same array, with some being one dimensional and
some being multi-dimensional.

This patch ensures that all accesses are delinearized with the same
dimensionality as soon as a single one of them has been detected as non-affine.

While writing this patch, it became evident that the options
-polly-allow-nonaffine and -polly-detect-keep-going have not been properly
supported in case delinearization has been turned on. This patch adds relevant
test coverage and addresses these issues as well. We also added some more
documentation to the functions that are modified in this patch.

This fixes llvm.org/PR20123

Differential Revision: http://reviews.llvm.org/D5329

llvm-svn: 217728
2014-09-13 14:47:55 +00:00
Tobias Grosser bcd4efffa7 Check that the elements of an array have the same size
At the moment we assume that only elements of identical size are stored/loaded
to a certain base pointer. This patch adds logic to the scop detection to verify
this.

Differential Revision: http://reviews.llvm.org/D5329

llvm-svn: 217727
2014-09-13 14:47:40 +00:00
Johannes Doerfert 8f7124ceb9 [Polly] Move MAY/MUST write property to IRAccess
Differential Revision: http://reviews.llvm.org/D5223

llvm-svn: 217665
2014-09-12 11:00:49 +00:00
Tobias Grosser ee46b0c8be Remove executable bit on all header files
Some header files had been marked executable by accident.

llvm-svn: 217587
2014-09-11 14:33:36 +00:00
Johannes Doerfert dd5c144246 Allow to generate a loop without the GuardBB
This allows us to omit the GuardBB in front of created loops
  if we can show the loop trip count is at least one. It also
  simplifies the dominance relation inside the new created region.
  A GuardBB (even with a constant branch condition) might trigger
  false dominance errors during function verification.

Differential Revision: http://reviews.llvm.org/D5297

llvm-svn: 217525
2014-09-10 17:33:32 +00:00
Johannes Doerfert 3826224428 [Refactor] Cleanup isl code generation
Summary:
  + Refactor the runtime check (RTC) build function
  + Added helper function to create an PollyIRBuilder
  + Change the simplify region function to create not
    only unique entry and exit edges but also enfore that
    the entry edge is unconditional
  + Cleaned the IslCodeGeneration runOnScop function:
      - less post-creation changes of the created IR
  + Adjusted and added test cases

Reviewers: grosser, sebpop, simbuerg, dpeixott

Subscribers: llvm-commits, #polly

Differential Revision: http://reviews.llvm.org/D5076

llvm-svn: 217508
2014-09-10 14:50:23 +00:00
Tobias Grosser 566ad58fe0 Introduce a typedef for the IDToValue type
llvm-svn: 216843
2014-08-31 16:21:12 +00:00
Andreas Simbuerger 6bf77979e0 Diagnostic: Provide end-user message for non-affine loop bound errors
llvm-svn: 215832
2014-08-17 10:09:15 +00:00
Andreas Simbuerger d46b935267 Diagnostic: Provide end-user message for non-affine access function errors
llvm-svn: 215831
2014-08-17 10:09:11 +00:00
Andreas Simbuerger f29f625748 Diagnostic: Provide end-user message for aliasing errors
This will spill out information about LLVM-internals. However, in cases
where the name of the Value matches the name of the array in the source,
we provide more useful information. In cases where we spill internals,
the information still might help the user to pin down the correct
arrays.
The problem we face here is: The error is pinned to the debug location
of one of the offending values out of the alias set instead of all of them.

The more information we give the user about the set of aliasing
pointers the better.

llvm-svn: 215830
2014-08-17 10:09:07 +00:00
Tobias Grosser 2873594709 Revert "[Refactor] Cleanup runtime code generation"
This reverts commit 215466 (and 215528, a trivial formatting fix).

The intention of these commits is a good one, but unfortunately they broke
our LNT buildbot:

http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-codegen-isl

Several of the cleanup changes that have been combined in this 'fixup' are
trivial and could probably be committed as obvious changes without risking to
break the build. The remaining changes are little and it should be easy to
figure out what went wrong.

llvm-svn: 215817
2014-08-16 09:09:15 +00:00
Andreas Simbuerger 57b469f842 Add print method to RejectLog
llvm-svn: 215627
2014-08-14 08:53:18 +00:00
Andreas Simbuerger ded7fa4439 Cleanup RejectLog code
llvm-svn: 215626
2014-08-14 08:53:15 +00:00
Andreas Simbuerger 05ae147d25 Use a snapshot of the aliasing pointers
Store the llvm::Value pointers of the AliasSet instead of the AliasSet
itself.

We have to be careful about changed IR when the message is generated,
because the Value pointers might not exist anymore. This would render
the Diagnostic invalid. For now we just assert there.

Simply do not retreive a diagnostic message after the IR has changed
it's not valid information anyway.

llvm-svn: 215625
2014-08-14 08:53:12 +00:00
Andreas Simbuerger b0af06f580 Do not assert when trying to replace the log with another log
This usually happens when TempScopInfo calls isMaxRegionInScop(..),
so don't fail there.

llvm-svn: 215624
2014-08-14 08:53:09 +00:00
Tobias Grosser b5c440f33f Fix formatting
llvm-svn: 215570
2014-08-13 19:39:08 +00:00
Johannes Doerfert 5aa2194ea5 [Polly] Remove the PoCC and ScopLib support
Remove the PoCC and ScopLib support from Polly as we do not have a
  user/maintainer for it.

Differential Revision: http://reviews.llvm.org/D4871

llvm-svn: 215563
2014-08-13 17:49:16 +00:00
Johannes Doerfert 9744c4af16 [Refactor] Cleanup runtime code generation
+ Use regexp in two test case.
  + Refactor the runtime condition build function

llvm-svn: 215466
2014-08-12 18:35:54 +00:00
Johannes Doerfert 13c8cf2544 [Refactor] Remove const keyword from access instruction
llvm-svn: 215309
2014-08-10 08:09:38 +00:00
Johannes Doerfert 2ef3f4fd23 Make used analysis passes explicit
Use the explicit analysis if possible, only for splitBlock we will continue
  to use the Pass * argument. This change allows us to remove the getAnalysis
  calls from the code generation.

llvm-svn: 215121
2014-08-07 17:14:54 +00:00
Johannes Doerfert a63b2579c6 Fix the modifiable access creation
+ Remove the class IslGenerator which duplicates the functionality of
    IslExprBuilder.
  + Use the IslExprBuilder to create code for memory access relations.
    + Also handle array types during access creation.
  + Enable scev codegen for one of the transformed memory access tests,
    thus access creation without canonical induction variables available.
  + Update one test case to the new output.

llvm-svn: 214659
2014-08-03 01:51:59 +00:00
Johannes Doerfert ed87831113 Allow the IslExprBuilder to generate access operations
llvm-svn: 214658
2014-08-03 01:50:50 +00:00
Johannes Doerfert 675e6bc43b [Format] Remove blank line in Dependences.h
llvm-svn: 214492
2014-08-01 08:44:49 +00:00
Johannes Doerfert 6f1ee8bec1 [Typo] Added dot at the end of a sentence.
llvm-svn: 214490
2014-08-01 08:18:39 +00:00
Johannes Doerfert dc6ad99aad Annotate the IslAst with broken reductions
+ Split all reduction dependences and map them to the causing memory accesses.
  + Print the types & base addresses of broken reductions for each "reduction
    parallel" marked loop (OpenMP style).
  + 3 test cases to show how reductions are now represented in the isl ast.

  The mapping "(ast) loops -> broken reductions" is also needed to find the
  memory accesses we need to privatize in a loop.

llvm-svn: 214489
2014-08-01 08:17:19 +00:00
Johannes Doerfert 32868bf4c3 Change the printing of reduction types
We use the C operator representation when applicable.

  + Update all the test cases accordingly.

llvm-svn: 214486
2014-08-01 08:13:25 +00:00
Johannes Doerfert 99f6630c82 [Refactor] Remove unecessary check and function
+ Perform the parallelism check on the innermost loop only once.
  + Inline the markOpenmpParallel function.
  + Rename all IslAstUserPayload * into Payload to make it consistent.

llvm-svn: 214448
2014-07-31 21:34:32 +00:00
Johannes Doerfert 0eefb0258f [Refactor] Use nicer print callback function in IslAst
llvm-svn: 214447
2014-07-31 21:33:49 +00:00
Johannes Doerfert 13c5c64b5d [Refactor] Expose the IslExprBuilder (missing files)
llvm-svn: 214220
2014-07-29 21:06:08 +00:00
Johannes Doerfert a261bbc50f [Refactor] Adjust some comments
llvm-svn: 214171
2014-07-29 09:16:55 +00:00
Johannes Doerfert 5d83f09cdd Added base array id's to Memory Accesses
These id's allow us to cread id -> array base value mappings.

llvm-svn: 214169
2014-07-29 08:37:55 +00:00
Johannes Doerfert d9e1dbd376 [Refactor] Use non-const MemoryAccess base addresses
llvm-svn: 214168
2014-07-29 08:36:18 +00:00
Johannes Doerfert 966aa930a5 [Refactor] Adjust some comments
llvm-svn: 214166
2014-07-29 08:35:00 +00:00
Johannes Doerfert 770ec7a72f [Refactor] Remove unused MemoryAccess constructor
llvm-svn: 214165
2014-07-29 08:34:03 +00:00
Johannes Doerfert 515f85770c Replace the dependences parallelism check by the IslAst one
llvm-svn: 214061
2014-07-28 03:46:28 +00:00
Johannes Doerfert a014a98255 [Refactor] Expose the runtime debug builder
llvm-svn: 213908
2014-07-24 23:55:19 +00:00
Johannes Doerfert 79fc23f26b Make getIslCompatibleName globaly available
llvm-svn: 213907
2014-07-24 23:48:02 +00:00