Opened 8 years ago

Closed 8 years ago

#5652 closed bug (fixed)

T3016 takes long time to compile with LLVM

Reported by: dterei Owned by: dterei
Priority: high Milestone: 7.4.1
Component: Compiler (LLVM) Version: 7.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:



It looks like T3016 is running out of time with -fllvm:

=====> T3016(optllvm) 763 of 3159 [0, 1, 0] cd ./simplCore/should_compile && '/64playpen/simonmar/nightly/HEAD-cam-04-unx/x86_64-unknown-linux/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts -fno-ghci-history -c T3016.hs -O -fllvm >T3016.comp.stderr 2>&1 Timeout happened...killing process... Compile failed (status 25344) errors were:

* unexpected failure for T3016(optllvm)

Maybe it's hitting a bad case in the LLVM generator? This module is just full of large integer constants, which ends up as a lot of top-level static data.



Change History (10)

comment:1 Changed 8 years ago by dterei

Quick check.

T3016 takes 30s to compile with -fasm, 2m to compile with -fllvm both at O0.

T3016 takes 8 min to compile with -fasm at -O2, haven't timed -fllvm yet.

Using -v2 and annotate-ouput command 1 min of the 2 min for llvm seems to be spent in the code generator (so either bad performance in actual llvm backend or in the mangler) and 1 min in the llc tool. (so bad performance by llvm).

comment:2 Changed 8 years ago by dterei

OK previous numbers were with GHC 7.2.1, lets try with HEAD:

Backend O<n> Time
fasm 0 3.78
fasm 1 4.44
fasm 2 4.83
fllvm 0 10:25.70
fllvm 1 11:14.00
fllvm 2 10:43.00

Note all the compiler time by the LLVM backend is spent in the actual backend code generator. So either a problem with the code generation or the LLVM Mangler. Time spent in LLVM tools is only a few seconds.

comment:3 Changed 8 years ago by dterei

OK so of 10 minute compile time for -fllvm the components are:

  • LLVM CodeGen : 10 min
  • LLVM Optimiser : 2 seconds
  • LLVM Compiler : 3 seconds
  • LLVM Mangler : 1 second

This is pretty nice to see actually, would have hated to have to change the Mangler again now that it seems so solid (and appears still to be). Also potentially there is a great overall win for -fllvm compile speeds to be found here!

comment:4 Changed 8 years ago by igloo

Milestone: 7.6.1

comment:5 Changed 8 years ago by simonmar

Priority: normalhigh

I'm fairly sure David would like to nail this for 7.4.1, right?

comment:6 Changed 8 years ago by dterei

Indeed I would.

comment:7 Changed 8 years ago by dterei

OK so fixed and ready to push. New compile time is down to 12 seconds. So still 3x slower than NCG which is ugly but no complexity blow up anymore. The 3x slower compile compared to NCG is a due to lots of small factors that would require a larger overhaul of the LLVM backend design to fix.

comment:8 Changed 8 years ago by dterei

Resolution: fixed
Status: newclosed

comment:9 Changed 8 years ago by dterei

Status: closedmerge

comment:10 Changed 8 years ago by dterei

Status: mergeclosed
Note: See TracTickets for help on using tickets.