Aggressive FMA fusion for NVPTX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Aggressive FMA fusion for NVPTX

Olivier H Sallenave

Hi,

I propose to override the TLI callback enableAggressiveFMAFusion for the NVPTX backend and return true instead of false. The reason is the same as for PPC: fmul, fmadd and fadd nodes cost the same number of cycles (see http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#arithmetic-instructions), so we can enable more combining heuristics to produce more FMAs. For instance, this pattern would be considered:

// fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))

cf. commits:
http://llvm.org/viewvc/llvm-project?view=revision&revision=218120
http://llvm.org/viewvc/llvm-project?view=revision&revision=225380

Please tell me what you think.

Olivier
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Reply | Threaded
Open this post in threaded view
|

Re: Aggressive FMA fusion for NVPTX

Justin Holewinski-2
Looks good to me!  Thanks!

On Tue, Jan 13, 2015 at 5:14 PM, Olivier H Sallenave <[hidden email]> wrote:

Hi,

I propose to override the TLI callback enableAggressiveFMAFusion for the NVPTX backend and return true instead of false. The reason is the same as for PPC: fmul, fmadd and fadd nodes cost the same number of cycles (see http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#arithmetic-instructions), so we can enable more combining heuristics to produce more FMAs. For instance, this pattern would be considered:

// fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))

cf. commits:
http://llvm.org/viewvc/llvm-project?view=revision&revision=218120
http://llvm.org/viewvc/llvm-project?view=revision&revision=225380

Please tell me what you think.

Olivier


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




--

Thanks,

Justin Holewinski

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev