Commit Graph

2811 Commits

Author SHA1 Message Date
Tobias Grosser 5f865032db PPCG codegen
The latest version of the isl C++ bindings does not export the 'set'
method yet. Fall back to the C interface until this method can be
exported.

llvm-svn: 338512
2018-08-01 10:48:38 +00:00
Tobias Grosser 4b53d74e89 [isl++] drop the isl namespace qualifiers [NFC]
These namespace qualifiers are not needed. Dropping them brings us
closer to the official isl namespace qualifiers.

While the delta of this change set is large, it only mechanically drops
the 'isl::' prefixes.

llvm-svn: 338505
2018-08-01 09:57:36 +00:00
Tobias Grosser a2fd441989 Rebase C++ bindings on top of latest isl bindings
The main difference in this change is that isl_stat is now always
checked by default. As we elminiated most used of isl_stat, thanks to
Philip Pfaffe's implementation of foreach, only a small set of changes
is needed.

This change does not include the following recent changes to isl's C++
bindings:

  - stricter error handling for isl_bool
  - dropping of the isl::namespace qualifiers

The former requires a larger patch in Polly and consequently should go
through a patch-review. The latter will be applied in the next commit to
keep this commit free from noise.

We also still apply a couple of other changes on top of the official isl
bindings. This delta is expected to shrink over time.

llvm-svn: 338504
2018-08-01 09:57:10 +00:00
Tobias Grosser d169d70bbf Update to isl-0.20-35-ge0a98b62
llvm-svn: 338501
2018-08-01 09:20:03 +00:00
Michael Kruse 37b3c1775b [JSONExporter] Try to appease buildbot. NFC.
The compiler does not seem to able move a local variable in the
function's return statement.

llvm-svn: 338466
2018-08-01 00:48:01 +00:00
Michael Kruse 42ad818265 [Polly-ACC] Fix compilation after r338450. NFC.
llvm-svn: 338462
2018-08-01 00:27:29 +00:00
Michael Kruse 23655020a2 [JSONExporter] Replace bundled Jsoncpp with llvm/Support/JSON.h. NFC.
Differential Revision: https://reviews.llvm.org/D49950

llvm-svn: 338461
2018-08-01 00:15:16 +00:00
Michael Kruse e873673b0c [CodeGen] Convert IslNodeBuilder::getNumberOfIterations to isl++. NFC.
llvm-svn: 338451
2018-07-31 23:01:50 +00:00
Michael Kruse f16378b080 [CodeGen] Convert IslNodeBuilder::createForSequential to isl++. NFC.
llvm-svn: 338450
2018-07-31 22:43:04 +00:00
Michael Kruse ade2242e7e [CodeGen] Convert IslNodeBuilder::getUpperBound to isl++. NFC.
llvm-svn: 338449
2018-07-31 22:42:59 +00:00
Tobias Grosser 6d69f92864 [DependenceInfo] Use isl++ to replace foreach_set with for loop
llvm-svn: 337248
2018-07-17 07:08:06 +00:00
Tobias Grosser 670482db8b [IslNodeBuilder] Use isl++ to replace foreach_set with for loop
llvm-svn: 337247
2018-07-17 07:08:01 +00:00
Tobias Grosser a98c7e7309 [ScopInfo] Replace isl foreach calls with for loops
llvm-svn: 337246
2018-07-17 06:41:20 +00:00
Tobias Grosser bbb510b18d [ZoneAlgo] Replace isl foreach calls with for loops
llvm-svn: 337245
2018-07-17 06:33:41 +00:00
Tobias Grosser c253931fcf [FlattenSchedule] Replace isl foreach calls with for loops
llvm-svn: 337244
2018-07-17 06:33:37 +00:00
Tobias Grosser 3867bae74b [MaximalStaticExpansion] Replace isl foreach calls with for loops
llvm-svn: 337243
2018-07-17 06:33:34 +00:00
Tobias Grosser 91f851b11a [ForwardOpTree] Replace isl foreach calls with for loops
llvm-svn: 337242
2018-07-17 06:33:31 +00:00
Tobias Grosser a33871686f [Simplify] Replace isl foreach calls with for loops
llvm-svn: 337241
2018-07-17 06:33:26 +00:00
Tobias Grosser 9d8913020d [FlattenAlgo] Replace more isl foreach calls with for loops
This time we replace for loops where the return isl::stat::error has
been used to carry status information.

There are still two uses of foreach remaining as we do not have a
corresponding for implementation for pw_aff functions.

llvm-svn: 337239
2018-07-17 06:16:58 +00:00
Tobias Grosser 6106595ac1 [FlattenAlgo] Replace some isl foreach calls with for loops
Replace foreach calls which only return 'ok' with for loops.

llvm-svn: 337238
2018-07-17 06:11:53 +00:00
Tobias Grosser 31e29a4b59 [ScopInfo] Replace isl foreach calls with for loops
After Philip added support for range-based for loops to our C++
bindings, we now convert another bunch of foreach calls to range-for loops.
This improves general readability of the code.

llvm-svn: 337201
2018-07-16 19:04:16 +00:00
Philip Pfaffe ee51d5c64e [Polly][isl] Add neutrally-named accessors to isl list elements and sizes
Summary: This could simplify the isl iterator implementation a lot.

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

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

llvm-svn: 337054
2018-07-13 22:05:01 +00:00
Philip Pfaffe 492cdfc5fb Add a file that was missing in r336425
llvm-svn: 336430
2018-07-06 11:33:35 +00:00
Tobias Grosser b370615451 Update isl to isl-0.19-224-gce84a511
This is a maintenance update. Besides many minor changes it ships two
functions "isl_*_list_size" and "isl_*_list_get_at" which will allow us
to simplify the iterator implementation in Polly.

llvm-svn: 336425
2018-07-06 09:00:26 +00:00
Tobias Grosser 4aab4ec836 [ScopInfo] Move foldSizeConstantsToRight() to isl++
Summary: This patch updates the isl interface used in `foldSizeConstantsToRight()` to the new C++ interface.

Reviewers: chelini, grosser, philip.pfaffe, Meinersbur

Reviewed By: grosser

Subscribers: llvm-commits

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

llvm-svn: 336362
2018-07-05 15:23:28 +00:00
Michael Kruse 9f305371d9 [CodeGen] Fix potential null pointer dereference. NFC.
ScalarEvolution::getSCEV dereferences its argument, s.t. passing nullptr
leads to undefined behaviour.

Check for nullptr before calling it instead of checking its argument
afterwards.

llvm-svn: 336350
2018-07-05 13:44:50 +00:00
Siddharth Bhat 936c74ad0d [PPCGCodeGen] Change printf to outs() to prevent garbled output. [NFC]
Summary:
It appears that llvm uses unbuffered C++ streams. So, we should not
mix C and C++ stream operations, because that will give us mixed
up output.

Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev, grosser, singam-sanjay, philip.pfaffe

Reviewed By: philip.pfaffe

Subscribers: nemanjai, kbarton

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

llvm-svn: 336288
2018-07-04 16:51:27 +00:00
Tobias Grosser a66ab832a0 ScopInfo: simplify equivalence classes before storing them [NFCI]
This change has no impact on upstream Polly directly, but reduces output
noise for some internal isl versions we are testing. In general, storing
simpler and more canonical output is a good idea. Hence, it seems useful
to upstream this change.

llvm-svn: 336281
2018-07-04 14:53:36 +00:00
Siddharth Bhat 98a7a31d1e [Polly-ACC] Add isl_space.h to gpu_tree.c
Summary:
This patch adds <isl_space.h> to gpu_tree.c. This prevents a segfault
when allocating a new isl_space in the function create_sync_domain(), as
the compiler now knows that the return type is a pointer instead of
assuming the function returns an int.

This has been updated in upstream PPCG, so we should bump up our PPCG
version.

Initially discovered by Philip Pfaffe in Polly.

Reviewers: grosser, bollu, philip.pfaffe

Reviewed By: bollu

Subscribers: nemanjai, kbarton, llvm-commits

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

Contributed-by: Alain Denzler <alaindenzler@gmail.com>
llvm-svn: 336251
2018-07-04 09:40:55 +00:00
Philip Pfaffe d71493cb06 [polly-acc] change cl_get_* return types to 32/64bit
Summary:
This patch changes the return types for ocl_get_* functions during SPIR code generation. Because these functions return size_t types, the return type needs to be changed to the actual size of size_t on the device.

Based on work by Michal Babej and Pekka Jääskeläinen

Patch by: Alain Denzler

Reviewers: grosser, philip.pfaffe, bollu

Reviewed By: grosser, philip.pfaffe

Subscribers: nemanjai, kbarton, llvm-commits

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

llvm-svn: 336080
2018-07-02 07:40:47 +00:00
Tobias Grosser d43114f880 Use range for in normalizeValInst [NFCI]
llvm-svn: 335971
2018-06-29 13:06:44 +00:00
Tobias Grosser 1696e48e79 Translate a couple of foreach callbacks into range-based iterator loops
Thanks to Philip Pfaffe for providing iterator support in the previous
commit.

llvm-svn: 335970
2018-06-29 12:23:48 +00:00
Philip Pfaffe ec1a3048a3 [ScopHelper] Provide support for recognising collective invariant loads
Summary: This patch aims to provide support for detecting load patterns which are collectively invariant but right now `isHoistableLoad()` is checking each load instruction individually which cannot detect the load pattern as a whole.

Patch by: Sahil Girish Yerawar

Reviewers: bollu, philip.pfaffe, Meinersbur

Reviewed By: philip.pfaffe, Meinersbur

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

llvm-svn: 335949
2018-06-29 07:29:45 +00:00
Eli Friedman 199caa2e80 [ScopHelper] Cache ScopExpander results.
The number of SCEV expressions is usually linear in the number of IR
instructions being modeled.  However, a naive SCEV visitor is not. For
an expression like x*x, "x" will be visited twice.  If x is itself an
expression like x*x, that will be visited twice, etc, and the overall
runtime is O(2^N) in the number of SCEV expressions.

To prevent this from happening, add a cache, so we only visit each SCEV
expression once.

Not sure this is the best solution. Maybe we can instead check whether
the SCEV is scop-invariant (in which case we never need to map the
value). But we don't have a utility for that at the moment.

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

llvm-svn: 335783
2018-06-27 20:35:02 +00:00
Michael Kruse 96da1ca584 [ZoneAlgo] Use getDefToTarget in makeValInst. NFC.
Move the optimized getDefToTarget() from ForwardOpTree to ZoneAlgo such
that it can be used by makeValInst.

This reduces the compile time of GrTestUtils of the aosp buildbot from
2m46s to 21s, which should fix the timeout issue.

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

llvm-svn: 335606
2018-06-26 14:29:09 +00:00
Tobias Grosser 6ec6e1d6d6 Move ScopInfo to isl++
llvm-svn: 335029
2018-06-19 08:13:53 +00:00
Tobias Grosser 67dc08bd4c Adjust for clang-format changes
llvm-svn: 334941
2018-06-18 13:01:52 +00:00
Tobias Grosser 09a5437886 [ScopInfo] Move splitAliasGroupsByDomain and getAccessDomain to isl++ [NFCI]
llvm-svn: 334940
2018-06-18 12:53:26 +00:00
Tobias Grosser 9b29af946f [ScopInfo] Move more functions to isl++ [NFCI]
This change includes:

  - getFortranArrayIds
  - adjustDomainDimensions
  - propagateInvalidStmtDomains
  - buildAliasGroupsForAccesses

llvm-svn: 334939
2018-06-18 12:49:47 +00:00
Tobias Grosser 85dfb53e32 [ScopInfo] Move addNonEmptyDomainConstraints to isl++ [NFCI]
llvm-svn: 334938
2018-06-18 12:41:58 +00:00
Tobias Grosser fd5c856fe5 Move buildConditionSet to C++
llvm-svn: 334937
2018-06-18 12:35:36 +00:00
Philip Pfaffe 66a05ad672 Simplify the implementation of getCUDALibDeviceFunction. NFC.
Summary:
The function is currently awfully complicated. Drop the IILE and use
StringRef over std::string.

Reviewers: Meinersbur, grosser, bollu

Reviewed By: Meinersbur

Subscribers: nemanjai, kbarton, bollu, llvm-commits, pollydev

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

llvm-svn: 334695
2018-06-14 08:54:55 +00:00
Tobias Grosser 6538f40e31 Drop unnecessary whitespace [NFCI]
llvm-svn: 334413
2018-06-11 15:11:57 +00:00
Tobias Grosser 80677bce11 [ScopBuilder] Slightly improve code structure [NFCI]
First build the surrounding loops and then build up the polyhedral
structures. Before r326664 we had to mix these updates, clean this
up to improve readability (slightly).

llvm-svn: 334412
2018-06-11 14:59:28 +00:00
Tobias Grosser 2c543e775f Update isl to isl-0.19-185-g8e9f55ce
This is mainly a maintenance update.

llvm-svn: 334406
2018-06-11 14:25:42 +00:00
Philip Pfaffe e6e1828004 Run clang-format
llvm-svn: 334172
2018-06-07 08:32:13 +00:00
Philip Pfaffe 30c5e4ad35 Fix a missing lambda return type that tripped the builders
llvm-svn: 334166
2018-06-07 07:50:55 +00:00
Michael Kruse 2dab88e652 [OpTree] Introduce shortcut for computing the def->target mapping. NFCI.
In case the schedule has not changed and the operand tree root uses a
value defined in an ancestor loop, the def-to-target mapping is trivial.
For instance, the SCoP

    for (int i < 0; i < N; i+=1) {
    DefStmt:
      D = ...;
      for (int j < 0; j < N; j+=1) {
    TargetStmt:
        use(D);
      }
    }

has DefStmt-to-TargetStmt mapping of

    { DefStmt[i] -> TargetStmt[i,j] }

This should apply on the majority of def-to-target mappings.
This patch detects this case and directly constructs the expected
mapping. It assumes that the mapping never crosses the loop header
DefStmt is in, which ForwardOpTree does not support at the moment
anyway.

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

llvm-svn: 334134
2018-06-06 21:37:35 +00:00
Tobias Grosser 6a6d9df78e getDependences to new C++ interface
Reviewers: Meinersbur, grosser, bollu, cs15btech11044, jdoerfert

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 334092
2018-06-06 13:10:32 +00:00
Tobias Grosser a998f98ba6 Fix formatting
llvm-svn: 333988
2018-06-05 09:03:46 +00:00