Programming-Language-Benchmarks icon indicating copy to clipboard operation
Programming-Language-Benchmarks copied to clipboard

D .yml should use LTO and vectorization

Open maxhaton opened this issue 1 year ago • 8 comments

maxhaton avatar Sep 24 '22 21:09 maxhaton

You have vectorization but not LTO.

maxhaton avatar Sep 24 '22 21:09 maxhaton

Hi Max, could you please specify exactly which compilation keys should be added?

cyrusmsk avatar Sep 26 '22 19:09 cyrusmsk

Adding -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto to dub.json flags for "ldc" makes fasta and mandelbrot on my machine even slower :) Maybe something wrong with the build..

cyrusmsk avatar Sep 29 '22 21:09 cyrusmsk

A lot of the impls are quite slow in the first place, I made one 400x faster I'll push it soon

maxhaton avatar Sep 29 '22 21:09 maxhaton

@cyrusmsk It would be good to ask @kinke (LDC maintainer) about what flags to use to get the most out of the bench code. Probably same for GDC with @ibuclaw

GavinRay97 avatar Oct 08 '22 21:10 GavinRay97

@GavinRay97 another thing about it - is that code by itself and compilation parameters should be comparable between different languages and realizations. So I think we should check top rows and see their compilation flags (Rust, Zig, C) and choose similar options for D. Because some of the problems are possible to solve in compile time and have almost 0 at runtime :) which obviously will be the not acceptable hack

cyrusmsk avatar Oct 13 '22 17:10 cyrusmsk

So I think we should check top rows and see their compilation flags (Rust, Zig, C) and choose similar options for D.

Yep; I've had an extremely quick look and noticed that e.g. Rust seems to tailor LLVM codegen to Broadwell, while there's no such 'tweak' for LDC (which defaults to Pentium 4 when targeting non-Mac x86_64...). The according LDC flag would be -mcpu=broadwell.

If https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/36514172486b4c90609d7591d16380b0e1b40297/bench/bench_d.yaml#L68-L69 is what controls the builds, the actual compiler args can be controlled via the DFLAGS env var (without the build/package manager dub interfering), e.g., DFLAGS="-O -release -mcpu=broadwell" dub build --compiler=ldc2 -v.

kinke avatar Oct 13 '22 18:10 kinke

Oh, just seen https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/36514172486b4c90609d7591d16380b0e1b40297/bench/include/d/dub.json#L12 That flag isn't accepted by LDC (mcpu, not march); I guess it only works because dub would need a dflags-ldc (vs. dflags-ldc2).

kinke avatar Oct 13 '22 18:10 kinke