Mesa (master): radv: lower ffma in nir.

Dave Airlie airlied at kemper.freedesktop.org
Tue Oct 10 21:33:45 UTC 2017


Module: Mesa
Branch: master
Commit: 2c61594d84911f486aa2edb4b8e561e780139d20
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c61594d84911f486aa2edb4b8e561e780139d20

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct  4 06:33:02 2017 +1000

radv: lower ffma in nir.

So it appears the Vulkan SPIR-V fma opcode can be equivalent to a
mad operation, and the fma hw opcode on AMD hw is issued like a double
opcode so is slower. Also the radeonsi stack does this.

This appears to improve performance on a number of games from Feral,
and thanks to Feral for noticing the problem.

I'm reposting this one as Marek indicated he thinks this is what
we should be doing on AMD hw.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Cc: "17.2" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/amd/vulkan/radv_shader.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index e0944a478e..535d0f4f58 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -63,6 +63,7 @@ static const struct nir_shader_compiler_options nir_options = {
 	.lower_unpack_unorm_4x8 = true,
 	.lower_extract_byte = true,
 	.lower_extract_word = true,
+	.lower_ffma = true,
 	.max_unroll_iterations = 32
 };
 




More information about the mesa-commit mailing list