Commit Graph

2124 Commits

Author SHA1 Message Date
Johannes Doerfert 96e5471139 Separate invariant equivalence classes by type
We now distinguish invariant loads to the same memory location if they
  have different types. This will cause us to pre-load an invariant
  location once for each type that is used to access it. However, we can
  thereby avoid invalid casting, especially if an array is accessed
  though different typed/sized invariant loads.

  This basically reverts the changes in r260023 but keeps the test
  cases.

llvm-svn: 260045
2016-02-07 17:30:13 +00:00
Johannes Doerfert e708790c59 [FIX] Two "off-by-one" error in constant range usage
llvm-svn: 260031
2016-02-07 13:59:03 +00:00
Johannes Doerfert adeab372ca Simplify code [NFC]
llvm-svn: 260030
2016-02-07 13:57:32 +00:00
Tobias Grosser 8ebdc2dd53 Make memory accesses with different element types optional
We also disable this feature by default, as there are still some issues in
combination with invariant load hoisting that slipped through my initial
testing.

llvm-svn: 260025
2016-02-07 08:48:57 +00:00
Tobias Grosser 46bafbd0fe Do not yet consider loads with non-canonical element size for load hoisting.
Invariant load hoisting of memory accesses with non-canonical element
types lacks support for equivalence classes that contain elements of
different width/size. This support should be added, but to get our buildbots
back to green, we disable load hoisting for memory accesses with non-canonical
element size for now.

llvm-svn: 260023
2016-02-07 08:11:36 +00:00
Tobias Grosser 107cd5f5f6 IslNodeBuilder: Invariant load hoisting of elements with differing sizes
Always use access-instruction pointer type to load the invariant values.
Otherwise mismatches between ScopArrayInfo element type and memory access
element type will result in invalid casts. These type mismatches are after
r259784 a lot more common and also arise with types of different size, which
have not been handled before.

Interestingly, this change actually simplifies the code, as we now have only
one code path that is always taken, rather then a standard code path for the
common case and a "fixup" code path that replaces the standard code path in
case of mismatching types.

llvm-svn: 260009
2016-02-06 21:23:39 +00:00
Michael Kruse 2e02d560aa Follow uses to create value MemoryAccesses
The previously implemented approach is to follow value definitions and
create write accesses ("push defs") while searching for uses. This
requires the same relatively validity- and requirement conditions to be
replicated at multiple locations (PHI instructions, other instructions,
uses by PHIs).

We replace this by iterating over the uses in a SCoP ("pull in
requirements"), and add writes only when at least one read has been
added. It turns out to be simpler code because each use is only iterated
over once and writes are added for the first access that reads it. We
need another iteration to identify escaping values (uses not in the
SCoP), which also makes the difference between such accesses more
obvious. As a side-effect, the order of scalar MemoryAccess can change.

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

llvm-svn: 259987
2016-02-06 09:19:40 +00:00
Tobias Grosser d840fc7277 Support accesses with differently sized types to the same array
This allows code such as:

void multiple_types(char *Short, char *Float, char *Double) {
  for (long i = 0; i < 100; i++) {
    Short[i] = *(short *)&Short[2 * i];
    Float[i] = *(float *)&Float[4 * i];
    Double[i] = *(double *)&Double[8 * i];
  }
}

To model such code we use as canonical element type of the modeled array the
smallest element type of all original array accesses, if type allocation sizes
are multiples of each other. Otherwise, we use a newly created iN type, where N
is the gcd of the allocation size of the types used in the accesses to this
array. Accesses with types larger as the canonical element type are modeled as
multiple accesses with the smaller type.

For example the second load access is modeled as:

  { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 }

To support code-generating these memory accesses, we introduce a new method
getAccessAddressFunction that assigns each statement instance a single memory
location, the address we load from/store to. Currently we obtain this address by
taking the lexmin of the access function. We may consider keeping track of the
memory location more explicitly in the future.

We currently do _not_ handle multi-dimensional arrays and also keep the
restriction of not supporting accesses where the offset expression is not a
multiple of the access element type size. This patch adds tests that ensure
we correctly invalidate a scop in case these accesses are found. Both types of
accesses can be handled using the very same model, but are left to be added in
the future.

We also move the initialization of the scop-context into the constructor to
ensure it is already available when invalidating the scop.

Finally, we add this as a new item to the 2.9 release notes

Reviewers: jdoerfert, Meinersbur

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

llvm-svn: 259784
2016-02-04 13:18:42 +00:00
Tobias Grosser dae306d2e4 ScopInfo: Improve documentation of ScopArrayInfo
This adds more information about how dimensions are incrementally updated and
what exactly the canonical element type is.

llvm-svn: 259772
2016-02-04 09:27:34 +00:00
Tobias Grosser a91684d554 Add 3.9 release notes document
llvm-svn: 259768
2016-02-04 08:10:29 +00:00
Tobias Grosser 719f843e67 Add 'Using Polly with Clang' to Spinx
llvm-svn: 259767
2016-02-04 07:45:32 +00:00
Tobias Grosser d7ccafe35f Add Sphinx configuration
This just adds the basic configuration with an empty index/welcome page

llvm-svn: 259765
2016-02-04 07:27:57 +00:00
Tobias Grosser b6948c1289 Add basic doxygen infrastructure for Polly
llvm-svn: 259764
2016-02-04 07:16:36 +00:00
Tobias Grosser 2a969e043a www: Remove some spaces
llvm-svn: 259761
2016-02-04 06:41:03 +00:00
Tobias Grosser 0ef8fa2528 www: Add Michael's thesis
llvm-svn: 259760
2016-02-04 06:40:59 +00:00
Tobias Grosser b9d4b24624 www: Add Felix-Antoine's master thesis
llvm-svn: 259759
2016-02-04 06:36:50 +00:00
Tobias Grosser 71c250445a www: Drop outdated dragonegg documentation
Even though the commands still work, dragonegg has not been updated to work with
recent versions of LLVM. Consequently, only very old Polly versions (which we
do not support any more), can be used in this way.

This simplifies our documentation page.

llvm-svn: 259758
2016-02-04 06:23:53 +00:00
Tobias Grosser a7f1e04031 Update to isl-0.16.1-20-gee54b48
This includes some (optional) improvements to the isl scheduler, which we do not
use yet, as well as a fix for a bug previously also affecting Polly:

commit 662ee9b7d45ebeb7629b239d3ed43442e25bf87c
Author: Sven Verdoolaege <skimo@kotnet.org>
Date:   Mon Jan 25 16:59:32 2016 +0100

    isl_basic_map_realign: perform Gaussian elimination on result

    Many parts of isl assume that Gaussian elimination has been
    applied to the equality constraints.  In particular singleton_extract_point
    makes this assumption.  The input to singleton_extract_point
    may have undergone parameter alignment.  This parameter alignment
    (ultimately performed by isl_basic_map_realign) therefore
    needs to make sure the result preserves this property

llvm-svn: 259757
2016-02-04 06:19:12 +00:00
Wei Mi eb14ac5396 Polly tests update contributed by Tobias Grosser for SCEV patch in r259736.
llvm-svn: 259737
2016-02-04 01:34:28 +00:00
Tobias Grosser ba043143a9 test: make test case more robust against removal of unrelated instructions
llvm-svn: 259693
2016-02-03 21:10:11 +00:00
Tobias Grosser bea6c54723 Properly build shared libraries if LLVM_LINK_LLVM_DYLIB is enabled.
Contributed-by: Jack Howarth <howarthjw@gmail.com>
llvm-svn: 259659
2016-02-03 16:29:04 +00:00
Tobias Grosser 05514e4d7f www: Simplify 'build & install' descriptions
We remove information for older versions of Polly and also shorten the overall
text. This should make it a lot easier for people to get to the important code
wight away.

llvm-svn: 259658
2016-02-03 16:18:24 +00:00
Tobias Grosser 23aea0d5d0 tScopInfo: Shorten comment slightly
llvm-svn: 259653
2016-02-03 15:42:38 +00:00
Tobias Grosser f4a97d0772 ScopInfo: Extend description of the access relation.
llvm-svn: 259633
2016-02-03 06:37:38 +00:00
Tobias Grosser e2c31210b2 Revert "Support loads with differently sized types from a single array"
This reverts commit (@259587). It needs some further discussions.

llvm-svn: 259629
2016-02-03 05:53:27 +00:00
Tobias Grosser 5d3fc1ea43 Support loads with differently sized types from a single array
We support now code such as:

void multiple_types(char *Short, char *Float, char *Double) {
  for (long i = 0; i < 100; i++) {
    Short[i] = *(short *)&Short[2 * i];
    Float[i] = *(float *)&Float[4 * i];
    Double[i] = *(double *)&Double[8 * i];
  }
}

To support such code we use as element type of the modeled array the smallest
element type of all original array accesses. Accesses with larger types are
modeled as multiple accesses with the smaller type.

For example the second load access is modeled as:

  { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 }

To support jscop-rewritable memory accesses we need each statement instance to
only be assigned a single memory location, which will be the address at which
we load the value. Currently we obtain this address by taking the lexmin of
the access function. We may consider keeping track of the memory location more
explicitly in the future.

llvm-svn: 259587
2016-02-02 22:05:29 +00:00
Tobias Grosser db543ede7e ScopInfo: Split memory access construction into different cases
We create separate functions for fixed-size multi-dimensional, parameteric-sized
multi-dimensional, as well as single-dimensional memory accesses to reduce the
complexity of a large monolithic function.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 259522
2016-02-02 16:46:49 +00:00
Tobias Grosser 5d51afedd8 ScopInfo: Do not track element-size as additional array size dimension [NFC]
There is no need to pass the size of the elements as the last size dimension
to ScopArrayInfo. This information is already available through the ElementType.
Tracking it twice is not only redundant but may result in inconsistencies.

llvm-svn: 259521
2016-02-02 16:46:45 +00:00
Johannes Doerfert 7c38b3296b [WWW] Add our Polly/OpenCL paper
llvm-svn: 259511
2016-02-02 15:03:31 +00:00
Johannes Doerfert 46d771c93f Remove unneeded definition [NFC]
llvm-svn: 259505
2016-02-02 14:16:22 +00:00
Johannes Doerfert 800e17a75c Add const keyword to MemoryAccess argument [NFC]
llvm-svn: 259504
2016-02-02 14:16:01 +00:00
Johannes Doerfert e0de09682e Sort analysis members and unifiy documentation [NFC]
llvm-svn: 259503
2016-02-02 14:15:37 +00:00
Johannes Doerfert a1f291ed18 Rename the DataLayout member [NFC]
llvm-svn: 259502
2016-02-02 14:15:13 +00:00
Johannes Doerfert a87810351c Remove helper function [NFC]
llvm-svn: 259501
2016-02-02 14:14:40 +00:00
Johannes Doerfert c36d39b7a8 Remove unnecessary getAnalysis call [NFC]
llvm-svn: 259500
2016-02-02 14:14:20 +00:00
Tobias Grosser cc77950b2b ScopInfo: Rename AccessType -> ElementType to unify naming with method declaration
llvm-svn: 259495
2016-02-02 13:22:54 +00:00
Tobias Grosser f5e239c4c3 www: Mark full/partial tile separation for vectorization as 'done'
Roman contributed this

llvm-svn: 259486
2016-02-02 09:55:59 +00:00
Tobias Grosser 0720570eee www: Update statistic code
llvm-svn: 259485
2016-02-02 09:55:55 +00:00
Tobias Grosser 6c2ae4592d www: update formatting of polyhedral.info news
llvm-svn: 259483
2016-02-02 09:30:01 +00:00
Tobias Grosser 542625eb6e www: Fix overlapping lines II
llvm-svn: 259477
2016-02-02 08:49:34 +00:00
Tobias Grosser 0dcafe94f8 Avoid overlapping lines
llvm-svn: 259476
2016-02-02 08:47:56 +00:00
Tobias Grosser c2fd8b411d ScopInfo: Correct schedule construction
For schedule generation we assumed that the reverse post order traversal used by
the domain generation is sufficient, however it is not. Once a loop is
discovered, we have to completely traverse it, before we can generate the
schedule for any block/region that is only reachable through a loop exiting
block.

To this end, we add a "loop stack" that will keep track of loops we
discovered during the traversal but have not yet traversed completely.
We will never visit a basic block (or region) outside the most recent
(thus smallest) loop in the loop stack but instead queue such blocks
(or regions) in a waiting list. If the waiting list is not empty and
(might) contain blocks from the most recent loop in the loop stack the
next block/region to visit is drawn from there, otherwise from the
reverse post order iterator.

We exploit the new property of loops being always completed before additional
loops are processed, by removing the LoopSchedules map and instead keep all
information in LoopStack. This clarifies that we indeed always only keep a
stack of in-process loops, but will never keep incomplete schedules for an
arbitrary set of loops. As a result, we can simplify some of the existing code.

This patch also adds some more documentation about how our schedule construction
works.

This fixes http://llvm.org/PR25879

This patch is an modified version of Johannes Doerfert's initial fix.

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

llvm-svn: 259354
2016-02-01 11:54:13 +00:00
Tobias Grosser ccbe383594 ScopInfo: Drop dead code in schedule description
In https://llvm.org/svn/llvm-project/polly/trunk@251870 code was committed to
avoid a failure in the presence of infinite loops, but the test case committed
along with this change passes without the actual change. I looked back into the
code and also checked with the original committer (Johannes), but could not find
the reason why the code is needed. The introduction of LoopStacks for
buildSchedule in one of the next commits will make it even more clear that this
code is not needed, but I remove this ahead of time to facilitate bisecting in
case I missed something.

llvm-svn: 259347
2016-02-01 10:07:43 +00:00
Tobias Grosser 0dd4a9a9f4 ScopInfo: use std::distance to shorten code [NFC]
llvm-svn: 259337
2016-02-01 01:55:08 +00:00
Craig Topper 7fb6e47101 Replace utostr_32 use with utostr to match removal from llvm.
llvm-svn: 259333
2016-01-31 20:36:20 +00:00
Tobias Grosser ed873cd3c1 cmake: Add additional libraries to fix the darwin shared library build
darwin requires the additional linkages of...

LLVMBitReader
LLVMMCParser
LLVMObject
LLVMProfileData
LLVMTarget
LLVMVectorize

as the darwin requires all of the weak undefined symbols in a library to be
resolved when linking it against an executable (unless
-Wl,-undefined,dynamic_lookup is used to override the default behavior of
-Wl,-undefined,error).

Contributed-by: Jack Howarth
llvm-svn: 259332
2016-01-31 20:25:46 +00:00
Michael Kruse 26311f00e8 Remove autotools build system
The autotools build system is based on and requires LLVM's autotools
build system to work, which has been depricated and finally removed in
r258861. Consequently we also remove the autotools build system from
Polly.

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

llvm-svn: 259041
2016-01-28 12:00:33 +00:00
Michael Kruse fd46308de4 ScopInfo: Never add read accesses for synthesizable values
Before adding a MK_Value READ MemoryAccess, check whether the read is
necessary or synthesizable. Synthesizable values are later generated by
the SCEVExpander and therefore do not need to be transferred
explicitly. This can happen because the check for synthesizability has
presumbly been forgotten in the case where a phi's incoming value has
been defined in a different statement.

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

llvm-svn: 258998
2016-01-27 22:51:56 +00:00
Michael Kruse 70131d3416 Introduce MemAccInst helper class; NFC
MemAccInst wraps the common members of LoadInst and StoreInst. Also use
of this class in:
- ScopInfo::buildMemoryAccess
- BlockGenerator::generateLocationAccessed
- ScopInfo::addArrayAccess
- Scop::buildAliasGroups
- Replace every use of polly::getPointerOperand

Reviewers: jdoerfert, grosser

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

llvm-svn: 258947
2016-01-27 17:09:17 +00:00
Michael Kruse ee6a4fc680 Unique phi write accesses
Ensure that there is at most one phi write access per PHINode and
ScopStmt. In particular, this would be possible for non-affine
subregions with multiple exiting blocks. We replace multiple MAY_WRITE
accesses by one MUST_WRITE access. The written value is constructed
using a PHINode of all exiting blocks. The interpretation of the PHI
WRITE's "accessed value" changed from the incoming value to the PHI like
for PHI READs since there is no unique incoming value.

Because region simplification shuffles around PHI nodes -- particularly
with exit node PHIs -- the PHINodes at analysis time does not always
exist anymore in the code generation pass. We instead remember the
incoming block/value pair in the MemoryAccess.

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

llvm-svn: 258809
2016-01-26 13:33:27 +00:00