From bc4365052252a33a10a95e4571bc4336f238fe39 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 1 Sep 2020 17:40:32 +0100 Subject: [PATCH] nir/opt_uniform_atomics: optimize image atomics MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit fossil-db (Navi): Totals from 65 (0.05% of 135946) affected shaders: SGPRs: 3792 -> 3784 (-0.21%) VGPRs: 2784 -> 2716 (-2.44%) CodeSize: 707492 -> 713080 (+0.79%) MaxWaves: 873 -> 887 (+1.60%) Instrs: 133376 -> 134524 (+0.86%) Cycles: 3004772 -> 3011440 (+0.22%) Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_opt_uniform_atomics.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_opt_uniform_atomics.c b/src/compiler/nir/nir_opt_uniform_atomics.c index cb21ff9..91abf67 100644 --- a/src/compiler/nir/nir_opt_uniform_atomics.c +++ b/src/compiler/nir/nir_opt_uniform_atomics.c @@ -43,7 +43,7 @@ static nir_op parse_atomic_op(nir_intrinsic_op op, unsigned *offset_src, unsigned *data_src) { switch (op) { - #define OP(intrin, alu) \ + #define OP_NOIMG(intrin, alu) \ case nir_intrinsic_ssbo_atomic_##intrin: \ *offset_src = 1; \ *data_src = 2; \ @@ -56,6 +56,14 @@ parse_atomic_op(nir_intrinsic_op op, unsigned *offset_src, unsigned *data_src) return nir_op_##alu; \ return nir_op_##alu; \ return nir_op_##alu; + #define OP(intrin, alu) \ + OP_NOIMG(intrin, alu) \ + case nir_intrinsic_image_deref_atomic_##intrin: \ + case nir_intrinsic_image_atomic_##intrin: \ + case nir_intrinsic_bindless_image_atomic_##intrin: \ + *offset_src = 1; \ + *data_src = 3; \ + return nir_op_##alu; OP(add, iadd) OP(imin, imin) OP(umin, umin) @@ -65,8 +73,9 @@ parse_atomic_op(nir_intrinsic_op op, unsigned *offset_src, unsigned *data_src) OP(or, ior) OP(xor, ixor) OP(fadd, fadd) - OP(fmin, fmin) - OP(fmax, fmax) + OP_NOIMG(fmin, fmin) + OP_NOIMG(fmax, fmax) + #undef OP_NOIMG #undef OP default: return nir_num_opcodes; -- 2.7.4