Commit Graph

1544 Commits

Author SHA1 Message Date
Tobias Grosser 495124c4d6 GPURuntimeDebugPrinter: Printer pointer values (except if they are strings)
Only pointer values in constant address space are assumed to be strings. For
all other pointers their address is printed.

llvm-svn: 242524
2015-07-17 13:57:57 +00:00
Tobias Grosser d783a98303 Add option to choose where in the pass pipeline polly is run
These options are useful to play with the location of Polly within LLVM's
pass manager.

llvm-svn: 242390
2015-07-16 08:28:09 +00:00
Tobias Grosser 469609a714 Mark a couple of items as completed
llvm-svn: 242136
2015-07-14 10:52:58 +00:00
Tobias Grosser c268835eca Drop outdated video
llvm-svn: 242135
2015-07-14 10:45:03 +00:00
Tobias Grosser 0241bd2c7e www: Add link to llvm.org
llvm-svn: 242134
2015-07-14 10:44:06 +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 16c4403a91 Make non-affine statement names isl compatible
Named isl sets can generally have any name if they remain within Polly, but only
certain strings can be parsed by isl. The new names we create ensure that we
can always copy-past isl strings from Polly to other isl tools, e.g. for
debugging.

llvm-svn: 241787
2015-07-09 07:31:45 +00:00
Tobias Grosser ec46e5376d Print thread-identifiers in GPU debug output
This helps us to understand which thread prints which information.

llvm-svn: 241452
2015-07-06 15:36:16 +00:00
Tobias Grosser 6c78048b76 Update isl to isl-0.15-35-ga1e44f0
This fixes a memory leak with in the sioimath backend.

llvm-svn: 241247
2015-07-02 07:59:21 +00:00
Tobias Grosser f519a288d5 Remove versions from README and add update instructions
llvm-svn: 241246
2015-07-02 07:59:16 +00:00
Tobias Grosser 4db553199c Update isl to isl-0.15-30-g3518765
This updated contains various changes to isl, including improvements to the
AST generator. For Polly, the most important change is a fix that unbreaks
builds on darwin (reported by: Jack Howard)

llvm-svn: 241048
2015-06-30 08:22:14 +00:00
Michael Kruse acc9ad5991 [Polly] Add -std=c99 flag only to C source files
Summary: Adding the flag to C++ source files emits a warning, hence we set the compile flag depending on the file's language.

Reviewers: grosser

Subscribers: Meinersbur, pollydev, llvm-commits

Projects: #polly

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

llvm-svn: 240986
2015-06-29 19:57:59 +00:00
Tobias Grosser 1b13ddea50 Add first support to delinearize A[t%2][i][j]
This is very preliminary support, but it seems to work for the most common case.
When observing more/different test cases, we can work on generalizing this.

llvm-svn: 240955
2015-06-29 14:44:22 +00:00
Tobias Grosser 23bceb2eec Fix delinearization after it's move to ScalarEvoltion
llvm-svn: 240954
2015-06-29 14:44:17 +00:00
Tobias Grosser 1a07e19180 Increase the dependence-analysis compute out
As Polly got a lot faster after the small-integer-optimization imath
patch, we now increase the compute out to optimize larger kernels. This
should also expose additional slow-downs for us to address.

In LNT this gives us a 3.4x speedup on 3mm, at a cost of a 2x increase in
compile time (now 0.77s). reg_detect, oorafft and adi also show some compile
time increases. This compile time cost is divided between more time in isl and
more time in LLVM's backends due to increased code size (versioning and tiling).

llvm-svn: 240840
2015-06-26 21:58:42 +00:00
Tobias Grosser f54bb7743a Drop divs before adding array-out-of-bounds assumptions
In case we have modulo operations in the access function (supported since
r240518), the assumptions generated to ensure array accesses remain within
bounds can contain existentially quantified dimensions which results in more
complex and more difficult to handle integer sets. As a result LNT's linpack
benchmark started to fail due to excessive compile time.

We now just drop the existentially quantified dimensions. This should be
generally save, but may result in less precise assumptions which may
consequently make us fall back to the original (unoptimized) code more often. In
practice, these cases probably do not appear to often.

I had difficulties to extract a good test case, but fortunately our LNT bots
cover this one well.

llvm-svn: 240775
2015-06-26 12:09:28 +00:00
Tobias Grosser af4e809ca6 Remove code for scalar and PHI to array translation
This removes old code that has been disabled since several weeks and was hidden
behind the flags -disable-polly-intra-scop-scalar-to-array=false and
-polly-model-phi-nodes=false. Earlier, Polly used to translate scalars and
PHI nodes to single element arrays, as this avoided the need for their special
handling in Polly. With Johannes' patches adding native support for such scalar
references to Polly, this code is not needed any more. After this commit both
-polly-prepare and -polly-independent are now mostly no-ops. Only a couple of
simple transformations still remain, but they are scheduled for removal too.

Thanks again to Johannes Doerfert for his nice work in making all this code
obsolete.

llvm-svn: 240766
2015-06-26 07:31:18 +00:00
Michael Kruse f1ac0fcf56 Enable ISL's small integer optimization
Summary:
With small integer optimization (short: sio) enabled, ISL uses 32 bit
integers for its arithmetic and only falls back to a big integer library
(in the case of Polly: IMath) if an operation's result is too large.
This gives a massive performance boost for most application using ISL.
For instance, experiments with ppcg (polyhedral source-to-source
compiler) show speed-ups of 5.8 (compared to plain IMath), respectively
2.7 (compared to GMP).

In Polly, a smaller fraction of the total compile time is taken by ISL,
but the speed-ups are still very significant. The buildbots measure
compilation speed-up up to 1.8 (oourafft, floyd-warshall, symm). All
Polybench benchmarks compile in at least 9% less time, and about 20%
less on average.

Detailed Polybench compile time results (median of 10):
correlation     -25.51%
covariance      -24.82%
2mm             -26.64%
3mm             -28.69%
atax            -13.70%
bicg            -10.78%
cholesky        -40.67%
doitgen         -11.60%
gemm            -11.54%
gemver          -10.63%
gesummv         -11.54%
mvt              -9.43%
symm            -41.25%
syr2k           -14.71%
syrk            -14.52%
trisolv         -17.65%
trmm             -9.78%
durbin          -19.32%
dynprog          -9.09%
gramschmidt     -15.38%
lu              -21.77%
floyd-warshall  -42.71%
reg_detect      -41.17%
adi             -36.69%
fdtd-2d         -32.61%
fdtd-apml       -21.90%
jacobi-1d-imper  -9.41%
jacobi-2d-imper -27.65%
seidel-2d       -31.00%

Reviewers: grosser

Reviewed By: grosser

Subscribers: Meinersbur, llvm-commits, pollydev

Projects: #polly

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

llvm-svn: 240689
2015-06-25 20:47:35 +00:00
Michael Kruse dddfeb6992 Fix autotools build
There were two issues:
* ISL's configure generates include/isl/stdint.h, not isl/stdint.h as
  assumed. This is also changed in the CMake build.

* Need to pass --with-int=imath to ISL's configure; the default is gmp. 

Polly's configure has been regenerated due to changing configure.ac

llvm-svn: 240657
2015-06-25 16:50:13 +00:00
Tobias Grosser 50165ffdee Add support for srem instruction
Remainder operations with constant divisor can be modeled as quasi-affine
expression. This patch adds support for detecting and modeling them. We also
add a test that ensures they are correctly code generated.

This patch was extracted from a larger patch contributed by Johannes Doerfert
in http://reviews.llvm.org/D5293

llvm-svn: 240518
2015-06-24 04:13:29 +00:00
Tobias Grosser a608569856 Replace srem by function call in nonaffine test cases
This makes the test cases nonaffine even if Polly some days gains support for
the srem instruction, an instruction which is currently not modeled but which
can clearly be modeled statically. A call to a function without definition
will always remain non-affine, as there is just insufficient static information
for it to be modeled more precisely.

llvm-svn: 240458
2015-06-23 20:55:05 +00:00
Tobias Grosser 6ca162e6e0 Add git patch files to .gitignore
llvm-svn: 240457
2015-06-23 20:55:01 +00:00
Michael Kruse f22855079a Use C99 to compile ISL
ISL with small integer optimization requires C99 to compile. gcc < 5.0
still uses C89 as default, so we need to enable the options to compile
in C99 mode.

This patch is preparing the actual activation of small integer
optimization.

Differential version: http://reviews.llvm.org/D10610

Reviewers: grosser
llvm-svn: 240322
2015-06-22 20:31:16 +00:00
Michael Kruse 9a4e22eea1 Make CMake generate isl/stdint.h
ISL's ./configure examines the system for the stdint.h to include and
creates a header file that points to it. On C99-compatible system

    #include <stdint.h>

is always valid such there no need for system introspection. This should
unbreak the build bots.

llvm-svn: 240315
2015-06-22 18:47:39 +00:00
Tobias Grosser 967c1e0b93 Handle zero-element ArrayRefs in CUDA run-time debug builder
llvm-svn: 240312
2015-06-22 18:45:23 +00:00
Michael Kruse 0c1c55345d Replace repository version of ISL by 'make dist' output
The 'make dist' archive is not dependent on ./configure output and
contains a GIT_HEAD_ID file that identifies the version of ISL used.

None of the files added or removed are used part of Polly's build
process (except of GIT_HEAD_ID since the previous revision r240301). No
functional change intended.

llvm-svn: 240306
2015-06-22 18:07:42 +00:00
Michael Kruse ee512e58a3 Prepare replacing ISL by its 'make dist' files
Currently the Polly repository contains the ISL sources with bogus
isl_config.h and gitversion.h. This is problematic. In this state a
 macro

    #define __attribute__(x)

becomes active in the source, leading to various problems e.g. when
included before system header files. This patch will instead generate
the two files specific to the host system at configure-time.

For CMake, we replicate the tests that ISL's configure performs using
try_compile(). In autotools build, we just invoke ISL's configure to
generate the two files. This consequently required regenerating
autoconf/configure.

'make dist' distributions of ISL contain a file GIT_HEAD_ID which
contains the version the distribution is derived from. The repository
files themselves do not contain such a hint. In a later commit we will
replace the isl directory by the contents of such a .tar.gz. It does
not contain the files imdrover.c iprime.c pi.c and rsamath.c currently
compiled into Polly, but not used and therefore are removed by this
patch.

In the long term we plan to generate a dedicated library for ISL instead
of adding its files to Polly.

This also does not yet include the switch to small-integer optimized ISL
nor enabling C99 mode required for the former. Those will come as well
in separate patches.

Differential version: http://reviews.llvm.org/D10603

Reviewers: grosser 
llvm-svn: 240301
2015-06-22 17:52:33 +00:00
David Blaikie de867e1ee9 Fix the clang -Werror build (-Wbraced-scalar-init)
llvm-svn: 240172
2015-06-19 20:07:18 +00:00
Tobias Grosser e7e628cc07 Add NVIDIA vprintf printing to RuntimeDebugBuilder
2nd try, this time with the corresponding LLVM IRBuilder changes in place.

llvm-svn: 240119
2015-06-19 02:33:45 +00:00
Michael Kruse 21a24730d0 Update external project versions in README.txt
This was meant to committed in r240027, but was left behind because 
svn, in contrast to git, only commits the changes in the directory you
are currently in.

llvm-svn: 240034
2015-06-18 18:07:06 +00:00
Michael Kruse c59f22c556 Update ISL to isl-0.15-3-g532568a
This version adds small integer optimization, but is not active by
default. It will be enabled in a later commit.
    
The schedule-fuse=min/max option has been replaced by the
serialize-sccs option. Adapting Polly was necessary, but retaining the
name polly-opt-fusion=min/max.

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

Reviewers: grosser
llvm-svn: 240027
2015-06-18 16:45:40 +00:00
Tobias Grosser aa9f575ae1 Adjust to personality function change in 239940
llvm-svn: 239992
2015-06-18 05:02:11 +00:00
Chandler Carruth afa4ea7121 [PM/AA] Update Polly for r239886 which removed UnknownSize from
AliasAnalysis by getting it from its newly canonical home of
MemoryLocation::UnknownSize.

llvm-svn: 239890
2015-06-17 08:29:32 +00:00
Michael Kruse dd6011c494 Orthography: substracting -> subtracting
This is a test commit for being granted commit-after-approval access.

llvm-svn: 239725
2015-06-15 10:52:28 +00:00
Tobias Grosser 039955a44c Revert "Add NVIDIA vprintf printing to RuntimeDebugBuilder"
This reverts commit 239219 which requires some LLVM changes I forgot to commit.

Reported-by: Marshall Clow
llvm-svn: 239306
2015-06-08 16:24:49 +00:00
Tobias Grosser 6091417ebc Add NVIDIA vprintf printing to RuntimeDebugBuilder
llvm-svn: 239219
2015-06-06 08:43:22 +00:00
Tobias Grosser d8308fbed9 Avoid the use of std::map emplace
This functionality does not yet seem to exist on all buildbots.

llvm-svn: 239133
2015-06-05 05:52:15 +00:00
Tobias Grosser 785ee20cac Free two strings produced by isl
With this commit 'make check-polly' is now address sanitizer clean.

llvm-svn: 239131
2015-06-05 05:31:46 +00:00
Tobias Grosser d5d93ecd03 Use owning pointers to avoid memory leaks
This fixes a memory leak caused by us not freeing the expanded region nodes.

llvm-svn: 239061
2015-06-04 17:59:54 +00:00
Tobias Grosser 8199c722c7 Disable output for test case that does not need output
llvm-svn: 239060
2015-06-04 17:59:51 +00:00
Tobias Grosser a5c092d844 Store ArrayShape in shared_ptr and MemAccs as actual objects
This fixes two more memory leaks.

llvm-svn: 239050
2015-06-04 16:03:16 +00:00
Tobias Grosser ff22e9e5f6 Store comparison objects as objects, not pointers
This fixes a memory leak. If we store the actual objects we can not forget to
free them.

llvm-svn: 239033
2015-06-04 11:44:09 +00:00
Tobias Grosser 22adfb4373 Mark sdivs as 'exact' instead of lowering them ourselves
LLVM's instcombine already translates power-of-two sdivs that are known to be
exact to fast ashr instructions. Hence, there is no need to add this logic
ourselves.

Pointed-out-by: Johannes Doerfert
llvm-svn: 239025
2015-06-04 07:45:09 +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
Chandler Carruth bdb4a39ad8 Update Polly for the AA/MemoryLocation refactoring.
llvm-svn: 239008
2015-06-04 03:49:46 +00:00
Tobias Grosser a441305564 [doc] Rename -polly-detect-only= to -polly-only-func=
llvm-svn: 238930
2015-06-03 15:45:19 +00:00
Tobias Grosser 244c8297cf Lower signed-divisions without rounding to ashr instructions
llvm-svn: 238929
2015-06-03 15:14:58 +00:00
Tobias Grosser 224b162280 Only convert power-of-two floor-division with non-negative denominator
floord(a,b) === a ashr log_2 (b) holds for positive and negative a's, but
shifting only makes sense for positive values of b. The previous patch did
not consider this as isl currently always produces postive b's. To avoid future
surprises, we check that b is positive and only then apply the optimization.

We also now correctly check the return value of the dyn-cast.

No additional test case, as isl currently does not produce negative
denominators.

Reported-by: David Majnemer <david.majnemer@gmail.com>
llvm-svn: 238927
2015-06-03 14:43:01 +00:00
Tobias Grosser cb73f150d4 Translate power-of-two floor-division into ashr
Power-of-two floor divisions can be translated into an arithmetic shift
operation. This allows us to replace a complex lowering that requires division
operations:

  %pexp.fdiv_q.0 = sub i64 %21, 128
  %pexp.fdiv_q.1 = add i64 %pexp.fdiv_q.0, 1
  %pexp.fdiv_q.2 = icmp slt i64 %21, 0
  %pexp.fdiv_q.3 = select i1 %pexp.fdiv_q.2, i64 %pexp.fdiv_q.1, i64 %21
  %pexp.fdiv_q.4 = sdiv i64 %pexp.fdiv_q.3, 128

with a simple ashr:

  %polly.fdiv_q.shr = ashr i64 %21, 7

llvm-svn: 238905
2015-06-03 06:31:30 +00:00
Tobias Grosser 97d8745087 Dump YAML schedule tree as properly indented tree in DEBUG output
llvm-svn: 238645
2015-05-30 06:46:59 +00:00