www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - avx512 usage

reply Igor Shirkalin <mathsoft inbox.ru> writes:
Hello,

we use LDC to dynamically select compiled and optimized code with 
particular instructions set with help of  target pragma. To make 
this we take core.cpu module, but it can't detect avx512 
instructions presence. Does LDC have its own some cpu instruction 
detection runtime routine(s) to make use of avx512-set?

Igor
Jan 21 2018
parent reply Johan Engelen <j j.nl> writes:
On Sunday, 21 January 2018 at 12:52:41 UTC, Igor Shirkalin wrote:
 Hello,

 we use LDC to dynamically select compiled and optimized code 
 with particular instructions set with help of  target pragma. 
 To make this we take core.cpu module, but it can't detect 
 avx512 instructions presence. Does LDC have its own some cpu 
 instruction detection runtime routine(s) to make use of 
 avx512-set?
You can use mir.cpuid: https://code.dlang.org/packages/mir-cpuid https://github.com/libmir/mir-cpuid ( It would be great if you could write an article about how you use dynamic selection and target. It will be very helpful for other D programmers. Contact Mike Parker if you want to write something for the D blog, where he can help writing. https://github.com/mdparker . Thanks! ) -Johan
Jan 21 2018
parent reply Igor Shirkalin <mathsoft inbox.ru> writes:
On Sunday, 21 January 2018 at 13:09:29 UTC, Johan Engelen wrote:
 On Sunday, 21 January 2018 at 12:52:41 UTC, Igor Shirkalin 
 wrote:
 Hello,

 we use LDC to dynamically select compiled and optimized code 
 with particular instructions set with help of  target pragma. 
 To make this we take core.cpu module, but it can't detect 
 avx512 instructions presence. Does LDC have its own some cpu 
 instruction detection runtime routine(s) to make use of 
 avx512-set?
You can use mir.cpuid: https://code.dlang.org/packages/mir-cpuid https://github.com/libmir/mir-cpuid ( It would be great if you could write an article about how you use dynamic selection and target. It will be very helpful for other D programmers. Contact Mike Parker if you want to write something for the D blog, where he can help writing. https://github.com/mdparker . Thanks! )
Johan, thanks for mir.cpuid direction. I'll call for Mike's help about an article if it is really interesting and useful/helpful for D programmers. Igor
Jan 21 2018
parent David Nadlinger <code klickverbot.at> writes:
On Sunday, 21 January 2018 at 17:15:38 UTC, Igor Shirkalin wrote:
 I'll call for Mike's help about an article if it is really 
 interesting and useful/helpful for D programmers.
Yes, please do! (We should make sure things are somewhat nicely cleaned up on the LDC side of things first, of course, but with your recent set of changes, this seems to be the case already anyway.) – David
Jan 25 2018