Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

compile hang and memory blowup when using profiling and optimization
When I try to compile the following files: ``` -- Vectorize.hs {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE TypeOperators #-} module Vectorize ( GVectorize(..) ) where import GHC.Generics import Data.Vector ( Vector ) import qualified Data.Vector as V gvlength :: GVectorize f => f a -> Int gvlength = V.length . gvectorize . (gempty `asFunctorOf`) where asFunctorOf :: f a -> f b -> f a asFunctorOf x _ = x class GVectorize f where gdevectorize :: Vector a -> f a gvectorize :: f a -> Vector a gempty :: f () instance (GVectorize f, GVectorize g) => GVectorize (f :*: g) where gdevectorize v0s | V.length v0s < n0 = error $ show n0 | otherwise = f0 :*: f1 where f0 = gdevectorize v0 f1 = gdevectorize v1 n0 = gvlength f0 (v0,v1) = V.splitAt n0 v0s gvectorize (f :*: g) = gvectorize f V.++ gvectorize g gempty = gempty :*: gempty instance GVectorize f => GVectorize (M1 i c f) where gdevectorize = M1 . gdevectorize gvectorize = gvectorize . unM1 gempty = undefined -- M1 gempty instance GVectorize Par1 where gdevectorize _ = undefined gvectorize = V.singleton . unPar1 gempty = undefined -- Par1 () ``` ``` -- Woo.hs {-# OPTIONS_GHC -Wall #-} {-# Language DeriveGeneric #-} module Woo ( Woo(..) , devectorize ) where import GHC.Generics import Data.Vector ( Vector ) import Vectorize ( GVectorize(..) ) data Woo a = MkWoo { x00 :: a , x01 :: a , x02 :: a , x03 :: a , x04 :: a , x05 :: a , x06 :: a , x07 :: a , x08 :: a , x09 :: a , x10 :: a , x11 :: a , x12 :: a , x13 :: a , x14 :: a , x15 :: a , x16 :: a , x17 :: a , x18 :: a , x19 :: a , x20 :: a , x21 :: a } deriving (Generic1) devectorize :: Vector a -> Woo a devectorize = to1 . gdevectorize ``` with `ghc -O2 -prof -fprof-auto-calls Woo.hs`, GHC seems to hang on Woo.o and the memory usage steadily creeps up (I killed it at 5GB after about 5 minutes). I don't think this is #7068 / #7898 / #8960 because `-fno-spec-constr` doesn't fix it and the end of the -v3 output is: ``` ... ... *** SpecConstr: Result size of SpecConstr = {terms: 89,855, types: 125,614, coercions: 138,597} *** Simplifier: Result size of Simplifier iteration=1 = {terms: 428,416, types: 555,965, coercions: 855,101} Result size of Simplifier = {terms: 428,386, types: 555,815, coercions: 626,125} *** Tidy Core: Result size of Tidy Core = {terms: 428,386, types: 555,815, coercions: 626,125} writeBinIface: 190 Names writeBinIface: 495 dict entries *** CorePrep: Result size of CorePrep = {terms: 533,584, types: 600,927, coercions: 626,125} *** Stg2Stg: *** CodeOutput: *** New CodeGen: *** CPSZ: *** CPSZ: *** CPSZ: *** CPSZ: *** CPSZ: *** CPSZ: *** CPSZ: ``` and then about another 100 lines of `*** CPSZ:` before it hangs. Removing either the optimization or profiling flags fixes the bug. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ---------------------- | | Version | 7.8.1-rc2 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | gregmainland@gmail.com | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"compile hang and memory blowup when using profiling and optimization","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["gregmainland@gmail.com"],"type":"Bug","description":"When I try to compile the following files:\r\n{{{\r\n-- Vectorize.hs\r\n{-# OPTIONS_GHC -Wall #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n \r\nmodule Vectorize\r\n ( GVectorize(..)\r\n ) where\r\n \r\nimport GHC.Generics\r\nimport Data.Vector ( Vector )\r\nimport qualified Data.Vector as V\r\n \r\ngvlength :: GVectorize f => f a -> Int\r\ngvlength = V.length . gvectorize . (gempty `asFunctorOf`)\r\n where\r\n asFunctorOf :: f a -> f b -> f a\r\n asFunctorOf x _ = x\r\n \r\nclass GVectorize f where\r\n gdevectorize :: Vector a -> f a\r\n gvectorize :: f a -> Vector a\r\n gempty :: f ()\r\n \r\ninstance (GVectorize f, GVectorize g) => GVectorize (f :*: g) where\r\n gdevectorize v0s\r\n | V.length v0s < n0 =\r\n error $ show n0\r\n | otherwise = f0 :*: f1\r\n where\r\n f0 = gdevectorize v0\r\n f1 = gdevectorize v1\r\n \r\n n0 = gvlength f0\r\n \r\n (v0,v1) = V.splitAt n0 v0s\r\n \r\n gvectorize (f :*: g) = gvectorize f V.++ gvectorize g\r\n gempty = gempty :*: gempty\r\n \r\ninstance GVectorize f => GVectorize (M1 i c f) where\r\n gdevectorize = M1 . gdevectorize\r\n gvectorize = gvectorize . unM1\r\n gempty = undefined -- M1 gempty\r\n \r\ninstance GVectorize Par1 where\r\n gdevectorize _ = undefined\r\n gvectorize = V.singleton . unPar1\r\n gempty = undefined -- Par1 ()\r\n}}}\r\n\r\n{{{\r\n-- Woo.hs\r\n{-# OPTIONS_GHC -Wall #-}\r\n{-# Language DeriveGeneric #-}\r\n \r\nmodule Woo\r\n ( Woo(..)\r\n , devectorize\r\n ) where\r\n \r\nimport GHC.Generics\r\nimport Data.Vector ( Vector )\r\n \r\nimport Vectorize ( GVectorize(..) )\r\n \r\ndata Woo a =\r\n MkWoo { x00 :: a\r\n , x01 :: a\r\n , x02 :: a\r\n , x03 :: a\r\n , x04 :: a\r\n , x05 :: a\r\n , x06 :: a\r\n , x07 :: a\r\n , x08 :: a\r\n , x09 :: a\r\n , x10 :: a\r\n , x11 :: a\r\n , x12 :: a\r\n , x13 :: a\r\n , x14 :: a\r\n , x15 :: a\r\n , x16 :: a\r\n , x17 :: a\r\n , x18 :: a\r\n , x19 :: a\r\n , x20 :: a\r\n , x21 :: a\r\n } deriving (Generic1)\r\n \r\ndevectorize :: Vector a -> Woo a\r\ndevectorize = to1 . gdevectorize\r\n}}}\r\nwith `ghc -O2 -prof -fprof-auto-calls Woo.hs`, GHC seems to hang on Woo.o and the memory usage steadily creeps up (I killed it at 5GB after about 5 minutes).\r\n\r\nI don't think this is #7068 / #7898 / #8960 because `-fno-spec-constr` doesn't fix it and the end of the -v3 output is:\r\n\r\n{{{\r\n...\r\n...\r\n*** SpecConstr:\r\nResult size of SpecConstr\r\n = {terms: 89,855, types: 125,614, coercions: 138,597}\r\n*** Simplifier:\r\nResult size of Simplifier iteration=1\r\n = {terms: 428,416, types: 555,965, coercions: 855,101}\r\nResult size of Simplifier\r\n = {terms: 428,386, types: 555,815, coercions: 626,125}\r\n*** Tidy Core:\r\nResult size of Tidy Core\r\n = {terms: 428,386, types: 555,815, coercions: 626,125}\r\nwriteBinIface: 190 Names\r\nwriteBinIface: 495 dict entries\r\n*** CorePrep:\r\nResult size of CorePrep\r\n = {terms: 533,584, types: 600,927, coercions: 626,125}\r\n*** Stg2Stg:\r\n*** CodeOutput:\r\n*** New CodeGen:\r\n*** CPSZ:\r\n*** CPSZ:\r\n*** CPSZ:\r\n*** CPSZ:\r\n*** CPSZ:\r\n*** CPSZ:\r\n*** CPSZ:\r\n}}}\r\n\r\nand then about another 100 lines of `*** CPSZ:` before it hangs.\r\n\r\nRemoving either the optimization or profiling flags fixes the bug.","type_of_failure":"OtherFailure","blocking":[]} -->
issue