Best way for JIT to query whether llvm.fma.* is fast?

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

Best way for JIT to query whether llvm.fma.* is fast?

Robison, Arch
For the Julia language JIT, we’d like be able to tell whether the llvm.fma.* intrinsic has hardware support.  What’s the best way to  query LLVM (JIT) for this information?
 
The information would be used in situations where the user wants to use different algorithms depending on whether FMA hardware is present or not.
 
- Arch D. Robison
 

_______________________________________________
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: Best way for JIT to query whether llvm.fma.* is fast?

Jingyue Wu-2
Does TargetLowering::isFMAFasterThanFMulAndFAdd (http://llvm.org/docs/doxygen/html/TargetLowering_8h_source.html#l01499) help? 

Jingyue

On Wed, Dec 10, 2014 at 12:48 PM, Robison, Arch <[hidden email]> wrote:
For the Julia language JIT, we’d like be able to tell whether the llvm.fma.* intrinsic has hardware support.  What’s the best way to  query LLVM (JIT) for this information?
 
The information would be used in situations where the user wants to use different algorithms depending on whether FMA hardware is present or not.
 
- Arch D. Robison
 

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



_______________________________________________
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: Best way for JIT to query whether llvm.fma.* is fast?

Robison, Arch

Thanks!  That’s probably close enough for practical purposes.  I looked at the overrides on various targets, and they all return true if the FMA hardware exists.

 

- Arch

 

From: Jingyue Wu [mailto:[hidden email]]
Sent: Wednesday, December 10, 2014 2:56 PM
To: Robison, Arch
Cc: [hidden email]
Subject: Re: [LLVMdev] Best way for JIT to query whether llvm.fma.* is fast?

 

Does TargetLowering::isFMAFasterThanFMulAndFAdd (http://llvm.org/docs/doxygen/html/TargetLowering_8h_source.html#l01499) help? 

 

Jingyue

 

On Wed, Dec 10, 2014 at 12:48 PM, Robison, Arch <[hidden email]> wrote:

For the Julia language JIT, we’d like be able to tell whether the llvm.fma.* intrinsic has hardware support.  What’s the best way to  query LLVM (JIT) for this information?

 

The information would be used in situations where the user wants to use different algorithms depending on whether FMA hardware is present or not.

 

- Arch D. Robison

 


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

 


_______________________________________________
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: Best way for JIT to query whether llvm.fma.* is fast?

Lang Hames
Hi Arch,

Also, consider just emitting the llvm.fmuladd intrinsic instead of llvm.fma. fmuladd is lowered to llvm.fma in codegen if the optimizer determines that it's beneficial, otherwise it is expanded to a mul and an add.

At the moment I think SelectionDAG is just checking isFMAFasterThanFMulAndFAdd anyway, but that condition could be refined in the future.

Cheers,
Lang.


On Wed, Dec 10, 2014 at 1:17 PM, Robison, Arch <[hidden email]> wrote:

Thanks!  That’s probably close enough for practical purposes.  I looked at the overrides on various targets, and they all return true if the FMA hardware exists.

 

- Arch

 

From: Jingyue Wu [mailto:[hidden email]]
Sent: Wednesday, December 10, 2014 2:56 PM
To: Robison, Arch
Cc: [hidden email]
Subject: Re: [LLVMdev] Best way for JIT to query whether llvm.fma.* is fast?

 

Does TargetLowering::isFMAFasterThanFMulAndFAdd (http://llvm.org/docs/doxygen/html/TargetLowering_8h_source.html#l01499) help? 

 

Jingyue

 

On Wed, Dec 10, 2014 at 12:48 PM, Robison, Arch <[hidden email]> wrote:

For the Julia language JIT, we’d like be able to tell whether the llvm.fma.* intrinsic has hardware support.  What’s the best way to  query LLVM (JIT) for this information?

 

The information would be used in situations where the user wants to use different algorithms depending on whether FMA hardware is present or not.

 

- Arch D. Robison

 


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

 


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



_______________________________________________
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: Best way for JIT to query whether llvm.fma.* is fast?

Robison, Arch

Thanks for the tip.  Indeed the current plan is to have Julia functions the correspond to both llvm.fmuladd and llvm.fma.  Discussion is at https://github.com/JuliaLang/julia/pull/8112

 

- Arch

 

From: Lang Hames [mailto:[hidden email]]
Sent: Friday, December 12, 2014 11:16 AM
To: Robison, Arch
Cc: Jingyue Wu; [hidden email]
Subject: Re: [LLVMdev] Best way for JIT to query whether llvm.fma.* is fast?

 

Hi Arch,

 

Also, consider just emitting the llvm.fmuladd intrinsic instead of llvm.fma. fmuladd is lowered to llvm.fma in codegen if the optimizer determines that it's beneficial, otherwise it is expanded to a mul and an add.

 

At the moment I think SelectionDAG is just checking isFMAFasterThanFMulAndFAdd anyway, but that condition could be refined in the future.

 

Cheers,

Lang.

 

 

On Wed, Dec 10, 2014 at 1:17 PM, Robison, Arch <[hidden email]> wrote:

Thanks!  That’s probably close enough for practical purposes.  I looked at the overrides on various targets, and they all return true if the FMA hardware exists.

 

- Arch

 

From: Jingyue Wu [mailto:[hidden email]]
Sent: Wednesday, December 10, 2014 2:56 PM
To: Robison, Arch
Cc: [hidden email]
Subject: Re: [LLVMdev] Best way for JIT to query whether llvm.fma.* is fast?

 

Does TargetLowering::isFMAFasterThanFMulAndFAdd (http://llvm.org/docs/doxygen/html/TargetLowering_8h_source.html#l01499) help? 

 

Jingyue

 

On Wed, Dec 10, 2014 at 12:48 PM, Robison, Arch <[hidden email]> wrote:

For the Julia language JIT, we’d like be able to tell whether the llvm.fma.* intrinsic has hardware support.  What’s the best way to  query LLVM (JIT) for this information?

 

The information would be used in situations where the user wants to use different algorithms depending on whether FMA hardware is present or not.

 

- Arch D. Robison

 


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

 


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

 


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