digitalmars.D - SIMD-specialized overloads of Phobos algorithms
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (12/12) Jun 28 2019 According to
- kinke (2/5) Jun 28 2019 It's `-mcpu=native`.
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (2/3) Jun 28 2019 Can/Could the value of this switch be detected at compile-time?
- Nicholas Wilson (8/11) Jun 28 2019 Well from the point of view of the code you usually don't really
- Johan Engelen (4/10) Jun 30 2019 Indeed:
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (8/11) Jul 01 2019 Cool.
- Andrei Alexandrescu (5/23) Jul 04 2019 There are several schools of thought. A simple way to ease into it is to...
- a11e99z (3/6) Jun 30 2019 dynamic compilation may be useful too
- 9il (3/10) Jul 01 2019 Specializations are welcome for mir-algorithm.
According to http://0x80.pl/notesen/2018-10-03-simd-index-of-min.html SIMD-tuning a Phobos function, such as, std.algorithm.searching.minIndex for an `int[]`-haystack on AVX512f leads to a speedup of 15x. Should such specializations be added to Phobos or is such an optimization only possible for LDC or GCC but not for DMD? Further, when will compilers, such as LDC and GDC, be able to do these auto-vectorizations automatically? Will the GCC and Clang compiler setting of `-march=native` play a role also for LDC in the future. Currently (in LDC 1.16.0) the setting `-march=native` is not allowed.
Jun 28 2019
On Friday, 28 June 2019 at 15:49:34 UTC, Per Nordlöw wrote:Will the GCC and Clang compiler setting of `-march=native` play a role also for LDC in the future. Currently (in LDC 1.16.0) the setting `-march=native` is not allowed.It's `-mcpu=native`.
Jun 28 2019
On Friday, 28 June 2019 at 16:30:31 UTC, kinke wrote:It's `-mcpu=native`.Can/Could the value of this switch be detected at compile-time?
Jun 28 2019
On Friday, 28 June 2019 at 19:53:10 UTC, Per Nordlöw wrote:On Friday, 28 June 2019 at 16:30:31 UTC, kinke wrote:Well from the point of view of the code you usually don't really care because it's just like passing a higher value of n to `-On`. It's probably already implemented as an LDC specific __trait, but if it isn't it shouldn't be too hard to add to __traits(getTargetInfo) (the optimiser values that -mcpu=native sets probably will be made available through getTargetInfo at some point though).It's `-mcpu=native`.Can/Could the value of this switch be detected at compile-time?
Jun 28 2019
On Friday, 28 June 2019 at 22:53:45 UTC, Nicholas Wilson wrote:On Friday, 28 June 2019 at 19:53:10 UTC, Per Nordlöw wrote:Indeed: https://wiki.dlang.org/LDC-specific_language_changes#targetCPU -JohanOn Friday, 28 June 2019 at 16:30:31 UTC, kinke wrote:It's probably already implemented as an LDC specific __trait,It's `-mcpu=native`.Can/Could the value of this switch be detected at compile-time?
Jun 30 2019
On Sunday, 30 June 2019 at 15:40:07 UTC, Johan Engelen wrote:Indeed: https://wiki.dlang.org/LDC-specific_language_changes#targetCPU -JohanCool. Even better, https://wiki.dlang.org/LDC-specific_language_changes#targetHasFeature is _exactly_ what I want! :) Still, the question remains to be answered: Where should these CPU-specialized overloads of Phobos algorithms be placed?
Jul 01 2019
On 7/1/19 11:52 AM, Per Nordlöw wrote:On Sunday, 30 June 2019 at 15:40:07 UTC, Johan Engelen wrote:There are several schools of thought. A simple way to ease into it is to place specializations with the algorithms. That's transparent to coders and backward compatible. The decision to create visible, user-selectable versions can be thus postponed.Indeed: https://wiki.dlang.org/LDC-specific_language_changes#targetCPU -JohanCool. Even better, https://wiki.dlang.org/LDC-specific_language_changes#targetHasFeature is _exactly_ what I want! :) Still, the question remains to be answered: Where should these CPU-specialized overloads of Phobos algorithms be placed?
Jul 04 2019
On Friday, 28 June 2019 at 19:53:10 UTC, Per Nordlöw wrote:On Friday, 28 June 2019 at 16:30:31 UTC, kinke wrote:dynamic compilation may be useful too https://forum.dlang.org/post/bskpxhrqyfkvaqzoospx forum.dlang.orgIt's `-mcpu=native`.Can/Could the value of this switch be detected at compile-time?
Jun 30 2019
On Friday, 28 June 2019 at 15:49:34 UTC, Per Nordlöw wrote:According to http://0x80.pl/notesen/2018-10-03-simd-index-of-min.html SIMD-tuning a Phobos function, such as, std.algorithm.searching.minIndex for an `int[]`-haystack on AVX512f leads to a speedup of 15x. Should such specializations be added to Phobos or is such an optimization only possible for LDC or GCC but not for DMD?Specializations are welcome for mir-algorithm. http://mir-algorithm.libmir.org/mir_algorithm_iteration.html
Jul 01 2019