Mesa (master): nir/algebraic: refactor inexact opcode restrictions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 19 16:57:56 UTC 2019


Module: Mesa
Branch: master
Commit: 5ed5e76741b93e687d3c90efd00eb8f2e2b91ead
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ed5e76741b93e687d3c90efd00eb8f2e2b91ead

Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date:   Thu Sep 19 12:10:27 2019 +0200

nir/algebraic: refactor inexact opcode restrictions

Refactor the code to avoid calling a lot of time to auxiliary functions
when it is not really needed.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/compiler/nir/nir_algebraic.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 783d0b69285..fe66952ba16 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -1169,6 +1169,10 @@ ${pass_name}_block(nir_builder *build, nir_block *block,
          continue;
 
       unsigned bit_size = alu->dest.dest.ssa.bit_size;
+      const bool ignore_inexact =
+         nir_is_float_control_signed_zero_inf_nan_preserve(execution_mode, bit_size) ||
+         nir_is_denorm_flush_to_zero(execution_mode, bit_size);
+
       switch (states[alu->dest.dest.ssa.index]) {
 % for i in range(len(automaton.state_patterns)):
       case ${i}:
@@ -1176,9 +1180,7 @@ ${pass_name}_block(nir_builder *build, nir_block *block,
          for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_state${i}_xforms); i++) {
             const struct transform *xform = &${pass_name}_state${i}_xforms[i];
             if (condition_flags[xform->condition_offset] &&
-                !(xform->search->inexact &&
-                  (nir_is_float_control_signed_zero_inf_nan_preserve(execution_mode, bit_size) ||
-                   nir_is_denorm_flush_to_zero(execution_mode, bit_size))) &&
+                !(xform->search->inexact && ignore_inexact) &&
                 nir_replace_instr(build, alu, xform->search, xform->replace)) {
                progress = true;
                break;




More information about the mesa-commit mailing list