Commit Graph

58 Commits

Author SHA1 Message Date
Michael Kruse b41b990e05 Query llvm-config to get system libs required for linking.
Remove the unused function get_system_libs. Instead, run
'llvm-config --system-libs' to determine which libraries are required in
addition LLVM's for linking an executable. At the moment these are the unittests
that link to gtest and transitively depend on these system libs.

llvm-svn: 279743
2016-08-25 14:58:29 +00:00
Michael Kruse 606b06a156 Add comment for querying --libdir. NFC.
llvm-svn: 279742
2016-08-25 14:43:04 +00:00
Michael Kruse 05cf9c22f1 Introduce unittests.
Add the infrastructure for unittests to Polly and two simple tests for
conversion between isl_val and APInt. In addition, a build target
check-polly-unittests is added to run only the unittests but not the regression
tests.

Clang's unittest mechanism served as as a blueprint which then was adapted to
Polly.

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

llvm-svn: 279734
2016-08-25 12:36:15 +00:00
Michael Kruse 17a8b791ae Add LLVM libdir to library search path in out-of-tree builds.
This previously was not required because in an out-of-tree build Polly would
only build libraries (LLVMPolly, libPolly, libPollyISL, libPollyPPCG), but no
executables where the libraries would be linked to. This will change when adding
unittests in a follow-up commit.

llvm-svn: 279730
2016-08-25 11:28:52 +00:00
Michael Kruse 941a692690 Also warn if llvm-lit is not available.
The program 'llvm-lit', like 'not' and 'FileCheck' are necessary for running
check-polly. Warn of any of the three is not in LLVM_INSTALL_ROOT/bin directory.

llvm-svn: 279728
2016-08-25 10:35:22 +00:00
Tobias Grosser a56f8f8e58 GPGPU: Shorten ppcg include paths to avoid conflict with cuda.h
Instead of directly linking to ppcg's main source directory, we link to the
parent director. This allows us to access ppcg's include files with
'ppcg/cuda.h' and avoids a conflict with NVIDIA's cuda.h header.

Also drop an include directory that is currently not used.

llvm-svn: 275536
2016-07-15 07:50:36 +00:00
Tobias Grosser e938517e37 GPGPU: create default initialized PPCG scop and gpu program
At this stage, we do not yet modify the IR but just generate a default
initialized ppcg_scop and gpu_prog and free both immediately. Both will later be
filled with data from the polly::Scop and are needed to use PPCG for GPU
schedule generation. This commit does not yet perform any GPU code generation,
but ensures that the basic infrastructure has been put in place.

We also add a simple test case to ensure the new code is run and use this
opportunity to verify that GPU_CODEGEN tests are only run if GPU code generation
has been enabled in cmake.

llvm-svn: 275389
2016-07-14 10:22:19 +00:00
Tobias Grosser d1e90f5929 cmake: do not check-format anything in lib/External
There is no need to specifically match for isl, but we can exclude anything in
lib/External from formatting as we assume that externally contributed code
should always match the upstream code. This simplifies the cmake script and
allows additional external projects to be added without the need to explicitly
exclude them from formatting.

llvm-svn: 274557
2016-07-05 15:26:33 +00:00
Eugene Zelenko 2487cb28ce Respect LLVM_INSTALL_TOOLCHAIN_ONLY.
Only shared library should be installed when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.

Differential revision: http://reviews.llvm.org/D21543

llvm-svn: 273292
2016-06-21 18:14:01 +00:00
Tobias Grosser 25a99e98c4 cmake: Ensure tools/* is still formatted
This got accidentally dropped in r264283.

Also, drop the wwwfiles from the removal list. This is not needed any more as
we now explicitly list the directories that should be formatted.

llvm-svn: 264397
2016-03-25 12:16:17 +00:00
Johannes Doerfert 6af7700ddf [CMAKE] Try to find the correct globbing expression
llvm-svn: 264286
2016-03-24 14:31:49 +00:00
Johannes Doerfert 8ff253bfbf Restrict clang-format to lib/ [NFC]
llvm-svn: 264283
2016-03-24 13:49:39 +00:00
Tobias Grosser 114180db5b Also clang-format *.c run-time library files
llvm-svn: 262917
2016-03-08 07:34:58 +00:00
Tobias Grosser b6948c1289 Add basic doxygen infrastructure for Polly
llvm-svn: 259764
2016-02-04 07:16:36 +00:00
Tobias Grosser 5da48f392c Add -sort-includes to our automatic source code formatting
llvm-svn: 250393
2015-10-15 12:18:37 +00:00
Michael Kruse 519b3cfd27 Compile ISL into its own library
Refactor all ISL-related cmake build instructions into its own 
CMakeLists.txt and build as a separate library.

This is useful to apply ISL-related build flags to ISL only and not to 
Polly's files. Also, it the separation of both projects becomes clearer.

Proposed name of the library is Polly_isl. It is not "isl" to avoid 
mix-up with potentially installed libisl.{a|so}.

Tested configurations:
- Windows with cmake 3.2
- Ubuntu with cmake 3.0.2 
- Ubuntu with cmake 3.0.2  BUILD_SHARED_LIBS on
- Ubuntu with cmake 2.8.12.2 (LLVM minimum version)
- Ubuntu out-of-LLVM-tree

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

llvm-svn: 248484
2015-09-24 11:30:22 +00:00
Michael Kruse 69f3788c36 Revise polly-{update|check}-format targets
Summary:
Make clang-format run on each file independently using
add_custom_format (instead using a shell script in utils/). The targets
polly-{update|check}-format depend on these.

The primary motivation is to make them work on Windows, but also
improves them generally:
- Each file update/check can run in parallel (Although they do not take
  long to run anyway)
- Implicit dependency on clang-format, so it recompiles if necessary
- polly-check-format shows the formatting difference if failing

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

llvm-svn: 247581
2015-09-14 16:59:50 +00:00
Michael Kruse 84bf8a3bc4 Introspect llvm-config --assertion-mode in cmake out-of-tree builds
When compiling Polly without LLVM sources but with system-installed
LLVM, the build process would not honor the LLVM_ENABLE_ASSERTIONS
setting LLVM was compiled with, but effectively assume that it is
switched off when compiling. During unit-tests llvm-lit would still
query the LLVM_ENABLE_ASSERTIONS flag and enable tests which require
assertions. Even if enabled for LLVM, Polly does not output its debug
info and statistics in this this mode such that 7 tests fail.

To fix, we query llvm-config --assertion-mode and if on, enable
assertions as HandleLLVMOptions.cmake would do.

We cannot reliably use HandleLLVMOptions.cmake itself as the host's
LLVM build might have been built using automake and distributions
change file locations (e.g. Debian to
/usr/share/llvm-${VERSION}/cmake/HandleLLVMOptions.cmake).

llvm-svn: 247470
2015-09-11 20:47:14 +00:00
Michael Kruse 27aae88d76 Do not use -fvisibility option with Visual C
It doesn't know the option and prints a warning. 

llvm-svn: 244363
2015-08-07 22:16:44 +00:00
Michael Kruse 6362f5aa0b Unify FOLDER property of Polly targets
Put all Polly targets into a single "Polly" category (i.e.
solution folder). Previously there was no recognizable scheme and most
categories contained just one or two targets or targets didn't belong
to any category.

Reviewers: grosser
llvm-svn: 242779
2015-07-21 12:40:01 +00:00
Michael Kruse 9e0db1d2e8 Remove header project from Visual Studio builds
Remove the polly_headers_do_not_build project. Visual Studio is capable
of finding the headers itself, although they are not listed explicitly.
For explicit listing, the headers should be added to the relevant
target.

Reviewers: grosser
llvm-svn: 242777
2015-07-21 12:33:15 +00:00
Michael Kruse 441357dca2 Remove gcc-specific flags from Visual Studio build
Remove the flags -fno-exceptions -fno-rtti and add the equivalent for
compiling with MSVC.

Reviewers: grosser
llvm-svn: 242775
2015-07-21 12:22:36 +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
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
Tobias Grosser d35f388b49 [cmake] Remove two unused include paths
These include paths are leftovers from times when we used GMP or an external
isl installation. They are not longer needed.

llvm-svn: 236596
2015-05-06 12:28:23 +00:00
Tobias Grosser 378e003748 Drop libpluto support
We do not have buildbots or anything that tests this functionality, hence it
most likely bitrots. People interested to use this functionality can always
recover it from svn history.

llvm-svn: 233570
2015-03-30 17:54:01 +00:00
Tobias Grosser f85d0e217f Build the isl files as PIC
Otherwise we get linker errors.

llvm-svn: 228204
2015-02-04 21:56:28 +00:00
Tobias Grosser 52a25237d8 Import isl(+imath) as an external library into Polly
With this patch Polly is always GPL-free (no dependency on GMP any more). As a
result, building and distributing Polly will be easier. Furthermore, there is no
need to tightly coordinate isl and Polly releases anymore.

We import isl b3e0fa7a05d as well as imath 4d707e5ef2. These are the git
versions Polly currently was tested with when using utils/checkout_isl.sh. The
imported libraries are both MIT-style licensed.

We build isl and imath with -fvisibility=hidden to avoid clashes in case other
projects (such as gcc) use conflicting versions of isl. The use of imath can
temporarily reduce compile-time performance of Polly. We will work on
performance tuning in tree.

Patches to isl should be contributed first to the main isl repository and can
then later be reimported to Polly.

This patch is also a prerequisite for the upcoming isl C++ interface.

llvm-svn: 228193
2015-02-04 20:55:43 +00:00
Johannes Doerfert 305fed96e6 Drop Cloog support
This commit drops the Cloog support for Polly. The scripts and
  documentation are changed to only use isl as prerequisity. In the code
  all Cloog specific parts have been removed and all relevant tests have
  been ported to the isl backend when it was created.

llvm-svn: 223141
2014-12-02 19:26:58 +00:00
Johannes Doerfert 9e7b17b0d4 Added arcanist linters and cleaned errors and warnings
Arcanist (arc) will now always run linters before uploading any new
  commit to Phabricator. All errors/warnings (or their absence) will be
  shown in the web interface together with a explanation by the commiter
  (arcanist will ask the commiter if the build was not clean).

  The linters include:
    - clang-format
    - spelling check
    - permissions check (aka. chmod)
    - filename check
    - merge conflict marker check
  Note, that their scope is sometimes limited (see .arclint for
  details).

  This commit also fixes all errors and warnings these linters reported,
  namely:
    - spelling mistakes and typos
    - executable permissions for various text files

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

llvm-svn: 215871
2014-08-18 00:40:13 +00:00
Johannes Doerfert 5aa2194ea5 [Polly] Remove the PoCC and ScopLib support
Remove the PoCC and ScopLib support from Polly as we do not have a
  user/maintainer for it.

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

llvm-svn: 215563
2014-08-13 17:49:16 +00:00
Johannes Doerfert 34558184a0 Reorder cmake include folders (polly source first)
llvm-svn: 209750
2014-05-28 16:54:42 +00:00
Tobias Grosser b24cf90645 Remove OpenScop
We only supported a very old version of OpenScop that was entirely different
to what OpenScop is today. To not confuse people, we remove this old and
unusable support. If anyone is interested to add OpenScop support back in,
the relevant patches are available in version control.

llvm-svn: 206026
2014-04-11 09:47:45 +00:00
Sebastian Pop a8fb72428b record in POLLY_LINK_LIBS all the libs needed for polly
llvm-svn: 203841
2014-03-13 20:24:48 +00:00
Rafael Espindola fa0841c78f Set CMAKE_INSTALL_RPATH_USE_LINK_PATH to true.
This will make sure polly finds libisl.so at runtime even if the parent
CMakeLists.txt sets CMAKE_INSTALL_RPATH.

llvm-svn: 201935
2014-02-22 13:28:31 +00:00
Sebastian Pop bfec361cae GMP is only required for CLooG
llvm-svn: 201925
2014-02-22 02:15:39 +00:00
Tobias Grosser c8f0779c38 cmake: Provide path to installed clang-format
This will now also enable the automatic formatting checks in the Polly buildbot.

llvm-svn: 195507
2013-11-22 22:42:13 +00:00
Tobias Grosser cf7f6db300 cmake: Add option POLLY_USE_CLOOG
This allows to build Polly without CLooG.

llvm-svn: 195344
2013-11-21 11:48:07 +00:00
Tobias Grosser d0fe8371bf cmake: Add target to reformat with clang-format
Calling 'make polly-update-format' will format all Polly files with
clang-format.

llvm-svn: 181293
2013-05-07 07:30:31 +00:00
Tobias Grosser 0db04b4778 cmake: Do not clang-format check the externally imported json library
llvm-svn: 177795
2013-03-23 01:04:48 +00:00
Tobias Grosser 482706f31f Do not run formatting checks by default
llvm-svn: 175178
2013-02-14 16:42:50 +00:00
Tobias Grosser c38af88764 cmake: add command polly-check-format
This command runs clang-format on all files and reports formatting problems

llvm-svn: 175170
2013-02-14 16:19:16 +00:00
Tobias Grosser 7b3ac71920 [cmake] Make CLooG optional
CLooG is already optional in the autoconf build.

llvm-svn: 174872
2013-02-11 10:36:19 +00:00
Tobias Grosser 71036882d2 cmake: Install all polly include files
Contributed-by: Richard Membarth <richard.membarth@informatik.uni-erlangen.de>
llvm-svn: 172903
2013-01-19 14:17:52 +00:00
Tobias Grosser 70325bb308 cmake: Fix installation of include files
Install the configured Config/config.h file, rather than the
Config/config.h.cmake and Config/Config.h.in source files.

Contributed-by: Richard Membarth <richard.membarth@informatik.uni-erlangen.de>
llvm-svn: 168780
2012-11-28 10:12:21 +00:00
Tobias Grosser bc822eb25f Introduce a separate file for CMake macros
Contributed by:  Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>

llvm-svn: 166394
2012-10-21 15:51:49 +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 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 c11349c55a Add support for libpluto as the scheduling optimizer.
llvm-svn: 161157
2012-08-02 07:47:26 +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