Ticket #2396 (closed bug: fixed)

Opened 4 years ago

Last modified 16 months ago

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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

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

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

Change History

Changed 4 years ago by sedillard

program exhibiting the bug

Changed 4 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10 branch

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

Changed 4 years ago by simonmar

  • type changed from bug to run-time performance bug

Changed 3 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 3 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 3 years ago by igloo

  • milestone changed from 6.10 branch to 6.12 branch

Changed 2 years ago by simonmar

  • failure set to Runtime performance bug

Changed 22 months ago by igloo

  • milestone changed from 6.12 branch to 6.12.3

Changed 20 months ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

Changed 16 months 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.

Changed 16 months 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

Changed 16 months ago by reinerp

  • status changed from new to closed
  • resolution set to fixed

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.