digitalmars.D.learn - Aggressive conditional inlining with ldc only, not dmd
- =?UTF-8?B?Tm9yZGzDtnc=?= (16/16) Mar 25 2018 Is there a way to make ldc do more aggressive inlining other than
- kinke (9/12) Mar 25 2018 From https://dlang.org/spec/pragma.html#inline: 'If inside a
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/7) Mar 25 2018 Wonderful, thanks!
- Rene Zwanenburg (2/3) Mar 26 2018 Just to make sure: are you passing -O as well?
- =?UTF-8?B?Tm9yZGzDtnc=?= (10/13) Mar 26 2018 Yes I am, thanks, via the dub spec
- jmh530 (3/12) Mar 26 2018 https://wiki.dlang.org/Using_LDC
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/6) Mar 26 2018 Thx!
Is there a way to make ldc do more aggressive inlining other than pragma(inline, true) ? Reason for asking is that https://github.com/nordlow/phobos-next/blob/master/src/open_hashmap_or_hashset.d achieves much better performance when I qualify some inner loop functions with pragma(inline, true) instead of pragma(inline) eventhough I compile with -release -inline -nobounds flags. Unfortunately these functions cannot be inlined by dmd in release mode so my code either runs slower than possible or it cannot be built by dmd in release mode. And I haven't found a way to conditionally qualify these inner loop functions with `pragma(inline, true)` for the ldc case only.
Mar 25 2018
On Sunday, 25 March 2018 at 22:09:43 UTC, Nordlöw wrote:And I haven't found a way to conditionally qualify these inner loop functions with `pragma(inline, true)` for the ldc case only.From https://dlang.org/spec/pragma.html#inline: 'If inside a function, it affects the function it is enclosed by.' So: void foo() { version(LDC) pragma(inline, true); // affects foo() ... }
Mar 25 2018
On Sunday, 25 March 2018 at 22:30:50 UTC, kinke wrote:void foo() { version(LDC) pragma(inline, true); // affects foo() ... }Wonderful, thanks!
Mar 25 2018
On Sunday, 25 March 2018 at 22:09:43 UTC, Nordlöw wrote:eventhough I compile with -release -inline -nobounds flags.Just to make sure: are you passing -O as well?
Mar 26 2018
On Monday, 26 March 2018 at 16:02:30 UTC, Rene Zwanenburg wrote:On Sunday, 25 March 2018 at 22:09:43 UTC, Nordlöw wrote:Yes I am, thanks, via the dub spec buildType "release-nobounds" { dflags "-mcpu=native" "-O3" buildOptions "releaseMode" "optimize" "noBoundsCheck" "inline" } I didn't measure any significant difference between -O and -O3. Is each optimization level `x` in `-Ox` defined in the same way for clang and ldc? If so, where's the best documentation for it?eventhough I compile with -release -inline -nobounds flags.Just to make sure: are you passing -O as well?
Mar 26 2018
On Monday, 26 March 2018 at 18:47:17 UTC, Nordlöw wrote:Yes I am, thanks, via the dub spec buildType "release-nobounds" { dflags "-mcpu=native" "-O3" buildOptions "releaseMode" "optimize" "noBoundsCheck" "inline" } I didn't measure any significant difference between -O and -O3. Is each optimization level `x` in `-Ox` defined in the same way for clang and ldc? If so, where's the best documentation for it?https://wiki.dlang.org/Using_LDC -O is equivalent to -O3
Mar 26 2018
On Monday, 26 March 2018 at 21:11:12 UTC, jmh530 wrote:Thx!Is each optimization level `x` in `-Ox` defined in the same way for clang and ldc? If so, where's the best documentation for it?https://wiki.dlang.org/Using_LDC
Mar 26 2018