From 3adf614dad526c4ba3fe6857b7812ef06149639f Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 2 Sep 2023 17:55:57 +0200 Subject: [PATCH] nir/opt_algebraic: remove broken fddx/fddy patterns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These patterns are broken in the following scenario: %1 = f2fmp %0 %2 = fddx %1 %3 = ... // non quad uniform if %3 { %4 = f2f32 %2 ... } Which would turn into %3 = ... if %3 { %4 = fddx %0 ... } Yet another example that shows why derivative instructions should be be intrinsics, not alu. Reviewed-by: Marek Olšák Reviewed-by: Emma Anholt Cc: mesa-stable Part-of: (cherry picked from commit 136a6982515f527a82bfbdeb19c6f5c9d7ce3cf2) --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_algebraic.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5cf3d081602..d7a5f79bc8a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -643,7 +643,7 @@ "description": "nir/opt_algebraic: remove broken fddx/fddy patterns", "nominated": true, "nomination_type": 0, - "resolution": 0, + "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 444542076a7..96c3e47329d 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -3102,8 +3102,7 @@ for op in ['ffma', 'ffmaz']: # first eliminate temporary up-conversions such as in op1(f2fmp(f2f32(op2()))). # # Unary opcodes -for op in ['fabs', 'fceil', 'fcos', 'fddx', 'fddx_coarse', 'fddx_fine', 'fddy', - 'fddy_coarse', 'fddy_fine', 'fexp2', 'ffloor', 'ffract', 'flog2', 'fneg', +for op in ['fabs', 'fceil', 'fcos', 'fexp2', 'ffloor', 'ffract', 'flog2', 'fneg', 'frcp', 'fround_even', 'frsq', 'fsat', 'fsign', 'fsin', 'fsqrt']: late_optimizations += [(('~f2f32', (op, ('f2fmp', a))), (op, a))]