Commit Graph

2856 Commits

Author SHA1 Message Date
Roman Gareev 98075fe181 A new algorithm for identification of a SCoP statement that implement a matrix
multiplication

The current identification of a SCoP statement that implement a matrix
multiplication does not help to identify different permutations of loops that
contain it and check for dependencies, which can prevent it from being
optimized. It also requires external determination of the operands of
the matrix multiplication. This patch contains the implementation of a new
algorithm that helps to avoid these issues. It also modifies the test cases
that generate matrix multiplications with linearized accesses, because
the new algorithm does not support them.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>,
             Tobias Grosser <tobias@grosser.es>

Differential Revision: https://reviews.llvm.org/D28357

llvm-svn: 293890
2017-02-02 14:23:14 +00:00
Tobias Grosser ff40087a6a Update to recent formatting changes
llvm-svn: 293756
2017-02-01 10:12:09 +00:00
Daniel Jasper baaa152294 Fix format after recent clang-format change.
llvm-svn: 293753
2017-02-01 09:31:42 +00:00
Roman Gareev 7758a2af53 Update the documentation on how the packing transformation is implemented
Add a simple example to update the documentation on how the packing
transformation is implemented.

Reviewed-by: Tobias Grosser <tobias@grosser.es>,
             Michael Kruse <llvm@meinersbur.de>

Differential Revision: https://reviews.llvm.org/D28021

llvm-svn: 293429
2017-01-29 10:37:50 +00:00
Tobias Grosser f58469ad45 Add forgotten test case for r293169
llvm-svn: 293383
2017-01-28 14:32:45 +00:00
Tobias Grosser 682c51143d [BlockGenerator] Comment corretions for r293374 [NFC]
This addresses some additional comments from Michael Kruse for commit r293374
as expressed in https://reviews.llvm.org/D28901.

llvm-svn: 293378
2017-01-28 11:39:02 +00:00
Tobias Grosser 587f1f57ad [Polly] [BlockGenerator] Unify ScalarMap and PhiOpsMap
Instead of keeping two separate maps from Value to Allocas, one for
MemoryType::Value and the other for MemoryType::PHI, we introduce a single map
from ScopArrayInfo to the corresponding Alloca. This change is intended, both as
a general simplification and cleanup, but also to reduce our use of
MemoryAccess::getBaseAddr(). Moving away from using getBaseAddr() makes sure
we have only a single place where the array (and its base pointer) for which we
generate code for is specified, which means we can more easily introduce new
access functions that use a different ScopArrayInfo as base. We already today
experiment with modifiable access functions, so this change does not address
a specific bug, but it just reduces the scope one needs to reason about.

Another motivation for this patch is https://reviews.llvm.org/D28518, where
memory accesses with different base pointers could possibly be mapped to a
single ScopArrayInfo object. Such a mapping is currently not possible, as we
currently generate alloca instructions according to the base addresses of the
memory accesses, not according to the ScopArrayInfo object they belong to.  By
making allocas ScopArrayInfo specific, a mapping to a single ScopArrayInfo
object will automatically mean that the same stack slot is used for these
arrays. For D28518 this is not a problem, as only MemoryType::Array objects are
mapping, but resolving this inconsistency will hopefully avoid confusion.

llvm-svn: 293374
2017-01-28 07:42:10 +00:00
Michael Kruse d1508812f5 [Support] Add general isl tools for DeLICM. NFC.
Add some generally useful isl tools into a their own new ISLTools.cpp.
These are the helpers were extracted from and will be use by the DeLICM
algorithm (https://reviews.llvm.org/D24716).

Suggested-by: 	Tobias Grosser <tobias@grosser.es>
llvm-svn: 293340
2017-01-27 22:51:36 +00:00
Michael Kruse 33dc454700 [CodePrepa] Remove unused declaration. NFC.
llvm-svn: 293304
2017-01-27 16:59:09 +00:00
Tobias Grosser 77363965c0 [ScopDetectionDiagnostic] Add meaningfull enduser message for regions with entry block
Before this change the user only saw "Unspecified Error", when a region
contained the entry block. Now we report:

"Scop contains function entry (not yet supported)."

llvm-svn: 293169
2017-01-26 10:41:37 +00:00
Tobias Grosser 64bbb1357f ScopDetectionDiagnostics: Also emit diagnostics in case no debug info is available
In this case, we just use the start of the scop as the debug location.

llvm-svn: 293165
2017-01-26 10:30:55 +00:00
Tobias Grosser 75dfaa1dbe BlockGenerator: Do not redundantly reload from PHI-allocas in non-affine stmts
Before this change we created an additional reload in the copy of the incoming
block of a PHI node to reload the incoming value, even though the necessary
value has already been made available by the normally generated scalar loads.
In this change, we drop the code that generates this redundant reload and
instead just reuse the scalar value already available.

Besides making the generated code slightly cleaner, this change also makes sure
that scalar loads go through the normal logic, which means they can be remapped
(e.g. to array slots) and corresponding code is generated to load from the
remapped location. Without this change, the original scalar load at the
beginning of the non-affine region would have been remapped, but the redundant
scalar load would continue to load from the old PHI slot location.

It might be possible to further simplify the code in addOperandToPHI,
but this would not only mean to pull out getNewValue, but to also change the
insertion point update logic. As this did not work when trying it the first
time, this change is likely not trivial. To not introduce bugs last minute, we
postpone further simplications to a subsequent commit.

We also document the current behavior a little bit better.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D28892

llvm-svn: 292486
2017-01-19 14:12:45 +00:00
Tobias Grosser 943c369c60 BlockGenerator: remove obfuscating const and const casts
Making certain values 'const' to just cast it away a little later mainly
obfuscates the code. Hence, we just drop the 'const' parts.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 292480
2017-01-19 13:25:52 +00:00
Tobias Grosser 97b8490982 Use range-based for loop [NFC]
llvm-svn: 292471
2017-01-19 05:09:23 +00:00
Tobias Grosser a989a8b84c Improve test coverage in test/Isl/CodeGen/loop_partially_in_scop.ll [NFC]
We rename the test case with -metarenamer to make the variable names easier to
read and add additional check lines that verify the code we currently generate
for PHI nodes. This code is interesting as it contains a PHI node in a
non-affine sub-region, where some incoming blocks are within the non-affine
sub-region and others are outside of the non-affine subregion.

As can be seen in the check lines we currently load the PHI-node value twice.
This commit documents this behavior. In a subsequent patch we will try to
improve this.

llvm-svn: 292470
2017-01-19 04:54:45 +00:00
Tobias Grosser e1ff0cf2eb Relax assert when setting access functions with invariant base pointers
Summary:
Instead of forbidding such access functions completely, we verify that their
base pointer has been hoisted and only assert in case the base pointer was
not hoisted.

I was trying for a little while to get a test case that ensures the assert is
correctly fired in case of invariant load hoisting being disabled, but I could
not find a good way to do so, as llvm-lit immediately aborts if a command
yields a non-zero return value. As we do not generally test our asserts,
not having a test case here seems OK.

This resolves http://llvm.org/PR31494

Suggested-by: Michael Kruse <llvm@meinersbur.de>

Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D28798

llvm-svn: 292213
2017-01-17 12:00:42 +00:00
Tobias Grosser 7fcb689ea8 test: harden test case to fail even in non-asserts build
The original test case was added in r292147.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 292202
2017-01-17 07:03:25 +00:00
Tobias Grosser 7f8da87c34 docs: Add source of LLVM pass order illustration
llvm-svn: 292199
2017-01-17 06:16:09 +00:00
Eli Friedman 71329901ea Tidy up getFirstNonBoxedLoopFor [NFC]
Move the function getFirstNonBoxedLoopFor which is used in ScopBuilder
and in ScopInfo to Support/ScopHelpers to make it reusable in other
locations. No functionality change.

Patch by Sameer Abu Asal.

Differential Revision: https://reviews.llvm.org/D28754

llvm-svn: 292168
2017-01-16 22:54:29 +00:00
Tobias Grosser eec7f6daa1 Add test showing the update of access functions with in-scop defined base ptrs
This feature is currently not supported and an explicit assert to prevent the
introduction of such accesses has been added in r282893. This test case allows
to reproduce the assert (and without the assert the miscompile) added in
r282893. It will help when adding such support at some point.

llvm-svn: 292147
2017-01-16 17:51:28 +00:00
Tobias Grosser 0032d87337 ScopInfo: document base pointers in alias-checks must be invariant [NFC]
Before this change, this code has been mixed with a check for non-affine
loops (and when originally introduce was also duplicated). By creating
a separate loop and explicitly documenting this property, the current
behavior becomes a lot more clear.

llvm-svn: 292140
2017-01-16 15:49:14 +00:00
Tobias Grosser f3c145f2ab ScopInfo: Improve comments in buildAliasGroup [NFC]
llvm-svn: 292139
2017-01-16 15:49:09 +00:00
Tobias Grosser 77f3257b41 ScopInfo: split out construction of a single alias group [NFC]
The loop body in buildAliasGroups is still too large to easily scan it. Hence,
we split the loop body out into a separate function to improve readability.

llvm-svn: 292138
2017-01-16 15:49:07 +00:00
Tobias Grosser e95222343c ScopInfo: Do not modify the original alias group [NFC]
Instead of modifying the original alias group and repurposing it as read-write
access group when splitting accesses in read-only and read-write accesses, we
just keep all three groups: the original alias group, the set of read-only
accesses and the set of read-write accesses.  This allows us to remove some
complicated iterator handling and also allows for more code-reuse in
calculateMinMaxAccess.

llvm-svn: 292137
2017-01-16 15:49:04 +00:00
Tobias Grosser 457eb579dd ScopInfo: No need to keep ReadOnlyAccesses in an additional map [NFC]
It seems over time we added an additional map that maps from the base address
of a read-only access to the actual access. However this map is never used.
Drop the creation and use of this map to simplify our alias check generation
code.

llvm-svn: 292126
2017-01-16 14:24:48 +00:00
Tobias Grosser dba2206b65 ScopInfo: no need to clear alias group explicitly
The alias group will anyhow be cleared at the end of this function and is not
used afterwards. We avoid an explicit clear() call at multiple places to
improve readability of this code.

llvm-svn: 292125
2017-01-16 14:13:01 +00:00
Tobias Grosser 93eb7e321f Un-XFAIL test case after half support was added to PTX backend in r291956
llvm-svn: 292124
2017-01-16 14:08:14 +00:00
Tobias Grosser 21a059af09 Adjust formatting to commit r292110 [NFC]
llvm-svn: 292123
2017-01-16 14:08:10 +00:00
Tobias Grosser 92fd612c84 ScopInfo: Fold SmallVectors used in alias check generation back into loop [NFC]
Hoisting small vectors out of a loop seems to be a pure performance
optimization, which is unlikely to have great impact in practice. As this
hoisting just increases code-complexity, we fold the SmallVectors back into
the loop.

In subsequent commits, we will further simplify and structure this code, but
we committed this change separately to provide an explanation to make clear
that we purposefully reverted this optimization.

llvm-svn: 292122
2017-01-16 14:08:02 +00:00
Tobias Grosser e39f9127f9 ScopInfo: Extract out splitAliasGroupsByDomain [NFC]
The function buildAliasGroups got very large. We extract out the splitting
of alias groups to reduce its size and to better document the current behavior.

llvm-svn: 292121
2017-01-16 14:08:00 +00:00
Tobias Grosser 9edcf07e83 ScopInfo: Extract out buildAliasGroupsForAccesses [NFC]
The function buildAliasGroups got very large. We extract out the actual
construction of alias groups to reduce its size and to better document the
current behavior.

llvm-svn: 292120
2017-01-16 14:07:57 +00:00
Tobias Grosser 2ef3887d28 Do not track the isl PDF manual in SVN
There is no point in regularly committing a binary file to the repository, as
this just unnecessarily increases the repository size. Interested people can
find the isl manual for example at isl.gforge.inria.fr/manual.pdf.

llvm-svn: 292105
2017-01-16 11:48:03 +00:00
Hongbin Zheng 6aded2a0e4 Fix compilation on MSVC, NFC
Differential Revision: https://reviews.llvm.org/D28739

llvm-svn: 292067
2017-01-15 16:47:26 +00:00
Tobias Grosser 4d5a917287 Use typed enums to model MemoryKind and move MemoryKind out of ScopArrayInfo
To benefit of the type safety guarantees of C++11 typed enums, which would have
caught the type mismatch fixed in r291960, we make MemoryKind a typed enum.
This change also allows us to drop the 'MK_' prefix and to instead use the more
descriptive full name of the enum as prefix. To reduce the amount of typing
needed, we use this opportunity to move MemoryKind from ScopArrayInfo to a
global scope, which means the ScopArrayInfo:: prefix is not needed. This move
also makes historically sense. In the beginning of Polly we had different
MemoryKind enums in both MemoryAccess and ScopArrayInfo, which were later
canonicalized to one. During this canonicalization we just choose the enum in
ScopArrayInfo, but did not consider to move this shared enum to global scope.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D28090

llvm-svn: 292030
2017-01-14 20:25:44 +00:00
Tobias Grosser 67e94fb435 ScheduleOptimizer: Allow to set register width in command line
We use this option to set a fixed register width in our test cases to make
sure the results are identical accross platforms.

llvm-svn: 292002
2017-01-14 07:14:54 +00:00
Tobias Grosser 4e8d1475bd ScopInfo: use correct enum type in type definition
Instead of a plain 'int' we use the correct enum type. This does not give
us type safety yet, but at least makes the code more correct in terms of typing.
To avoid such mismatches it might sense to switch these enums to C++11 typed
enums.

llvm-svn: 291960
2017-01-13 21:46:48 +00:00
Hans Wennborg d5a5d72382 Clear the release notes for 5.0.0
llvm-svn: 291852
2017-01-12 22:47:01 +00:00
Tobias Grosser e29db2173b Update to recent clang-format changes
llvm-svn: 291810
2017-01-12 21:05:19 +00:00
Tobias Grosser bb1e386c4d Update tests to more precise analysis results in LLVM core
LLVM's range analysis became a little tighter, which means Polly can derive
tighter bounds as well.

llvm-svn: 291718
2017-01-11 22:53:34 +00:00
Chandler Carruth 23bae6df12 Teach Polly's standalone build to work now that we include the gmock
component of gtest.

llvm-svn: 291638
2017-01-11 01:07:37 +00:00
Chandler Carruth 290ea508a6 Teach Polly's unittest macro to link LLVMDemangle which LLVMSupport now
depends on...

llvm-svn: 291637
2017-01-11 01:07:35 +00:00
Eli Friedman c6e3b6f156 Delete stray isl_map_dump call.
llvm-svn: 291521
2017-01-10 01:08:11 +00:00
Tobias Grosser 9e2dceba19 www: Add dates RSS news
llvm-svn: 291388
2017-01-08 09:28:10 +00:00
Tobias Grosser be6f9f24ba www: add rss feeds from pollylabs.org and polyhedral.info
llvm-svn: 291387
2017-01-08 09:14:39 +00:00
Tobias Grosser b1e9eed9bc www: add Polly Labs named link
llvm-svn: 291386
2017-01-08 08:31:38 +00:00
Tobias Grosser 91f02e192a www: Add pollylabs news to navigation
llvm-svn: 291385
2017-01-08 08:30:11 +00:00
Tobias Grosser dd135157ff www: Add news for HiPEAC 2017
llvm-svn: 291384
2017-01-08 08:25:41 +00:00
Tobias Grosser cdbe5c9d6c Fix some typos in comments
llvm-svn: 291247
2017-01-06 17:30:34 +00:00
Tobias Grosser 94e5371dde Update to isl-0.18-43-g0b4256f
Even more isl coalesce changes.

llvm-svn: 290783
2016-12-31 07:46:11 +00:00
Tobias Grosser ba3ea97689 Update to isl-0.18-28-gccb9f33
Another set of isl coalesce changes.

llvm-svn: 290681
2016-12-28 19:35:49 +00:00