2009-08-10 12:35:16 +01:00
|
|
|
LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
|
|
|
|
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
============
|
|
|
|
|
2009-11-26 11:15:08 +00:00
|
|
|
- A x86 or amd64 processor. 64bit mode is preferred.
|
|
|
|
|
|
|
|
Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
|
|
|
|
yield the most efficient code. The less features the CPU has the more
|
|
|
|
likely is that you ran into underperforming, buggy, or incomplete code.
|
|
|
|
|
|
|
|
See /proc/cpuinfo to know what your CPU supports.
|
2009-08-16 11:50:17 +01:00
|
|
|
|
2011-03-13 19:24:26 +00:00
|
|
|
- LLVM. Version 2.8 recommended. 2.6 or later required.
|
2009-08-16 11:50:17 +01:00
|
|
|
|
2010-01-10 18:37:07 +00:00
|
|
|
For Linux, on a recent Debian based distribution do:
|
2009-08-10 12:35:16 +01:00
|
|
|
|
|
|
|
aptitude install llvm-dev
|
2009-08-10 15:43:04 +01:00
|
|
|
|
2010-01-10 18:37:07 +00:00
|
|
|
For Windows download pre-built MSVC 9.0 or MinGW binaries from
|
|
|
|
http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
|
|
|
|
variable to the extracted path.
|
|
|
|
|
2010-05-13 16:18:05 +01:00
|
|
|
For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
|
|
|
|
llvm-x.x-msvc32mtd.7z .
|
|
|
|
|
|
|
|
You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
|
|
|
|
debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
|
|
|
|
debug=no. This is necessary as LLVM builds as static library so the chosen
|
|
|
|
MS CRT must match.
|
|
|
|
|
2009-11-24 16:01:01 +00:00
|
|
|
- scons (optional)
|
2009-08-10 12:35:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
Building
|
|
|
|
========
|
|
|
|
|
2010-01-10 18:37:07 +00:00
|
|
|
To build everything on Linux invoke scons as:
|
2009-08-10 12:35:16 +01:00
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
scons build=debug libgl-xlib
|
2009-08-10 12:35:16 +01:00
|
|
|
|
2009-08-22 22:26:55 +01:00
|
|
|
Alternatively, you can build it with GNU make, if you prefer, by invoking it as
|
|
|
|
|
|
|
|
make linux-llvm
|
|
|
|
|
2009-09-11 11:24:00 +01:00
|
|
|
but the rest of these instructions assume that scons is used.
|
2009-08-22 22:26:55 +01:00
|
|
|
|
2010-01-10 18:37:07 +00:00
|
|
|
For windows is everything the except except the winsys:
|
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
scons build=debug libgl-gdi
|
2009-08-10 12:35:16 +01:00
|
|
|
|
|
|
|
Using
|
|
|
|
=====
|
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
On Linux, building will create a drop-in alternative for libGL.so into
|
2009-08-10 12:35:16 +01:00
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
build/foo/gallium/targets/libgl-xlib/libGL.so
|
2009-08-22 22:26:55 +01:00
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
To use it set the LD_LIBRARY_PATH environment variable accordingly.
|
2009-08-22 22:26:55 +01:00
|
|
|
|
2009-09-11 11:24:00 +01:00
|
|
|
For performance evaluation pass debug=no to scons, and use the corresponding
|
|
|
|
lib directory without the "-debug" suffix.
|
|
|
|
|
2010-01-10 18:37:07 +00:00
|
|
|
On Windows, building will create a drop-in alternative for opengl32.dll. To use
|
|
|
|
it put it in the same directory as the application. It can also be used by
|
|
|
|
replacing the native ICD driver, but it's quite an advanced usage, so if you
|
|
|
|
need to ask, don't even try it.
|
|
|
|
|
2009-08-10 12:35:16 +01:00
|
|
|
|
2010-09-21 17:50:30 +01:00
|
|
|
Profiling
|
|
|
|
=========
|
|
|
|
|
|
|
|
To profile llvmpipe you should pass the options
|
|
|
|
|
2010-11-01 13:30:22 +00:00
|
|
|
scons build=profile <same-as-before>
|
2010-09-21 17:50:30 +01:00
|
|
|
|
|
|
|
This will ensure that frame pointers are used both in C and JIT functions, and
|
|
|
|
that no tail call optimizations are done by gcc.
|
|
|
|
|
|
|
|
|
|
|
|
To better profile JIT code you'll need to build LLVM with oprofile integration.
|
|
|
|
|
2011-03-13 19:24:26 +00:00
|
|
|
./configure \
|
2010-09-21 17:50:30 +01:00
|
|
|
--prefix=$install_dir \
|
|
|
|
--enable-optimized \
|
|
|
|
--disable-profiling \
|
|
|
|
--enable-targets=host-only \
|
|
|
|
--with-oprofile
|
|
|
|
|
|
|
|
make -C "$build_dir"
|
|
|
|
make -C "$build_dir" install
|
|
|
|
|
|
|
|
find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug
|
|
|
|
|
|
|
|
The you should define
|
|
|
|
|
|
|
|
export LLVM=/path/to/llvm-2.6-profile
|
|
|
|
|
|
|
|
and rebuild.
|
|
|
|
|
|
|
|
|
2009-08-10 12:35:16 +01:00
|
|
|
Unit testing
|
|
|
|
============
|
|
|
|
|
|
|
|
Building will also create several unit tests in
|
|
|
|
build/linux-???-debug/gallium/drivers/llvmpipe:
|
|
|
|
|
|
|
|
- lp_test_blend: blending
|
|
|
|
- lp_test_conv: SIMD vector conversion
|
|
|
|
- lp_test_format: pixel unpacking/packing
|
|
|
|
|
2009-09-11 11:24:00 +01:00
|
|
|
Some of this tests can output results and benchmarks to a tab-separated-file
|
2009-08-20 10:21:49 +01:00
|
|
|
for posterior analysis, e.g.:
|
|
|
|
|
2009-08-22 22:26:55 +01:00
|
|
|
build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
|
2009-08-10 12:35:16 +01:00
|
|
|
|
2009-08-21 10:57:48 +01:00
|
|
|
|
|
|
|
Development Notes
|
|
|
|
=================
|
|
|
|
|
2009-08-22 22:26:55 +01:00
|
|
|
- When looking to this code by the first time start in lp_state_fs.c, and
|
|
|
|
then skim through the lp_bld_* functions called in there, and the comments
|
|
|
|
at the top of the lp_bld_*.c functions.
|
|
|
|
|
2010-03-15 17:46:41 +00:00
|
|
|
- The driver-independent parts of the LLVM / Gallium code are found in
|
|
|
|
src/gallium/auxiliary/gallivm/. The filenames and function prefixes
|
|
|
|
need to be renamed from "lp_bld_" to something else though.
|
2009-08-22 22:26:55 +01:00
|
|
|
|
2009-08-21 10:57:48 +01:00
|
|
|
- We use LLVM-C bindings for now. They are not documented, but follow the C++
|
|
|
|
interfaces very closely, and appear to be complete enough for code
|
|
|
|
generation. See
|
|
|
|
http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
|
2010-11-01 13:30:22 +00:00
|
|
|
for a stand-alone example. See the llvm-c/Core.h file for reference.
|