giordi91

HLSL compiler not generating FMA instruction

Discussion created by giordi91 on Jul 13, 2018
Latest reply on Aug 16, 2018 by dipak

Good morning, during a shader optimization pass, I noticed that the AMD shader compiler was not generating FMA instructions.

The case was really simple given the source code:

 

myValue.xy = (anototherValue.xy + 1.0f) * 0.5f;

 

I was not able to generate FMA instruction unless myValue (which is a float4) was fully initialized, something like adding before myValue.zw = 1.0f;.

I have written a blog post about it at length, with all the different disassemblies.

HLSL: Will it MAD/FMA ?

 

What I would like to know if it is a compiler bug, or if there is a specific reason I might not know behind that behavior?

 

PS: Is it there a dedicated HLSL/DirectX forum or is this the closest matching one?

Outcomes