From bf59cfcee1d0cf02971ab74375daf82b0d6b1971 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 9 Mar 2023 12:12:54 +0200 Subject: [PATCH] intel/fs: prevent large vector ops generated by peephole_ffma Signed-off-by: Lionel Landwerlin Reviewed-by: Emma Anholt Part-of: --- src/intel/compiler/brw_nir.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index b340c09..6c9feaf 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1458,8 +1458,19 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, brw_nir_optimize(nir, compiler, is_scalar); if (devinfo->ver >= 6) { - /* Try and fuse multiply-adds */ - OPT(brw_nir_opt_peephole_ffma); + /* Try and fuse multiply-adds, if successful, run shrink_vectors to + * avoid peephole_ffma to generate things like this : + * vec16 ssa_0 = ... + * vec16 ssa_1 = fneg ssa_0 + * vec1 ssa_2 = ffma ssa_1, ... + * + * We want this instead : + * vec16 ssa_0 = ... + * vec1 ssa_1 = fneg ssa_0.x + * vec1 ssa_2 = ffma ssa_1, ... + */ + if (OPT(brw_nir_opt_peephole_ffma)) + OPT(nir_opt_shrink_vectors); } if (is_scalar) -- 2.7.4