Opened 9 years ago

Closed 7 years ago

#2396 closed bug (fixed)

Default class method not inlined

Reported by: sedillard Owned by:
Priority: low Milestone: 7.0.1
Component: Compiler Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Default class method not inlined. Class PackedMat has a method unpackMat. There is one instance declared. In the attached file, the method definitions of that instance are commented out, falling back to the default defs. Compile as-is (with -O2) to see the bug. Uncomment the instance method definitions to see the desired behavior.

possibly related to #672

http://www.haskell.org/pipermail/glasgow-haskell-users/2008-June/014974.html

Attachments (1)

ClassMethodInline.hs (3.7 KB) - added by sedillard 9 years ago.
program exhibiting the bug

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by sedillard

Attachment: ClassMethodInline.hs added

program exhibiting the bug

comment:1 Changed 9 years ago by igloo

difficulty: Unknown
Milestone: 6.10 branch

Thanks for the testcase; we'll take a look.

comment:2 Changed 9 years ago by simonmar

Type: bugrun-time performance bug

comment:3 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 9 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:6 Changed 8 years ago by simonmar

Type of failure: Runtime performance bug

comment:7 Changed 7 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:8 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:9 Changed 7 years ago by reinerp

With ghc 6.12.3, we get the following core from your file:

Test.$wmultmv3d =
  \ (ww_svV :: Double#)
    (ww1_svW :: Double#)
    (ww2_svX :: Double#)
    (ww3_sw3 :: Double#)
    (ww4_sw4 :: Double#)
    (ww5_sw5 :: Double#)
    (ww6_swb :: Double#)
    (ww7_swc :: Double#)
    (ww8_swd :: Double#)
    (w_swj :: Test.Vec3D) ->
    case w_swj of _ { Test.Vec3D rb_XtF rb1_XtH rb2_XtJ ->
    (# +##
         (*## rb_XtF ww_svV)
         (+##
            (*## rb1_XtH ww1_svW) (*## rb2_XtJ ww2_svX)),
       +##
         (*## rb_XtF ww3_sw3)
         (+##
            (*## rb1_XtH ww4_sw4) (*## rb2_XtJ ww5_sw5)),
       +##
         (*## rb_XtF ww6_swb)
         (+##
            (*## rb1_XtH ww7_swc) (*## rb2_XtJ ww8_swd)) #)
    }
...
Test.multmv3d :: Test.Mat33D -> Test.Vec3D -> Test.Vec3D
GblId

 Worker Test.$wmultmv3d

Test.multmv3d =
  __inline_me (\ (w_svR :: Test.Mat33D) (w1_swj :: Test.Vec3D) ->
                 case w_svR of _ { Test.:. ww_svT ww1_svZ ->
                 case ww_svT of _ { Test.Vec3D ww3_svV ww4_svW ww5_svX ->
                 case ww1_svZ of _ { Test.:. ww7_sw1 ww8_sw7 ->
                 case ww7_sw1 of _ { Test.Vec3D ww10_sw3 ww11_sw4 ww12_sw5 ->
                 case ww8_sw7 of _ { Test.:. ww14_sw9 _ ->
                 case ww14_sw9 of _ { Test.Vec3D ww17_swb ww18_swc ww19_swd ->
                 case Test.$wmultmv3d
                        ww3_svV
                        ww4_svW
                        ww5_svX
                        ww10_sw3
                        ww11_sw4
                        ww12_sw5
                        ww17_swb
                        ww18_swc
                        ww19_swd
                        w1_swj
                 of _ { (# ww21_swp, ww22_swq, ww23_swr #) ->
                 Test.Vec3D ww21_swp ww22_swq ww23_swr
                 }
                 }
                 }
                 }
                 }
                 }
                 })

which has no unnecessary constructors.

comment:10 Changed 7 years ago by simonpj

So you are saying that 6.12 was good? What about the 7.0 release candidate. If that's ok too, just close the ticket. (Again I can't see a good way to make a regression test.)

Simon

comment:11 Changed 7 years ago by reinerp

Resolution: fixed
Status: newclosed

The given program fails to compile with the 7.0 release candidate, due to #4418. Working around this problem by adding the fundep pm -> pv to the PackedMat class, it compiles and gives Core essentially the same as the 6.12 Core: no unnecessary constructors.

Note: See TracTickets for help on using tickets.