[GHC] #15126: Opportunity to compress common info table representation.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[GHC] #15126: Opportunity to compress common info table representation.

GHC - devs mailing list
#15126: Opportunity to compress common info table representation.
-------------------------------------+-------------------------------------
           Reporter:  AndreasK       |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.2.2
           Keywords:  CodeGen        |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I've looked at a lot of GHC produced assembly recently and noticed that
 most info tables
 describing stacks have the form:

 {{{
 .align 8
         .long   SDjR_srt-(block_cHmk_info)+296
         .long   0
         .quad   6151
         .quad   4294967326
 }}}

 I haven't managed to dig fully into the description however some
 observations:

 * I noticed that the second .long directive almost always ends up being
 zero.
 * When figuring out what is what I realized the first quad (describing the
 pointers) is almost never fully used.
 * The last entrie (closure type + ?), here `4294967326` also seems quite
 repetitive given the size reserved.

 So I looked in detail at spectral/simple:
 * There are 2012 info tables of this sort with all of them having a zero
 in the second long.
 * We also reserve 8 byte for the stack layout. However only a single of
 these tables requires more than 4 byte.

 The compiled module has a size of 276384 Bytes, with 16092 being
 redundant:
 * 4 bytes for 0
 * 4 bytes unused stack description
 * times 2012 info tables.

 That is an overhead of 5,8% which seems like quite a lot to me.

 The questions where to put that information is a different one. But only
 looking at the data and not how it is used tagging the pointer to the SRT
 table seems like a possibility.

 The info table description `4294967326` also appeared over 1k times. Maybe
 it's possible to come up with a more efficient encoding there as well.

 I didn't give it much thought yet since I don't have the time to do
 anything about it in the near future.
 But putting it here in case anyone is interested or looks into this in the
 future.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15126>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #15126: Opportunity to compress common info table representation.

GHC - devs mailing list
#15126: Opportunity to compress common info table representation.
-------------------------------------+-------------------------------------
        Reporter:  AndreasK          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  CodeGen
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Compressing info tables looks like a good plan.  But be careful about
 imposing a slow-down in the fast path, if extra instructions are need to
 decode the info table.  With a bit of luck, we could have zero overhead
 for the fast path.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15126#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #15126: Opportunity to compress common info table representation.

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#15126: Opportunity to compress common info table representation.
-------------------------------------+-------------------------------------
        Reporter:  AndreasK          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  CodeGen
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4632
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by AndreasK):

 * differential:   => Phab:D4632


--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15126#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #15126: Opportunity to compress common info table representation.

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#15126: Opportunity to compress common info table representation.
-------------------------------------+-------------------------------------
        Reporter:  AndreasK          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  CodeGen
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4632
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonmar):

 Phab:D4634 reduces the size of info tables with an SRT by one word on
 x86_64, which implements some (but perhaps not all) of the opportunities
 for savings mentioned here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15126#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets