[GHC] #15876: Function versioning instead of compilation flags...

GHC ghc-devs at haskell.org
Thu Nov 8 13:01:21 UTC 2018


#15876: Function versioning instead of compilation flags...
-------------------------------------+-------------------------------------
           Reporter:  MichalGajda    |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.6.3
          Component:  Compiler       |           Version:  8.6.2
  (Linking)                          |
           Keywords:  simd,          |  Operating System:  Unknown/Multiple
  flavors, speed                     |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Wanting to take advantage of SIMD, we need to compile a different
 implementation of certain core libraries functions (like `ByteString`
 c_memchr to make it 16x faster).

 This would require recompiling most of the libraries for new flags.

 Instead, it would be much simpler to add function versioning a la GCC:
 https://lwn.net/Articles/691932/

 This would allow us to write code like this:
 {-# target(avx512) #-}
 c_memchr = ...SIMD code...
 {-# !target(avx512) #-}
 c_memchr = ...current code...

 We currently use special libraries for these kind of speedups, but it
 would be much better to use SIMD across few key functions in all libraries
 to get 16x speedups across the board (`c_memchr` for parsing.)

 Ideally we could also use it to remove some of _flavoring_ in the future.

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


More information about the ghc-tickets mailing list