[Mesa-dev] [PATCH 08/10] radeonsi: re-enable unsafe-fp-math for LLVM 3.8

Marek Olšák maraeo at gmail.com
Sat Oct 10 18:29:48 PDT 2015


From: Marek Olšák <marek.olsak at amd.com>

Required for 1/sqrt ==> rsq.

We should finally fix the hang instead of running away from the issue. This
assumes the bug is in LLVM and we have time to fix it before the release.
Include compute shaders as well, which only affects TGSI and thus OpenGL.

Totals:
SGPRS: 344368 -> 345104 (0.21 %)
VGPRS: 197552 -> 197420 (-0.07 %)
Code Size: 7366304 -> 7324692 (-0.56 %) bytes
LDS: 91 -> 91 (0.00 %) blocks
Scratch: 1615872 -> 1524736 (-5.64 %) bytes per wave

Totals from affected shaders:
SGPRS: 146696 -> 147432 (0.50 %)
VGPRS: 87212 -> 87080 (-0.15 %)
Code Size: 3852664 -> 3811052 (-1.08 %) bytes
LDS: 48 -> 48 (0.00 %) blocks
Scratch: 1179648 -> 1088512 (-7.73 %) bytes per wave
---
 src/gallium/drivers/radeon/radeon_llvm_emit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 6b2ebde..4bda4a4 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -84,6 +84,13 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type)
 	sprintf(Str, "%1d", llvm_type);
 
 	LLVMAddTargetDependentFunctionAttr(F, "ShaderType", Str);
+
+#if HAVE_LLVM >= 0x0308
+	/* This only affects TGSI (OpenGL), so it's okay to set it for
+	 * compute shaders too.
+	 */
+	LLVMAddTargetDependentFunctionAttr(F, "unsafe-fp-math", "true");
+#endif
 }
 
 static void init_r600_target()
-- 
2.1.4



More information about the mesa-dev mailing list