Re: LDC cross-module-inlining

2020-08-10 Thread kinke via Digitalmars-d-learn

On Monday, 10 August 2020 at 11:11:57 UTC, Per Nordlöw wrote:

Are the official LDC-releases builtin with or without LTO?


Most of them are, but not sure why that matters here (the gain is 
almost negligible and mainly interesting for the C++ parts - as 
all D files are compiled to a single object file anyway).



On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote:
I am not sure but last time I checked ldc does not do cross 
module inlinig by default,


Right, it's still experimental and has issues.

and LTO only help if your ldc(druntime+phobos) are built with 
enabled LTO


That's only true if (mostly non-templated) functions in 
druntime/Phobos are to be cross-module inlined, just like any 
other library. In that case, you can simply use 
`-flto= -defaultlib=phobos2-ldc-lto,druntime-ldc-lto` 
with LDC builds shipping with LTO druntime/Phobos and don't have 
to recompile druntime/Phobos manually anymore.


Re: LDC cross-module-inlining

2020-08-10 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 1:15 PM Per Nordlöw via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote:
> > I am not sure but last time I checked ldc does not do cross
> > module inlinig by default, and LTO only help if your
> > ldc(druntime+phobos) are built with enabled LTO[1]
> >
> > [1]
> > https://github.com/ldc-developers/ldc/issues/2182#issuecomment-343166633
>
> Are the official LDC-releases builtin with or without LTO?
>

AFAIK only for OSX, but Arch linux ldc package is now build with  LTO
enabled


Re: LDC cross-module-inlining

2020-08-10 Thread Per Nordlöw via Digitalmars-d-learn

On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote:
I am not sure but last time I checked ldc does not do cross 
module inlinig by default, and LTO only help if your 
ldc(druntime+phobos) are built with enabled LTO[1]


[1] 
https://github.com/ldc-developers/ldc/issues/2182#issuecomment-343166633


Are the official LDC-releases builtin with or without LTO?


Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:50 AM claptrap via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote:
> > ...
> If you enable link time optimisation you get cross module
> inlining,
>
> -flto=full
>
> I'm not 100% sure but I think LDC did cross module inlining by
> default at some point, then I updated the compiler and had to add
> the LTO thing. I think there is an option to enable just cross
> module inlining, but if you want speed you'll probably want to
> have LTO enabled anyway?
>

I am not sure but last time I checked ldc does not do cross module
inlinig by default, and LTO only help if your ldc(druntime+phobos) are
built with enabled LTO[1]

[1] https://github.com/ldc-developers/ldc/issues/2182#issuecomment-343166633


Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:20 AM Per Nordlöw via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
>
> Is cross-module-inlining enabled by default in LDC when compiling
> in release mode or do I have to use explicitly flag for it? I
> can't find any such flag from the output of neither
>
>  ldc2 -h
>
> nor
>
>  ldmd2 -h
>
> Johan Engelen mentioned this, then experimental, flag in his
> DConf talk from 2017 [1]
>
> [1] https://www.youtube.com/watch?v=IZY67TBZ0V4

ldc2 --help-hidden | grep cross
  --disable-demotion  - Clone
multicolor basic blocks but do not demote cross scopes
 * --enable-cross-module-inlining=  - (*)
Enable cross-module function inlining (default disabled)*
  --iterative-counter-promotion   - Allow
counter promotion across the whole loop nest.
  --jump-threading-across-loop-headers- Allow
JumpThreading to thread across loop headers, for testing
  --licm-n2-threshold=   - How
many instruction to cross product using AA
  --lsr-backedge-indexing - Enable
the generation of cross iteration indexed memops
=cross-dso-cfi-
Cross-DSO CFI
=cross-dso-cfi-
Cross-DSO CFI
  --split-dwarf-cross-cu-references   - Enable
cross-cu references in DWO files
  --x86-align-branch-boundary=

Re: LDC cross-module-inlining

2020-08-09 Thread claptrap via Digitalmars-d-learn

On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote:
Is cross-module-inlining enabled by default in LDC when 
compiling in release mode or do I have to use explicitly flag 
for it? I can't find any such flag from the output of neither


ldc2 -h

nor

ldmd2 -h

.

Johan Engelen mentioned this, then experimental, flag in his 
DConf talk from 2017 [1]


[1] https://www.youtube.com/watch?v=IZY67TBZ0V4


If you enable link time optimisation you get cross module 
inlining,


-flto=full

I'm not 100% sure but I think LDC did cross module inlining by 
default at some point, then I updated the compiler and had to add 
the LTO thing. I think there is an option to enable just cross 
module inlining, but if you want speed you'll probably want to 
have LTO enabled anyway?


Re: LDC cross-module-inlining

2020-08-09 Thread Per Nordlöw via Digitalmars-d-learn

On Sunday, 9 August 2020 at 22:45:16 UTC, claptrap wrote:
I'm not 100% sure but I think LDC did cross module inlining by 
default at some point, then I updated the compiler and had to 
add the LTO thing. I think there is an option to enable just 
cross module inlining, but if you want speed you'll probably 
want to have LTO enabled anyway?


Yes, I do. Thanks.


LDC cross-module-inlining

2020-08-09 Thread Per Nordlöw via Digitalmars-d-learn
Is cross-module-inlining enabled by default in LDC when compiling 
in release mode or do I have to use explicitly flag for it? I 
can't find any such flag from the output of neither


ldc2 -h

nor

ldmd2 -h

.

Johan Engelen mentioned this, then experimental, flag in his 
DConf talk from 2017 [1]


[1] https://www.youtube.com/watch?v=IZY67TBZ0V4