diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2018-04-01 03:10:27 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2018-05-24 19:44:56 +0300 |
commit | b4a8b813993138cc831d4c04f0f94bdafc51e7fe (patch) | |
tree | 72b5fcfe3cdfdf6c4a9db68d896414ef0d5cdb0c /intern/cycles/util | |
parent | 68627626854c27c2135cab72b48b648cb638c8cb (diff) |
Cycles Denoising: Don't use atomics in the accumulation kernel on CPUs
The GPU kernel needs to use atomics for accumulation since all offsets are processed in
parallel, but on CPUs that's not the case, so we can disable them there for a considerable speedup.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_math_matrix.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math_matrix.h b/intern/cycles/util/util_math_matrix.h index 382dad64ea5..9ffcb9659b2 100644 --- a/intern/cycles/util/util_math_matrix.h +++ b/intern/cycles/util/util_math_matrix.h @@ -144,6 +144,18 @@ ccl_device_inline void math_trimatrix_add_gramian_strided(ccl_global float *A, } } +ccl_device_inline void math_trimatrix_add_gramian(ccl_global float *A, + int n, + const float *ccl_restrict v, + float weight) +{ + for(int row = 0; row < n; row++) { + for(int col = 0; col <= row; col++) { + MATHS(A, row, col, 1) += v[row]*v[col]*weight; + } + } +} + /* Transpose matrix A inplace. */ ccl_device_inline void math_matrix_transpose(ccl_global float *A, int n, int stride) { |