3 <TITLE>llvmpipe
</TITLE>
5 <link rel=
"stylesheet" type=
"text/css" href=
"mesa.css"></head>
12 The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
13 do runtime code generation.
14 Shaders, point/line/triangle rasterization and vertex processing are
15 implemented with LLVM IR which is translated to x86 or x86-
64 machine
17 Also, the driver is multithreaded to take advantage of multiple CPU cores
18 (up to
8 at this time).
19 It's the fastest software rasterizer for Mesa.
26 <dt>An x86 or amd64 processor.
64-bit mode is preferred.
</dt>
29 Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
30 yield the most efficient code. The less features the CPU has the more
31 likely is that you ran into underperforming, buggy, or incomplete code.
34 See /proc/cpuinfo to know what your CPU supports.
37 <dt>LLVM. Version
2.8 recommended.
2.6 or later required.
</dt>
40 <b>NOTE
</b>: LLVM
2.8 and earlier will not work on systems that support the
41 Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
42 fail when trying to emit AVX instructions. This was fixed in LLVM
2.9.
45 For Linux, on a recent Debian based distribution do:
48 aptitude install llvm-dev
50 For a RPM-based distribution do:
53 yum install llvm-devel
57 For Windows download pre-built MSVC
9.0 or MinGW binaries from
58 http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
59 variable to the extracted path.
63 For MSVC there are two set of binaries: llvm-x.x-msvc32mt
.7z and
64 llvm-x.x-msvc32mtd
.7z .
68 You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
69 debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
70 debug=no. This is necessary as LLVM builds as static library so the chosen
75 <dt>scons (optional)
</dt>
82 To build everything on Linux invoke scons as:
85 scons build=debug libgl-xlib
88 Alternatively, you can build it with GNU make, if you prefer, by invoking it as
94 but the rest of these instructions assume that scons is used.
96 For windows is everything the except except the winsys:
99 scons build=debug libgl-gdi
105 On Linux, building will create a drop-in alternative for libGL.so into
108 build/foo/gallium/targets/libgl-xlib/libGL.so
115 To use it set the LD_LIBRARY_PATH environment variable accordingly.
117 For performance evaluation pass debug=no to scons, and use the corresponding
118 lib directory without the
"-debug" suffix.
120 On Windows, building will create a drop-in alternative for opengl32.dll. To use
121 it put it in the same directory as the application. It can also be used by
122 replacing the native ICD driver, but it's quite an advanced usage, so if you
123 need to ask, don't even try it.
128 To profile llvmpipe you should pass the options
131 scons build=profile
<same-as-before>
134 This will ensure that frame pointers are used both in C and JIT functions, and
135 that no tail call optimizations are done by gcc.
137 To better profile JIT code you'll need to build LLVM with oprofile integration.
141 --prefix=$install_dir \
143 --disable-profiling \
144 --enable-targets=host-only \
148 make -C
"$build_dir" install
150 find
"$install_dir/lib" -iname '*.a' -print0 | xargs -
0 strip --strip-debug
153 The you should define
156 export LLVM=/path/to/llvm-
2.6-profile
162 <h1>Unit testing
</h1>
165 Building will also create several unit tests in
166 build/linux-???-debug/gallium/drivers/llvmpipe:
170 <li> lp_test_blend: blending
171 <li> lp_test_conv: SIMD vector conversion
172 <li> lp_test_format: pixel unpacking/packing
176 Some of this tests can output results and benchmarks to a tab-separated-file
177 for posterior analysis, e.g.:
180 build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
184 <h1>Development Notes
</h1>
188 When looking to this code by the first time start in lp_state_fs.c, and
189 then skim through the lp_bld_* functions called in there, and the comments
190 at the top of the lp_bld_*.c functions.
193 The driver-independent parts of the LLVM / Gallium code are found in
194 src/gallium/auxiliary/gallivm/. The filenames and function prefixes
195 need to be renamed from
"lp_bld_" to something else though.
198 We use LLVM-C bindings for now. They are not documented, but follow the C++
199 interfaces very closely, and appear to be complete enough for code
201 http://npcontemplation.blogspot.com/
2008/
06/secret-of-llvm-c-bindings.html
202 for a stand-alone example. See the llvm-c/Core.h file for reference.