Commit Graph

566 Commits

Author SHA1 Message Date
Tobias Grosser cd95b77330 Pocc: Fix some bugs in the PoCC optimizer pass
This includes:
  - The isl_id of the domain of the scattering must be copied from the original
    domain
  - Remove outdated references to a 'FinalRead' statement
  - Print of the Pocc output, if -debug is provided.
  - Add line breaks to some error messages.

Reported and Debugged by:  Dustin Feld  <d3.feld@gmail.com>

llvm-svn: 162901
2012-08-30 11:49:38 +00:00
Tobias Grosser 4a7527e0eb Pluto: Print pluto input in debugging mode
llvm-svn: 162900
2012-08-30 11:49:31 +00:00
Tobias Grosser 882a283946 Dependences: Print dependences in -analyze output
The dependency printing was accidentally removed in during a previous
restructuring.

llvm-svn: 162662
2012-08-27 08:44:15 +00:00
Tobias Grosser 6f9465591e PoCC: Simplify condition
llvm-svn: 162555
2012-08-24 13:56:56 +00:00
Tobias Grosser 4a67e01216 Sort includes
llvm-svn: 162554
2012-08-24 13:54:40 +00:00
Tobias Grosser c8fc2d7045 PoCC: Adapt to earlier vectorizer changes
llvm-svn: 162553
2012-08-24 13:54:36 +00:00
Tobias Grosser 1df5289782 autoconf: Only define GPGPU_CODEGEN, if that feature is requested
Before we defined GPGPU_CODEGEN to '0', which does not disable the relevant code
as we just check if that value is defined at all. We now follow the cmake
approach and only define GPGPU_CODEGEN, if the feature should be enabled.

Reported by: Sebastian Pop <spop@codeaurora.org>

llvm-svn: 162275
2012-08-21 12:29:10 +00:00
Tobias Grosser 7a19b31a23 Remove executable bits from html files
llvm-svn: 161930
2012-08-15 05:50:24 +00:00
Tobias Grosser 1049611070 www documentation for using Polly with dragonegg.
Added a file that explains how to load Polly in dragonegg.
Also fixed a typo in the document for clang.

Committed with a typo fix and a change to make this website available from
the documentation section.

Contributed by: Sameer Sahasrabuddhe  <Sameer.Sahasrabuddhe@amd.com>

llvm-svn: 161928
2012-08-15 05:02:25 +00:00
Tobias Grosser 6217e18a7d Add preliminary implementation for GPGPU code generation.
Translate the selected parallel loop body into a ptx string and run it with the
cuda driver API. We limit this preliminary implementation to target the
following special test cases:

  - Support only 2-dimensional parallel loops with or without only one innermost
    non-parallel loop.
  - Support write memory access to only one array in a SCoP.

The patch was committed with smaller changes to the build system:

There is now a flag to enable gpu code generation explictly. This was required
as we need the llvm.codegen() patch applied on the llvm sources, to compile this
feature correctly. Also, enabling gpu code generation does not require cuda.
This requirement was removed to allow 'make polly-test' runs, even without an
installed cuda runtime.

Contributed by:  Yabin Hu  <yabin.hwu@gmail.com>

llvm-svn: 161239
2012-08-03 12:50:07 +00:00
Tobias Grosser 08ffdba6bd Remove 'using namespace llvm' from header file
This fixes a conflict between polly::createIndVarSimplifyPass() and
llvm::createIndVarSimplifyPass(), which causes problems on windows.

Reported by:  Michael Kruse  <MichaelKruse@meinersbur.de

llvm-svn: 161235
2012-08-03 08:11:24 +00:00
Tobias Grosser 5a2925c6a1 cmake: Fix building of Polly on Apple system
The Apple linker fails by default, if some function calls can not be resolved at
link time. However, all functions that are part of LLVM itself will not be
linked into Polly, but will be provided by the compiler that Polly is loaded
into.  Hence, during linking we need to ignore failures due to unresolved
function calls.

llvm-svn: 161234
2012-08-03 07:12:07 +00:00
Tobias Grosser b19de925e9 Remove leftover definitions
Contributed by: Michael Kruse  <MichaelKruse@meinersbur.de>

llvm-svn: 161174
2012-08-02 13:34:58 +00:00
Tobias Grosser 9e97ae143f Update llvm.codegen() patch for CodeGen.cpp changes in r159694.
Contributed by:  Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 161160
2012-08-02 08:16:40 +00:00
Tobias Grosser 8ea010b6b1 Add missing dependency to cmake system
llvm-svn: 161158
2012-08-02 07:47:37 +00:00
Tobias Grosser c11349c55a Add support for libpluto as the scheduling optimizer.
llvm-svn: 161157
2012-08-02 07:47:26 +00:00
Hongbin Zheng 7aee737062 IndependentBLocks: Do not visit the same instruction twice when moving the
operand tree.

This patch fix Bug 13491, and the original "FIXME" in IndependentBlocks.cpp.

Patched by Kevin Fan<kevin.fan@gmail.com>.

llvm-svn: 161105
2012-08-01 08:46:11 +00:00
Tobias Grosser 19bde907b5 Create a new directory before running the polly script
Otherwise the script spams the home directory and, in case there are folders
of previous attempts lying around, it may fail in some unexpected way.

llvm-svn: 160677
2012-07-24 16:58:57 +00:00
Tobias Grosser 25184fe925 Allow cast instructions within scops
Cast instruction do not have side effects and can consequently be part of a
scop. We special cased them earlier, as they may be problematic within array
subscripts or loop bounds. However, the scalar evolution validator already
checks for them such that there is no need to also check the instructions within
the basic blocks.  Checking them is actually overly conservative as the precence
of casts may invalidate a scop, even though scalar evolution is not influenced
by it.

llvm-svn: 160261
2012-07-16 10:57:32 +00:00
Tobias Grosser 6cc23b07e6 Revert "Add preliminary implementation for GPGPU code generation."
I did not take into account, that this patch fails to compile without the
llvm.codegen patch applied. This breaks buildbots.

I revert this until we found a solution to commit this without buildbots
complaining.

This reverts commit cb43ab80e94434e780a66be3b9a6ad466822fe33.

llvm-svn: 160165
2012-07-13 07:44:56 +00:00
Tobias Grosser b299d28181 Add preliminary implementation for GPGPU code generation.
Translate the selected parallel loop body into a ptx string and run it
with cuda driver API. We limit this preliminary implementation to
target the following special test cases:
  - Support only 2-dimensional parallel loops with or without only one
    innermost non-parallel loop.
  - Support write memory access to only one array in a SCoP.

Contributed by:  Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 160164
2012-07-13 07:21:00 +00:00
Tobias Grosser 903c242662 Update libGPURuntime to be dual licensed under MIT and UIUC license.
Contributed by: Yabin Hu  <yabin.hwu@gmail.com>

llvm-svn: 159815
2012-07-06 10:40:15 +00:00
Hongbin Zheng cea35f60d5 Add an Instruction member to MemoryAccess Class.
Patched by TangKK <dengjunqi06323011@hotmail.com>.

llvm-svn: 159808
2012-07-06 06:47:03 +00:00
Hongbin Zheng 454e8f9ee8 Add stringFromIslObj support for various isl_objs.
Patched by JunQi<dengjunqi06323011@hotmail.com>.

llvm-svn: 159735
2012-07-05 08:55:31 +00:00
Hongbin Zheng 5205e0c40e Refactor: Use generic internal function template in GICHelper.cpp to avoid duplication.
llvm-svn: 159734
2012-07-05 08:42:39 +00:00
Tobias Grosser 5c0f6f3350 Replace CUDA data types with Polly's GPGPU data types.
Contributed by:  Yabin Hu  <yabin.hwu@gmail.com>

llvm-svn: 159725
2012-07-04 21:45:03 +00:00
Tobias Grosser 822b254507 codegen.intrinsic: Update testcase to work with NVPTX backend
llvm-svn: 159650
2012-07-03 08:18:34 +00:00
Tobias Grosser b266c98ccc Update to Polly for LLVM r159614 which changes Passes.cpp.
Contributed by: Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 159649
2012-07-03 08:18:31 +00:00
Tobias Grosser 1b593a114e Update to Polly for LLVM r159383 which changes SelectionDAGBuilder.cpp.
Contributed by: Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 159507
2012-07-01 13:47:50 +00:00
Chandler Carruth c55b598dc2 Speculative update to Polly for LLVM r159421 which moved IRBuilder.h.
llvm-svn: 159423
2012-06-29 12:39:49 +00:00
Tobias Grosser b5f971f744 Add TempScop::isWrite() function.
llvm-svn: 158987
2012-06-22 10:59:36 +00:00
Tobias Grosser 96682025c7 Add some tests for the independent blocks pass.
llvm-svn: 158306
2012-06-11 10:25:12 +00:00
Tobias Grosser fb4842ff95 Add the runtime library for GPGPU code generation.
Contributed by: Yabin Hu <yabin.hwu@gmail.com>

llvm-svn: 158304
2012-06-11 09:25:01 +00:00
Tobias Grosser 3cc99748b6 Fix some coding convention problems.
llvm-svn: 158081
2012-06-06 16:33:15 +00:00
Tobias Grosser 88aeaf6ac4 Detect the cuda library available.
We will use the cuda library for the upcoming automatic GPGPU code generation.

Contributed by: Yabin Hu  <yabin.hwu@gmail.com>

llvm-svn: 158064
2012-06-06 12:16:10 +00:00
Tobias Grosser baa1ac260b CLooG: Do not take into account the context
CLooG and the CLooG based code generation does not yet correctly derive the
types of the expressions, but just uses i64 for everything. This is incorrect,
but works normally pretty well. However, the recent change of adding parameter
bounds to the context made CLooG generate expressions that contain a lot of very
large integers that possibly don't fit into an i64. This broke the code
generation for several benchmarks.

To get the CLooG based code generation working again, we just don't take into
account any constraints in the context. This brings us back to the theoretical
incorrect, but in practice generally correct code.

The next step will be the isl based code generation. Here we will derive
automatically correct types.

llvm-svn: 158015
2012-06-05 19:31:08 +00:00
Tobias Grosser 1cf47f1160 www: Add GPGPU Code Generation Documentation.
llvm-svn: 157690
2012-05-30 13:54:02 +00:00
Tobias Grosser 8d7c4dbf8c Add llvm.codegen intrinsic patch file to polly/utils.
The "llvm.codegen" intrinsic patch is a patch to LLVM, which is used
to generate code for embedded LLVM-IR strings. In Polly, we use it
to generate ptx assembly text for GPGPU code generation.

llvm-svn: 157689
2012-05-30 13:53:57 +00:00
Tobias Grosser 084d8f7d4c ScopInfo: Store ScopStmt pointer in the domain
Store a pointer to each ScopStmt in the isl_id associated with the space of its
domain. This will later allow us to recover the statement during code
generation with isl.

llvm-svn: 157607
2012-05-29 09:29:44 +00:00
Tobias Grosser 400a4ac658 Mark the increments of the generated induction variables 'NSW'
In general, all code that we produce is NSW.

llvm-svn: 157606
2012-05-29 09:11:59 +00:00
Tobias Grosser 3a275d20dd Move executeScopConditionally() into its own file
We will reuse this function for the isl code generator.

llvm-svn: 157605
2012-05-29 09:11:54 +00:00
Tobias Grosser 0a91f3220b Move CLooG.h into include/polly/CodeGen/
llvm-svn: 157604
2012-05-29 09:11:46 +00:00
Tobias Grosser 29666113fd ScheduleOptimizer: Simplify some code
We now use isl_map_equate, which makes the code a lot simpler.

llvm-svn: 157246
2012-05-22 10:47:31 +00:00
Tobias Grosser 18daacad61 ScopInfo: Add parameter bounds to context
Derive the maximal and minimal values of a parameter from the type it has. Add
this information to the scop context. This information is needed, to derive
optimal types during code generation.

llvm-svn: 157245
2012-05-22 10:47:27 +00:00
Tobias Grosser 3b2cf96bae Replace some asserts with llvm_unreachable
llvm-svn: 157244
2012-05-22 10:47:21 +00:00
Tobias Grosser 42b69e5745 ScopInfo: SCEVUnknowns are always parameters
There is no need for special code to handle SCEVUnknowns. SCEVUnkowns are always
parameters and will be handled by the generic parameter handling code in
visit().

llvm-svn: 157243
2012-05-22 10:47:17 +00:00
Tobias Grosser e192b23f5e Move isParallelFor into CodeGeneration
This removes another include of CLooG header files.

llvm-svn: 157242
2012-05-22 08:46:07 +00:00
Sebastian Pop 8b7f01c6a1 make registerPollyPreoptPasses static
llvm-svn: 156326
2012-05-07 21:27:11 +00:00
Sebastian Pop 5cc8caf88d make registerPollyPasses static, remove param
llvm-svn: 156325
2012-05-07 21:27:09 +00:00
Sebastian Pop e1f6554ed8 add some more missing ifdef CLOOG_FOUND
llvm-svn: 156306
2012-05-07 16:35:11 +00:00
Sebastian Pop 082cea8616 add a check for ISL codegen at configure time
llvm-svn: 156305
2012-05-07 16:20:07 +00:00
Hongbin Zheng da4bf55066 WWW: Adapt the vectorize option change.
llvm-svn: 156256
2012-05-06 10:22:57 +00:00
Hongbin Zheng 6417255283 Regression tests: Adapt the vectorize option change.
llvm-svn: 156255
2012-05-06 10:22:43 +00:00
Hongbin Zheng 6879421727 Allow polly ask bb-vectorizer to vectorize the loop body.
llvm-svn: 156254
2012-05-06 10:22:19 +00:00
Sebastian Pop 775d8e65e8 fix typo
llvm-svn: 156210
2012-05-04 21:36:08 +00:00
Chandler Carruth 30dfdfca3b Try to fix the Polly build while I'm trying to get it to build at all locally.
llvm-svn: 156207
2012-05-04 21:24:27 +00:00
Chandler Carruth d6447953f2 Update Polly to match the LLVM interface change in r156196.
llvm-svn: 156203
2012-05-04 20:57:29 +00:00
Sebastian Pop c200977905 compile cloog code only when CLOOG_FOUND is set
llvm-svn: 156199
2012-05-04 20:30:03 +00:00
Sebastian Pop de613265c5 move Cloog.cpp to CodeGen
llvm-svn: 156184
2012-05-04 18:15:57 +00:00
Tobias Grosser 14afc07577 Fix typo.
Reported by: Andreas Simbuerger

llvm-svn: 156171
2012-05-04 12:11:01 +00:00
Tobias Grosser 913fa54836 ScopDection: Improve status message for non-affine memory accesses.
llvm-svn: 156170
2012-05-04 11:26:52 +00:00
Tobias Grosser ca9a2913b7 Remove unused function
Suggested by: Sebastian Pop

llvm-svn: 155863
2012-04-30 23:49:05 +00:00
Tobias Grosser e71c6ab54c SCEV based code generation
This is an incomplete implementation of the SCEV based code generation.
When finished it will remove the need for -indvars -enable-iv-rewrite.

For the moment it is still disabled. Even though it passes 'make polly-test',
there are still loose ends especially in respect of OpenMP code generation.

llvm-svn: 155717
2012-04-27 16:36:14 +00:00
Hongbin Zheng 746eefeddd 1. Add a header guard for RegisterPasses.h to prevent multiple inclusion.
2. Include the helper function and the helper class in the RegisterPasses.h into the polly namespace.

llvm-svn: 155636
2012-04-26 13:55:33 +00:00
Tobias Grosser f91c441e72 Further simplify parallelism test
llvm-svn: 155634
2012-04-26 13:43:03 +00:00
Tobias Grosser 460e9a463d ScheduleOptimizer: Move functions into class
llvm-svn: 155548
2012-04-25 13:22:43 +00:00
Hongbin Zheng 8a8466106c Refactor: Move the code generation related header files to include/polly/CodeGen.
llvm-svn: 155547
2012-04-25 13:18:28 +00:00
Hongbin Zheng 3b11a16a44 Refactor: Move the declaration of the BlockGenerator/VectorBlockGenerator
to standalone header and source files.

llvm-svn: 155546
2012-04-25 13:16:49 +00:00
Hongbin Zheng 39645abf4c ScopStmt: Provide a function to allow users look up the corresponding
memory access of a particular instruction, the function will return
  null if no such memory access.

llvm-svn: 155544
2012-04-25 09:34:33 +00:00
Hongbin Zheng 86a37745eb Minor change: Replace convertInt in ScopInfo.cpp by utostr_32, which is
defined in StringExtras.h.

llvm-svn: 155539
2012-04-25 08:01:38 +00:00
Tobias Grosser fe0675927d Simplify import/export command line flags.
Instead of -polly-run-import-jscop and -polly-run-export-jscop, we just use
-polly-import and -polly-export.

llvm-svn: 155446
2012-04-24 16:12:34 +00:00
Tobias Grosser 58eee8f106 Unify the optimizer selection.
We now support -polly-optimizer=isl, -polly-optimizer=pocc and
-polly-optimizer=none. The option -polly-no-optimizer is gone.

llvm-svn: 155445
2012-04-24 16:12:30 +00:00
Tobias Grosser 7c3061acdd Make vector tests less sensible to codegen changes
llvm-svn: 155438
2012-04-24 11:08:07 +00:00
Hongbin Zheng 4ac4e15582 Refactor: Pass the argument 'IRBuilder' and 'AfterBlock' of function 'createLoop' by
reference, so that we do not need to type an extra '&' operator when calling the function.

llvm-svn: 155349
2012-04-23 13:03:56 +00:00
Hongbin Zheng 6f7aa074ad 1. Add a header guard for LoopGenerators.h to prevent multiple inclusion.
2. Include the helper function and the helper class in the LoopGenerator.h into the polly namespace.

llvm-svn: 155348
2012-04-23 13:03:43 +00:00
Tobias Grosser 902c9b243d Dependences: Rework parallelism check
After working and explaining this function to someone, I realized it could be
simplified and better documented.

llvm-svn: 155135
2012-04-19 16:38:16 +00:00
Tobias Grosser 105c984b51 www: Update matmul example slightly.
llvm-svn: 154952
2012-04-17 21:38:20 +00:00
Tobias Grosser 216ea58b21 ScheduleOpt: Fix crash with -enable-polly-vector
llvm-svn: 154808
2012-04-16 11:06:06 +00:00
Tobias Grosser 4cb5461dae CodeGen: Generate scalar code if vector instructions cannot be generated
This fixes two crashes that appeared in case of:
  - A load of a non vectorizable type (e.g. float**)
  - An instruction that is not vectorizable (e.g. call)

llvm-svn: 154586
2012-04-12 10:46:55 +00:00
Hongbin Zheng e2107f0999 Revert "Make the "all" target depend on polly-test, so that users can run regression"
This reverts commit 97bd8d50881000c11b65b0e033996ec5f57bcd15.

llvm-svn: 154487
2012-04-11 07:43:24 +00:00
Hongbin Zheng 91bfd78fb2 Revert "Fix a bug introduced by r153739: We are not able to provide the correct"
This reverts commit 2c6bdbf972ac966498489d30a33bfd252df9107d.

llvm-svn: 154486
2012-04-11 07:43:13 +00:00
Tobias Grosser d654c250c4 Fix typo
Suggested by: Sebastian Pop  <sebpop@gmail.com>

llvm-svn: 154415
2012-04-10 18:12:19 +00:00
Tobias Grosser f9fbbdfd74 Fix typos.
Pointed out by: Sebastian Pop  <sebpop@gmail.com>

llvm-svn: 154337
2012-04-09 19:46:05 +00:00
Hongbin Zheng ed986ab6a4 Rewritten expandRegion to clarify the intention and improve
performance, patched by Johannes Doerfert <johannes@jdoerfert.de>.

llvm-svn: 154260
2012-04-07 15:14:28 +00:00
Hongbin Zheng 3a2d6035d2 ScopDetection: Add some comments to function "expandRegion".
llvm-svn: 154259
2012-04-07 12:29:27 +00:00
Hongbin Zheng 94868e6cc6 Speed up SCoP detection time by checking the exit of the region first,
patched by Johannes Doerfert <johannes@jdoerfert.de>.

llvm-svn: 154258
2012-04-07 12:29:17 +00:00
Tobias Grosser 84ecc47e1c CodeGen: Allow Polly to do 'grouped unrolling', but no vector generation.
Grouped unrolling means that we unroll a loop such that the different instances
of a certain statement are scheduled right after each other, but we do
not generate any vector code. The idea here is that we can schedule the
bb vectorizer right afterwards and use it heuristics to decide when
vectorization should be performed.

llvm-svn: 154251
2012-04-07 06:16:08 +00:00
Hongbin Zheng 2b4aeca74e Fix a bug introduced by r153739: We are not able to provide the correct
dependent list for target polly-test, hence making "all" from the top
  of llvm build directory will cause the target "polly-test" being built
  before its dependencing target built.

Patched by Sebastian Pop<spop@codeaurora.org>

llvm-svn: 154162
2012-04-06 03:56:27 +00:00
Tobias Grosser 8239a4cadf CodeGen: Remove unused declaration
llvm-svn: 153954
2012-04-03 12:37:14 +00:00
Tobias Grosser 0905a23806 CodeGen: Recreate old ivs with the original type
To avoid overflows we still use a larger type (i64) while calculating the value
of the old ivs.  However, we truncate the result to the type of the old iv when
providing it to the new code.

A corresponding test case is added to the polly test suite. Also, a failing test
case is fixed.

This fixes PR12311.

Contributed by: Tsingray Liu  <tsingrayliu@gmail.com>

llvm-svn: 153952
2012-04-03 12:24:32 +00:00
Hongbin Zheng 9270a8875a www: Fix typo, replace "LD_LBIRARY_PATH" by "LD_LIBRARY_PATH" in get_started.
llvm-svn: 153948
2012-04-03 09:15:52 +00:00
Hongbin Zheng da4138d105 www: Append path instead overwrite path when exporting the path of pocc.
llvm-svn: 153936
2012-04-03 06:29:27 +00:00
Hongbin Zheng eedc49c3d4 www: Fix typo in the setting LD_LBIRARY_PATH command, as pointed out by
Dmitry N. Mikushin.

llvm-svn: 153934
2012-04-03 04:39:47 +00:00
Tobias Grosser f00bd96cde CodeGen: Some style improvements
llvm-svn: 153871
2012-04-02 12:26:13 +00:00
Tobias Grosser d6d7d7e128 CodeGen: Remove unused variable
llvm-svn: 153840
2012-04-01 16:55:30 +00:00
Tobias Grosser de49ef76f6 Remove unneeded alias analysis
llvm-svn: 153839
2012-04-01 16:49:48 +00:00
Tobias Grosser 89339067b0 CodeGen: Allow function parameters to be rewritten in getNewValue()
When deriving new values for the statements of a SCoP, we assumed that parameter
values are constant within the SCoP and consquently do not need to be rewritten.
For OpenMP code generation this assumption is wrong, as such values are not
available in the OpenMP subfunction and consequently also may need to be
rewritten.

Committed with some changes.

Contributed-By: Johannes Doerfert  <s9jodoer@stud.uni-saarland.de>
llvm-svn: 153838
2012-04-01 16:49:45 +00:00
Hongbin Zheng b5bf8cfa17 Make the "all" target depend on polly-test, so that users can run regression
tests by simply typing "make -C tools/polly/test", like llvm's regression
  tests.

llvm-svn: 153739
2012-03-30 09:27:16 +00:00
Hongbin Zheng 2700adebfa Autoconf build: Try to update LLVMPolly.so before running regression tests
llvm-svn: 153738
2012-03-30 09:27:07 +00:00
Hongbin Zheng 609089f254 Move the CodeGeneration.cpp to the CodeGen folder and update the build system.
Patched by Tsingray.

llvm-svn: 153736
2012-03-30 08:46:18 +00:00