diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index ed6fdffd265..21c8bd331b5 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -558,6 +558,11 @@ brw_initialize_context_constants(struct brw_context *brw) static const nir_shader_compiler_options gen6_nir_options = { .native_integers = true, + /* In order to help allow for better CSE at the NIR level we tell NIR + * to split all ffma instructions during opt_algebraic and we then + * re-combine them as a later step. + */ + .lower_ffma = true, }; /* We want the GLSL compiler to emit code that uses condition codes */ diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 4f4b74620fe..94641cf2ec1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -52,8 +52,6 @@ nir_optimize(nir_shader *nir) nir_validate_shader(nir); progress |= nir_opt_algebraic(nir); nir_validate_shader(nir); - progress |= nir_opt_peephole_ffma(nir); - nir_validate_shader(nir); progress |= nir_opt_constant_folding(nir); nir_validate_shader(nir); progress |= nir_opt_remove_phis(nir); @@ -149,6 +147,12 @@ fs_visitor::emit_nir_code() nir_optimize(nir); + if (brw->gen >= 6) { + /* Try and fuse multiply-adds */ + nir_opt_peephole_ffma(nir); + nir_validate_shader(nir); + } + nir_opt_algebraic_late(nir); nir_validate_shader(nir); |