From 648cda258b48bd1dbd7af988e149320dfcee0998 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 19 Apr 2019 23:15:45 +0000 Subject: [PATCH] panfrost/mdg: Use shared fsign lowering Fixes failures in shaders.operator.common_functions.sign.* Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/midgard/midgard_compile.c | 1 - src/gallium/drivers/panfrost/midgard/midgard_compile.h | 4 ++++ src/gallium/drivers/panfrost/midgard/midgard_nir.h | 1 - .../drivers/panfrost/midgard/midgard_nir_algebraic.py | 9 --------- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 203e6cdf69a..67c1d59d85a 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -767,7 +767,6 @@ optimise_nir(nir_shader *nir) do { progress = false; - NIR_PASS(progress, nir, midgard_nir_lower_algebraic); NIR_PASS(progress, nir, nir_lower_var_copies); NIR_PASS(progress, nir, nir_lower_vars_to_ssa); diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.h b/src/gallium/drivers/panfrost/midgard/midgard_compile.h index 4bc5d475b5a..0724582d62c 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.h +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.h @@ -99,6 +99,10 @@ static const nir_shader_compiler_options midgard_nir_options = { .lower_fpow = true, .lower_find_lsb = true, + /* TODO: We have native ops to help here, which we'll want to look into + * eventually */ + .lower_fsign = true, + .vertex_id_zero_based = true, .lower_extract_byte = true, .lower_extract_word = true, diff --git a/src/gallium/drivers/panfrost/midgard/midgard_nir.h b/src/gallium/drivers/panfrost/midgard/midgard_nir.h index 6b4833b32b2..85eadd34631 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_nir.h +++ b/src/gallium/drivers/panfrost/midgard/midgard_nir.h @@ -1,6 +1,5 @@ #include #include "nir.h" -bool midgard_nir_lower_algebraic(nir_shader *shader); bool midgard_nir_lower_algebraic_late(nir_shader *shader); bool midgard_nir_scale_trig(nir_shader *shader); diff --git a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py index 8aad4b128c4..7c8cd06feed 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py +++ b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py @@ -29,13 +29,6 @@ import math a = 'a' b = 'b' -algebraic = [ - # XXX: We have hw ops for this, just unknown atm.. - #(('fsign@32', a), ('i2f32@32', ('isign', ('f2i32@32', ('fmul', a, 0x43800000))))) - #(('fsign', a), ('fcsel', ('fge', a, 0), 1.0, ('fcsel', ('flt', a, 0.0), -1.0, 0.0))) - (('fsign', a), ('bcsel', ('fge', a, 0), 1.0, -1.0)), -] - algebraic_late = [ # ineg must be lowered late, but only for integers; floats will try to # have modifiers attached... hence why this has to be here rather than @@ -65,8 +58,6 @@ def run(): import nir_algebraic # pylint: disable=import-error print('#include "midgard_nir.h"') - print(nir_algebraic.AlgebraicPass("midgard_nir_lower_algebraic", - algebraic).render()) print(nir_algebraic.AlgebraicPass("midgard_nir_lower_algebraic_late", algebraic_late).render()) -- 2.30.2