imageworks/OpenShadingLanguage — pull request #422 by lgritz (2014-10-09 18:33:23+00:00)
Title: Noise speedups

Primarily, return to SIMD-ization of noise. I did 2D and 3D noise a while back, this patch uses SIMD instructions to accelerate 4D noise varieties (float-valued, vector-valued, with and without derivatives). I clock a speedup of over 3x for all varieties, very close to 4x for vector-valued 4D noise.

Also, this patch fixes something I noticed -- the kind of noise that takes a name (like, noise("snoise",...)), if the name is not a string literal, will mark the resulting instruction as "taking derivatives of its arguments" since SOME varieties of noise might (in particular, gabor). But if, in the course of runtime optimization, it is able to determine the type of noise and it's not gabor, it was still cascading the need for derivatives upstream. So the fix here is that the constant folder notices this case and unmarks it as needing derivatives. This doesn't speed up the noise per se, but by not requiring certain upstream inputs to need to propagate derivs, it can make other little speedups. (I've seen as much as 10% gain, but also scenes where it was not any measurable difference at all).