X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=docs%2Fllvmpipe.html;h=c7d0dd4652af7de20a60756e67418ceb80af7f81;hb=7f821289cb5bdf730d3af03472d83a1562bce25a;hp=28d7411d4347e7a56ba33960d78fd33e39b9c1bf;hpb=fa31b1095eeea97695125ad5770239805bed37da;p=mesa.git diff --git a/docs/llvmpipe.html b/docs/llvmpipe.html index 28d7411d434..c7d0dd4652a 100644 --- a/docs/llvmpipe.html +++ b/docs/llvmpipe.html @@ -1,18 +1,28 @@ - + + + + + Gallium LLVMpipe Driver + + + -llvmpipe +
+ The Mesa 3D Graphics Library +
- + +
- +

Gallium LLVMpipe Driver

-

Introduction

+

Introduction

The Gallium llvmpipe driver is a software rasterizer that uses LLVM to do runtime code generation. Shaders, point/line/triangle rasterization and vertex processing are -implemented with LLVM IR which is translated to x86 or x86-64 machine +implemented with LLVM IR which is translated to x86, x86-64, or ppc64le machine code. Also, the driver is multithreaded to take advantage of multiple CPU cores (up to 8 at this time). @@ -20,33 +30,41 @@ It's the fastest software rasterizer for Mesa.

-

Requirements

+

Requirements

-
-
An x86 or amd64 processor. 64-bit 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. + For x86 or amd64 processors, 64-bit mode is recommended. + Support for SSE2 is strongly encouraged. Support for SSE3 and SSE4.1 will + yield the most efficient code. The fewer features the CPU has the more + likely it is that you will run into underperforming, buggy, or incomplete code.

    - See /proc/cpuinfo to know what your CPU supports. + For ppc64le processors, use of the Altivec feature (the Vector + Facility) is recommended if supported; use of the VSX feature (the + Vector-Scalar Facility) is recommended if supported AND Mesa is + built with LLVM version 4.0 or later.

    -
-
LLVM. Version 2.8 recommended. 2.6 or later required.
-

- NOTE: LLVM 2.8 and earlier will not work on systems that support the - Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will - fail when trying to emit AVX instructions. This was fixed in LLVM 2.9. + See /proc/cpuinfo to know what your CPU supports.

+ +
  • +

    Unless otherwise stated, LLVM version 3.4 is recommended; 3.3 or later is required.

    For Linux, on a recent Debian based distribution do:

          aptitude install llvm-dev
     
    +

    + If you want development snapshot builds of LLVM for Debian and derived + distributions like Ubuntu, you can use the APT repository at apt.llvm.org, which are maintained by Debian's LLVM maintainer. +

    +

    For a RPM-based distribution do:

    @@ -54,30 +72,50 @@ It's the fastest software rasterizer for Mesa.
     

    - 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. + For Windows you will need to build LLVM from source with MSVC or MINGW + (either natively or through cross compilers) and CMake, and set the + LLVM environment variable to the directory you installed + it to. + + LLVM will be statically linked, so when building on MSVC it needs to be + built with a matching CRT as Mesa, and you'll need to pass + -DLLVM_USE_CRT_xxx=yyy as described below.

    -

    - For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and - llvm-x.x-msvc32mtd.7z . -

    + + + + + + + + + + + + + + + + + + + +
    LLVM build-typeMesa build-type
    debug,checkedrelease,profile
    Debug-DLLVM_USE_CRT_DEBUG=MTd-DLLVM_USE_CRT_DEBUG=MT
    Release-DLLVM_USE_CRT_RELEASE=MTd-DLLVM_USE_CRT_RELEASE=MT

    - 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. + You can build only the x86 target by passing + -DLLVM_TARGETS_TO_BUILD=X86 to cmake.

    -
  • - -
    scons (optional)
    -
    + +
  • +

    scons (optional)

    +
  • + -

    Building

    +

    Building

    To build everything on Linux invoke scons as: @@ -85,24 +123,29 @@ To build everything on Linux invoke scons as: scons build=debug libgl-xlib -Alternatively, you can build it with GNU make, if you prefer, by invoking it as - +Alternatively, you can build it with meson with:
    -  make linux-llvm
    +  mkdir build
    +  cd build
    +  meson -D glx=gallium-xlib -D gallium-drivers=swrast
    +  ninja
     
    but the rest of these instructions assume that scons is used. -For windows is everything the except except the winsys: +For Windows the procedure is similar except the target:
    -  scons build=debug libgl-gdi
    +  scons platform=windows build=debug libgl-gdi
     
    -

    Using

    +

    Using

    -On Linux, building will create a drop-in alternative for libGL.so into +

    Linux

    + +

    On Linux, building will create a drop-in alternative for +libGL.so into

       build/foo/gallium/targets/libgl-xlib/libGL.so
    @@ -112,93 +155,189 @@ or
       lib/gallium/libGL.so
     
    -To use it set the LD_LIBRARY_PATH environment variable accordingly. +

    To use it set the LD_LIBRARY_PATH environment variable +accordingly.

    + +

    For performance evaluation pass build=release to scons, +and use the corresponding lib directory without the -debug +suffix.

    + -For performance evaluation pass debug=no to scons, and use the corresponding -lib directory without the "-debug" suffix. +

    Windows

    -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 +

    +On Windows, building will create +build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll +which is a drop-in alternative for system's opengl32.dll. To use +it put it in the same directory as your 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. +

    +

    +There is however an easy way to replace the OpenGL software renderer that comes +with Microsoft Windows 7 (or later) with llvmpipe (that is, on systems without +any OpenGL drivers): +

    + + -

    Profiling

    -To profile llvmpipe you should pass the options +

    Profiling

    +

    +To profile llvmpipe you should build as +

    -  scons build=profile 
    +  scons build=profile <same-as-before>
     
    +

    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. - -
    -  ./configure \
    -      --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
    -
    +

    Linux perf integration

    -The you should define +

    +On Linux, it is possible to have symbol resolution of JIT code with Linux perf: +

    -  export LLVM=/path/to/llvm-2.6-profile
    +	perf record -g /my/application
    +	perf report
     
    -and rebuild. +

    +When run inside Linux perf, llvmpipe will create a +/tmp/perf-XXXXX.map file with symbol address table. It also +dumps assembly code to /tmp/perf-XXXXX.map.asm, which can be +used by the bin/perf-annotate-jit.py script to produce +disassembly of the generated code annotated with the samples. +

    + +

    You can obtain a call graph via +Gprof2Dot.

    -

    Unit testing

    +

    Unit testing

    Building will also create several unit tests in -build/linux-???-debug/gallium/drivers/llvmpipe: +build/linux-???-debug/gallium/drivers/llvmpipe:

    - -
  • lp_test_blend: blending -
  • lp_test_conv: SIMD vector conversion -
  • lp_test_format: pixel unpacking/packing +

    -Some of this tests can output results and benchmarks to a tab-separated-file -for posterior analysis, e.g.: +Some of these tests can output results and benchmarks to a tab-separated file +for later analysis, e.g.:

       build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
     
    -

    Development Notes

    +

    Development Notes

    + + + + + +
  • + +