SB-SIMD

SIMD support for SBCL

System requirements

SB-SIMD supports MMX/SSE operations on x86 hardware. AltiVec volunteers welcome.

Quick start

SB-SIMD is rather easy to install; but it does require compiling and installing SBCL. Here's how to proceed.
  • Download, compile, and install the patched SBCL sources.
  • Download and compile the SB-SIMD user library.
  • Try the examples.
    CL-USER> (load "example-test.lisp") CL-USER> (test-foo) CL-USER> (test-2) CL-USER> (test-sign) CL-USER> CL-USER> (load "timing.lisp") CL-USER> (load "test-matrix.lisp") CL-USER> (test-matrix 100000)

    To mirror the sb-simd project,

    rsync -a common-lisp.net::project/sb-simd sb-simd

     

    Supported SSE instructions

    See here

    SSE VOPs

    Some VOPs are available, see sse-*.lisp at cvs. (And test-*.lisp for examples). Use at your own risk.

    TODO

    • SBCL errors if VOP returns (:SCS (XMM-REG)), define-move-vop's are apparently not enough..
    • Add guards to vops
    • Add index bounds checks to vops
    • Make sbcl disassembler aware of new instructions
    • Make CL versions of VOP's and get rid of sb-sys:%primitive -calls
    • Documentation?
    • More higher-level simd ops
    • ..

    Performance

    Running SBCL version 0.9.3 + patch on Intel(R) Pentium(R) 4 CPU 2.80GHz (arch X86)

    TestTyped CLSSERatio TypedCL:SSE
    Matrix 3x3 mul, 10M ops 8.31 +- 0.02 sec1.50 +- 0.03 sec5.5 : 1
    Seq=, two equal 256kb simple-array-ub-8 137 +- 2 MBytes/sec3340 +- 6 MBytes/sec1 : 24
    Unless stated otherwise, values are avg of 10 samples, and +- is std dev.

    References

    General intro

    Tommesani.com
    Emmerald

    AMD

    Software Optimization Guide for AMD Athlon
    AMD64 Architecture Programmer's Manual Volume 4: 128-Bit Media Instructions

    Apple

    Velocity Engine

    IBM

    PowerPC 970 AltiVec(TM) PEM

    Intel

    SIMD Matrix multiplication

    Mailing List

    sb-simd-devel

    History

    Christophe Rhodes announced the first code to sbcl-devel on 2001-10-12.
    Risto Laakso started the SB-SIMD project on common-lisp.net around August 5, 2005.
    Daniel Herring found SB-SIMD around July 27, 2007.