Vc: portable, zero-overhead C++ types for explicitly data-parallel programming

Recent generations of CPUs, and GPUs in particular, require data-parallel codes for full efficiency. Data parallelism requires that the same sequence of operations is applied to different input data. CPUs and GPUs can thus reduce the necessary hardware for instruction decoding and scheduling in favor of more arithmetic and logic units, which execute the same instructions synchronously. On CPU architectures this is implemented via SIMD registers and instructions. A single SIMD register can store N values and a single SIMD instruction can execute N operations on those values. On GPU architectures N threads run in perfect sync, fed by a single instruction decoder/scheduler. Each thread has local memory and a given index to calculate the offsets in memory for loads and stores.

Current C++ compilers can do automatic transformation of scalar codes to SIMD instructions (auto-vectorization). However, the compiler must reconstruct an intrinsic property of the algorithm that was lost when the developer wrote a purely scalar implementation in C++. Consequently, C++ compilers cannot vectorize any given code to its most efficient data-parallel variant. Especially larger data-parallel loops, spanning over multiple functions or even translation units, will often not be transformed into efficient SIMD code.

The Vc library provides the missing link. Its types enable explicitly stating data-parallel operations on multiple values. The parallelism is therefore added via the type system. Competing approaches state the parallelism via new control structures and consequently new semantics inside the body of these control structures.

Vc is a free software library to ease explicit vectorization of C++ code. It has an intuitive API and provides portability between different compilers and compiler versions as well as portability between different vector instruction sets. Thus an application written with Vc can be compiled for:

  • AVX and AVX2
  • SSE2 up to SSE4.2 or SSE4a
  • Scalar
  • MIC
  • NEON (in development)
  • NVIDIA GPUs / CUDA (in development)

Build Requirements

cmake >= 3.0

C++11 Compiler:

  • GCC >= 4.8.1
  • clang >= 3.4
  • ICC >= 15.0.3
  • Visual Studio (not ready for Vc 1.0 yet)

Building and Installing Vc

  • Create a build directory:
$ mkdir build
$ cd build
  • Call cmake with the relevant options:
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/Vc -DBUILD_TESTING=OFF <srcdir>
  • Build and install:
$ make -j16
$ make install

Documentation

The documentation is generated via doxygen. You can build the documentation by running doxygen in the doc subdirectory. Alternatively, you can find nightly builds of the documentation at:

Publications

Communication

A channel on the freenode IRC network is reserved for discussions on Vc: ##vc on freenode (via SSL)

There exist two mailinglists:

Feel free to use the GitHub issue tracker for questions, too.

License

Vc is released under the terms of the 3-clause BSD license.

Related Repositories

vc-platform

vc-platform

Virto Commerce Platform repository ...

glide-vc

glide-vc

Glide vendor cleaner ...

wp-vc-template-manager

wp-vc-template-manager

Template manager for Visual Composer ...

vc-common-src

vc-common-src

common codes be relied upon HP-Socket & VC-Logger ...

compilscripts

compilscripts

( Unmaintained ) Old script to compile Krita, Mypaint, and Vc lib ...


Top Contributors

mattkretz chr-engwer vks theMarix jcowgill kgnk j-stephan fuhlig1 hkaiser oshadura sawenzel lduhem

Releases

-   1.3.0 zip tar
-   1.2.0 zip tar
-   1.1.0 zip tar
-   1.0.0 zip tar
-   0.99.71 zip tar
-   0.7.5 zip tar
-   0.7.4 zip tar
-   0.7.3 zip tar
-   0.7.2 zip tar
-   0.7.1 zip tar
-   0.7.0 zip tar
-   0.6.95 zip tar
-   0.6.1 zip tar
-   0.6.0 zip tar
-   0.5.80 zip tar
-   0.5.0 zip tar
-   0.4.91 zip tar
-   0.4.90 zip tar
-   0.4.80 zip tar
-   0.4.0 zip tar
-   0.3.90 zip tar
-   0.2.92 zip tar
-   0.2.91 zip tar
-   0.2.90 zip tar
-   0.2.3 zip tar
-   0.2.2 zip tar