Commit Graph

60 Commits

Author SHA1 Message Date
Johannes Doerfert 45be64464b [NFC] Consistenly use commented and annotated ScopPass functions
The changes affect methods that are part of the Pass interface and
  include:
    - Comments that describe the methods purpose.
    - A consistent use of the keywords override and virtual.
  Additionally, the printScop method is now optional and removed from
  SCoP passes that do not implement it.

llvm-svn: 248685
2015-09-27 15:43:29 +00:00
Tobias Grosser 6f73008506 Allow the import of multi-dimensional access functions
Originally, we disallowed the import of multi-dimensional access functions due
to our code generation not supporting the generation of new address expressions
for multi-dimensional memory accesses. When building our run-time alias check
infrastructure we added code generation support for multi-dimensional address
calculations.  Hence, we can now savely allow the import of new
multi-dimensional access functions.

llvm-svn: 246917
2015-09-05 07:46:47 +00:00
Tobias Grosser 808cd69a92 Use schedule trees to represent execution order of statements
Instead of flat schedules, we now use so-called schedule trees to represent the
execution order of the statements in a SCoP. Schedule trees make it a lot easier
to analyze, understand and modify properties of a schedule, as specific nodes
in the tree can be choosen and possibly replaced.

This patch does not yet fully move our DependenceInfo pass to schedule trees,
as some additional performance analysis is needed here. (In general schedule
trees should be faster in compile-time, as the more structured representation
is generally easier to analyze and work with). We also can not yet perform the
reduction analysis on schedule trees.

For more information regarding schedule trees, please see Section 6 of
https://lirias.kuleuven.be/handle/123456789/497238

llvm-svn: 242130
2015-07-14 09:33:13 +00:00
Tobias Grosser 5cf7860704 Ensure memory access mappings are defined for full domain
We now verify that memory access functions imported via JSON are indeed defined
for the full iteration domain. Before this change we accidentally imported
memory mappings such as i -> i / 127, which only defined a mapped for values of
i that are evenly divisible by 127, but which did not define any mapping for the
remaining values, with the result that isl just generated an access expression
that had undefined behavior for all the unmapped values.

In the incorrect test cases, we now either use floor(i/127) or we use p/127 and
provide the information that p is indeed a multiple of 127.

llvm-svn: 239024
2015-06-04 07:44:35 +00:00
Tobias Grosser 7c3bad52dd Use value semantics for list of ScopStmt(s) instead of std::owningptr
David Blaike suggested this as an alternative to the use of owningptr(s) for our
memory management, as value semantics allow to avoid the additional interface
complexity caused by owningptr while still providing similar memory consistency
guarantees. We could also have used a std::vector, but the use of std::vector
would yield possibly changing pointers which currently causes problems as for
example the memory accesses carry pointers to their parent statements. Such
pointers should not change.

Reviewer: jblaikie, jdoerfert

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

llvm-svn: 238290
2015-05-27 05:16:57 +00:00
Tobias Grosser 679dfafd33 Use unique_ptr to clarify ownership of ScopStmt
llvm-svn: 238090
2015-05-23 05:14:09 +00:00
Tobias Grosser ba0d09227c Sort include directives
Upcoming revisions of isl require us to include header files explicitly, which
have previously been already transitively included. Before we add them, we sort
the existing includes.

Thanks to Chandler for sort_includes.py. A simple, but very convenient script.

llvm-svn: 236930
2015-05-09 09:13:42 +00:00
Tobias Grosser a63b7cee66 Adding debug location information to Polly's JSCOP and dot exports
This change adds location information for the detected regions in Polly when the
required debug information is available.

The JSCOP output format is extended with a "location" field which contains the
information in the format "source.c:start-end"

The dot output is extended to contain the location information for each nested
region in the analyzed function.

As part of this change, the existing getDebugLocation function has been moved
into lib/Support/ScopLocation.cpp to avoid having to include
polly/ScopDetectionDiagnostics.h.

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

Contributed-by: Roal Jordans <r.jordans@tue.nl>
llvm-svn: 236393
2015-05-03 05:21:36 +00:00
Tobias Grosser 2165de8894 JScoP Import/Export: Ensure parameters have the same isl_id
When reading parameters from a JSON file parameters with identical names
may be related to different isl_ids, which then causes isl to treat them
as differnet objects. This does not cause issues at the moment, but has
shown problematic in subsequent schedule tree changes.

This commit will be tested by the following changes.

llvm-svn: 235588
2015-04-23 12:23:56 +00:00
Tobias Grosser 5483931117 Rename 'scattering' to 'schedule'
In Polly we used both the term 'scattering' and the term 'schedule' to describe
the execution order of a statement without actually distinguishing between them.
We now uniformly use the term 'schedule' for the execution order.  This
corresponds to the terminology of isl.

History: CLooG introduced the term scattering as the generated code can be used
as a sequential execution order (schedule) or as a parallel dimension
enumerating different threads of execution (placement). In Polly and/or isl the
term placement was never used, but we uniformly refer to an execution order as a
schedule and only later introduce parallelism. When doing so we do not talk
about about specific placement dimensions.

llvm-svn: 235380
2015-04-21 11:37:25 +00:00
Tobias Grosser 97112eeeff Fix stupid memory leak
llvm-svn: 233326
2015-03-26 22:22:33 +00:00
Tobias Grosser 140b394e10 Fix compilation after 'Make DataLayout Non-Optional in the Module' commit
llvm-svn: 231362
2015-03-05 09:48:20 +00:00
Johannes Doerfert 7e6424ba5a Create a dependence struct to hold dependence information for a SCoP.
The new Dependences struct in the DependenceInfo holds all information
  that was formerly part of the DependenceInfo. It also provides the
  same interface for the user to access this information.

  This is another step to a more general ScopPass interface that does
  allow multiple SCoPs to be "in flight".

llvm-svn: 231327
2015-03-05 00:43:48 +00:00
Johannes Doerfert f6557f98a2 Rename the Dependences pass to DependenceInfo [NFC]
We rename the Dependences pass to DependenceInfo as a first step to a
  caching pass policy. The new DependenceInfo pass will later provide
  "Dependences" for a SCoP.

  To keep consistency the test folder is renamed too.

llvm-svn: 231308
2015-03-04 22:43:40 +00:00
Johannes Doerfert de4a0fd813 [Refactor] Include explicitly what is used
llvm-svn: 230902
2015-03-01 18:51:51 +00:00
Johannes Doerfert f94d5178a5 [Refactor] Remove Scop * member to simplify JSON class
llvm-svn: 230900
2015-03-01 18:44:57 +00:00
Johannes Doerfert 3fe584d64f [Refactor] Add a Scop & as argument to printScop
This is the first step in the interface simplification.

llvm-svn: 230897
2015-03-01 18:40:25 +00:00
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 9b5786960d Relax the condition on the jsop accesses regarding the alignment.
We restricted the new access functions to be a subset of the old one
  because we want to keep the alignment, however if the alignment is
  "not special", thus the default for the type, we can allow any access.


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

llvm-svn: 219503
2014-10-10 15:14:29 +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 87901453d9 Align copied load/store instructions as the original.
This also forbids the json importer to access other memory locations
  than the original instruction as we to reuse the alignment of the
  original load/store.

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

llvm-svn: 218883
2014-10-02 16:22:19 +00:00
Rafael Espindola ac27f730d7 Update for LLVM api change
llvm-svn: 216394
2014-08-25 18:16:52 +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
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
Rafael Espindola 316952a483 Fix the polly build.
llvm-svn: 210847
2014-06-12 22:37:15 +00:00
Rafael Espindola 8730ee7375 Try to fix the polly build.
llvm-svn: 210811
2014-06-12 19:22:17 +00:00
Saleem Abdulrasool e653622b98 polly: update for LLVM API change
SVN r209103 removed the OwningPtr variant of the MemoryBuffer APIs.  Switch to
the equivalent std::unique_ptr versions.  This should clear up the build bots.

llvm-svn: 209104
2014-05-19 03:55:49 +00:00
Benjamin Kramer ff69b3c260 Add missing include.
llvm-svn: 207618
2014-04-30 07:26:28 +00:00
Chandler Carruth 95fef9446c [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, Polly edition.

If you want to know more details about this, you can see the recent
commits to Debug.h in LLVM. This is just the Polly segment of a cleanup
I'm doing globally for this macro.

llvm-svn: 206852
2014-04-22 03:30:19 +00:00
Rafael Espindola d288d9aa94 Update for llvm api change.
llvm-svn: 202056
2014-02-24 18:21:12 +00:00
Rafael Espindola 3f4ace1611 Update for llvm API change.
llvm-svn: 202048
2014-02-24 16:26:33 +00:00
Tobias Grosser f240b487a3 Remove IR/Writer.h
This should fix the buildbots.

llvm-svn: 198859
2014-01-09 10:42:15 +00:00
Chandler Carruth e243b03a8c Update #include paths for r198688 in LLVM that moved headers in the Assembly
directory to their proper homes.

llvm-svn: 198691
2014-01-07 12:59:58 +00:00
Tobias Grosser 85f7421731 JSONImporter: Free new schedule if found invalid
In case we detect that the schedule the user wants to import is invalid we
refuse it _and_ free the isl_maps containing it.

Another bug found thanks to Rafael.

llvm-svn: 187339
2013-07-29 05:12:01 +00:00
Tobias Grosser aef925e81f Small style improvements
llvm-svn: 186248
2013-07-13 16:58:07 +00:00
Tobias Grosser 58032cb029 Integrate latest clang-format changes
llvm-svn: 184655
2013-06-23 01:29:29 +00:00
Tobias Grosser 83628182f7 Sort includes
llvm-svn: 181297
2013-05-07 08:11:54 +00:00
Tobias Grosser 637bd63123 Move polly options into separate option category
Use the new cl::OptionCategory support to move the Polly options into a separate
option category. The aim is to hide most options and show by default only the
options a user needs to influence '-O3 -polly'. The available options probably
need some care, but here is the current status:

Polly Options:
Configure the polly loop optimizer

  -enable-polly-openmp              - Generate OpenMP parallel code
  -polly                            - Enable the polly optimizer (only at -O3)
  -polly-no-tiling                  - Disable tiling in the scheduler
  -polly-only-func=<function-name>  - Only run on a single function
  -polly-report                     - Print information about the activities
                                      of Polly
  -polly-vectorizer                 - Select the vectorization strategy
    =none                           -   No Vectorization
    =polly                          -   Polly internal vectorizer
    =unroll-only                    -   Only grouped unroll the vectorize
                                        candidate loops
    =bb                             -   The Basic Block vectorizer driven by
                                        Polly

llvm-svn: 181295
2013-05-07 07:31:10 +00:00
Tobias Grosser e602a07662 Reformat with clang-format
clang-format become way more stable. This time we mainly reformat function
signatures.

llvm-svn: 181294
2013-05-07 07:30:56 +00:00
Tobias Grosser d7e58640a5 Update formatting to latest version of clang-format
llvm-svn: 179160
2013-04-10 06:55:45 +00:00
Tobias Grosser 4d96c8d714 clang-format: Many more files
After this commit, polly is clang-format clean. This can be tested with
'ninja polly-check-format'. Updates to clang-format may change this, but the
differences will hopefully be both small and general improvements to the
formatting.

We currently have some not very nice formatting for a couple of items, DEBUG()
stmts for example. I believe the benefit of being clang-format clean outweights
the not perfect layout of this code.

llvm-svn: 177796
2013-03-23 01:05:07 +00:00
Tobias Grosser 7a2f39534f 'chmod -x' on files that do not need the executable bits
llvm-svn: 171224
2012-12-29 15:09:03 +00:00
Tobias Grosser 084d8f7d4c ScopInfo: Store ScopStmt pointer in the domain
Store a pointer to each ScopStmt in the isl_id associated with the space of its
domain. This will later allow us to recover the statement during code
generation with isl.

llvm-svn: 157607
2012-05-29 09:29:44 +00:00
Tobias Grosser 3cbe5cfff3 Remove FinalRead
The FinalRead statement represented a virtual read that is executed after the
SCoP. It was used when we verified the correctness of a schedule by checking if
it yields the same FLOW dependences as the original code. This is only works, if
we have a final read that reads all memory at the end of the SCoP.
We now switched to just checking if a schedule does not introduce negative
dependences and also consider WAW WAR dependences. This restricts the schedules
a little bit more, but we do not have any optimizer that would calculate a more
complex schedule. Hence, for now final reads are obsolete.

llvm-svn: 152319
2012-03-08 15:21:51 +00:00
Tobias Grosser 29ee0b14d5 Do not use getNameStr() anymore.
Instead we switch to the recommended getName(). This fixes compilation with
recent versions of LLVM.

llvm-svn: 144909
2011-11-17 14:52:36 +00:00
Tobias Grosser 626227462d JSONImporter: Fix parameter ids when importing new access functions
The new isl_id support for parmeters created problems when importing new
access functions. Even though the parameters had the same names,
they were mapped to different ids and where therefore incompatible.
We copy the ids now from the old parameter dimensions. This fixes the
problem.

llvm-svn: 144642
2011-11-15 11:38:59 +00:00
Tobias Grosser ff9b54d5a9 JScop: Allow to update the context
llvm-svn: 144639
2011-11-15 11:38:44 +00:00
Tobias Grosser ecf6cd06f0 Make JScop export/reimport accessible from clang
llvm-svn: 144638
2011-11-15 11:38:36 +00:00
Tobias Grosser 5d45381294 ScopInfo: Only give away a copy of the access relation.
Also take the chance and rename access functions to access relations. This is
because we do not only allow plain functions to describe an access, but we
can have any access relation that can be described with linear constraints.

llvm-svn: 141257
2011-10-06 00:04:11 +00:00