[GHC] #8949: switch -msse2 to be on by default

#8949: switch -msse2 to be on by default ----------------------------------------------+---------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.9 Keywords: | Operating System: Architecture: x86 | Unknown/Multiple Difficulty: Moderate (less than a day) | Type of failure: Other Blocked By: | Test Case: Related Tickets: | Blocking: ----------------------------------------------+---------------------------- I propose msse2 to be on by default. I guess the default was chosen way back, when Pentium III support was still relevant. Nowadays we don't really win on the CPU support, because e.g. https://github.com/tibbe/hashable/blob/master/hashable.cabal is built by default with sse2 on the injected C code level. And hashable has a lot of reverse depends, therefore on an end user system (RedHat or Debian) the user is most probably unlucky with a Pentium III CPU anyways. Flipping this default would also fix the excess precision problem for most users of GHC on the i686 platform. GHC should provide a -mno-sse2 flag for the cases when this needs to be disabled. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by schyler): I second this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by tibbe): I think we should, like LLVM, switch on -march=native by default and have people who want to build more portable binaries specify their target explicitly. This doesn't preclude turning on -msse2 by default of course. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by errge): Johan, -march=native is a very interesting idea, thanks for bringing it up! If you have ideas about that, please open a new ticket for discussion. I'd like to keep this ticket/patch/feature request as minimal as possible and only about switching the default if others in the community agree. Implementing your envisioned -march=native seems to be a very useful thing to do, but a much bigger job... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by carter): Errge: I'd argue that changing the default needs to be predicated on adding march style machinery! There's enough stuff slated for 7.10 that would benefit from from ghc having more systematic support for micro arch selection feature flags that making msse2 the default on 32bit systems would miss the point of tst work. I also think that while it would touch more of ghc, such a patch wouldn't be much more complex. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by simonmar): Replying to [comment:2 tibbe]:
I think we should, like LLVM, switch on -march=native by default and have people who want to build more portable binaries specify their target explicitly. This doesn't preclude turning on -msse2 by default of course.
I like `-march-native`, but I'm not convinced it should be the default. For GHC it will add minimal gain, in exchange for some very obscure crashes when someone forgets to turn it off when building a binary that might need to run on another machine. The Haskell way is correct but slow by default, and I think that's what we should do here. I think I'm less concerned about `-msse2`, because it will affect a lot fewer people. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: Unknown/Multiple | Difficulty: Moderate (less Type of failure: Other | than a day) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by tibbe): I'm fine with only doing `-msse2` for now. The amount of benefit we'll get from `-march=native` is growing. We're adding more intelligence to the code generator (e.g. `memcpy` will soon unroll to wider instructions if the target supports it, we have `popcnt` and `bswap`) and compiling with `-fllvm` should benefit too e.g. as code for the vector package would presumably compile to better assembly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default -------------------------------------+------------------------------------- Reporter: errge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (CodeGen) | Keywords: Resolution: | Architecture: x86 Operating System: | Difficulty: Moderate (less Unknown/Multiple | than a day) Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * failure: Other => Runtime performance bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by bgamari): * priority: normal => high * milestone: => 8.4.1 Comment: I am fine doing this for 8.4. Milestonjng. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #13540 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by MikolajKonarski): * related: => #13540 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

neither the linux elf nor Windows GHCi linkers (non-dynamic way) currently honor section alignment. so using SSE2 more aggressively would
#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #13540 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by bgamari): Phyx points out in ticket:13540#comment:4 that, likely cause issues here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #13540 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by bgamari): * milestone: 8.4.1 => 8.6.1 Comment: We can't act on this until the linker issues are sorted out. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by George): * related: #13540 => #13540, #13624 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: 13624 | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by George): * blockedby: => 13624 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: 13624 | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by bgamari): * milestone: 8.6.1 => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: 13624 | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by carter): I know this was fixed in the windows linker afaik. Has the alignment issue been addressed on other platforms yet or what are the blockers ? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: 13624 | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by carter): https://gitlab.haskell.org/ghc/ghc/merge_requests/24 is my first step towards making sse2 always true on x86/x86_64 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8949: switch -msse2 to be on by default --------------------------------------------+------------------------------ Reporter: errge | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler (CodeGen) | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86 Type of failure: Runtime performance bug | Test Case: Blocked By: 13624 | Blocking: Related Tickets: #13540, #13624 | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by carter): https://gitlab.haskell.org/ghc/ghc/merge_requests/26 is the corrected one :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8949#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC