You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.7 KiB

  1. namespace StormEigen {
  2. /** \eigenManualPage TopicFixedSizeVectorizable Fixed-size vectorizable Eigen objects
  3. The goal of this page is to explain what we mean by "fixed-size vectorizable".
  4. \section FixedSizeVectorizable_summary Executive Summary
  5. An Eigen object is called "fixed-size vectorizable" if it has fixed size and that size is a multiple of 16 bytes.
  6. Examples include:
  7. \li StormEigen::Vector2d
  8. \li StormEigen::Vector4d
  9. \li StormEigen::Vector4f
  10. \li StormEigen::Matrix2d
  11. \li StormEigen::Matrix2f
  12. \li StormEigen::Matrix4d
  13. \li StormEigen::Matrix4f
  14. \li StormEigen::Affine3d
  15. \li StormEigen::Affine3f
  16. \li StormEigen::Quaterniond
  17. \li StormEigen::Quaternionf
  18. \section FixedSizeVectorizable_explanation Explanation
  19. First, "fixed-size" should be clear: an Eigen object has fixed size if its number of rows and its number of columns are fixed at compile-time. So for example Matrix3f has fixed size, but MatrixXf doesn't (the opposite of fixed-size is dynamic-size).
  20. The array of coefficients of a fixed-size Eigen object is a plain "static array", it is not dynamically allocated. For example, the data behind a Matrix4f is just a "float array[16]".
  21. Fixed-size objects are typically very small, which means that we want to handle them with zero runtime overhead -- both in terms of memory usage and of speed.
  22. Now, vectorization (both SSE and AltiVec) works with 128-bit packets. Moreover, for performance reasons, these packets need to be have 128-bit alignment.
  23. So it turns out that the only way that fixed-size Eigen objects can be vectorized, is if their size is a multiple of 128 bits, or 16 bytes. Eigen will then request 16-byte alignment for these objects, and henceforth rely on these objects being aligned so no runtime check for alignment is performed.
  24. */
  25. }