Skip to content

Arithmetic types for alignment debugging

Jö Fahlke requested to merge feature/debugalign into master

This class wraps fundamental arithmetic types and makes them overaligned. Actual alignment is checked at runtime in the constructor/destructor.

AVX SIMD types are overaligned, that is, some hardware instructions require them to be aligned to 32 bytes (or greater), while GCC only guarantees 16 bytes alignment. When allocated on the stack, the compiler still honours the overalignment, but typically not when allocated dynamically. This means that containers, that should support overaligned types, must use a special allocator to allocate internal memory that is supposed to hold objects of such types. This is however not always implemented correctly.

Debugging and unit testing with AVX SIMD types is not always possible, for instance because the required hardware or required libraries are not readily available. This makes is difficult to find incorrect use of allocators in containers.

This is where these overaligned wrapper types come in. They can be used for debugging and unit testing instead of SIMD types, and will work without particular hardware or libraries.

Depends: !225 (merged)

Due for merge: 2017-05-02

[WIP] Needs support for <cmath> functions.
Missing:

  • Support for <cmath> functions with more than one argument (can be added at a later time when someone needs them).

Merge request reports