[Mesa-dev] [PATCH] radv: lower ffma in nir.

Roland Scheidegger sroland at vmware.com
Tue Oct 3 21:22:09 UTC 2017


Am 03.10.2017 um 22:58 schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
> 
> 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.
> 
> 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 ca0ad2d..a37345b 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -64,6 +64,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
>  };
>  
> 

Looks like quite a misnomer to me in spir-v then - if it is allowed to
be unfused that's more commonly called fmuladd. After all the "f" in fma
is there for "fused"...

But anyway, I don't have anything against the patch if spir-v allows it...

Roland


More information about the mesa-dev mailing list