Commit Graph

1063 Commits

Author SHA1 Message Date
Johannes Doerfert af9b1e2d80 [Refactor] Remove containsLoop to find innermost loops
Use the fact that if we visit a for node first in pre and next in post order
  we know we did not visit any children, thus we found an innermost loop.

  + Test case for an innermost loop with a conditional inside

llvm-svn: 213870
2014-07-24 15:59:06 +00:00
Johannes Doerfert 94d908216b [Fix] Typo during refactoring
llvm-svn: 213795
2014-07-23 20:26:25 +00:00
Johannes Doerfert c4968e508b [Refactor] IslAst and payload struct
+ Renamed context into build when it's the isl_ast_build
  + Use the IslAstInfo functions to extract the schedule of a node
  + Use the IslAstInfo functions to extract the build/context of a node
  + Move the payload struct into the IslAstInfo class
  + Use a constructor and destructor (also new and delete) to
    allocate/initialize the payload struct

llvm-svn: 213792
2014-07-23 20:17:28 +00:00
Johannes Doerfert f6583176ab [Refactor] Unify IslAst print methods
+ Add const annotations to some member functions

llvm-svn: 213779
2014-07-23 18:14:43 +00:00
Bill Wendling 03074dd83e Update formatting with clang-format.
llvm-svn: 213468
2014-07-20 05:28:52 +00:00
Matt Arsenault 8ca36815ee Update for RegionInfo changes.
Mostly related to missing includes and renaming of
the pass to RegionInfoPass.

llvm-svn: 213457
2014-07-19 18:40:17 +00:00
Johannes Doerfert 6e81905ece [Refactor] Move code out of the IslAst header
Offer the static functions to extract information out of an IslAst for node
  as members of IslAstInfo not as top level entities.

  + Refactor common code
  + Add isParallel and isReductionParallel
  + Rename IslAstUser to IslAstUserPayload to make it clear this is just a (or
    the) payload struct.

llvm-svn: 213272
2014-07-17 16:11:28 +00:00
Johannes Doerfert 43e1eadf26 [Refactor] Use attributes to mark function as invalid for polly
+ Test case annotated with the new attribute
  + Modified test case to check if subfunctions are annotated

llvm-svn: 213093
2014-07-15 21:06:48 +00:00
Tobias Grosser 18611cff58 Update to isl-0.13.0
This pulls in a couple of minor cleanups in isl. More importantly, in
preparation of the upcoming LLVM releases this change brings us back on a
released version of isl.

llvm-svn: 213062
2014-07-15 11:25:32 +00:00
Johannes Doerfert 3151463091 [Format] Clang format IslAst.cpp
llvm-svn: 213026
2014-07-15 00:58:57 +00:00
Johannes Doerfert 457f73eaee Annotate reduction parallel loops in the IslAst textual output
+ Introduced dependency type TYPE_TC_RED to represent the transitive closure
    (& the reverse) of reduction dependences. These are used when we check for
    reduction parallel loops.
  + Test cases including loop reversals and modulo schedules which compute
    reductions in a alternated order.

llvm-svn: 213019
2014-07-15 00:00:35 +00:00
Tobias Grosser c2920ff747 DeadCodeElimination: Fix liveout computation
We move back to a simple approach where the liveout is the last must-write
statement for a data-location plus all may-write statements. The previous
approach did not work out. We would have to consider per-data-access
dependences, instead of per-statement dependences to correct it. As this adds
complexity and it seems we would not gain anything over the simpler approach
that we implement in this commit, I moved us back to the old approach of
computing the liveout, but enhanced it to also add may-write accesses.

We also fix the test case and explain why we can not perform dead code
elimination in this case.

llvm-svn: 212925
2014-07-14 08:32:01 +00:00
Tobias Grosser e8162928c8 Remove unnecessary isl annotations
They where just left over from copy-pasting.

Reported-by:  Johannes Doerfert <jdoerfert@codeaurora.org>
llvm-svn: 212800
2014-07-11 09:02:41 +00:00
Tobias Grosser 780ce0f8e3 DeadCodeElim: Compute correct liveout for non-affine accesses
Thanks to Johannes Doerfert for narrowing down the bug.

Reported-by: Chris Jenneisch <chrisj@codeaurora.org>
llvm-svn: 212796
2014-07-11 07:12:10 +00:00
Tobias Grosser 483a90d1bd clang-format polly to avoid buildbot noise
llvm-svn: 212609
2014-07-09 10:50:10 +00:00
Rafael Espindola d432e0f905 Update for llvm api change.
llvm-svn: 212412
2014-07-06 18:11:46 +00:00
Tobias Grosser 5e6813d184 Derive run-time conditions for delinearization
As our delinearization works optimistically, we need in some cases run-time
checks that verify our optimistic assumptions. A simple example is the
following code:

void foo(long n, long m, long o, double A[n][m][o]) {

  for (long i = 0; i < 100; i++)
    for (long j = 0; j < 150; j++)
      for (long k = 0; k < 200; k++)
        A[i][j][k] = 1.0;
}

After clang linearized the access to A and we delinearized it again to
A[i][j][k] we need to ensure that we do not access the delinearized array
out of bounds (this information is not available in LLVM-IR). Hence, we
need to verify the following constraints at run-time:

CHECK:   Assumed Context:
CHECK:   [o, m] -> {  : m >= 150 and o >= 200 }
llvm-svn: 212198
2014-07-02 17:47:48 +00:00
Tobias Grosser ce67a044e0 Use arguments of user statements to perform induction variable substitution
To translate the old induction variables as they exist before Polly to new
new induction variables introduced during AST code generation we need to
generate code that computes the new values from the old ones. We can do this
by just looking at the arguments isl generates in each scheduled statement.

Example:

  // Old
  for i
    S(i)

  // New
  for c0
    for c1
      S(c0 + c1)

To get the value of i, we need to compute 'c0 + c1'. This expression is readily
available in the user statements generated by isl and just needs to be
translated to LLVM-IR.

This replaces an old confusing construct that constructed during ast generation
an isl multi affine expression that described this relation and which was then
again ast generated for each statement and argument when translating the isl ast
to LLVM-IR. This approach was difficult to understand and the additional ast
generation calls where entirely redundant as isl provides the relevant
expressions as arguments of the generated user statements.

llvm-svn: 212186
2014-07-02 16:26:47 +00:00
Johannes Doerfert f618339a37 Introduce reduction types
This change is particularly useful in the code generation as we need
  to know which binary operator/identity element we need to combine/initialize
  the privatization locations.

  + Print the reduction type for each memory access
  + Adjusted the test cases to comply with the new output format and
    to test for the right reduction type

llvm-svn: 212126
2014-07-01 20:52:51 +00:00
Johannes Doerfert 9890a05287 [FIX] Don't consider reductions which are partially outside the SCoP
+ Test case

llvm-svn: 212080
2014-07-01 00:32:29 +00:00
Tobias Grosser 083d3d3cb3 [C++11] Use more range based fors
llvm-svn: 211981
2014-06-28 08:59:45 +00:00
Tobias Grosser bc4ef90802 Remove redundant code and use C++ range fors
llvm-svn: 211980
2014-06-28 08:59:38 +00:00
Johannes Doerfert 1a62c7a34a [Fix] Deleted renamed test after r211957
llvm-svn: 211964
2014-06-27 21:48:42 +00:00
Johannes Doerfert e58a012094 Allow multiple reductions per statement
Iterate over all store memory accesses and check for valid binary reduction
  candidate loads by following the operands of the stored value.  For each
  candidate pair we check if they have the same base address and there are no
  other accesses which may overlap with them. This ensures that no intermediate
  value can escape into other memory locations or is overwritten at some point.

  + 17 test cases for reduction detection and reduction dependency modeling

llvm-svn: 211957
2014-06-27 20:31:28 +00:00
Andreas Simbuerger b379edbb3e Don't expand to invalid Scops with -polly-detect-keep-going
Enabling -keep-going in ScopDetection causes expansion to an invalid
Scop candidate.

Region A     <- Valid candidate
   |
Region B     <- Invalid candidate

If -keep-going is enabled, ScopDetection would expand A to A+B because
the RejectLog is never checked for errors during expansion.

With this patch only A becomes a valid Scop.

llvm-svn: 211875
2014-06-27 06:21:14 +00:00
Johannes Doerfert 1530adffdd [Refactor] Make the used dependence types explicit
llvm-svn: 211803
2014-06-26 20:24:17 +00:00
Johannes Doerfert 76dd493eff [Fix] Broken tests after r211796.
llvm-svn: 211797
2014-06-26 19:29:11 +00:00
Johannes Doerfert 6780bc310a [Refactor] Change memory access dump to preserve space
llvm-svn: 211796
2014-06-26 18:47:03 +00:00
Johannes Doerfert f8ee915deb Use wrapped reduction dependences
This change will ease the transision to multiple reductions per statement as
  we can now distinguish the effects of multiple reductions in the same
  statement.

  + Wrapped reduction dependences are used to compute privatization dependences
  + Modified test cases to account for the change

llvm-svn: 211795
2014-06-26 18:44:14 +00:00
Johannes Doerfert ea23b1d561 Hybrid dependency analysis
This dependency analysis will keep track of memory accesses if they might be
  part of a reduction. If not, the dependences are tracked on a statement level.
  The main reason to do this is to reduce the compile time while beeing able to
  distinguish the effects of reduction and non-reduction accesses.

  + Adjusted two test cases

llvm-svn: 211794
2014-06-26 18:38:08 +00:00
Andreas Simbuerger 5bf774ce0e Use own class for storing the RejectLogs
Use a container class to store the reject logs. Delegating most calls to
the internal std::map and add a few convenient shortcuts (e.g.,
hasErrors()).

llvm-svn: 211780
2014-06-26 13:36:52 +00:00
Andreas Simbuerger 99d4ab2b84 Add diagnostic remark for ReportVariantBasePtr
llvm-svn: 211777
2014-06-26 13:33:35 +00:00
Andreas Simbuerger aee4541828 Fix dangling reference
llvm-svn: 211773
2014-06-26 11:09:13 +00:00
Andreas Simbuerger e2c924366c Support for LLVM-style RTTI isa<...>, dyn_cast<...> et al.
llvm-svn: 211770
2014-06-26 10:19:57 +00:00
Andreas Simbuerger 5569bf300d Support the new DiagnosticRemarks
Add support for generating optimization remarks after completing the
detection of Scops.
The goal is to provide end-users with useful hints about opportunities that
help to increase the size of the detected Scops in their code.

By default the remark is unspecified and the debug location is empty. Future
patches have to expand on the messages generated.

This patch brings a simple test case for ReportFuncCall to demonstrate the
feature.

Reports all missed opportunities to increase the size/number of valid
Scops:
 clang <...> -Rpass-missed="polly-detect" <...>
 opt <...> -pass-remarks-missed="polly-detect" <...>

Reports beginning and end of all valid Scops:
 clang <...> -Rpass="polly-detect" <...>
 opt <...> -pass-remarks="polly-detect" <...>

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

llvm-svn: 211769
2014-06-26 10:06:40 +00:00
Tobias Grosser 50a5e6dac0 test/ScopInfo: Remove %defaultOpts and list passes explicitly
Due to bad habit we sometimes used a variable %defaultOpts that listed
a set of passes commonly run to prepare for Polly. None of these test cases
actually needs special preparation and only two of them need the 'basicaa' to
be scheduled. Scheduling the required alias analysis explicitly makes the test
cases clearer.

llvm-svn: 211671
2014-06-25 06:38:18 +00:00
Tobias Grosser 08031390d5 Clean up XFAILed test cases
We had a set of test cases that have been incomplete and XFAILED. This patch
completes a couple of the interesting ones and removes the ones which seem
redundant or not sufficiently reduced to be useful.

llvm-svn: 211670
2014-06-25 06:31:19 +00:00
Johannes Doerfert 5e275bc83a [Refactor] Create nicer test cases from C/C++
Insert a header into the new testcase containing a sample RUN line a FIXME and
an XFAIL. Then insert the formated C code and finally the LLVM-IR without
attributes, the module ID or the target triple.

llvm-svn: 211612
2014-06-24 17:02:53 +00:00
Tobias Grosser f59b3c1d90 cmake: Fix reference to Pluto file
llvm-svn: 211591
2014-06-24 13:31:42 +00:00
Yabin Hu cc91169fd7 Remove use of llvm.codegen intrinsic for GPGPU codegen
We use llvm.codegen intrinsic to generate code for embedded LLVM-IR
strings. The reason we introduce such a intrinsic is that previous
clang/opt tools was NOT linked with various LLVM targets and their
AsmParsers and AsmPrinters. Since clang/opt been linked with all the
needed libraries, we no longer need the llvm.codegen intrinsic.

llvm-svn: 211573
2014-06-24 08:11:36 +00:00
Yabin Hu 30d7731032 Add "Yabin Hu" to CREDITS.txt
llvm-svn: 211440
2014-06-21 18:35:33 +00:00
Johannes Doerfert 5ec80c2a85 [Refactor] Simplify memory access isWrite
llvm-svn: 211379
2014-06-20 17:06:41 +00:00
Johannes Doerfert ffa73bd44c Reduction like is now a memory access property
- Remove the statement reduction like property
+ Add the reduction like property to memory accesses

llvm-svn: 211372
2014-06-20 16:58:12 +00:00
Johannes Doerfert f1906138b4 Model statement wise reduction dependences
+ Collect reduction dependences
+ Introduced TYPE_RED in Dependences.h which can be used to obtain the
  reduction dependences
+ Used TYPE_RED to prevent parallelization while we do not have a privatizing
  code generation
+ Relax the dependences for non-parallel code generation
+ Add privatization dependences to ensure correctness
+ 12 Test cases to check for reduction and privatization dependences

llvm-svn: 211369
2014-06-20 16:37:11 +00:00
Tobias Grosser 868832b3fd Update for ScopStmt iterator name change in LLVM r210927
Contributed-by: Yabin Hu <yabin.hwu@gmail.com>
llvm-svn: 211280
2014-06-19 16:45:04 +00:00
Johannes Doerfert aeed39774d Fix build
See r210927 and r210847

llvm-svn: 211278
2014-06-19 16:19:32 +00:00
Johannes Doerfert da80386700 Missing reduction detection test cases
llvm-svn: 211235
2014-06-18 23:08:14 +00:00
Johannes Doerfert 0ee1f21478 Subject: [PATCH-v5] Detect and mark reduction like statements
+ Flag to indicate reduction like statements
+ Command line option to (dis)allow multiplicative reduction opcodes
+ Two simple positive test cases, one fp test case w and w/o fast math
+ One "negative" test case (only reduction like but no reduction)

llvm-svn: 211114
2014-06-17 17:31:36 +00:00
Johannes Doerfert f675289d87 [Refactor] C++11 Memory access iterators in SCoP stmts
+ Added const iterator version
+ Changed name to begin/end to allow range loops
+ Changed call sites to range loops
+ Changed typename to (const_)iterator

llvm-svn: 210927
2014-06-13 18:01:45 +00:00
Johannes Doerfert fdd9f2b23d [Refactor] Simplify dependency map dump
llvm-svn: 210926
2014-06-13 18:00:22 +00:00