Opened 5 years ago

Closed 4 years ago

#9229 closed bug (worksforme)

Compiler memory use regression

Reported by: augustss Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: #8852, #8980, #8941, 8960, #7898, #7068, #7944, #5550, #8836 Differential Rev(s):
Wiki Page:

Description

I have a module which compiles fine with ghc 7.6, but where ghc 7.8.2 runs out of memory (32-bit Windows). Sadly, I cannot supply the source code since it's proprietary, so I realize that this bug will be almost impossible to fix. It is possible to compile the module with -O0 and -O1, but not -O2. (This is a very performance critical module so I'd like -O2.)

Change History (5)

comment:1 Changed 5 years ago by thoughtpolice

This is probably #8960. Is it possible for you to turn off SpecConstr with -fno-spec-constr and see what difference it makes in compilation time and resulting executable speed?

comment:2 Changed 5 years ago by augustss

Yes, turning off SpecConstr makes it work. Thanks for the workaround!

comment:3 Changed 5 years ago by thomie

Status: newinfoneeded

Can you try to compile your module with either HEAD (the master branch) or the ghc-7.8 branch? Those branches contain the following bug fix, which should solve your problem:

commit af4bc31c50c873344a2426d4be842f92edf17019
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Aug 25 12:28:44 2014 +0100

    Do not duplicate call information in SpecConstr (Trac #8852)
    
    This long-standing and egregious bug meant that call information was
    being gratuitously copied, leading to an exponential blowup in the
    number of calls to be examined when function definitions are deeply
    nested.  That is what has been causing the blowup in SpecConstr's
    running time, not (as I had previously supposed) generating very large code.
    
    See Note [spec_usg includes rhs_usg]

comment:4 Changed 5 years ago by augustss

I will test it when there's a win-32 ghc-7.8.4.

comment:5 Changed 4 years ago by thomie

Resolution: worksforme
Status: infoneededclosed

Please reopen if this is still a problem.

You can get ghc-7.8.4 for 32-bit windows here: https://www.haskell.org/ghc/download_ghc_7_8_4#windows

Note: See TracTickets for help on using tickets.