Thread overview |
---|
March 25, 2018 Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
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. |
March 25, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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() ... } |
March 26, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Sunday, 25 March 2018 at 22:30:50 UTC, kinke wrote:
> void foo()
> {
> version(LDC) pragma(inline, true); // affects foo()
> ...
> }
Wonderful, thanks!
|
March 26, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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?
|
March 26, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | 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:
>> eventhough I compile with -release -inline -nobounds flags.
>
> Just to make sure: are you passing -O as well?
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?
|
March 26, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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 |
March 26, 2018 Re: Aggressive conditional inlining with ldc only, not dmd | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On Monday, 26 March 2018 at 21:11:12 UTC, jmh530 wrote:
>> 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
Thx!
|
Copyright © 1999-2021 by the D Language Foundation