Developer Guide and Reference

Contents

SDLT Primitives (SDLT_PRIMITIVE)

Primitives represent the data we want to work over in SIMD. They can be more than just data structures. As a C++ object, it can have its own methods that modify its data.
Rules:
  • Must be Plain Old Data (POD)
    • Has trivial copy constructor
    • Has trivial move constructor
    • Has trivial destructor
    • No virtual functions or virtual bases
  • No reference data members
  • No unions
  • No bit fields
  • No bool types
    • Comparison semantics not efficient in SIMD
    • Use 32-bit integer and compare against known values like 0 or 1 explicitly
  • Data members need to be public or declare
    SDLT_PRIMITIVE_FRIEND
    in the object's definition
Current limitations:
  • No pointer data members
  • No C++11 strongly typed enums—use integers instead.
  • No array based data members.
  • copy constructor and assignment operator (=) defined by individual member assignment—strongly encouraged to facilitate better code generation
They may seem like large restrictions, but often code can easily be re-factored to meet this requirement. For example:
class Point3d { // methods... protected: double v[3]; };
can be re-factored to have a public data member for each element in the array and update methods to use the
x
,
y
, and
z
data members rather than the array
v
.
class Point3d { public: // methods... double x; double y; double z; };
For better code generation, explicitly define a copy constructor and assignment operator (=) by individual member assignment.

SDLT_PRIMITIVE
Macro