spirv: reverse order in matrix multiplication
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 17 Jun 2020 12:44:40 +0000 (13:44 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 3 Nov 2020 14:56:00 +0000 (14:56 +0000)
commit16c756e55d553673314d22931bb0a84864380ff3
tree6a3128eb371ae1d68179975683816cb7a092c691
parent24a18b1a4b99c5dc97bfb2cf9a2b0c2211839b3a
spirv: reverse order in matrix multiplication

This will create code that is easier to combine into MADs/FMA when the
last component of the vector is 1.0.

nir_opt_algebraic_late has an optimization to do something similar but it
only works for inexact code, if the multiplication-by-1 optimization is
done before it and if the backend enables fuse_ffma.

fossil-db (Navi):
Totals from 4296 (3.75% of 114665) affected shaders:
SGPRs: 283468 -> 283764 (+0.10%); split: -0.02%, +0.12%
VGPRs: 172868 -> 172904 (+0.02%); split: -0.09%, +0.11%
CodeSize: 14045312 -> 14027128 (-0.13%); split: -0.15%, +0.02%
MaxWaves: 59285 -> 59282 (-0.01%); split: +0.04%, -0.05%
Instrs: 2703507 -> 2683187 (-0.75%); split: -0.76%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>
src/compiler/spirv/vtn_alu.c