Padding and speed

Issue #56 wontfix
Mario Emmenlauer created an issue

Dear All,

maybe this is just a misunderstanding on my side: I think blaze gains speed by padding to an array size that is efficient for sse/sse2/avx/... instructions, so I guess by padding to some multiple of 4, 8, or something. Is that correct?

For the sake of curiosity, I ran a few blazemarks (for example dmatdmatadd) without padding but array sizes that are powers of 2 (and multiples of 4, 8 and 16). To my surprise, blaze was suddenly not faster than the competitors! Suddenly it was up to 4 times slower than with padding enabled.

Why can an array of size power of two (512, 1024, ...) profit from padding?

Comments (2)

  1. Klaus Iglberger

    Hi Mario!

    You are correct, Blaze uses padding explicitly to achieve its performance. Mainly for testing purposes it is possible to deactivate padding, which, als you correctly observed, leads to a loss in performance, especially for tiny vectors and matrices. However, this is to be expected and is not a defect. The optimization strategy of all Blaze operations is based on the assumption that padding is available. Therefore, as much as it is desirable to also achieve the same great performance without padding it is unfortunately not feasible at this time since it would require a complete rework of all operations. The effort would be comparable to writing a new math library.

    Best regards,

    Klaus!

  2. Mario Emmenlauer reporter

    Hi Klaus,

    ok what you say makes sense! Thanks for answering so quickly, its interesting to learn more about blaze.

    Cheers, Mario

  3. Log in to comment