Commit Graph

3814 Commits

Author SHA1 Message Date
Philip Pfaffe cb8a82929c Fix for r336080: Missing colon in REQUIRES line
llvm-svn: 336083
2018-07-02 08:36:49 +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
Tobias Grosser da82da8a20 Add missing namespace specifier
llvm-svn: 335966
2018-06-29 11:49:34 +00:00
Philip Pfaffe 2f3eff86b1 [NFC] Fix formatting to appease builders
llvm-svn: 335952
2018-06-29 08:29:17 +00:00
Philip Pfaffe 52025af1da Implement an iterator for isl maps, basic_maps, sets, basic_sets
Summary:
Provide an iterator to simplify iteration over some isl collections.
Since these types do not natively support iteration, they have to be converted
to an list first by the caller, but can then be used in a ranged for loop:
```
isl::set S;
for (auto SubSet : S.get_basic_set_list ()) {
  // ...
}
```

Reviewers: bollu, Meinersbur, grosser, dexonsmith

Reviewed By: bollu

Subscribers: hfinkel, mgorny, Meinersbur, mehdi_amini, bollu, steven_wu, llvm-commits

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

llvm-svn: 335951
2018-06-29 08:17:03 +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
Tobias Grosser 17a098dedf test: use regex matchers to make test-case robust against register renumberings
Suggested-by: Michael Kruse
llvm-svn: 335813
2018-06-28 07:11:48 +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
Tim Shen 63f244c4f4 [SCEV] Re-apply r335197 (with Polly fixes).
Summary:
This initiates a discussion on changing Polly accordingly while re-applying r335197 (D48338).

I have never worked on Polly. The proposed change to param_div_div_div_2.ll is not educated, but just patterns that match the output.

All LLVM files are already reviewed in D48338.

Reviewers: jdoerfert, bollu, efriedma

Subscribers: jlebar, sanjoy, hiraditya, llvm-commits, bixia

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

llvm-svn: 335292
2018-06-21 21:29:54 +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
Paul Robinson 7555c589af Update copyright year to 2018.
llvm-svn: 334936
2018-06-18 12:22:17 +00:00
Tobias Grosser a78a809afc Adjust to recent LLVM changes to fix buildbots
llvm-svn: 334893
2018-06-16 17:38:19 +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 ee5762cfab [test] Fix a typo in a test case [NFCI]
Also remove an undef value that does not add any value to the test case.

llvm-svn: 334661
2018-06-13 21:46:29 +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
Krzysztof Parzyszek fb3ed4f409 [Polly] Fix a testcase after LLVM commit r334318
ScalarEvolution has become slightly more intelligent, so obfuscate the
exit condition in the testcase some more to keep it working.

llvm-svn: 334327
2018-06-08 21:39:55 +00:00
Philip Pfaffe 4d24093ac4 Back out of GPU Codegen if NVPTX is not available
Summary:
When enabling GPU codegen in polly, CMake will fail if NVPTX is not a target
supported by the LLVM polly is being built against. In that case, GPU codegen
should be switched off.

Reviewers: Meinersbur, grosser, bollu

Reviewed By: Meinersbur

Subscribers: mgorny, bollu, pollydev, llvm-commits

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

llvm-svn: 334233
2018-06-07 21:10:49 +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
David Blaikie 4490465db7 Update for a header file move in LLVM
llvm-svn: 333956
2018-06-04 21:23:32 +00:00
Tobias Grosser 78a8494eb5 partitionSetParts from C to C++ interface.
Summary: partitionSetParts from C to new C++ interface.

Reviewers: grosser, Meinersbur, jdoerfert, bollu, cs15btech11044

Reviewed By: grosser, Meinersbur

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 333780
2018-06-01 19:12:00 +00:00
Michael Kruse d51fbfca46 [ZoneAlgo] Make ZoneAlgorithm::isNormalized out-of-quota safe.
The aosp-O3-polly-before-vectorizer-unprofitable buildbot currently
fails in ZoneAlgorithm::isNormalized, presumably because an
out-of-quota happens in that function.

Modify ZoneAlgorithm::isNormalized to return an isl::boolean such
it can report an error.

In the failing case, it was called in an assertion in ForwardOpTree.
Allow to pass the assertion in an out-of-quota event, a condition that
is later checked before forwarding an operand tree.

llvm-svn: 333709
2018-05-31 22:44:23 +00:00
Tobias Grosser 4dcd83fcd2 Update isl C++ bindings
This update adds new list types and adds functions which convert isl
data types to lists of their contained elements:

  isl::set::get_basic_set_list
  isl::union_set::get_set_list

  isl::map::get_basic_map_list
  isl::union_map::get_map_list

llvm-svn: 333688
2018-05-31 19:48:23 +00:00
Tobias Grosser ce27773a8e Update isl to isl-0.19-173-g77fe2538
Besides other changes, this update introduces functions to translate a
maps and sets into lists of their elements. These lists are useful as
we can define iterators for lists, which allow us to replace many uses
of foreach.

llvm-svn: 333621
2018-05-31 03:59:05 +00:00
Michael Kruse d3ce899ddf [ForwardOpTree] Use less computationally expensive method to compute def-to-target map. NFCI.
When forwarding a LoadInst to another statement, a map that translates
their domain is needed. Before this patch, is was computed by appending
the def-to-use map to the def-to-target of the operand tree's target.

This patch lets the new method getDefToTarget do this. This is
computationally less expensive due to:

 * Caching of the result such that it can be used for multiple operands
   tree to the same target.

 * The map is only computed when there is a LoadInst that needs it.

 * It is only computed for the statement requiring the translator map,
   instead of having an intermediate result for every edge in the
  operand tree.

The downside is that this scheme cannot handle forwarding from a
previous loop iteration (which would require the entire path from
statement to target). Since ForwardOpTree currently does not support
forwarding across loop iterations (SCEV expressions would need to be
transformed), this was not needed anyway.

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

llvm-svn: 333426
2018-05-29 15:19:17 +00:00
Tobias Grosser 9b9c701020 [ScopInfo] Update Scop::addUserContext() to C++ interface
Summary: This patch updates `Scop::addUserContext()` function to the new C++ interface and replaces the `auto` keyword with explicit type wherever used in this function.

Reviewers: grosser, bollu, philip.pfaffe, chelini, Meinersbur

Reviewed By: grosser

Subscribers: llvm-commits

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

llvm-svn: 333366
2018-05-28 07:45:25 +00:00
Philip Pfaffe 7cc4300dac [Acc] Followup for r333105: Fix one additional testcase
llvm-svn: 333168
2018-05-24 10:18:09 +00:00
Tobias Grosser 79e3f2c6e2 Update isl to isl-0.19-152-g437e6ab0
Besides normal updates this change also contains a bug-fix to in
isl_coalesce which broke the AOSP buildbot. Thanks to Michael Kruse for
reporting this bug and Sven Verdoolage for fixing this bug.

llvm-svn: 333118
2018-05-23 20:18:50 +00:00
Tobias Grosser 10da5a0ae7 createNextIterationMap from C to C++ interface
Summary: update createNextIterationMap function to new C++ interface.

Reviewers: grosser, Meinersbur, jdoerfert, bollu, cs15btech11044

Reviewed By: cs15btech11044

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 333113
2018-05-23 18:41:40 +00:00
Philip Pfaffe 356d60683b [Acc] Enable legacy stmt granularity in remaining failing testcases
The default statement granularity changed in a recent change by Micheal. To
avoid forwad-porting the testcases, enable the legacy behaviour again in these tests.

llvm-svn: 333105
2018-05-23 17:46:10 +00:00
Philip Pfaffe 2e171b52ee [Acc] Update testcases for minor changes in the PPCG mapper and
statement naming

- A recent ppcg/isl update caused the grid/block size upper bounds to
deviate by one from the oracle. This is not an effect that's visible at
runtime.
- Statement naming changed in polly. Update the testcases.

llvm-svn: 333090
2018-05-23 14:56:57 +00:00
Philip Pfaffe c06a6380a0 [Acc] Re-land r326643 to finally fix PR33208.
Other than before, don't clear out LI entirely but only those relevant
loops.

llvm-svn: 333089
2018-05-23 14:52:35 +00:00
Peter Collingbourne 9a45114b3c CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.
Part of PR37466.

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

llvm-svn: 332881
2018-05-21 20:16:41 +00:00
Roman Lebedev df4fed6fe7 [polly] Drop nonexistant LLVM_PLUGIN_EXPORT macro from llvmGetPassPluginInfo()
Fixes build:
/build/polly/lib/Support/RegisterPasses.cpp:709:80: error: expected ';' after top level declarator
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK LLVM_PLUGIN_EXPORT
                                                                               ^
                                                                              ;

Was missed in rL332796 / D47082

llvm-svn: 332814
2018-05-19 19:16:35 +00:00
Eli Friedman e6ed0323cc [SCEVAffinator] BB can be null; don't use it to get the LLVMContext.
Fixes post-commit review comment on r332309.

llvm-svn: 332775
2018-05-18 21:57:44 +00:00
Michael Kruse d6c2ca8dd2 [DeLICM] Avoid assertion on out-of-quota.
An assertion was not prepared to be passed a nullptr because the
out-of-quota limit was exceeded.  Bail-out before the assertion
since the assertion does not apply on out-of-quote.

This fixes llvm.org/PR37477.

llvm-svn: 332488
2018-05-16 16:39:51 +00:00
Philip Pfaffe 9375d57202 [ScopInfo] Remove usage of isl_set_n_basic_set()
Summary: This patch aims to remove the usage of old C-styled isl functions (in this case `isl_set_n_basic_set()`) in favor of new C++ isl interface based methods in `ScopInfo.cpp`.

Patch by Sahil Yerawar

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

llvm-svn: 332471
2018-05-16 14:05:03 +00:00