From: Rhys Perry Date: Tue, 1 Sep 2020 16:40:32 +0000 (+0100) Subject: nir/opt_uniform_atomics: optimize image atomics X-Git-Tag: upstream/21.0.0~4318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc4365052252a33a10a95e4571bc4336f238fe39;p=platform%2Fupstream%2Fmesa.git nir/opt_uniform_atomics: optimize image atomics 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: --- 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;