summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@collabora.com>2022-04-19 11:05:45 -0500
committerDylan Baker <dylan.c.baker@intel.com>2022-06-01 14:10:29 -0700
commit1d0badd2f3c4979c27ff24c0a16d4a4d9aa29c97 (patch)
treea3624f2ccb61eddf2f68726ea27639563ec86a5d
parent89b80e6587c008a2698ea4129bb6cb20398a096b (diff)
nir: Mark negative re-distribution on fadd as imprecise
Otherwise, it would mutate `fneg(fadd(-0, 0))` into `fadd(0, -0)` which isn't correct since -0 + (+0) = +0 + (-0) = +0. This fixes the OpenCL contraction tests on Iris. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16041> (cherry picked from commit df1876f615aee242565e815752bf39ee7fefc0ae)
-rw-r--r--.pick_status.json2
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 3e43e4ca1f9..d13134602b7 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -8698,7 +8698,7 @@
"description": "nir: Mark negative re-distribution on fadd as imprecise",
"nominated": false,
"nomination_type": null,
- "resolution": 4,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index dcd4c501e4a..d45adbfe147 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -2844,7 +2844,7 @@ distribute_src_mods = [
(('fneg', ('ffma(is_used_once)', a, b, c)), ('ffma', ('fneg', a), b, ('fneg', c))),
(('fneg', ('flrp(is_used_once)', a, b, c)), ('flrp', ('fneg', a), ('fneg', b), c)),
- (('fneg', ('fadd(is_used_once)', a, b)), ('fadd', ('fneg', a), ('fneg', b))),
+ (('fneg', ('~fadd(is_used_once)', a, b)), ('fadd', ('fneg', a), ('fneg', b))),
# Note that fmin <-> fmax. I don't think there is a way to distribute
# fabs() into fmin or fmax.