Skip to content

Porting from Vc 0.7.x to Vc 1.x

Matthias Kretz edited this page Apr 8, 2016 · 5 revisions

AVX::int_v::Size changed

In 0.7 the number of elements in int_v and float_v was guaranteed to be equal. Since this does not reflect actual reality of SIMD hardware, the guarantee was dropped in Vc 1.0. Consequently, conversions between (u)int_v and float_v are not implicit anymore. If you explicitly convert using e.g. simd_cast you risk dropping data or generating zeros. Instead, you likely want to use the new SimdArray class template. Example:

using float_v = Vc::float_v;
using int_v = Vc::SimdArray<int, float_v::size()>;

int_v f(int_v x) {
  float_v fx = x;
  fx = do_stuff(fx);
  return fx;
}

load & store alignment default changed

Before Vc 1.0 the default of load and store operations was to use aligned loads and stores. The default has changed with Vc 1.0 to prefer safety over performance and thus defaults to unaligned loads and stores. Best practice recommendation: always specify the load/store flags on load & store functions.

cmake changes

Vc 0.7 shipped convenient macros to determine compiler flags and to support multi-target compilation. The same features are still available with 1.x. However, the old Vc_DEFINITIONS variable has changed meaning. Since 1.0 it only contains actual -D flags. All the other flags have moved to Vc_COMPILE_FLAGS and Vc_ARCHITECTURE_FLAGS. The Vc_ALL_FLAGS variable contains a union of the three (which is thus the drop-in replacement for 0.7's Vc_DEFINITIONS).