llvm-project/polly/www/example_load_Polly_into_cla...

97 lines
4.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Polly - Load Polly into clang</title>
<link type="text/css" rel="stylesheet" href="menu.css">
<link type="text/css" rel="stylesheet" href="content.css">
</head>
<body>
<!--#include virtual="menu.html.incl"-->
<div id="content">
<!--=====================================================================-->
<h1>Load Polly into clang and automatically run it at -O3</h1>
<!--=====================================================================-->
<p>Warning: This example makes it very easy to use Polly. Still, please be aware
that Polly is a young research project. It is expected to crash, produce
invalid code or to hang in complex calculations even for simple examples. In
case you see such a problem, please check the <a href="bugs.html">Bug
database</a> and consider reporting the bug.
<h2>Compiling code with Polly</h2>
To compile code with Polly you only need to add '-Xclang -load -Xclang
${POLLY_BUILD_DIR}/lib/LLVMPolly.so' to your command line or your CFLAGS and
Polly is automatically executed at -O3.
<p>
<b>WARNING: clang/LLVM/Polly need to be in sync. This means
you need to compile them yourself from a recent svn/git checkout</b>
</p>
<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 file.c</pre>
<h2>Automatic OpenMP code generation</h2>
To automatically detect parallel loops and generate OpenMP code for them you
also need to add '-mllvm -enable-polly-openmp -lgomp' to your CFLAGS.
<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 -mllvm -enable-polly-openmp -lgomp file.c</pre>
<h2>Automatic Vector code generation</h2>
Automatic vector code generation can be enabled by adding '-mllvm
-enable-polly-vector' to your CFLAGS.
<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 -mllvm -enable-polly-vector file.c</pre>
<h2>Further options</h2>
Polly supports further options that are mainly useful for the development or
the
analysis of Polly. The relevant options can be
added to clang by appending '-mllvm -option-name' to the CFLAGS or the clang
command line.
<h3>Limit Polly to a single function</h3>
To limit the execution of Polly to a single function, use the option
'-polly-detect-only=functionname'.
<h3>Disable LLVM-IR generation</h3>
Polly normally regenerates LLVM-IR from the Polyhedral representation. To only
see the effects of the preparing transformation, but to disable Polly code
generation add the option 'polly-no-codegen'.
<h3>Graphical view of the SCoPs</h3>
Polly can use graphviz to show the SCoPs it detects in a program. The relevant
options are '-polly-show', '-polly-show-only', '-polly-dot' and
'-polly-dot-only'. The 'show' options automatically run dotty or another
graphviz viewer to show the scops graphically. The 'dot' options store for each
function a dot file that highlights the detected SCoPs. If 'only' is appended at
the end of the option, the basic blocks are shown without the statements the
contain.
<h3>Disable the polyhedral optimizer</h3>
Polly automatically runs a polyhedral optimizer to optimize the schedules. To
disable it add the option '-polly-no-optimizer'.
<h3>Use the PoCC optimizer</h3>
Polly uses by default the isl scheduling optimizer, a new implementation of the
well known Pluto algorithm. The main reason for the isl scheduler being the
default is that it does not require any additional libraries or tools to be
installed. As the new scheduler may still have some bugs and because being
able to compare is good in general, it is possible to switch the used optimizer
back to PoCC. For this add the option '-polly-use-pocc'.
<h3>Disable tiling in the optimizer</h3>
By default both optimizers perform tiling, if possible. In case this is not
wanted the option '-polly-no-tiling' can be used to disable it. (This option
works for both optimizers).
</div>
</body>
</html>