[Mesa-dev] [PATCH 1/2] radeon/llvm: enable unsafe math for graphics shaders

Tom Stellard tom at stellard.net
Thu Jul 17 12:24:30 PDT 2014


On Thu, Jul 17, 2014 at 06:44:25PM +0200, Grigori Goronzy wrote:
> Accuracy of some operations was recently improved in the R600 backend,
> at the cost of slower code. This is required for compute shaders,
> but not for graphics shaders. Add unsafe-fp-math hint to make LLVM
> generate faster but possibly less accurate code.
> 
> Piglit didn't indicate any regressions.

Both patches are:
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

> ---
>  src/gallium/drivers/radeon/radeon_llvm_emit.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> index 1b17dd4..171ccaa 100644
> --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
> +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> @@ -26,6 +26,7 @@
>  #include "radeon_llvm_emit.h"
>  #include "radeon_elf_util.h"
>  #include "util/u_memory.h"
> +#include "pipe/p_shader_tokens.h"
>  
>  #include <llvm-c/Target.h>
>  #include <llvm-c/TargetMachine.h>
> @@ -50,6 +51,10 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type)
>    sprintf(Str, "%1d", type);
>  
>    LLVMAddTargetDependentFunctionAttr(F, "ShaderType", Str);
> +
> +  if (type != TGSI_PROCESSOR_COMPUTE) {
> +    LLVMAddTargetDependentFunctionAttr(F, "unsafe-fp-math", "true");
> +  }
>  }
>  
>  static void init_r600_target() {
> -- 
> 1.8.3.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list