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

Author: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Date:   Wed Mar 15 00:59:13 2017 +0100

radeonsi: disable sinking common instructions down to the end block

Initially this was a workaround for a bug introduced in LLVM 4.0
in the SimplifyCFG pass that caused image instrinsics to disappear
(because they were badly sunk). Finally, this is a win because it
decreases SGPR spilling and increases the number of waves a bit.

Although, shader-db results are good I think we might want to
remove it in the future once the issue is fixed. For now, enable
it for LLVM >= 4.0.

This also fixes a rendering issue with the speedometer in Dirt Rally.

More information can be found here https://reviews.llvm.org/D26348.

Thanks to Dave Airlie for the patch.

v2: - add a FIXME comment
    - use if (HAVE_LLVM >= 0x0400) instead

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99484
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97988
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Cc: 17.0 <mesa-sta...@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 5c63b73..7965b46 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -40,6 +40,7 @@
 #include <stdio.h>
 #include <llvm-c/Transforms/IPO.h>
 #include <llvm-c/Transforms/Scalar.h>
+#include <llvm-c/Support.h>
 
 /* Data for if/else/endif and bgnloop/endloop control flow structures.
  */
@@ -124,6 +125,16 @@ static void init_amdgpu_target()
        LLVMInitializeAMDGPUTarget();
        LLVMInitializeAMDGPUTargetMC();
        LLVMInitializeAMDGPUAsmPrinter();
+
+       if (HAVE_LLVM >= 0x0400) {
+               /*
+                * Workaround for bug in llvm 4.0 that causes image intrinsics
+                * to disappear.
+                * https://reviews.llvm.org/D26348
+                */
+               const char *argv[2] = {"mesa", 
"-simplifycfg-sink-common=false"};
+               LLVMParseCommandLineOptions(2, argv, NULL);
+       }
 }
 
 static once_flag init_amdgpu_target_once_flag = ONCE_FLAG_INIT;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to