imageworks/OpenShadingLanguage — pull request #415 by lgritz (2014-09-21 22:23:00+00:00)
Title: Noise functions significantly sped up with SIMD vector instructions

noise() speedups using SIMD vector instructions. Quick summary: noise on 3D domain is 2-3x faster, depending on the variety (noise on 2D domain not sped up by as much, but still significant).

Done: float- and triple-output Perlin noise on 2D & 3D, with and without derivs, both signed and unsigned varieties, also the periodic versions. The patterns are unchanged, they just speed up.

Not done:

* 1D domain (2D was already so much less speedup than 3D, didn't seem like 2D would have much gain).
* 3D domain (rarely used, more work, will come back to it)
* simplex, gabor, cell noises (will come back to these)

Timing results:

These are for Perlin signed noise, but the same code is used for periodic and unsigned versions. Improvements are reported as percentage of original time that it takes the new code to run. For example, 50% means the new SSE code runs in half the time of the old code, i.e., 2x faster.

Range Domain Derivs New Time (as percent of old time)
1D 2D 77%
1D 2D y 77%
1D 3D 53%
1D 3D y 32%
3D 2D 66%
3D 2D y 51%
3D 3D 42%
3D 3D y 40%

I'll probably return to this after a rest and tighten it up even more, as well as tackle the 4D noise cases I skipped. Also is worth a pass over the simplex and especially the gabor noise to see if we can get similar speedups.