Skip to content

Commit 2806055

Browse files
committed
more prose re: what happens behind the scenes
1 parent c3154a2 commit 2806055

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gallery/simd-vector-sum.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ double vectorSumSimd(NumericVector x) {
5858

5959
/**
6060
* As you can see, it's quite simple to take advantage of `Boost.SIMD`.
61+
*
62+
* Behind the scenes of `boost::simd::accumulate()`, `Boost.SIMD` will
63+
* apply your templated functor to 'packs' of values when appropriate,
64+
* and simple values when not. In other words, there are effectively
65+
* two kinds of template specializations being generated behind the scenes:
66+
* one with `T = double`, and one with `T = boost::simd::pack<double>`. The
67+
* use of the packed representation is what allows `Boost.SIMD` to ensure
68+
* vectorized instructions are used and generated.
69+
*
6170
* Now, let's compare the performance of these two implementations.
6271
*/
6372

0 commit comments

Comments
 (0)