Mesa (staging/19.1): intel/nir: do not apply the fsin and fcos trig workarounds for consts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 24 09:53:35 UTC 2019


Module: Mesa
Branch: staging/19.1
Commit: 51861c844bd2d513f88a212183e5669ace4810f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=51861c844bd2d513f88a212183e5669ace4810f6

Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date:   Tue Dec  4 16:41:36 2018 +0100

intel/nir: do not apply the fsin and fcos trig workarounds for consts

If we have fsin or fcos trigonometric operations with constant values
as inputs, we will multiply the result by 0.99997 in
brw_nir_apply_trig_workarounds, making the result wrong.

Adjusting the rules so they do not apply to const values we let a
later constant fold to deal with it.

v2:
- Do not early constant fold but only apply the trig workaround for
  non constants (Caio).
- Add fixes tag to commit log (Caio).

Fixes: bfd17c76c12 "i965: Port INTEL_PRECISE_TRIG=1 to NIR."
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Signed-off-by: Andres Gomez <agomez at igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
(cherry picked from commit 3c474f851313db5318d727d017b763ea2cb01e6d)

---

 src/intel/compiler/brw_nir_trig_workarounds.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_nir_trig_workarounds.py b/src/intel/compiler/brw_nir_trig_workarounds.py
index d60e094c625..dddadc71da2 100644
--- a/src/intel/compiler/brw_nir_trig_workarounds.py
+++ b/src/intel/compiler/brw_nir_trig_workarounds.py
@@ -37,8 +37,8 @@ import argparse
 import sys
 
 TRIG_WORKAROUNDS = [
-    (('fsin', 'x'), ('fmul', ('fsin', 'x'), 0.99997)),
-    (('fcos', 'x'), ('fmul', ('fcos', 'x'), 0.99997)),
+    (('fsin', 'x(is_not_const)'), ('fmul', ('fsin', 'x'), 0.99997)),
+    (('fcos', 'x(is_not_const)'), ('fmul', ('fcos', 'x'), 0.99997)),
 ]
 
 




More information about the mesa-commit mailing list