Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 22, 2018 Conditional compilation to detect AVX2 | ||||
---|---|---|---|---|
| ||||
Hello, Here is a little code exemple where I try to do some conditional compilation (https://dlang.org/spec/version.html) : https://run.dlang.io/is/i8ML91 Is seems 'D_AVX2' is not defined when I pass the '-mattr=+avx2 -O3' options: is there something wrong in my code ? |
May 22, 2018 Re: Conditional compilation to detect AVX2 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeff | On Tuesday, 22 May 2018 at 18:27:20 UTC, Jeff wrote: > Hello, > Here is a little code exemple where I try to do some conditional compilation (https://dlang.org/spec/version.html) : > https://run.dlang.io/is/i8ML91 > > Is seems 'D_AVX2' is not defined when I pass the '-mattr=+avx2 -O3' options: is there something wrong in my code ? No, this is a bug in LDC. Because LDC doesn't support the core.simd functions (we do support the types), we don't define D_SIMD. But looking at the definition of D_AVX and D_AVX2, we should indeed define them if the compile target supports them. For your purpose, the workaround is: `__traits(targetHasFeature, "avx2")` https://wiki.dlang.org/LDC-specific_language_changes#targetHasFeature (Note: the run.dlang.io machine appears to have a sandybridge CPU, which does not have AVX2; but you can test with AVX (one) instead) -Johan |
May 22, 2018 Re: Conditional compilation to detect AVX2 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Tuesday, 22 May 2018 at 19:07:47 UTC, Johan Engelen wrote: > On Tuesday, 22 May 2018 at 18:27:20 UTC, Jeff wrote: >> Hello, >> Here is a little code exemple where I try to do some conditional compilation (https://dlang.org/spec/version.html) : >> https://run.dlang.io/is/i8ML91 >> >> Is seems 'D_AVX2' is not defined when I pass the '-mattr=+avx2 -O3' options: is there something wrong in my code ? > > No, this is a bug in LDC. https://github.com/ldc-developers/ldc/pull/2711 |
May 22, 2018 Re: Conditional compilation to detect AVX2 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Tuesday, 22 May 2018 at 19:25:06 UTC, Johan Engelen wrote:
> On Tuesday, 22 May 2018 at 19:07:47 UTC, Johan Engelen wrote:
>> On Tuesday, 22 May 2018 at 18:27:20 UTC, Jeff wrote:
>>> Hello,
>>> Here is a little code exemple where I try to do some conditional compilation (https://dlang.org/spec/version.html) :
>>> https://run.dlang.io/is/i8ML91
>>>
>>> Is seems 'D_AVX2' is not defined when I pass the '-mattr=+avx2 -O3' options: is there something wrong in my code ?
>>
>> No, this is a bug in LDC.
>
> https://github.com/ldc-developers/ldc/pull/2711
Thanks, that was fast !
|
Copyright © 1999-2021 by the D Language Foundation