[GHC] #15148: Allow setting of custom alignments

GHC ghc-devs at haskell.org
Mon May 14 10:47:18 UTC 2018


#15148: Allow setting of custom alignments
-------------------------------------+-------------------------------------
           Reporter:  AndreasK       |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.2.2
  (NCG)                              |
           Keywords:  CodeGen        |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #15124
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Alignment can introduce a bias to benchmarking results which isn't
 obvious. To help deal with that I want to add some options adjusting
 alignment for generated code.

 To give one example I came across while looking into #15124:

 Padding a function that **is not even called** in nofib/real/eff/FS by
 multiples of 8 bytes gave runtimes of ~240ms, ~220ms and ~210ms depending
 on the padding.
 At 64 byte it seems to loop around (size of a cache line).

 At a minimum it should be possible to specify alignment of functions.

 Potentially we could also consider:
 * Padding for sections.
 * Padding for functions
 * Alignment for info tables.
 * Padding for info tables.
 * Alignment for Data


 The cases where this could have benefits:

 ----
 Problem: We optimize one subroutine changing it's size. This leads to
 alignment changes for the following functions making overall performance
 potentially worse.

 Here aligning functions along cache lines would make benchmarks more
 resilient against accidental alignment changes.

 ----
 Problem: We might try to optimize code based on a specific benchmark.
 Going purely by performance of this benchmark we might end up optimizing
 our code for this specific benchmark instead of the general case.

 Varying the alignment would to check if our code simply found a optimum
 for the alignment caused by this benchmark or if it is generally better.

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


More information about the ghc-tickets mailing list