From: Lionel Landwerlin Date: Thu, 9 Mar 2023 10:12:54 +0000 (+0200) Subject: intel/fs: prevent large vector ops generated by peephole_ffma X-Git-Tag: upstream/23.3.3~11702 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf59cfcee1d0cf02971ab74375daf82b0d6b1971;p=platform%2Fupstream%2Fmesa.git intel/fs: prevent large vector ops generated by peephole_ffma Signed-off-by: Lionel Landwerlin Reviewed-by: Emma Anholt Part-of: --- 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)